Skip to content

Commit 8bb407c

Browse files
committed
Successful Visualizer
1 parent cff52bf commit 8bb407c

File tree

2 files changed

+35
-12
lines changed

2 files changed

+35
-12
lines changed

train_een_latent.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@
130130
file_name_queue = tf.train.string_input_producer([arg.tfrecordspath])
131131
# Decode tfrecord file to usable numpy array
132132
x_train , y_train = dataloader.decode(file_name_queue)
133+
x_val = tf.identity(x_train,'x_val')
134+
y_val = tf.identity(y_train,'y_val')
133135
# Create Latent Implemented Model
134136
model = models.LatentResidualModel3Layer(x_train,y_train,g_weights,f_weights,g_biases,f_biases,phi_weights,phi_biases)
135137
# Feeding Operation

visualize.py

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import numpy as np
33
import argparse
44
import os
5-
import skimage.io as io
65
from matplotlib import pyplot as plt
76

87
import dataloader
@@ -36,12 +35,6 @@
3635
else:
3736
print('dataloader: {} exists'.format(arg.tfrecordspath))
3837

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-
4538
sess = tf.Session('', tf.Graph())
4639
with sess.graph.as_default():
4740
# Read meta graph and checkpoint to restore tf session
@@ -54,11 +47,39 @@
5447
threads.extend(qr.create_threads(sess, coord=coord, daemon=True,
5548
start=True))
5649

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
6276

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
6382

83+
## Show Image
84+
plt.show()
6485

0 commit comments

Comments
 (0)