def __call__(self, input, target): """ :param input: 5D probability maps torch tensor (NxCxDxHxW) :param target: 4D or 5D ground truth torch tensor. 4D (NxDxHxW) tensor will be expanded to 5D as one-hot :return: Soft Dice Coefficient averaged over all channels/classes """ # Average across channels in order to get the final score return torch.mean(compute_per_channel_dice(input, target, epsilon=self.epsilon, ignore_index=self.ignore_index))
def __call__(self, input, target): # Average across channels in order to get the final score return torch.mean(compute_per_channel_dice(input, target, epsilon=self.epsilon))
def __call__(self, input, target): # Average across channels in order to get the final score class_idx = torch.arange(input.shape[1]).to(input.device) input = torch.argmax(input, axis=1)==class_idx[:,None,None,None,None] input = input.transpose(1,0) return torch.mean(compute_per_channel_dice(input, target, epsilon=self.epsilon))