How do we use our model against a specific image?

Sir I work on only Cat and dog dataset but when i pass image of human then it shows cat or dog class …why this happens. rather than this i want to show some “Unknown Image Error” message how i can do

That classifier was only trained to recognize cats or dog. Regardless of what picture you give it, it will only tell you the probability the classifier thinks that there is a cat or dog present. If you want the classier to recognize people, you will need to train it with that category as well.
If you want to throw an unknown image error, you can code that yourself if both the cat and dog probability are below some threshold.

Hello,
What is the recommended way of getting multilabel predictions for a single image?
Currently I’m using this code:

pred_class, pred_idx, outputs = learn.predict(open_image('/mnt/preview/47/09/84/21/3/0-r.jpg'))
for index, value in enumerate(outputs):
        if value > 0.05:
            print(learn.data.classes[index])

I have an error, I get tfms_from_model is not defined when I try to predict .I am totally new to this and I don’t know what I am doing wrong ,need help ! Thank you !image

1 Like

AttributeError: ‘JpegImageFile’ object has no attribute ‘apply_tfms’

I have this issue please do help me out by viewing this link