diff --git a/modules/deeplearning/espcn.py b/modules/deeplearning/espcn.py index b4dcc871423c729d88ffb00cded1d4caba296db2..f0b66dfc112fa7dff1fd743f07ea5072ba976e43 100644 --- a/modules/deeplearning/espcn.py +++ b/modules/deeplearning/espcn.py @@ -59,12 +59,12 @@ data_idx, label_idx = 1, 1 data_param = data_params[data_idx] label_param = label_params[label_idx] -x_70 = np.arange(70) -y_70 = np.arange(70) -#x_70_2 = x_70[3:67:2] -#y_70_2 = y_70[3:67:2] -x_70_2 = x_70[2:69:2] -y_70_2 = y_70[2:69:2] +x_134 = np.arange(134) +y_134 = np.arange(134) +#x_134_2 = x_134[3:131:2] +#y_134_2 = y_134[3:131:2] +x_134_2 = x_134[2:133:2] +y_134_2 = y_134[2:133:2] def build_residual_conv2d_block(conv, num_filters, block_name, activation=tf.nn.leaky_relu, padding='SAME'): @@ -202,11 +202,11 @@ class ESPCN: label = data.copy() data = data[:, data_idx, :, :] - data = resample(x_70, y_70, data, x_70_2, y_70_2) + data = resample(x_134, y_134, data, x_134_2, y_134_2) data = np.expand_dims(data, axis=3) # label = label[:, label_idx, :, :] - label = label[:, label_idx, 3:67:2, 3:67:2] + label = label[:, label_idx, 3:131:2, 3:131:2] # label = label[:, label_idx, 3:67, 3:67] label = np.expand_dims(label, axis=3) @@ -375,6 +375,7 @@ class ESPCN: print(conv.shape) #conv = tf.nn.depth_to_space(conv, factor) + conv = tf.keras.layers.Conv2DTranspose(num_filters * (factor ** 2), 3, padding='same')(conv) print(conv.shape) self.logits = tf.keras.layers.Conv2D(1, kernel_size=3, strides=1, padding=padding, name='regression')(conv) @@ -732,7 +733,7 @@ class ESPCN: def prepare(param_idx=1, filename='/Users/tomrink/data_valid_40.npy'): nda = np.load(filename) #nda = nda[:, param_idx, :, :] - nda_lr = nda[:, param_idx, 2:69:2, 2:69:2] + nda_lr = nda[:, param_idx, x_134_2, y_134_2] # nda_lr = resample(x_70, y_70, nda, x_70_2, y_70_2) nda_lr = np.expand_dims(nda_lr, axis=3) return nda_lr