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

snapshot...

parent 5871e462
Branches
No related tags found
No related merge requests found
......@@ -523,9 +523,9 @@ class IcingIntensityFCN:
print('num test samples: ', tst_idxs.shape[0])
print('setup_test_pipeline: Done')
def setup_eval_pipeline(self, data_dct):
def setup_eval_pipeline(self, data_dct, num_tiles=1):
self.data_dct = data_dct
idxs = np.arange(1)
idxs = np.arange(num_tiles)
self.num_data_samples = idxs.shape[0]
self.get_evaluate_dataset(idxs)
......@@ -1124,7 +1124,46 @@ def run_evaluate_static_avg(data_dct, ll, cc, ckpt_dir_s_path, day_night='DAY',
return ice_lons, ice_lats, preds_2d
def run_evaluate_static_fcn(data_dct, ckpt_dir_s_path, day_night='DAY', l1b_or_l2='both', prob_thresh=0.5,
# def run_evaluate_static_fcn(data_dct, ckpt_dir_s_path, day_night='DAY', l1b_or_l2='both', prob_thresh=0.5,
# flight_levels=[0, 1, 2, 3, 4], use_flight_altitude=False):
#
# ckpt_dir_s = os.listdir(ckpt_dir_s_path)
# ckpt_dir = ckpt_dir_s_path + ckpt_dir_s[0]
#
# if not use_flight_altitude:
# flight_levels = [0]
#
# probs_dct = {flvl: None for flvl in flight_levels}
# preds_dct = {flvl: None for flvl in flight_levels}
#
# nn = IcingIntensityFCN(day_night=day_night, l1b_or_l2=l1b_or_l2, use_flight_altitude=use_flight_altitude)
# nn.num_data_samples = 1
# nn.build_model()
# nn.build_training()
# nn.build_evaluation()
#
# ckpt = tf.train.Checkpoint(step=tf.Variable(1), model=nn.model)
# ckpt_manager = tf.train.CheckpointManager(ckpt, ckpt_dir, max_to_keep=3)
# ckpt.restore(ckpt_manager.latest_checkpoint)
#
# for flvl in flight_levels:
# nn.flight_level = flvl
# nn.setup_eval_pipeline(data_dct)
# nn.do_evaluate(ckpt_dir)
#
# probs = nn.test_probs
# if NumClasses == 2:
# preds = np.where(probs > prob_thresh, 1, 0)
# else:
# preds = np.argmax(probs, axis=1)
#
# probs_dct[flvl] = probs
# preds_dct[flvl] = preds
#
# return preds_dct, probs_dct
def run_evaluate_static_fcn(data_dct, num_tiles, ckpt_dir_s_path, day_night='DAY', l1b_or_l2='both', prob_thresh=0.5,
flight_levels=[0, 1, 2, 3, 4], use_flight_altitude=False):
ckpt_dir_s = os.listdir(ckpt_dir_s_path)
......@@ -1137,7 +1176,7 @@ def run_evaluate_static_fcn(data_dct, ckpt_dir_s_path, day_night='DAY', l1b_or_l
preds_dct = {flvl: None for flvl in flight_levels}
nn = IcingIntensityFCN(day_night=day_night, l1b_or_l2=l1b_or_l2, use_flight_altitude=use_flight_altitude)
nn.num_data_samples = 1
nn.num_data_samples = num_tiles
nn.build_model()
nn.build_training()
nn.build_evaluation()
......@@ -1148,7 +1187,7 @@ def run_evaluate_static_fcn(data_dct, ckpt_dir_s_path, day_night='DAY', l1b_or_l
for flvl in flight_levels:
nn.flight_level = flvl
nn.setup_eval_pipeline(data_dct)
nn.setup_eval_pipeline(data_dct, num_tiles)
nn.do_evaluate(ckpt_dir)
probs = nn.test_probs
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment