mirror of
https://github.com/sbrl/research-rainfallradar
synced 2024-11-04 17:13:02 +00:00
debug
This commit is contained in:
parent
5472729f5e
commit
750f46dbd2
3 changed files with 12 additions and 1 deletions
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue