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

snapshot...

parent 8cad6ef4
No related branches found
No related tags found
No related merge requests found
...@@ -72,6 +72,8 @@ y_134_2 = y_134[2:133:2] ...@@ -72,6 +72,8 @@ y_134_2 = y_134[2:133:2]
slc_x = slice(3, 131) slc_x = slice(3, 131)
slc_y = slice(3, 131) slc_y = slice(3, 131)
slc_x_2 = slice(3, 131, 2)
slc_y_2 = slice(3, 131, 2)
def build_residual_conv2d_block(conv, num_filters, block_name, activation=tf.nn.leaky_relu, padding='SAME', scale=None): def build_residual_conv2d_block(conv, num_filters, block_name, activation=tf.nn.leaky_relu, padding='SAME', scale=None):
...@@ -214,17 +216,19 @@ class ESPCN: ...@@ -214,17 +216,19 @@ class ESPCN:
data_norm = [] data_norm = []
for k, param in enumerate(data_params): for k, param in enumerate(data_params):
tmp = input_data[:, k, :, :] # tmp = input_data[:, k, :, :]
tmp = input_data[:, k, slc_y_2, slc_x_2]
tmp = normalize(tmp, param, mean_std_dct, add_noise=add_noise, noise_scale=noise_scale) tmp = normalize(tmp, param, mean_std_dct, add_noise=add_noise, noise_scale=noise_scale)
tmp = resample_2d_linear(x_134, y_134, tmp, x_134_2, y_134_2) # tmp = resample_2d_linear(x_134, y_134, tmp, x_134_2, y_134_2)
data_norm.append(tmp) data_norm.append(tmp)
tmp = input_data[:, label_idx, :, ] # tmp = input_data[:, label_idx, :, ]
tmp = input_data[:, label_idx, slc_y_2, slc_x_2]
if label_param != 'cloud_fraction': if label_param != 'cloud_fraction':
tmp = normalize(tmp, label_param, mean_std_dct, add_noise=add_noise, noise_scale=noise_scale) tmp = normalize(tmp, label_param, mean_std_dct, add_noise=add_noise, noise_scale=noise_scale)
else: else:
tmp = np.where(np.isnan(tmp), 0, tmp) tmp = np.where(np.isnan(tmp), 0, tmp)
tmp = resample_2d_linear(x_134, y_134, tmp, x_134_2, y_134_2) # tmp = resample_2d_linear(x_134, y_134, tmp, x_134_2, y_134_2)
data_norm.append(tmp) data_norm.append(tmp)
data = np.stack(data_norm, axis=3) data = np.stack(data_norm, axis=3)
...@@ -336,7 +340,6 @@ class ESPCN: ...@@ -336,7 +340,6 @@ class ESPCN:
print('num test samples: ', tst_idxs.shape[0]) print('num test samples: ', tst_idxs.shape[0])
print('setup_pipeline: Done') print('setup_pipeline: Done')
def setup_test_pipeline(self, test_data_files): def setup_test_pipeline(self, test_data_files):
self.test_data_files = test_data_files self.test_data_files = test_data_files
tst_idxs = np.arange(len(test_data_files)) tst_idxs = np.arange(len(test_data_files))
...@@ -389,7 +392,7 @@ class ESPCN: ...@@ -389,7 +392,7 @@ class ESPCN:
conv = conv_b conv = conv_b
print(conv.shape) print(conv.shape)
conv = tf.keras.layers.Conv2D(IMG_DEPTH * (factor ** 2), 3, padding='same')(conv) conv = tf.keras.layers.Conv2D(IMG_DEPTH * (factor ** 2), 3, padding='same', activation=activation)(conv)
print(conv.shape) print(conv.shape)
conv = tf.nn.depth_to_space(conv, factor) conv = tf.nn.depth_to_space(conv, factor)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment