wahaha commited on
Commit
f3cf058
1 Parent(s): 445332a
Files changed (1) hide show
  1. test1.py +6 -4
test1.py CHANGED
@@ -13,9 +13,6 @@ class ImportGraph:
13
  self.graph = tf.Graph()
14
  self.sess = tf.Session(graph=self.graph, config=tf.ConfigProto(allow_soft_placement=True, gpu_options=tf.GPUOptions(allow_growth=True)))
15
  with self.graph.as_default():
16
- test_real = tf.placeholder(tf.float32, [1, None, None, 3], name='test')
17
- with tf.variable_scope("generator", reuse=True):
18
- self.test_generated = generator.G_net(test_real).fake
19
  saver = tf.train.Saver()
20
 
21
  ckpt = tf.train.get_checkpoint_state(checkpoint_dir) # checkpoint file information
@@ -32,7 +29,12 @@ class ImportGraph:
32
 
33
  sample_image = np.asarray(load_test_data(sample_file, img_size))
34
  image_path = os.path.join(result_dir, '{0}'.format(os.path.basename(sample_file)))
35
- fake_img = self.sess.run(self.test_generated, feed_dict={test_real: sample_image})
 
 
 
 
 
36
  if if_adjust_brightness:
37
  save_images(fake_img, image_path, sample_file)
38
  else:
 
13
  self.graph = tf.Graph()
14
  self.sess = tf.Session(graph=self.graph, config=tf.ConfigProto(allow_soft_placement=True, gpu_options=tf.GPUOptions(allow_growth=True)))
15
  with self.graph.as_default():
 
 
 
16
  saver = tf.train.Saver()
17
 
18
  ckpt = tf.train.get_checkpoint_state(checkpoint_dir) # checkpoint file information
 
29
 
30
  sample_image = np.asarray(load_test_data(sample_file, img_size))
31
  image_path = os.path.join(result_dir, '{0}'.format(os.path.basename(sample_file)))
32
+
33
+ test_real = tf.placeholder(tf.float32, [1, None, None, 3], name='test')
34
+ with tf.variable_scope("generator", reuse=False):
35
+ test_generated = generator.G_net(test_real).fake
36
+
37
+ fake_img = self.sess.run(test_generated, feed_dict={test_real: sample_image})
38
  if if_adjust_brightness:
39
  save_images(fake_img, image_path, sample_file)
40
  else: