Skip to content
Snippets Groups Projects
Commit 9d483005 authored by tomrink's avatar tomrink
Browse files

snapshot...

parent 247b326f
No related branches found
No related tags found
No related merge requests found
...@@ -1180,18 +1180,22 @@ def run_evaluate_static_2(model, data_dct, num_tiles, prob_thresh=0.5, flight_le ...@@ -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): 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) ckpt_dir_s = os.listdir(ckpt_dir_s_path)
weight_s = [] model_weight_s = []
for ckpt in ckpt_dir_s: for ckpt in ckpt_dir_s:
ckpt_dir = ckpt_dir_s_path + ckpt ckpt_dir = ckpt_dir_s_path + ckpt
if not os.path.isdir(ckpt_dir): if not os.path.isdir(ckpt_dir):
continue continue
model = load_model(ckpt_dir, day_night=day_night, l1b_andor_l2=l1b_andor_l2, use_flight_altitude=use_flight_altitude) 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 k_model = model.model
weight_s.append(k_model.get_weights()) model_weight_s.append(k_model.get_weights())
sum = 0.0
for w in weight_s: avg_model_weights = []
sum += w for m in model_weight_s:
avg_weights = sum / len(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 # -- 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) new_model = IcingIntensityFCN(day_night=day_night, l1b_or_l2=l1b_andor_l2, use_flight_altitude=use_flight_altitude)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment