Hi Fikrat!



 Fikrat:

Therefore, my target is to implement Weighted Cross Entropy Loss, aiming at providing more weights to colourful pixels, rather than black pixels.


If your problem is one a binary segmentation, presumably
black = background, color = foreground, then you should use
BCEWithLogitsLoss 20 and the pos_weight argument that you
pass to its constructor.
If it’s multi-class segmentation, e.g., black = background, some
colors or patterns = lane 1, some other colors or patterns = lane 2,
etc., then you should use CrossEntropyLoss 24 and the weight
argument passed to its constructor.
Best.
K. Frank