junqiangchen / BraTS18-Challege

Multimodal Brain Tumor Segmentation Challenge 2018
https://www.med.upenn.edu/sbia/brats2018.html
50 stars 12 forks source link

loss = -tf.reduce_mean(intersection / denominator) 为什么有那个负号呢? #4

Closed cqlouis closed 3 years ago

cqlouis commented 3 years ago

在model_vnet3d.py 中,

def __get_cost(self, Y_pred, Y_gt, cost_name): Z, H, W, C = Y_gt.get_shape().as_list()[1:] if cost_name == "dice coefficient": smooth = 1e-5 pred_flat = tf.reshape(Y_pred, [-1, H W C Z]) true_flat = tf.reshape(Y_gt, [-1, H W C Z]) intersection = 2 tf.reduce_sum(pred_flat true_flat, axis=1) + smooth denominator = tf.reduce_sum(pred_flat, axis=1) + tf.reduce_sum(true_flat, axis=1) + smooth loss = -tf.reduce_mean(intersection / denominator) return loss

=========================== loss = -tf.reduce_mean(intersection / denominator) , 这里为什么有个负号呢?感觉不对吧?

cqlouis commented 3 years ago

I understood it.