Closed cqlouis closed 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) , 这里为什么有个负号呢?感觉不对吧?
I understood it.
在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) , 这里为什么有个负号呢?感觉不对吧?