예제 #1
0
 def test(self):
     mnist = input_data.read_data_sets('MNIST_data', one_hot=True)
     test_results = self.out_image.eval(
         feed_dict={
             self.x: mnist.test.images,
             self.y_: mnist.test.labels,
             self.keep_prob: 1.0
         })
     combined_images = np.zeros(
         (0, 56))  # Empty array of 'correct' dimensions for concatenation
     for i in range(10):
         test_image = np.array(test_results[i]).reshape((28, 28))
         test_image = self.post_process(test_image)
         actual_image = np.array(mnist.test.images[i]).reshape(
             (28, 28)) * 255
         actual_image = np.rot90(actual_image)
         # Stack output image with actual horizontally, for comparison
         image_column = np.hstack((test_image, actual_image))
         combined_images = np.vstack((combined_images, image_column))
     Preprocessor.displayImage(combined_images)
예제 #2
0
preprocessing.displayImage(post_process(batch[0][0]))
#print(batch[1][0])


m = re.match(r"^\D+(\d+)$", "model.ckpt-120")
print(int(m.group(1)))

datasetName = "datasets/" + "offices"
mat_database = datasetName + ".mat"
#mat_contents = h5py.File(mat_database, 'r')
mat = scipy.io.loadmat(mat_database)
image = mat["collection"][0,0]['image']
depths = mat["collection"][0,0]['depths']
print(len(mat["collection"][0]))
print(image.shape)
Preprocessor.displayImage(np.rot90(image))
Preprocessor.displayImage(depths)
#print(mat["ans"])

image = np.zeros((32,32))
scim.imsave("test_output/debug" + str(15).zfill(4) + ".bmp", image)

# Get number of images in 'offices'
prefix = 'home_office'
mat_files = glob.glob("datasets/" + prefix + "*.pkl")
first  = True # Don't load old (non-existent) network when training on the first chunk!
pp = Preprocessor() # Dummy pp
sum_sizes = 0
for filename in mat_files:
    # Get the actual name of the chunk
    regex = r"^.*/(" + prefix +".*)\.pkl$"