moreshud:

Can this approach be helpful in a multi-label, multiclass class imbalance image segmentation also?


Yes, I would think so.



 moreshud:

Am I to use the weight or pos weight parameter in the nn.BCEWithLogitsLoss because it will be combined with a weighted dice loss function?


Calculating the weights in my code snippet would add the corresponding weights to each sample of the loss before the reduction is done.
The pos_weight acts directly on the positive term of the loss function as shown in the docs 10, so they wouldn’t be equivalent.