Skip to content
Snippets Groups Projects
Commit 11dd86e2 authored by tomrink's avatar tomrink
Browse files

test...

parent 5aec769d
No related branches found
No related tags found
No related merge requests found
import glob
import tensorflow as tf
from util.setup import logdir, modeldir, cachepath, now, ancillary_path
from util.util import EarlyStop, normalize, denormalize
from util.util import EarlyStop, normalize, denormalize, resample
import os, datetime
import numpy as np
import pickle
......@@ -59,6 +59,11 @@ 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]
def build_residual_conv2d_block(conv, num_filters, block_name, activation=tf.nn.leaky_relu, padding='SAME'):
......@@ -194,18 +199,15 @@ class ESPCN:
data = np.concatenate(label_s)
label = np.concatenate(label_s)
# label = label[:, label_idx, :, :]
#label = label[:, label_idx, 3:67, 3:67]
label = label[:, label_idx, 0:32, 0:32]
label = np.expand_dims(label, axis=3)
#label = tf.image.resize(label, (32, 32), method='nearest').numpy()
# data = data[:, data_idx, :, :]
data = data[:, data_idx, :, :]
#data = data[:, data_idx, 3:67, 3:67]
data = data[:, data_idx, 0:32, 0:32]
data = resample(x_70, y_70, data, x_70_2, y_70_2)
data = np.expand_dims(data, axis=3)
#data = tf.image.resize(data, (32, 32), method='nearest').numpy()
# data = tf.image.resize(data, (36, 36)).numpy()
# data = tf.image.resize(data, (32, 32)).numpy()
# label = label[:, label_idx, :, :]
label = label[:, label_idx, 3:67:2, 3:67:2]
label = np.expand_dims(label, axis=3)
data = data.astype(np.float32)
label = label.astype(np.float32)
......@@ -357,11 +359,11 @@ class ESPCN:
conv_b = build_residual_conv2d_block(conv_b, num_filters, 'Residual_Block_1')
# conv_b = build_residual_conv2d_block(conv_b, num_filters, 'Residual_Block_2')
#
# conv_b = build_residual_conv2d_block(conv_b, num_filters, 'Residual_Block_3')
#
# conv_b = build_residual_conv2d_block(conv_b, num_filters, 'Residual_Block_4')
conv_b = build_residual_conv2d_block(conv_b, num_filters, 'Residual_Block_2')
conv_b = build_residual_conv2d_block(conv_b, num_filters, 'Residual_Block_3')
conv_b = build_residual_conv2d_block(conv_b, num_filters, 'Residual_Block_4')
conv_b = tf.keras.layers.Conv2D(num_filters, kernel_size=3, strides=1, padding=padding)(conv_b)
......
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