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

snapshot...

parent ec14fec8
No related branches found
No related tags found
No related merge requests found
...@@ -1198,11 +1198,7 @@ def run_average_models(ckpt_dir_s_path, day_night='NIGHT', l1b_andor_l2='BOTH', ...@@ -1198,11 +1198,7 @@ def run_average_models(ckpt_dir_s_path, day_night='NIGHT', l1b_andor_l2='BOTH',
for k, w in enumerate(m): for k, w in enumerate(m):
model_lyrs[k].append(w) model_lyrs[k].append(w)
for lyr in model_lyrs: for lyr in model_lyrs:
nda = np.stack(lyr, axis=-1) avg_model_weights.append(np.mean(np.stack(lyr, axis=-1), axis=-1))
print(nda.shape)
avg = np.mean(nda, axis=-1)
print(avg.shape)
avg_model_weights.append(nda)
# -- 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)
...@@ -1211,13 +1207,13 @@ def run_average_models(ckpt_dir_s_path, day_night='NIGHT', l1b_andor_l2='BOTH', ...@@ -1211,13 +1207,13 @@ def run_average_models(ckpt_dir_s_path, day_night='NIGHT', l1b_andor_l2='BOTH',
new_model.build_evaluation() new_model.build_evaluation()
# -- Save the averaged weights to a new the model # -- Save the averaged weights to a new the model
# if not os.path.exists(modeldir): if not os.path.exists(modeldir):
# os.mkdir(modeldir) os.mkdir(modeldir)
# ckpt = tf.train.Checkpoint(step=tf.Variable(1), model=new_model.model) ckpt = tf.train.Checkpoint(step=tf.Variable(1), model=new_model.model)
# ckpt_manager = tf.train.CheckpointManager(ckpt, modeldir, max_to_keep=3) ckpt_manager = tf.train.CheckpointManager(ckpt, modeldir, max_to_keep=3)
#
# new_model.model.set_weights(avg_weights) new_model.model.set_weights(avg_model_weights)
# ckpt_manager.save() ckpt_manager.save()
return return
......
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