我正在尝试获取两组边界框之间的平均 IOU 指标。我遇到了这个错误:RuntimeError:启用急切执行时不支持 tf.metrics.mean_iou。抛出错误的可重现代码:import tensorflow as tfa = [[0.462, 0.465, 0.492, 0.58], [0.435, 0.385, 0.462, 0.467], [0.586, 0.449, 0.627, 0.616], [0.431, 0.671, 0.494, 0.8], [0.519, 0.282, 0.586, 0.449]]b = [[0.465, 0.467, 0.491, 0.586], [0.432, 0.488, 0.464, 0.59], [0.585, 0.442, 0.633, 0.625], [0.429, 0.664, 0.493, 0.805], [0.524, 0.502, 0.594, 0.642]]tf.compat.v1.metrics.mean_iou(a, b, num_classes=1)我有什么选择?
1 回答
慕容708150
TA贡献1831条经验 获得超4个赞
我能够让它发挥作用:
import tensorflow as tf
a = [[0.462, 0.465, 0.492, 0.58],
[0.435, 0.385, 0.462, 0.467],
[0.586, 0.449, 0.627, 0.616],
[0.431, 0.671, 0.494, 0.8],
[0.519, 0.282, 0.586, 0.449]]
b = [[0.465, 0.467, 0.491, 0.586],
[0.432, 0.488, 0.464, 0.59],
[0.585, 0.442, 0.633, 0.625],
[0.429, 0.664, 0.493, 0.805],
[0.524, 0.502, 0.594, 0.642]]
metric = tf.keras.metrics.MeanIoU(num_classes=1)
print(metric(a, b))
>> tf.Tensor(1.0, shape=(), dtype=float32)
添加回答
举报
0/150
提交
取消