Validaiton result is not good,how to improve it?

junqiangchen: <p>Hi,i want to use Unet segment target in different dataset.In Unet,using GroupNormalization,LeakRelu,maxpooling and conv,traing opt is Adam,loss is mutildice,accu is mean dice.<br>
first i segment five target,the train and validation performence are both good,look first line:<br>
second i segment three target,the train performence is good,but validation is not well,look second line:<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/a/b/ab7ae5e771d0f7ac0cab473640901ac38aaf84ff.png" data-download-href="https://discuss.pytorch.org/uploads/default/ab7ae5e771d0f7ac0cab473640901ac38aaf84ff" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/a/b/ab7ae5e771d0f7ac0cab473640901ac38aaf84ff_2_664x500.png" alt="image" data-base62-sha1="osYXeimGUvmW5oP1fmR7EYEgRK7" width="664" height="500" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/a/b/ab7ae5e771d0f7ac0cab473640901ac38aaf84ff_2_664x500.png, https://discuss.pytorch.org/uploads/default/optimized/3X/a/b/ab7ae5e771d0f7ac0cab473640901ac38aaf84ff_2_996x750.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/a/b/ab7ae5e771d0f7ac0cab473640901ac38aaf84ff.png 2x" data-dominant-color="E8ECE9"><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">image</span><span class="informations">1009×759 113 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>can anyone know how to solve it?</p>
<p>thank you!!!<br>
chenjunqiang</p>

mtalhaubaid: <p>you need to add the regularization i.e L1, L2 . If the results were not improved you can increase the dataset by using data augmentation</p>

junqiangchen: <p>i have add data augmentation with zoom, pan, rotate, flip operation，i will try regularization L2 to Adam opt.</p>

mtalhaubaid: <p>you also need to add the dropout layer as your model is clearly over fitted</p>

junqiangchen: <p>ok，i also add dropout layer after conv operation.</p>

junqiangchen: <p>i add dropout,but the result is also not good.<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/c/d/cdcc300bd92b842d719f9af33fa8262846efa832.png" data-download-href="https://discuss.pytorch.org/uploads/default/cdcc300bd92b842d719f9af33fa8262846efa832" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/c/d/cdcc300bd92b842d719f9af33fa8262846efa832_2_690x264.png" alt="image" data-base62-sha1="tmzlNhzFEk98tKACnHi4qd92MFA" width="690" height="264" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/c/d/cdcc300bd92b842d719f9af33fa8262846efa832_2_690x264.png, https://discuss.pytorch.org/uploads/default/original/3X/c/d/cdcc300bd92b842d719f9af33fa8262846efa832.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/c/d/cdcc300bd92b842d719f9af33fa8262846efa832.png 2x" data-dominant-color="E7EBE8"><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">image</span><span class="informations">899×344 51.1 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>

mtalhaubaid: <p>also increase the learning rate may be it will help</p>

tom: <p>So I don’t know if you already do more, but you seem to mention techniques that would be typically used for classification problems where the image has a “global” label.<br>
One of the ways to look at pixelwise segmentation (e.g. with UNets) is as a pixelwise classification problem. Then, perhaps not as obvious when you don’t explicitly entertain the pixelwise classification view, class balance is important. We briefly discuss this in Part II of our book and a long time ago, there was also this thread:</p>
<aside class="quote quote-modified" data-post="2" data-topic="128303">
  <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/tom/48/3162_2.png" class="avatar">
    <a href="https://discuss.pytorch.org/t/calibrating-probability-output-and-threshold/128303/2">Calibrating probability output and threshold</a> <a class="badge-category__wrapper " href="/c/vision/5"><span data-category-id="5" data-drop-close="true" class="badge-category " title="Topics related to either pytorch/vision or vision research related topics"><span class="badge-category__name">vision</span></span></a>
  </div>
  <blockquote>
    So two things: 

In my experience, the first thing to do is balancing the pixels more. For example, when training the U-Net for nodule detection in our book (a very imbalanced problem), we take care that we have enough slices with nodules fed into the U-Net. A brief discussion is in section 13.5.5 (Designing our training and validation data). We didn’t write an entire paper about it, but in our situation it went from “doesn’t learn” (even with weighted dice) to “learns”.
If you have some holdout…
  </blockquote>
</aside>

<p>Best regards</p>
<p>Thomas</p>