codecamp

TensorFlow函数:tf.metrics.mean_iou

tf.metrics.mean_iou函数

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

定义在:tensorflow/python/ops/metrics_impl.py.

计算每步mean Intersection-Over-Union(mIOU).

Mean Intection-Over-Union是语义图像分割的常用评估指标,它首先计算每个语义类的IOU,然后计算平均类.

IOU定义如下:IOU = true_positive /(true_positive + false_positive + false_negative).

predictions在混淆矩阵中累积,通过weights加权,然后从中计算mIOU.

为了估计数据流上的度量,该函数创建一个update_op操作来更新这些变量并返回mean_iou.

如果weights是None,则权重默认为1,使用权重0来屏蔽值.

参数:

  • labels:具有形状[batch size]和类型为int32或int64的正确标记(ground truth)的labels的Tensor.如果秩> 1,则张量将flatten.
  • predictions:语义labels的预测结果的Tensor,其形状为[batch size]和类型为int32或int64.如果秩> 1,则张量将flatten.
  • num_classes:预测任务可能具有的labels数量.必须提供此值,因为将分配维度= [num_classes,num_classes]的混淆矩阵.
  • weights:可选的Tensor,其秩为0或与labels具有相同的秩,并且必须可广播到labels(即,所有维度必须为1或者与相应的labels维度相同).
  • metrics_collections:mean_iou应添加到的集合的可选列表.
  • updates_collections:update_op应添加到的集合的可选列表.
  • name:可选的variable_scope名称.

返回:

  • mean_iou:表示Mean Intection-Over-Union的Tensor.
  • update_op:增加混淆矩阵的操作.

可能引发的异常:

  • ValueError:如果predictions和labels有不匹配的形状,或者weights不是None,并且它的形状与predictions不匹配,或者如果metrics_collections或updates_collections中任意一个不是一个列表或元组.
  • RuntimeError:如果启用了急切执行.
TensorFlow函数:tf.metrics.mean_cosine_distance
TensorFlow函数:tf.metrics.mean_per_class_accuracy
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

TensorFlow 函数介绍

TensorFlow 函数模块:tf

TensorFlow的image模块

TensorFlow使用之tf.io

TensorFlow使用之tf.keras

TensorFlow函数教程:tf.keras.applications

TensorFlow函数教程:tf.keras.backend

TensorFlow使用之tf.metrics

TensorFlow使用之tf.nn

TensorFlow使用之tf.python_io

TensorFlow 功能函数

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }