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

snapshot...

parent 29f9e806
No related branches found
No related tags found
No related merge requests found
......@@ -70,18 +70,20 @@ N_X = N_Y = 1
LEN_X = LEN_Y = 128
if KERNEL_SIZE == 3:
slc_x = slice(2, N_X*LEN_X + 4)
slc_y = slice(2, N_Y*LEN_Y + 4)
slc_x_2 = slice(1, N_X*LEN_X + 6, 2)
slc_y_2 = slice(1, N_Y*LEN_Y + 6, 2)
slc_x_m = slice(1, int((N_X*LEN_X)/2) + 4)
slc_y_m = slice(1, int((N_Y*LEN_Y)/2) + 4)
slc_x = slice(3, N_X*LEN_X + 5)
slc_y = slice(3, N_Y*LEN_Y + 5)
slc_x_2 = slice(2, N_X*LEN_X + 7, 2)
slc_y_2 = slice(2, N_Y*LEN_Y + 7, 2)
x_2 = np.arange(int((N_X*LEN_X)/2) + 3)
y_2 = np.arange(int((N_Y*LEN_Y)/2) + 3)
t = np.arange(0, int((N_X*LEN_X)/2) + 3, 0.5)
s = np.arange(0, int((N_Y*LEN_Y)/2) + 3, 0.5)
x_k = slice(1, N_X*LEN_X + 3)
y_k = slice(1, N_Y*LEN_Y + 3)
x_128 = slice(3, N_X*LEN_X + 3)
y_128 = slice(3, N_Y*LEN_Y + 3)
x_128 = slice(4, N_X*LEN_X + 4)
y_128 = slice(4, N_Y*LEN_Y + 4)
elif KERNEL_SIZE == 5:
slc_x = slice(3, 135)
slc_y = slice(3, 135)
......@@ -120,7 +122,6 @@ def build_residual_conv2d_block(conv, num_filters, block_name, activation=tf.nn.
def upsample(tmp):
tmp = tmp[:, slc_y_2, slc_x_2]
tmp = resample_2d_linear(x_2, y_2, tmp, t, s)
tmp = tmp[:, y_k, x_k]
return tmp
......@@ -290,9 +291,10 @@ class SRCNN:
data_norm = []
for param in data_params_half:
idx = params_i.index(param)
tmp = input_label[:, idx, :, :]
idx = params.index(param)
tmp = input_data[:, idx, :, :]
tmp = np.where(np.isnan(tmp), 0, tmp)
tmp = tmp[:, slc_y_m, slc_x_m]
tmp = upsample(tmp)
tmp = normalize(tmp, param, mean_std_dct)
data_norm.append(tmp)
......@@ -302,23 +304,24 @@ class SRCNN:
tmp = input_label[:, idx, :, :]
tmp = np.where(np.isnan(tmp), 0, tmp)
lo, hi, std, avg = get_min_max_std(tmp)
lo = upsample_nearest(lo)
hi = upsample_nearest(hi)
avg = upsample_nearest(avg)
lo = normalize(lo, param, mean_std_dct)
hi = normalize(hi, param, mean_std_dct)
avg = normalize(avg, param, mean_std_dct)
# lo, hi, std, avg = get_min_max_std(tmp)
# lo = upsample_nearest(lo)
# hi = upsample_nearest(hi)
# avg = upsample_nearest(avg)
# lo = normalize(lo, param, mean_std_dct)
# hi = normalize(hi, param, mean_std_dct)
# avg = normalize(avg, param, mean_std_dct)
#
# data_norm.append(lo[:, slc_y, slc_x])
# data_norm.append(hi[:, slc_y, slc_x])
# data_norm.append(avg[:, slc_y, slc_x])
data_norm.append(lo[:, slc_y, slc_x])
data_norm.append(hi[:, slc_y, slc_x])
data_norm.append(avg[:, slc_y, slc_x])
# tmp = normalize(tmp, param, mean_std_dct)
# data_norm.append(tmp[:, slc_y, slc_x])
tmp = normalize(tmp, param, mean_std_dct)
data_norm.append(tmp[:, slc_y, slc_x])
# ---------------------------------------------------
tmp = input_label[:, label_idx_i, :, :]
tmp = np.where(np.isnan(tmp), 0, tmp)
tmp = tmp[:, slc_y_2, slc_x_2]
tmp = upsample(tmp)
data_norm.append(tmp)
# ---------
......
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