diff --git a/modules/deeplearning/cnn_cld_frac_mod_res.py b/modules/deeplearning/cnn_cld_frac_mod_res.py index e0f56732a84000826f4d12682295237499765763..5ef886ed770e40b3a37d82ee1b515587f99bf7b9 100644 --- a/modules/deeplearning/cnn_cld_frac_mod_res.py +++ b/modules/deeplearning/cnn_cld_frac_mod_res.py @@ -315,23 +315,6 @@ class SRCNN: tf.debugging.set_log_device_placement(LOG_DEVICE_PLACEMENT) def get_in_mem_data_batch(self, idxs, is_training): - # if is_training: - # files = self.train_data_files - # else: - # files = self.test_data_files - # - # data_s = [] - # for k in idxs: - # f = files[k] - # try: - # nda = np.load(f) - # except Exception: - # print(f) - # continue - # data_s.append(nda) - # input_data = np.concatenate(data_s) - # # input_label = input_data[:, label_idx, :, :] - if is_training: data_files = self.train_data_files label_files = self.train_label_files @@ -359,14 +342,12 @@ class SRCNN: tmp = tmp.copy() if DO_ESPCN: tmp = tmp[:, slc_y_2, slc_x_2] - else: # Half res upsampled to full res: + else: tmp = tmp[:, slc_y, slc_x] tmp = normalize(tmp, param, mean_std_dct) data_norm.append(tmp) for param in data_params_full: - # idx = params.index(param) - # tmp = input_data[:, idx, :, :] idx = params_i.index(param) tmp = input_label[:, idx, :, :] tmp = tmp.copy() @@ -386,7 +367,7 @@ class SRCNN: tmp = tmp.copy() if DO_ESPCN: tmp = tmp[:, slc_y_2, slc_x_2] - else: # Half res upsampled to full res: + else: tmp = tmp[:, slc_y, slc_x] if label_param != 'cloud_probability': tmp = normalize(tmp, label_param, mean_std_dct) @@ -396,7 +377,6 @@ class SRCNN: data = data.astype(np.float32) # ----------------------------------------------------- # ----------------------------------------------------- - # label = input_data[:, label_idx, :, :] label = input_label[:, label_idx_i, :, :] label = label.copy() label = label[:, y_128, x_128] @@ -469,9 +449,6 @@ class SRCNN: self.test_data_files = test_data_files self.test_label_files = test_label_files - # self.train_data_files = train_data_files - # self.test_data_files = test_data_files - trn_idxs = np.arange(len(train_data_files)) np.random.shuffle(trn_idxs) @@ -572,7 +549,7 @@ class SRCNN: optimizer = tf.keras.optimizers.Adam(learning_rate=self.learningRateSchedule) if TRACK_MOVING_AVERAGE: - # Not really sure this works properly (from tfa) + # Not sure that this works properly (from tfa) # optimizer = tfa.optimizers.MovingAverage(optimizer) self.ema = tf.train.ExponentialMovingAverage(decay=0.9999) @@ -804,10 +781,6 @@ class SRCNN: valid_label_files = glob.glob(directory+'valid*ires*.npy') self.setup_pipeline(train_data_files, train_label_files, valid_data_files, valid_label_files, num_data_samples) - # train_data_files = glob.glob(directory+'data_train_*.npy') - # valid_data_files = glob.glob(directory+'data_valid_*.npy') - # self.setup_pipeline(train_data_files, None, valid_data_files, None, num_data_samples) - self.build_model() self.build_training() self.build_evaluation() @@ -815,8 +788,6 @@ class SRCNN: def run_restore(self, directory, ckpt_dir): self.num_data_samples = 1000 - # valid_data_files = glob.glob(directory + 'data_valid*.npy') - # self.setup_test_pipeline(valid_data_files, None) valid_data_files = glob.glob(directory + 'valid*mres*.npy') valid_label_files = glob.glob(directory + 'valid*ires*.npy')