A computer-implemented method of detecting unknown classes in an image, comprising: generating a first classifier for a first plurality of classes, each class corresponding to an object in the image, the first classifier receiving input data in the form of the image, and an output of the first classifier having a vector of scores of dimension of at least two, the vector of scores indicating the confidence of the input data belonging to one or more classes of the first plurality of classes, and wherein the scores are raw scores output by the first classifier for data which is not normalized; designing a second classifier to receive, as an input, the output of the first classifier, wherein the second classifier is a binary classifier that is adapted to decide whether the input data belongs to the first plurality of classes or an unknown class based on a threshold set for each of the top two scores, wherein designing the second classifier comprises training the second classifier with examples of data belonging to the first plurality of classes and data not belonging to the first plurality of classes and adjusting the thresholds; and classifying the input data into the unknown class when the input data does not belong to one of the first plurality of classes, wherein classifying the input data further comprises: the second classifier classifying the input data into the unknown class when the vector of scores is less than the threshold for each of the top two scores; and the second classifier determining that the input data is known when the vector of scores is greater than the threshold for the top two scores and the first classifier classifying the input data into a class of the first plurality of classes. generating a first classifier for a first plurality of classes, each class corresponding to an object in the image, the first classifier receiving input data in the form of the image, and an output of the first classifier having a vector of scores of dimension of at least two, the vector of scores indicating the confidence of the input data belonging to one or more classes of the first plurality of classes, and wherein the scores are raw scores output by the first classifier for data which is not normalized; designing a second classifier to receive, as an input, the output of the first classifier, wherein the second classifier is a binary classifier that is adapted to decide whether the input data belongs to the first plurality of classes or an unknown class based on a threshold set for each of the top two scores, wherein designing the second classifier comprises training the second classifier with examples of data belonging to the first plurality of classes and data not belonging to the first plurality of classes and adjusting the thresholds; and the second classifier classifying the input data into the unknown class when the vector of scores is less than the threshold for each of the top two scores; and the second classifier determining that the input data is known when the vector of scores is greater than the threshold for the top two scores and the first classifier classifying the input data into a class of the first plurality of classes. <EOS>