def loss_image(prediction, mask):
"""Calc loss for predition on image of mask.
Args.
inputs: prediction image
mask: true image
Return:
error: loss value
"""
print(prediction.get_shape())
print(mask.get_shape())
#mask = tf.flatten(mask)
#prediction = tf.flatten(prediction)
intersection = tf.reduce_sum(prediction * mask)
loss = -(2. * intersection + 1.) / (tf.reduce_sum(mask) + tf.reduce_sum(prediction) + 1.)
tf.scalar_summary('loss', loss)
return loss
nerve_net.py 文件源码
python
阅读 21
收藏 0
点赞 0
评论 0
评论列表
文章目录