0

I am using convolution neural network to train my model with two classes Horse and Lion, i want the model evaluation return "none of the above" if i use a image of a Dog, any idea how should i train my model to accomplish that?

Eddy Ma
  • 98
  • 9

1 Answers1

1

There's two ways you could likely structure this:

  1. Create a third label "Other", and continue having your convolutional net use softmax normalization to output probabilities such that p(Horse), p(Lion), and and p(Other) add to 1.0. Then simply add any number of pictures that don't have Horse or Lion in them and label them with Other

  2. Rearchitect your system as detection rather than classification - ie it looks at any given picture and "detects" whether there is a Horse or a Lion in it with the possibility that there are neither, one, or both present. In this system, you won't use the softmax constraint that the p(Horse) + p(Lion) = 1.0, you'll simply train each class detection independently. Then include training data with neither Horses or Lions and make sure they are labeled as Horse=0 and Lion=0.

Hope that helps!

Dwight Crow
  • 368
  • 3
  • 11
  • Have try your suggestion, "add any number of pictures that don't have Horse or Lion", i upload a picture without horse and lion to test, the result was roughly 30% for Horse 40% for Lion and 30% for Other, i guess it was causing by the background of the picture, e.g. if a picture of horse/lion was taken with a background of something, as soon as the test picture (without horse/lion) has the similar background will ends up with high percentage after softmax, any thought? – Eddy Ma Oct 04 '16 at 23:54
  • How many samples of horse/lion/other are you training on? keep in mind that competitions like imageNet have many thousands of images and frequently nets with 10's if not hundreds of layers. getting accurate output will take lots of work and training data (unlike mnist which is a really easy starting example) – Dwight Crow Oct 05 '16 at 01:40
  • I currently got 15 on each category with 3 x (convolution, ReLu, Maxpool) layers, the test data with 5 on each category shows 3% of error rate, looks like I need a lot more, what would you suggest? – Eddy Ma Oct 05 '16 at 10:27
  • I think you've already figured this out, but for other people that may browse the question: 60 images are as good as no images at all. If you guys face similar problem, try having several hundreds of images at least. For instance, in CIFAR-10 there are 6000 pictures in each class. CNTK's Image processing module provides tools to crop and resize, so it is enough to just google a substantial amount of lions, horses and other to proceed. – Kolya Ivankov Dec 05 '16 at 14:36