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

snapshot...

parent 9d483005
Branches
No related tags found
No related merge requests found
...@@ -1188,6 +1188,7 @@ def run_average_models(ckpt_dir_s_path, day_night='NIGHT', l1b_andor_l2='BOTH', ...@@ -1188,6 +1188,7 @@ def run_average_models(ckpt_dir_s_path, day_night='NIGHT', l1b_andor_l2='BOTH',
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
model_weight_s.append(k_model.get_weights()) model_weight_s.append(k_model.get_weights())
print('done loading models ******************************************')
avg_model_weights = [] avg_model_weights = []
for m in model_weight_s: for m in model_weight_s:
...@@ -1204,13 +1205,13 @@ def run_average_models(ckpt_dir_s_path, day_night='NIGHT', l1b_andor_l2='BOTH', ...@@ -1204,13 +1205,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_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.
Please to comment