Analyze of loss vs epochs

123456: <p>I am training a deep learning model, where the loss vs epochs is plotted for 50 epochs<br>
Training loss at every epoch and validation after every two training epochs.</p>
<p><img src="https://discuss.pytorch.org/uploads/default/original/3X/5/5/55a41b06c01c9a62a25746ddb43dcd61306a8152.png" alt="image" data-base62-sha1="cdCb8cLVvnlkZ2yOxovBqghMoP8" width="255" height="192"></p>
<p>Blue -training loss<br>
Pink - validation loss<br>
As I see, the training loss is not getting stable.</p>
<p>I have used the pretrained model given by the author on my dataset which is built with the same procedure as given by the author. Technique is also same.</p>
<p>Can I know whether my graph is right or wrong? Should I run it for more epochs or not?</p>
<p>Thankyou</p>

tom: <aside class="quote no-group" data-username="123456" data-post="1" data-topic="192616">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/123456/48/61623_2.png" class="avatar"> 123456:</div>
<blockquote>
<p>Can I know whether my graph is right or wrong? Should I run it for more epochs or not?</p>
</blockquote>
</aside>
<p>It looks like it might plausibly OK, but naturally, you’d want to look at how you generate it to know.<br>
Training for more epochs could be worth a try.</p>
<p>Best regards</p>
<p>Thomas</p>

J_Johnson: <p>That looks fine. As long as the validation loss kept declining, you’re good to keep training.</p>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/c/6/c6fa9be84bd3e908893dd0bb0921057ad765d925.png" data-download-href="https://discuss.pytorch.org/uploads/default/c6fa9be84bd3e908893dd0bb0921057ad765d925" title="1686362738964"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/c/6/c6fa9be84bd3e908893dd0bb0921057ad765d925_2_671x500.png" alt="1686362738964" data-base62-sha1="sofsVa740XJo5T0TFHFNQ9Guvn7" width="671" height="500" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/c/6/c6fa9be84bd3e908893dd0bb0921057ad765d925_2_671x500.png, https://discuss.pytorch.org/uploads/default/original/3X/c/6/c6fa9be84bd3e908893dd0bb0921057ad765d925.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/c/6/c6fa9be84bd3e908893dd0bb0921057ad765d925.png 2x" data-dominant-color="D3EBDA"><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">1686362738964</span><span class="informations">800×596 363 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>During optimization, your model is traversing something like the above, except with millions of dimensions, instead of just 2. Bound to be some bumps along the way.</p>

123456: <p>Okay Thankyou <a class="mention" href="/u/tom">@tom</a> <a class="mention" href="/u/j_johnson">@J_Johnson</a><br>
I will train it with more epochs.</p>
<p><a class="mention" href="/u/j_johnson">@J_Johnson</a> what can be the cause of bumps?</p>
<p>Sir, I have one question<br>
As I am running the code given by author, along with pretrained weights given by him on my dataset, Then I applied this generated model at the time of testing then Why the predicted binary masks are not generated corresponding to images at the time of testing. The masks are fully gray colored image. It should be binary mask which will depict the focused region from two images (white-focused,black-defocused)</p>
<p>Where can be the problem?<br>
Either training is not done properly or there is problem in my generated dataset or something else</p>
<p>The author also has trained it for 50 epochs only.</p>

J_Johnson: <p>If the problem could be traversed in a straight line, then you wouldn’t need gradient descent, as there would be easier methods of solving the problem.</p>
<p>Your second question I am not clear on.</p>

Julian_Lehrer: <p>It’s plausible that the curve is fine. If you’re using cross entropy keep in mind that the function is entirely unbounded. If your epoch-level loss is just averaged across all batches then one sample with a very high loss value could throw the average off.</p>