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
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.
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.