本文介绍了Tensorflow:每班IOU的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 deeplab 进行语义分割.我想计算每个班级的 IOU(仅限个人的 IOU)而不是平均 IOU.

I'm trying to use deeplab for semantic segmentation. I'd like to calculate IOU per class(IOU for person only) instead of mean IOU.

在 L142 处https://github.com/tensorflow/models/blob/master/research/deeplab/eval.py,我试图通过

At L142 ofhttps://github.com/tensorflow/models/blob/master/research/deeplab/eval.py,I tried to get confusion matrix instead of mean IOU by

miou, cmat = tf.metrics.mean_iou(...)
metric_map['cmat'] = cmat

但是没有用.如果有人建议我如何出行,我将不胜感激.

but it did not work.I'd appreciate if someone suggest me how to get around.

推荐答案

您可以使用 tensorflow.python.ops.metrics_impl 中的 _streaming_confusion_matrix 来获取混淆矩阵.从本质上讲,它的工作方式与 mean_iou 等其他运行指标相同.这意味着,在调用此指标时,您将获得两个操作,一个总混淆矩阵操作和一个更新操作,该操作累积更新混淆矩阵.

You can use _streaming_confusion_matrix from tensorflow.python.ops.metrics_impl to get the confusion matrix.Essentially it works the same way as other running metrics like mean_iou. which means, you get two ops when calling this metric, a total confusion_matrix op and an update op that updates the confusion matrix cumulatively.

有了混淆矩阵,现在你应该可以计算类别的iou了

With the confusion matrix, now you should be able to compute the class wise iou

这篇关于Tensorflow:每班IOU的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-14 15:23