How to choose the correct loss function (Image Segmentation)

username: mayool
cooked: <p>Hey,<br>
I am working on (binary) semantic segmentation and thinking about changing my loss function to improve my model (currently F.cross_entropy) and found this:</p>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/e/b/eb4aca1678c8672d530c916e2543d01be2677c09.png" data-download-href="https://discuss.pytorch.org/uploads/default/eb4aca1678c8672d530c916e2543d01be2677c09" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/e/b/eb4aca1678c8672d530c916e2543d01be2677c09_2_690x331.png" alt="image" data-base62-sha1="xzurlEFC8iZelIOtwUEU0O07HMR" width="690" height="331" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/e/b/eb4aca1678c8672d530c916e2543d01be2677c09_2_690x331.png, https://discuss.pytorch.org/uploads/default/optimized/3X/e/b/eb4aca1678c8672d530c916e2543d01be2677c09_2_1035x496.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/e/b/eb4aca1678c8672d530c916e2543d01be2677c09_2_1380x662.png 2x" data-dominant-color="EAE0D7"><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">1507×724 188 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>
<a href="https://github.com/JunMa11/SegLoss" rel="noopener nofollow ugc">(source of image)</a></p>
<p>How do I choose which loss function is usefull in my case?</p>
<p>This is how my output looks at the moment (left GT, right model prediction):<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/1/8/18c0668d6cb6e05b24247d81bb466948fbd9e2b3.png" data-download-href="https://discuss.pytorch.org/uploads/default/18c0668d6cb6e05b24247d81bb466948fbd9e2b3" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/1/8/18c0668d6cb6e05b24247d81bb466948fbd9e2b3_2_690x183.png" alt="image" data-base62-sha1="3wXFTfZGHZtJJaRBN0UdUx4Jx87" width="690" height="183" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/1/8/18c0668d6cb6e05b24247d81bb466948fbd9e2b3_2_690x183.png, https://discuss.pytorch.org/uploads/default/original/3X/1/8/18c0668d6cb6e05b24247d81bb466948fbd9e2b3.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/1/8/18c0668d6cb6e05b24247d81bb466948fbd9e2b3.png 2x" data-dominant-color="5F5F5F"><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">1023×272 33.7 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>Is there something like a guide to choose a loss function somewhere? <img src="https://discuss.pytorch.org/images/emoji/apple/smiley.png?v=12" title=":smiley:" class="emoji" alt=":smiley:" loading="lazy" width="20" height="20"></p>
<p>Thanks for any help <img src="https://discuss.pytorch.org/images/emoji/apple/slight_smile.png?v=12" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>