5
$\begingroup$

It is the closed-world assumption of a CNN. For example I have trained a CNN to recognize, sedans, jeeps, trucks, suvs and crossovers, and I present an airplane it tries to fit it into of these 5. How do I get a CNN to recognize a "none of these" category.

I have read this paper Bendale et al but this seems to re-architect the Softmax with their Openmax. Are there any "hack" approaches that do the trick?

$\endgroup$
4
$\begingroup$

One solution: you could add a new label that represents "None of the above" and then you can train your CNN on this labeled dataset.

Another possible benefit here is that you could use a lot more data, since lots of different images fit the description "None of the above." Maybe you could leverage all these new images to learn more descriptive features, and perhaps it can help regularize your network. A recent paper actually explores these ideas: Universum Prescription: Regularization using Unlabeled Data.

$\endgroup$
1
  • $\begingroup$ Is that so - all that is needed is to label a separate class for all "none of these" classes in the data set? I read that the paper also describes three universum prescription methods. Is it saying that changes to the neural network (maybe loss functions) are also needed? $\endgroup$ – linbianxiaocao Jul 15 '16 at 13:50
0
$\begingroup$

the solution is quiet simple, it is just to look at probability of each class. I have transfer learned a model using fastai. My model detects following classes classes detected by my model :

none of those classes represents photos of animals or humans...etc, but when i run my model on image of a cat, it still classifies cat as one of the above class, like this. running a cat image on model

But to avoid it, have a look at the values returned by the model, the first is class "OutofFocus", second is index of class ie, "2", the third is a tensor showing the probability of each class on the image of cat. It says the probability of it being "Festive class is 2.5%" and same with other classes, the highest among them is for "OutOfFocus" it is 90% so just validate your model on this accuracy ie, if the probability is less than 97% of any class then make it none of the above. In my case the threshold is 97% but yours might be different so perform a few tries and come up with a threshold. If there is a solution pls let me know.

$\endgroup$
1
  • 2
    $\begingroup$ it would be better if you were formatting your code using markdown rather than adding it as images $\endgroup$ – Antoine Apr 11 '20 at 7:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.