My model is always predicting the same

I’m trying to learn from first lessons of Fastai. Maybe they are not meant to be used with images like heatmaps. But anyway. What I don’t understand is why my model keeps predicting the same output. Here I share with you the code. Also, is there a great guide to understand the metrics of each epoch? I’m halfway through the 3rd video, I’m still pretty noob, this is my first “project” on DL sorry.



Sin título3

How large is your training/validation set? It looks like you might be overfitting to your training set since your training loss is going down but your validation loss is rising. You may need some more training data.

Alternatively, you might want to look into using image augmentations. You will need to spend a bit of time thinking about which make sense for the types of images you are working with, for example, is there a ‘right way up’ on your images or not (to decide whether to use rotation or not).

2 Likes

You are right! My data set is quite small. I will look into using image aumentations too. Thanks! You really helped me a lot. Have a nice day!

1 Like

Can it be that your training data is strongly imbalanced towards the class that your model ends up predicting most of the time? In this case try to add training data especially for the underrepresented classes in your training data.

1 Like

Hi Hazard I hope hall is well!
I agree with the comments posted so far and would add that, your images are far less distinctive than say types of cat, so you will need say 50-200 maybe more images per class this would be a good start, these should be as distinctive as possible. The more distinctive the classes generally the less data you need.

Your confusion matrix is clearly saying that all five of your classes are similar to class 4 and the 3rd class is the most similar of all. (maybe overfiitting).

Having built approximately 70+ image classifer apps, the most difficult was a wristwatch classifier, it worked well for 2 classes but I couldn’t get it to work for 70 classes, because unless you read the name on the dial many watches look very similar.

Heat maps pose some problems that images don’t, here are some links that may help generate some ideas.

Also segmentation seems to be used a lot with heat maps.

Cheers mrfabulous1 :grinning: :grinning:

1 Like