diff --git a/modules/deeplearning/icing_fcn.py b/modules/deeplearning/icing_fcn.py index 3aadbd7fa60bbff44cfe686c6a780310761ad9d8..d5607669dac0e3dde1aca914431d34583834aeea 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)