|
2 | 2 | import numpy as np |
3 | 3 | import argparse |
4 | 4 | import os |
5 | | -import skimage.io as io |
6 | 5 | from matplotlib import pyplot as plt |
7 | 6 |
|
8 | 7 | import dataloader |
|
36 | 35 | else: |
37 | 36 | print('dataloader: {} exists'.format(arg.tfrecordspath)) |
38 | 37 |
|
39 | | -### Operations ### |
40 | | -# Make tfrecord filename queue |
41 | | -file_name_queue = tf.train.string_input_producer([arg.tfrecordspath]) |
42 | | -# Decode tfrecord file to usable numpy array |
43 | | -x_train , y_train = dataloader.decode(file_name_queue) |
44 | | - |
45 | 38 | sess = tf.Session('', tf.Graph()) |
46 | 39 | with sess.graph.as_default(): |
47 | 40 | # Read meta graph and checkpoint to restore tf session |
|
54 | 47 | threads.extend(qr.create_threads(sess, coord=coord, daemon=True, |
55 | 48 | start=True)) |
56 | 49 |
|
57 | | - g_result, f_result = sess.run(['deterministic_feed_op:0','latent_feed_op:0']) |
58 | | - g_image = g_result[3,:,:,6:9] |
59 | | - print(g_image.shape) |
60 | | - io.imshow(g_image) |
61 | | - plt.show() |
| 50 | + while(True): |
| 51 | + x_val,y_val,g_result, f_result = sess.run(['x_val:0','y_val:0','deterministic_feed_op:0','latent_feed_op:0']) |
| 52 | + |
| 53 | + ## Make Subplot |
| 54 | + fig=plt.figure(figsize=(8, 8)) |
| 55 | + rows = 4 |
| 56 | + columns = 5 |
| 57 | + index = 1 |
| 58 | + # x_val |
| 59 | + for i in range(columns): |
| 60 | + img = x_val[0,:,:,i*3:(i+1)*3] |
| 61 | + fig.add_subplot(rows, columns, index) |
| 62 | + plt.imshow(img) |
| 63 | + index = index + 1 |
| 64 | + |
| 65 | + for i in range(columns): |
| 66 | + img = y_val[0,:,:,i*3:(i+1)*3] |
| 67 | + fig.add_subplot(rows, columns, index) |
| 68 | + plt.imshow(img) |
| 69 | + index = index + 1 |
| 70 | + |
| 71 | + for i in range(columns): |
| 72 | + img = g_result[0,:,:,i*3:(i+1)*3] |
| 73 | + fig.add_subplot(rows, columns, index) |
| 74 | + plt.imshow(img) |
| 75 | + index = index + 1 |
62 | 76 |
|
| 77 | + for i in range(columns): |
| 78 | + img = f_result[0,:,:,i*3:(i+1)*3] |
| 79 | + fig.add_subplot(rows, columns, index) |
| 80 | + plt.imshow(img) |
| 81 | + index = index + 1 |
63 | 82 |
|
| 83 | + ## Show Image |
| 84 | + plt.show() |
64 | 85 |
|
0 commit comments