def iou_coe(output, target, threshold=0.5, epsilon=1e-10):
 pre = tf.cast((output > threshold), dtype=tf.float32)
 truth = tf.cast((target > threshold), dtype=tf.float32)
 intersection = tf.reduce_sum((pre * truth))
 union = tf.reduce_sum(tf.cast(((pre + truth) > threshold), dtype=tf.float32))
 return (tf.reduce_sum(intersection) / (tf.reduce_sum(union) + epsilon))

def iou_coe ( output , target , threshold = 0.5 , epsilon = 1e-10 ) : pre = tf . cast ( ( output > threshold ) , dtype = tf . float32 ) truth = tf . cast ( ( target > threshold ) , dtype = tf . float32 ) intersection = tf . reduce_sum ( ( pre * truth ) ) union = tf . reduce_sum ( tf . cast ( ( ( pre + truth ) > threshold ) , dtype = tf . float32 ) ) return ( tf . reduce_sum ( intersection ) / ( tf . reduce_sum ( union ) + epsilon ) )
non-differentiable intersection over union .