there have big gap between train result and validation result?

username: junqiangchen
cooked: <p>Hi,i am newer in pytorch,i find that using same data for train and validaiton,train and validation reuslt have big gap,fig1</p>
<p>i use same params to do it with tensorflow,train and validation result is same,fig2</p>
<p>at same time,i do another experiment,using same data with only one data for train and validation,fig3</p>
<p>and using same data with five data for train and validaiton,fig4</p>
<p>It’s strange why there are different results，</p>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/6/6/66ff3dbef51db77aecb96f52ca2b11ca05718277.png" data-download-href="https://discuss.pytorch.org/uploads/default/66ff3dbef51db77aecb96f52ca2b11ca05718277" title="屏幕截图 2022-07-14 155854"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/6/6/66ff3dbef51db77aecb96f52ca2b11ca05718277_2_345x242.png" alt="屏幕截图 2022-07-14 155854" data-base62-sha1="eH9ykvXnGsm6dzIlDf2fx0vUKs7" width="345" height="242" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/6/6/66ff3dbef51db77aecb96f52ca2b11ca05718277_2_345x242.png, https://discuss.pytorch.org/uploads/default/optimized/3X/6/6/66ff3dbef51db77aecb96f52ca2b11ca05718277_2_517x363.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/6/6/66ff3dbef51db77aecb96f52ca2b11ca05718277_2_690x484.png 2x" data-dominant-color="E0EBE2"><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">屏幕截图 2022-07-14 155854</span><span class="informations">849×596 107 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>here is my project:<a href="https://github.com/junqiangchen/PytorchDeepLearing" class="inline-onebox" rel="noopener nofollow ugc">GitHub - junqiangchen/PytorchDeepLearing: Meidcal Image Segmentation Pytorch Version</a></p>

username: ptrblck
cooked: <p>Could you explain the issue in more details and also post the figure separately with own descriptions as it’s currently hard to tell which values the curves have (e.g. it’s unclear to me if the losses in Fig. 2 are different or equal).</p>
<p>Also, I don’t understand the difference between Fig. 1 and 3 as apparently both are using “same data for train and validation”.</p>

username: mccreezhao
cooked: <p>BN, Dropout, and other ops perform in a different manner during training and testing may cause this problem. Fix them and try again?</p>

username: junqiangchen
cooked: <p>i want use UNet3d to segmt mutil target,but i find the validation result always lower than traing result,<br>
so i do some experiments,<br>
first one that is using same datas with 5 volume dataset for train and validation,but the loss and accuracy have some gap distance,like this:<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/3/d/3d7d428a47a84c1b9d35f0c60d9690d110348836.png" data-download-href="https://discuss.pytorch.org/uploads/default/3d7d428a47a84c1b9d35f0c60d9690d110348836" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/3/d/3d7d428a47a84c1b9d35f0c60d9690d110348836_2_690x262.png" alt="image" data-base62-sha1="8LXuCkLai0Tgs9eNU3xUcyUNUQ6" width="690" height="262" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/3/d/3d7d428a47a84c1b9d35f0c60d9690d110348836_2_690x262.png, https://discuss.pytorch.org/uploads/default/original/3X/3/d/3d7d428a47a84c1b9d35f0c60d9690d110348836.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/3/d/3d7d428a47a84c1b9d35f0c60d9690d110348836.png 2x" data-dominant-color="E8EAEA"><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">942×359 68.5 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>

username: junqiangchen
cooked: <p>another one is that using only one volume dataset for train and validation,the loss and accuracy is same,like this:<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/b/0/b026fdb19d48177e43aee75db097f77100801a83.png" data-download-href="https://discuss.pytorch.org/uploads/default/b026fdb19d48177e43aee75db097f77100801a83" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/b/0/b026fdb19d48177e43aee75db097f77100801a83_2_690x262.png" alt="image" data-base62-sha1="p8jzv7GCi0PkgHJYqGUie7dlGJJ" width="690" height="262" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/b/0/b026fdb19d48177e43aee75db097f77100801a83_2_690x262.png, https://discuss.pytorch.org/uploads/default/original/3X/b/0/b026fdb19d48177e43aee75db097f77100801a83.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/b/0/b026fdb19d48177e43aee75db097f77100801a83.png 2x" data-dominant-color="E9EBEA"><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">968×368 54.8 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><br>
so it’s strange why there have different size dataset for train and validation,the train and validation is different.</p>
<p>ps:the network is Unet3d,using BN layer,loss is mutil dice.<br>
thank you!!</p>

username: junqiangchen
cooked: <p>in Unet3d only use BN,ops is Adam with default params</p>

username: junqiangchen
cooked: <p>i find the problem,the BN is not stable when batchsize is too small,so i change BN to GN,it’s same.</p>