If my CNN model is over-fitting despite trying all possible hyper parameter tuning, does it mean I must decrease/increase my input image size in the Imagadatagenarator?
-
$\begingroup$ If you only have a handful of images, but train the model for a large number of epochs, you're going to see poor results regardless of your network structure. In gereral, and assuming your network structure is optimal, you should (1) collect more images, (2) perform data/image augmentation, (3) tune batch and epoch size. $\endgroup$– ralphCommented Apr 19, 2022 at 22:07
-
$\begingroup$ Thanks for the reply, ive pre-trained on a vgg16 model using image sample sizes of 600/200/200 for train/validation/test, I have used data augmentation and used different combinations of batch and epoch sizes. Do you recommend that I still collect more images? $\endgroup$– DeepakCommented Apr 19, 2022 at 23:30
-
$\begingroup$ If you can, 600 really isn't that many, especially if you're performing multiclass classification. Also, VGG16 is very deep, having around 100 million parameters. I believe when VGG16 was used in the Imagenet competition, close to one million training images were used. Consider if this network structure is the right one for you. Start with something simple (input > basic hidden layer > output). Build up from there. $\endgroup$– ralphCommented Apr 20, 2022 at 2:54
-
$\begingroup$ Thank you so much for your inputs, Ill try increasing the sample sizes. I did try with a building a simple model and different combinations, however isn't it true that we can get better model performances by leveraging the use of the per-trained models. $\endgroup$– DeepakCommented Apr 20, 2022 at 3:21
-
$\begingroup$ Assuming the outputs are the same, and that the inputs are fairly similar (object you want to classify in the same position, colour, lighting, and so on), then yes you can generally expect decent performance when using a pre-trained network. $\endgroup$– ralphCommented Apr 20, 2022 at 8:16
1 Answer
Overfitting of a model in deep learning is very highly related to number of training samples you have. Given that you use VGG16 which has 138 million parameters it requires a lot of data for training properly. If you use 600 images only for training it will overfit on training data. Its difficult to control overfitting on these small data by adjusting any other hyperparameter or resizing the image.
Please collect more data or use data augmentation techniques to increase the samples of training data