Commit 25e0c1ec authored by Yipeng Hu's avatar Yipeng Hu

ref #2 path updated

parent 99471e70
......@@ -11,6 +11,10 @@ import os
os.environ["CUDA_VISIBLE_DEVICES"]="0"
path_to_data = '../../../promise12' # git clone -b promise12 --single-branch https://weisslab.cs.ucl.ac.uk/WEISSTeaching/datasets.git
path_to_save = './result'
### Define a few functions for network layers
def conv3d(input, filters, downsample=False, activation=True, batch_norm=False):
if downsample: strides = [1,2,2,2,1]
......@@ -200,7 +204,6 @@ learning_rate = 1e-5
total_iter = int(1e6)
n = 50 # 50 training image-label pairs
size_minibatch = 4
path_to_data = '../../../promise12' # git clone -b promise12 --single-branch https://weisslab.cs.ucl.ac.uk/WEISSTeaching/datasets.git
num_minibatch = int(n/size_minibatch) # how many minibatches in each epoch
indices_train = [i for i in range(n)]
......@@ -233,6 +236,6 @@ for step in range(total_iter):
pred_test = residual_unet(input_test)
# save the segmentation
for idx in range(size_minibatch):
np.save("./label_test%02d_step%06d.npy" % (indices_test[idx], step), pred_test[idx, ...])
np.save(os.path.join(path_to_save, "label_test%02d_step%06d.npy" % (indices_test[idx], step)), pred_test[idx, ...])
tf.print('Test results saved.')
import numpy as np
import os
import matplotlib.pyplot as plt
path_to_data = '../../../promise12'
path_to_save = './result'
# specify these to plot the results w.r.t. the images
step = 56000
idx_case = 24
idx_slice = 6
image = np.load(os.path.join(path_to_data, "image_test%02d.npy" % idx_case))[::2, ::2, ::2]
label = np.load(os.path.join(path_to_save, "label_test%02d_step%06d.npy" % (idx_case, step)))[..., 0]
print(label.shape)
plt.figure()
plt.imshow(image[idx_slice,:,:], cmap='gray')
plt.figure()
plt.imshow(label[idx_slice,:,:], cmap='gray')
plt.show()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment