def forward(self, yhat, y): yhat = utils.Activation(yhat, self.activation_T) ce = self.ce(yhat, y) boundary = self.boundary(yhat, y) # dice = self.dice(yhat,y) kernel = torch.ones(3, 3).cuda() yhat_skel = kornia.morphology.dilation(torch_skeleton(yhat), kernel) y_skel = kornia.morphology.dilation(torch_skeleton(y), kernel) dice_skel = self.dice(yhat_skel, y_skel) return ce + boundary + dice_skel #+dice
def forward(self, yhat, y): yhat = utils.Activation(yhat, self.activation_T) loss_ce = self.ce(yhat, y) loss_dice = self.dice(yhat, y) kernel = torch.ones(3, 3).cuda() yhat_skel = kornia.morphology.dilation(torch_skeleton(yhat), kernel) y_skel = kornia.morphology.dilation(torch_skeleton(y), kernel) loss_ce_skel = self.ce(yhat_skel, y_skel) loss_dice_skel = self.dice(yhat_skel, y_skel) return loss_ce + loss_ce_skel + loss_dice + loss_dice_skel
def forward(self, yhat, y): yhat = utils.Activation(yhat, self.activation_T) ce = self.ce(yhat, y) boundary = self.boundary(yhat, y) return ce + boundary
def forward(self, yhat, y): yhat = utils.Activation(yhat, self.activation_T) dice = self.dice(yhat, y) ce = self.ce(yhat, y) return dice + ce
def forward(self, yhat, y): yhat = utils.Activation(yhat, self.activation_T) y = y[:, 0].long() loss = self.ce(yhat, y) return loss