質問編集履歴
1
参考リンク追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -35,7 +35,8 @@
|
|
35
35
|
return tf.py_function(mean_IoU, [y_true, y_pred], tf.float64)
|
36
36
|
```
|
37
37
|
しかし、実際にIoUを実装したという別のコードを答え合わせとして使用し流してみたところ出力が異なっていました。
|
38
|
-
参考にしたコードと
|
38
|
+
参考にしたコードと参考資料を以下に示します。
|
39
|
+
[答え合わせ先資料](https://zshitake.hatenablog.com/entry/2018/11/08/135335)
|
39
40
|
```
|
40
41
|
def true_positive(y_true, y_pred):
|
41
42
|
#print(K.equal(y_true * y_pred, 1))
|
@@ -61,14 +62,4 @@
|
|
61
62
|
return TP / (TP+FN+FP)
|
62
63
|
```
|
63
64
|
|
64
|
-
```
|
65
|
-
# 関数実行結果
|
66
|
-
y_true = tf.constant([[[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]])
|
67
|
-
y_pred = tf.constant([[[0.8, 0.1, 0.1], [0.2, 0.2, 0.6], [0.2, 0.6, 0.2]]])
|
68
|
-
print(my_mean_iou([y_true], [y_pred]))
|
69
|
-
print(iou(y_true, y_pred))
|
70
|
-
|
71
|
-
[out] tf.Tensor(0.3333333333333333, shape=(), dtype=float64)
|
72
|
-
[out] tf.Tensor(0.2, shape=(), dtype=float32)
|
73
|
-
```
|
74
65
|
おそらくそもそもの考え方が違うと思うのですが、どこに誤りがあるのかわからない状態です。原因について教えていただけると助かります。よろしくお願いします。
|