From 9d48300519a9d5c7a3202d1acede2f29a6920177 Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Mon, 13 Nov 2023 16:12:40 -0600
Subject: [PATCH] snapshot...

---
 modules/deeplearning/icing_fcn.py | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/modules/deeplearning/icing_fcn.py b/modules/deeplearning/icing_fcn.py
index 3aadbd7f..d5607669 100644
--- a/modules/deeplearning/icing_fcn.py
+++ b/modules/deeplearning/icing_fcn.py
@@ -1180,18 +1180,22 @@ def run_evaluate_static_2(model, data_dct, num_tiles, prob_thresh=0.5, flight_le
 def run_average_models(ckpt_dir_s_path, day_night='NIGHT', l1b_andor_l2='BOTH', use_flight_altitude=False):
 
     ckpt_dir_s = os.listdir(ckpt_dir_s_path)
-    weight_s = []
+    model_weight_s = []
     for ckpt in ckpt_dir_s:
         ckpt_dir = ckpt_dir_s_path + ckpt
         if not os.path.isdir(ckpt_dir):
             continue
         model = load_model(ckpt_dir, day_night=day_night, l1b_andor_l2=l1b_andor_l2, use_flight_altitude=use_flight_altitude)
         k_model = model.model
-        weight_s.append(k_model.get_weights())
-    sum = 0.0
-    for w in weight_s:
-        sum += w
-    avg_weights = sum / len(weight_s)
+        model_weight_s.append(k_model.get_weights())
+
+    avg_model_weights = []
+    for m in model_weight_s:
+        print(len(m))
+        for w in m:
+            print(w.shape)
+            avg_model_weights.append(np.mean(w))
+
 
     # -- Make a new model for the averaged weights
     new_model = IcingIntensityFCN(day_night=day_night, l1b_or_l2=l1b_andor_l2, use_flight_altitude=use_flight_altitude)
-- 
GitLab