Closed Sayantan17 closed 3 years ago
Hi @Sayantan17 ,
Thanks for your interest very much.
The code was copied from nnUNet
as I mentioned in the comments.
https://github.com/JunMa11/SegLoss/blob/858c27e0eda817238b827d3972c198ec68f6cebf/losses_pytorch/dice_loss.py#L2
Honestly speaking, I do not dig these details.
I think Fabian would be the best person to answer your question:) Could you please raise this issue at https://github.com/MIC-DKFZ/nnUNet?
Best, Jun
Sure. Thx. Sure thing. I will take you in a loop.
Hi Jun @JunMa11
Thanks for getting time for collecting all loss functions at one place. You are.awesome.~😉
Can you please help me in understanding why you did them? (One by one). Will be great if you help.
Started the tuple from 2 and the next lines, I mean you checking masks are returning proper identity without squares, then can you please explain x_i * with all rows + columns of the mask?
axes = tuple(range(2, len(net_output.size()))) ...... tp = torch.stack(tuple(x_i * mask[:, 0] for x_i in torch.unbind(tp, dim=1)), dim=1)
if self.batch_dice: axes = [0] + list(range(2, len(shp_x))) else: axes = list(range(2, len(shp_x))) if self.apply_nonlin is not None: x = self.apply_nonlin(x)