我正在嘗試獲取兩組邊界框之間的平均 IOU 指標(biāo)。我遇到了這個(gè)錯(cuò)誤:RuntimeError:?jiǎn)⒂眉鼻袌?zhí)行時(shí)不支持 tf.metrics.mean_iou。拋出錯(cuò)誤的可重現(xiàn)代碼: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貢獻(xiàn)1831條經(jīng)驗(yàn) 獲得超4個(gè)贊
我能夠讓它發(fā)揮作用:
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)
添加回答
舉報(bào)
0/150
提交
取消