diff --git a/modules/deeplearning/icing_cnn.py b/modules/deeplearning/icing_cnn.py index 87a380c3509ca3f2e063489b5b63b622e39bf1ab..38b9463d7d94edfbdf7681020e2c5d063b8ad13c 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'):