From b75a359cc4c0f57be6e77789cf3fb6a460f6a633 Mon Sep 17 00:00:00 2001 From: tomrink <rink@ssec.wisc.edu> Date: Tue, 12 Oct 2021 15:55:00 -0500 Subject: [PATCH] bug fix --- modules/deeplearning/icing_cnn.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/deeplearning/icing_cnn.py b/modules/deeplearning/icing_cnn.py index 87a380c3..38b9463d 100644 --- a/modules/deeplearning/icing_cnn.py +++ b/modules/deeplearning/icing_cnn.py @@ -951,6 +951,9 @@ class IcingIntensityNN: def run_restore_static(filename_l1b, filename_l2, ckpt_dir_s_path): ckpt_dir_s = os.listdir(ckpt_dir_s_path) cm_s = [] + prob_s = [] + labels = None + for ckpt in ckpt_dir_s: ckpt_dir = ckpt_dir_s_path + ckpt if not os.path.isdir(ckpt_dir): @@ -958,13 +961,20 @@ def run_restore_static(filename_l1b, filename_l2, ckpt_dir_s_path): nn = IcingIntensityNN() nn.run_restore(filename_l1b, filename_l2, ckpt_dir) cm_s.append(tf.math.confusion_matrix(nn.test_labels.flatten(), nn.test_preds.flatten())) + prob_s.append(nn.test_probs.flatten()) + if labels is None: # These should be the same + labels = nn.test_labels.flatten() + num = len(cm_s) cm_avg = cm_s[0] + prob_avg = prob_s[0] for k in range(num-1): cm_avg += cm_s[k+1] + prob_avg += prob_s[k+1] cm_avg /= num + prob_avg /= num - return cm_avg + return labels, prob_avg, cm_avg def run_evaluate_static(h5f, ckpt_dir_s_path, prob_thresh=0.5, satellite='GOES16', domain='FD'): -- GitLab