forked from david-gpu/srez
-
Notifications
You must be signed in to change notification settings - Fork 1
/
srez_demo.py
29 lines (23 loc) · 850 Bytes
/
srez_demo.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
import moviepy.editor as mpe
import numpy as np
import numpy.random
import os.path
import scipy.misc
import tensorflow as tf
FLAGS = tf.app.flags.FLAGS
def demo1(sess):
"""Demo based on images dumped during training"""
#print('train_dir={}'.format(FLAGS.train_dir))
# Get images that were dumped during training
filenames = tf.gfile.ListDirectory(FLAGS.train_dir)
filenames = sorted(filenames)
#print('filenames={}'.format(filenames))
filenames = [os.path.join(FLAGS.train_dir, f) for f in filenames if f[-4:]=='.png']
assert len(filenames) >= 1
fps = 30
# Create video file from PNGs
print("Producing video file...")
filename = os.path.join(FLAGS.train_dir, 'demo1.mp4')
clip = mpe.ImageSequenceClip(filenames, fps=fps)
clip.write_videofile(filename)
print("Done!")