def define_eval_metrics(self): """ Evaluate the model on the current batch """ # Dice with tf.variable_scope('Dice'): self.dice = dice_coe(output=self.sup_pred_mask_oh, target=self.sup_output_data) with tf.variable_scope('Dice_3channels'): self.dice_3chs = dice_coe(output=self.sup_pred_mask_oh[..., 1:], target=self.sup_output_data[..., 1:])
def define_eval_metrics(self): """ Evaluate the model on the current batch """ with tf.variable_scope('Dice_sup'): self.dice_sup = dice_coe(output=self.sup_pred_mask_oh[..., 1:], target=self.acdc_sup_output_mask[..., 1:])
def dice_loss(output, target, axis=(1, 2, 3), smooth=1e-12): """ Returns Soft Sørensen–Dice loss """ return 1.0 - dice_coe(output, target, axis=axis, smooth=smooth)