From 750f46dbd2b67743296e001a837d146dc5c4b4e1 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Fri, 3 Mar 2023 22:39:30 +0000 Subject: [PATCH] debug --- aimodel/src/lib/ai/components/MetricMeanIoU.py | 5 ++++- aimodel/src/lib/ai/components/MetricSensitivity.py | 4 ++++ aimodel/src/lib/ai/components/MetricSpecificity.py | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/aimodel/src/lib/ai/components/MetricMeanIoU.py b/aimodel/src/lib/ai/components/MetricMeanIoU.py index 1fa2947..523c2f6 100644 --- a/aimodel/src/lib/ai/components/MetricMeanIoU.py +++ b/aimodel/src/lib/ai/components/MetricMeanIoU.py @@ -12,10 +12,13 @@ def one_hot_mean_iou(y_true, y_pred, classes=2): Returns: tf.Tensor: The computed mean IoU. """ - + print("DEBUG:meaniou y_pred.shape BEFORE", y_pred.shape) + print("DEBUG:meaniou y_true.shape BEFORE", y_true.shape) y_pred = tf.math.argmax(y_pred, axis=-1) y_true = tf.cast(y_true, dtype=tf.float32) y_pred = tf.cast(y_pred, dtype=tf.float32) + print("DEBUG:meaniou y_pred.shape AFTER", y_pred.shape) + print("DEBUG:meaniou y_true.shape AFTER", y_true.shape) iou = tf.keras.metrics.MeanIoU(num_classes=classes) diff --git a/aimodel/src/lib/ai/components/MetricSensitivity.py b/aimodel/src/lib/ai/components/MetricSensitivity.py index be435e9..1839e36 100644 --- a/aimodel/src/lib/ai/components/MetricSensitivity.py +++ b/aimodel/src/lib/ai/components/MetricSensitivity.py @@ -3,9 +3,13 @@ import math import tensorflow as tf def sensitivity(y_true, y_pred): + print("DEBUG:sensitivity y_pred.shape BEFORE", y_pred.shape) + print("DEBUG:sensitivity y_true.shape BEFORE", y_true.shape) y_pred = tf.math.argmax(y_pred, axis=-1) y_true = tf.cast(y_true, dtype=tf.float32) y_pred = tf.cast(y_pred, dtype=tf.float32) + print("DEBUG:sensitivity y_pred.shape AFTER", y_pred.shape) + print("DEBUG:sensitivity y_true.shape AFTER", y_true.shape) recall = tf.keras.metrics.Recall() recall.update_state(y_true, y_pred) diff --git a/aimodel/src/lib/ai/components/MetricSpecificity.py b/aimodel/src/lib/ai/components/MetricSpecificity.py index e5fb9c8..614db0f 100644 --- a/aimodel/src/lib/ai/components/MetricSpecificity.py +++ b/aimodel/src/lib/ai/components/MetricSpecificity.py @@ -13,9 +13,13 @@ def specificity(y_true, y_pred): Returns: Specificity score """ + print("DEBUG:specificity y_pred.shape BEFORE", y_pred.shape) + print("DEBUG:specificity y_true.shape BEFORE", y_true.shape) y_pred = tf.math.argmax(y_pred, axis=-1) y_true = tf.cast(y_true, dtype=tf.float32) y_pred = tf.cast(y_pred, dtype=tf.float32) + print("DEBUG:specificity y_pred.shape AFTER", y_pred.shape) + print("DEBUG:specificity y_true.shape AFTER", y_true.shape) neg_y_true = 1 - y_true neg_y_pred = 1 - y_pred