Model overfitting

sparshgarg23: <p>I have been training resnet 18 as well as resnet50 model on my dataset(which contains about 1500 samples).<br>
When it comes to predicting output labels of dimension 73x4 and 1x199,the models tend to do well,but for output vectors of dimension 1x6 or for classification purposes,I have noticed that there is huge overfitting.<br>
With training loss being 0.03 and validation loss being 0.24</p>
<p>What steps can I take to avoid overfitting.<br>
Should I apply data augmentation on my images,or should I go for a different pretrained model like efficientnet/vgg.<br>
Note I tried using vgg16 ,but no effect in performance was seen.</p>
<p>Enclosed is the loss curve<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/3/c/3cc5e2cd110ce8583b5701eedd924953c8ddeb24.png" data-download-href="https://discuss.pytorch.org/uploads/default/3cc5e2cd110ce8583b5701eedd924953c8ddeb24" title="plot"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/3/c/3cc5e2cd110ce8583b5701eedd924953c8ddeb24_2_626x500.png" alt="plot" data-base62-sha1="8FCCfmSOh8KuLVeNuUpRyjdwApm" width="626" height="500" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/3/c/3cc5e2cd110ce8583b5701eedd924953c8ddeb24_2_626x500.png, https://discuss.pytorch.org/uploads/default/original/3X/3/c/3cc5e2cd110ce8583b5701eedd924953c8ddeb24.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/3/c/3cc5e2cd110ce8583b5701eedd924953c8ddeb24.png 2x" data-dominant-color="FCFCFB"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">plot</span><span class="informations">712×568 13.2 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>

L-Reichardt: <p>I assume you have trained longer than 4 epochs, because this loss curve does not look like overfitting to me. Was the curve identical for both ResNets? If yes, maybe the problem is somewhere else.</p>
<p>Some good examples of curves here: <a href="https://machinelearningmastery.com/learning-curves-for-diagnosing-machine-learning-model-performance/" class="inline-onebox" rel="noopener nofollow ugc">How to use Learning Curves to Diagnose Machine Learning Model Performance</a></p>
<p>If you are 100% certain its not a different issue I would attempt more augmentation. It could also be an issue how your dataset train/val/test splits are selected. Maybe the test split is unrepresentative compared to the train/val splits.</p>

sparshgarg23: <p>Yes for both resnet 18 and 50 the curve was the same.<br>
I looked into my training data,apparently there is a class imbalance,with 600 samples belonging to class 1 and 400 belonging to class 2.Does that impact the learning process,also I am not sure why the training curve is coming out to be flat.<br>
Here is another image corresponding to training on another model with dropout and weight decay and early stopping.<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/b/3/b376b84357acce901034bc8facf3fc3afda214ba.png" data-download-href="https://discuss.pytorch.org/uploads/default/b376b84357acce901034bc8facf3fc3afda214ba" title="download (1)"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/b/3/b376b84357acce901034bc8facf3fc3afda214ba_2_626x500.png" alt="download (1)" data-base62-sha1="pBBP2efC4pFZyqQEBwRSeamubR8" width="626" height="500" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/b/3/b376b84357acce901034bc8facf3fc3afda214ba_2_626x500.png, https://discuss.pytorch.org/uploads/default/original/3X/b/3/b376b84357acce901034bc8facf3fc3afda214ba.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/b/3/b376b84357acce901034bc8facf3fc3afda214ba.png 2x" data-dominant-color="FBFBFB"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">download (1)</span><span class="informations">712×568 14 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
<p>the final result after training for 17 epochs</p>
<pre><code class="lang-auto">[17/50] train_loss: 0.24435 valid_loss: 1.98771
</code></pre>
<p>Furthermore,it seems that my dataset doesn’t have any variations in it.</p>