Training accuracy increases while validation accuracy stays constant

WassimOrabi: <p>I am new to Neural Networks and currently doing a project for university. I am trying to train a CNN using frames that portray me shooting a ball through a basket. And my aim is for the network to be able to classify the result( hit or miss) correctly. When I train the network, the training accuracy increases slowly until it reaches 100%, while the validation accuracy remains around 65% (It is important to mention here that 65% is the percentage of shots that have a Miss label. So the network gives the highest Validation accuracy when it predicts all frames are a miss) Does anyone have experience with a similar problem?<br>
I am using PyTorch and Resnet18 ( have tried other architectures as well but they all gave the same result). My frames are jpg images of sie 224.<br>
As an optimizer, both Adam and SGD gave the same result<br>
Thank you in advance</p>

Prerna_Dhareshwar: <p>Hi Wassim,</p>
<p>Sounds like your model is over fitting to the training set. You could try adding regularization or dropout during training to avoid it. You can also read up more about how else to avoid overfitting to the training set online.</p>
<p>Hope this helps,</p>
<p>Best,<br>
Prerna</p>

Mazhar_Shaikh: <p>Hi Wassim,<br>
In addition to what <a class="mention" href="/u/prerna_dhareshwar">@Prerna_Dhareshwar</a> said, do have a look at your training data to make sure there are no biases or features in the image that would allow the network to “cheat”. One example would be ratio of hits and misses in your training data, which ideally should be 1(called a balanced dataset). Another example, if you collected the training data for “hit” during the day, training data for “miss” during the night, and all validation data during the night, your network could just be predicting day or night depending on the lighting conditions, and get 100% accuracy on your training data.<br>
Hope this helps!</p>

AleksandraDeis: <p>Hi! In addition to previous answers I would like to suggest you to use data augmentations. This will help you to increase your training set and will have a regularization effect.</p>

banikr: <p>I am having the same issue. I am doing 3D medical image synthesis and train loss(red) and valid loss(blue) looks as below plot.</p>
<p>The valid loss doesnt drop. I tried standardizing and normalizing and changed the validation sets.</p>
<p>I would request to look at my discussions lately for more details (having trouble to paste links from phone)</p>
<p>Would appreciate any feedbacks.</p>
<p><img src="https://discuss.pytorch.org/uploads/default/original/2X/0/04a3e189321c16018d1b769b1c29cfd4efcf4676.png" alt="image" data-base62-sha1="F31rA4pbaUmygi5rc0IsGGOcLk" width="640" height="480"></p>

WassimOrabi: <p><a class="mention" href="/u/mazhar_shaikh">@Mazhar_Shaikh</a> Thank you for your input. My data is quite unbalanced (around 65% miss and 35% hit). Is the unbalance large enough to cause this error? It seems like, during validation, the model tries to predict the outcome but gets a very low accuracy, so it goes back to predicting all shots to be a miss and gets stuck on 65% accuracy.<br>
<img src="https://discuss.pytorch.org/uploads/default/original/2X/5/5ee3f3274f7c37b64d3d66341ac2ddd986e3f80f.png" alt="Download" data-base62-sha1="dxrggSE1rJpzWqoIMmv7poAKGfR" width="392" height="278"></p>

WassimOrabi: <p><a class="mention" href="/u/banikr">@banikr</a> <a class="mention" href="/u/prerna_dhareshwar">@Prerna_Dhareshwar</a>  Thank you for the tips. I will give it a try <img src="https://discuss.pytorch.org/images/emoji/apple/slight_smile.png?v=9" title=":slight_smile:" class="emoji" alt=":slight_smile:"></p>