tf.compat.v1.metrics.mean_iou

View source on GitHub

Calculate per-step mean Intersection-Over-Union (mIOU).

tf.compat.v1.metrics.mean_iou(
    labels, predictions, num_classes, weights=None, metrics_collections=None,
    updates_collections=None, name=None
)

Mean Intersection-Over-Union is a common evaluation metric for semantic image segmentation, which first computes the IOU for each semantic class and then computes the average over classes. IOU is defined as follows: IOU = true_positive / (true_positive + false_positive + false_negative). The predictions are accumulated in a confusion matrix, weighted by weights, and mIOU is then calculated from it.

For estimation of the metric over a stream of data, the function creates an update_op operation that updates these variables and returns the mean_iou.

If weights is None, weights default to 1. Use weights of 0 to mask values.

Args:

Returns:

Raises: