forked from MarvinTeichmann/tensorflow-fcn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_fcn32_vgg.py
executable file
·39 lines (27 loc) · 944 Bytes
/
test_fcn32_vgg.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python
import os
import scipy as scp
import scipy.misc
import numpy as np
import tensorflow as tf
import fcn32_vgg
import utils
from tensorflow.python.framework import ops
img1 = scp.misc.imread("./test_data/tabby_cat.png")
with tf.Session() as sess:
images = tf.placeholder("float")
feed_dict = {images: img1}
batch_images = tf.expand_dims(images, 0)
vgg_fcn = fcn32_vgg.FCN32VGG()
with tf.name_scope("content_vgg"):
vgg_fcn.build(batch_images, debug=True)
print('Finished building Network.')
init = tf.global_variables_initializer()
sess.run(init)
print('Running the Network')
tensors = [vgg_fcn.pred, vgg_fcn.pred_up]
down, up = sess.run(tensors, feed_dict=feed_dict)
down_color = utils.color_image(down[0])
up_color = utils.color_image(up[0])
scp.misc.imsave('fcn32_downsampled.png', down_color)
scp.misc.imsave('fcn32_upsampled.png', up_color)