From 26372c0e887b529a1365f1f78490c6711cb6cd80 Mon Sep 17 00:00:00 2001 From: tomrink <rink@ssec.wisc.edu> Date: Fri, 17 Sep 2021 08:35:27 -0500 Subject: [PATCH] snapshot... --- modules/deeplearning/icing_cnn.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/modules/deeplearning/icing_cnn.py b/modules/deeplearning/icing_cnn.py index 311db230..be8cdeb5 100644 --- a/modules/deeplearning/icing_cnn.py +++ b/modules/deeplearning/icing_cnn.py @@ -35,6 +35,7 @@ TRIPLET = False CONV3D = False NOISE_TRAINING = False +NOISE_STDDEV = 0.01 img_width = 16 @@ -244,10 +245,12 @@ class IcingIntensityNN: data = [] for param in train_params: nda = self.get_parameter_data(param, nd_idxs, is_training) - if NOISE_TRAINING and is_training: - nda = normalize(nda, param, mean_std_dct, add_noise=True, noise_scale=0.01, seed=42) - else: - nda = normalize(nda, param, mean_std_dct) + # Manual Corruption Process. Better: see use of tf.keras.layers.GaussianNoise + # if NOISE_TRAINING and is_training: + # nda = normalize(nda, param, mean_std_dct, add_noise=True, noise_scale=0.01, seed=42) + # else: + # nda = normalize(nda, param, mean_std_dct) + nda = normalize(nda, param, mean_std_dct) if DO_ZERO_OUT and is_training: try: zero_out_params.index(param) @@ -842,6 +845,8 @@ class IcingIntensityNN: f.close() def build_model(self): + if NOISE_TRAINING: + self.inputs[0] = tf.keras.layers.GaussianNoise(stddev=NOISE_STDDEV)(self.inputs[0]) flat = self.build_cnn() # flat_1d = self.build_1d_cnn() # flat = tf.keras.layers.concatenate([flat, flat_1d, flat_anc]) -- GitLab