Reputation: 21
I have already trained a model to recognise animal and it is working, deployed into android application. I'm finding for a solution to make the image classifier to only classify the trained categories. I'm not sure whether to do this through the model training or any code to be added to solve this.
Example, if a picture of a cup is sent for classification, the result shows as Dog or some other animal name. How to make only classify the given category, anything else than that show it as "not a animal".
Im using Tensorflow 1.12, MobileNet Model
Upvotes: 2
Views: 128
Reputation: 8595
The simple straightforward solution is to create additional binary classifier that would classify animals vs everything else. So the first step would be to classify whether a given picture is an animal. If the first steps succeeds, the second step is to classify what animal it is.
One of the limitation of current ML framework you're working in is inability to reason about uncertainty over the features. The features extracted from a dataset are often given as point estimates and they do not capture how much the model is confident in its estimation. To quantify the uncertainty you need probabilistic Bayesian model (e.g. Gaussian process). Such models are more complicated because model's weights are assumed to be drawn from some probability distribution. The output y*
for input x*
would be a probability distribution with some mean and variance. High variance would indicate that the model is not certain in its prediction.
There are some great literature where you can read about it in great detail:
Upvotes: 1
Reputation: 13
what about checking probability score? Eventhough a cup is classifed as Dog , it will have less score. so you can set your threshold. If the probability score > threshold value, then it will be displayed as animal otherwise not.
Upvotes: 0