Hi Talha!



 talhaanwarch:

I am trying to calculate dice coefficient


Okay, for Dice loss, one_hot() makes sense.


    mask_gt=F.one_hot(mask_gt.long(), num_classes=n_pred_ch) #create one hot vector



This line from the code you’ve posted seems to indicate that you’ve
answered your own question.
To repeat my question from my previous post:  Why do you want to
find those images that have all 60 labels?
As an aside, some people find that for semantic segmentation using
Dice loss to augment CrossEntropyLoss works better than using
Dice loss in isolation.  You might want to explore that after you get
your Dice loss working.
Best.
K. Frank