예제 #1
0
    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
예제 #2
0
    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
예제 #3
0
 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
예제 #4
0
 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
예제 #5
0
 def forward(self, yhat, y):
     yhat = utils.Activation(yhat, self.activation_T)
     y = y[:, 0].long()
     loss = self.ce(yhat, y)
     return loss