About creating image-classifier model

I have got pre-trained model and its predicts always wrong. I think problem is my model on overfitting. I was trained it with 24.000 image data for two classes. İs it too much ?How can ı train my model correctly is there any source code or example kernel on kaggle ? thanks.

Hi,

There are a few questions, you’d have to answer before we could help you finding out, why your model does not perform as well as it’s supposed to be:

  • What kind of model do you use?

  • On what data was it pretrained? (Where did you get the model from)?

  • What kind of images do you have?

  • What kind of preprocessing did you apply?

  • What are your hyperparams during finetuning (learning rate etc.)?

Usually overfitting occurs, if you have only a very limited amount of training data (it is often compared with learning examples “by heart”, rather than learning common patterns). Since you have 24.000 images, this should be quite unlikely.

Another common problem is that people don’t apply the same preprocessing (e.g. normalization) as it was done during the original training. In that case the model’s parameters simply don’t fit (they have been trained for another kind/range of input).

Have you checked if your classes are separable at all (they most likely are if you only have two of them)?

1 Like
  1. I am using model trained with resnet50

  2. I use my own data and ı was prepare it with fast.ai module

3.What kind of images do you have ? ( Actually ı dont get it well but ı will answer it with my understand.I am using .jpg extensioned image files and preprocessed by fast.ai )

and there is my link of kaggle kernel :
https://www.kaggle.com/hamdikaptan1/testkern/output?scriptVersionId=13063952

This code looks fine to me. If I were you, I’d train a bit longer (5 epochs is not that much for a resnet50; try it with 50 or something like that) and maybe choose a smaller network (I’d say a resnet18 should be more than sufficient here)

1 Like

thanks ı will try and will notice to here . Thanks again.

https://www.kaggle.com/hamdikaptan1/testkern/notebook

can you look at it again ? my error rates looks like some things are wrong.

this seems to look good. can you get an accuracy out of this?

when ı fit my model it shows 0.000 error rate ı think its a problem . It can predict correct value of images when ı downloaded it , it dosent work correctly. İt is my main problem here.