diff --git a/modules/deeplearning/icing_fcn.py b/modules/deeplearning/icing_fcn.py index 7271cd68800c00e57a4306f67a8bb27867103e5b..aeb70a6355b8826452a4e8377bdb6230fd43db85 100644 --- a/modules/deeplearning/icing_fcn.py +++ b/modules/deeplearning/icing_fcn.py @@ -1191,18 +1191,18 @@ def run_evaluate_static_avg(ckpt_dir_s_path, day_night='NIGHT', l1b_andor_l2='BO sum += w avg_weights = sum / len(weight_s) - # --------------------------------------------- - + # -- 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.build_model() new_model.build_training() new_model.build_evaluation() - if ckpt_dir is None: - 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) + # -- 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()