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',
for k, w in enumerate(m):
model_lyrs[k].append(w)
for lyr in model_lyrs:
nda = np.stack(lyr, axis=-1)
print(nda.shape)
avg = np.mean(nda, axis=-1)
print(avg.shape)
avg_model_weights.append(nda)
avg_model_weights.append(np.mean(np.stack(lyr, axis=-1), axis=-1))
# -- 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)
......@@ -1211,13 +1207,13 @@ def run_average_models(ckpt_dir_s_path, day_night='NIGHT', l1b_andor_l2='BOTH',
new_model.build_evaluation()
# -- Save the averaged weights to a new the model
# if not os.path.exists(modeldir):
# os.mkdir(modeldir)
# ckpt = tf.train.Checkpoint(step=tf.Variable(1), model=new_model.model)
# ckpt_manager = tf.train.CheckpointManager(ckpt, modeldir, max_to_keep=3)
#
# new_model.model.set_weights(avg_weights)
# ckpt_manager.save()
if not os.path.exists(modeldir):
os.mkdir(modeldir)
ckpt = tf.train.Checkpoint(step=tf.Variable(1), model=new_model.model)
ckpt_manager = tf.train.CheckpointManager(ckpt, modeldir, max_to_keep=3)
new_model.model.set_weights(avg_model_weights)
ckpt_manager.save()
return
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment