Example #1
0
 def __init__(self, soft_dice_kwargs, ce_kwargs, aggregate="sum", square_dice=False):
     super(DC_and_topk_loss, self).__init__()
     self.aggregate = aggregate
     self.ce = TopKLoss(**ce_kwargs)
     if not square_dice:
         self.dc = SoftDiceLoss(apply_nonlin=softmax_helper, **soft_dice_kwargs)
     else:
         self.dc = SoftDiceLossSquared(apply_nonlin=softmax_helper, **soft_dice_kwargs)
Example #2
0
 def __init__(self,
              plans_file,
              fold,
              output_folder=None,
              dataset_directory=None,
              batch_dice=True,
              stage=None,
              unpack_data=True,
              deterministic=True,
              fp16=False):
     super().__init__(plans_file, fold, output_folder, dataset_directory,
                      batch_dice, stage, unpack_data, deterministic, fp16)
     self.loss = TopKLoss(k=10)
Example #3
0
 def __init__(self,
              soft_dice_kwargs,
              topk_kwargs,
              focal_kwargs,
              aggregate="sum",
              square_dice=False):
     super(DC_topk_focal_loss, self).__init__()
     self.aggregate = aggregate
     self.topk = TopKLoss(**topk_kwargs)
     self.focal = FocalLoss(apply_nonlin=softmax_helper, **focal_kwargs)
     if not square_dice:
         self.dc = SoftDiceLoss(apply_nonlin=softmax_helper,
                                **soft_dice_kwargs)
     else:
         self.dc = SoftDiceLossSquared(apply_nonlin=softmax_helper,
                                       **soft_dice_kwargs)
Example #4
0
 def __init__(self, soft_dice_kwargs, ce_kwargs, aggregate="sum"):
     super(DC_and_topk_loss, self).__init__()
     self.aggregate = aggregate
     self.ce = TopKLoss(**ce_kwargs)
     self.dc = SoftDiceLoss(apply_nonlin=softmax_helper, **soft_dice_kwargs)
Example #5
0
 def __init__(self, soft_iou_kwargs, ce_kwargs, aggregate="sum"):
     super(Iou_and_TopK_loss, self).__init__()
     self.aggregate = aggregate
     self.topk = TopKLoss(**ce_kwargs)
     self.iou = IoULoss(apply_nonlin=softmax_helper, **soft_iou_kwargs)