Skip to content

Commit 382d374

Browse files
HaDavidHaDavid
HaDavid
authored and
HaDavid
committed
first commit
0 parents  commit 382d374

21 files changed

+2041
-0
lines changed

MNIST_data/t10k-images-idx3-ubyte.gz

1.57 MB
Binary file not shown.

MNIST_data/t10k-labels-idx1-ubyte.gz

4.44 KB
Binary file not shown.

MNIST_data/train-images-idx3-ubyte.gz

9.45 MB
Binary file not shown.

MNIST_data/train-labels-idx1-ubyte.gz

28.2 KB
Binary file not shown.

README.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# cppn-gan-vae tensorflow
2+
3+
Train [Compositional Pattern Producing Network](https://en.wikipedia.org/wiki/Compositional_pattern-producing_network) as a Generative Model, using Generative Adversarial Networks and Variational Autoencoder techniques to produce high resolution images.
4+
5+
![Morphing](https://cdn.rawgit.com/hardmaru/cppn-gan-vae-tensorflow/master/examples/output_linear.gif)
6+
7+
Run `python train.py` from the command line to train from scratch and experiment with different settings.
8+
9+
`sampler.py` can be used inside IPython to interactively see results from the models being trained.
10+
11+
See my blog post at [blog.otoro.net](http://blog.otoro.net/2016/04/01/generating-abstract-patterns-with-tensorflow/) for more details.
12+
13+
I tested the implementation on TensorFlow 0.60.
14+
15+
Used images2gif.py written by Almar Klein, Ant1, Marius van Voorden.
16+
17+
# License
18+
19+
BSD - images2gif.py
20+
21+
MIT - everything else

anim_gif_demo.py

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
'''
2+
generate cool animation morphing effect for all digits
3+
sampler is assumed to be an instance of Sampler()
4+
'''
5+
6+
def create_z_array():
7+
z_array = []
8+
for i in range(10):
9+
z_array.append(sampler.encode(sampler.get_random_specific_mnist(i)))
10+
sampler.show_image_from_z(z_array[i])
11+
return z_array
12+
13+
def make_img_data_array(z_array_input, sinusoid = True, fps=24, x_dim = 1080, y_dim = 1080):
14+
z_array = list(z_array_input)
15+
n = len(z_array)
16+
data = []
17+
for i in range(n-1):
18+
print "Morphing Image #", i
19+
sampler.show_image_from_z(z_array[i])
20+
data.append(sampler.morph(z_array[i], z_array[i+1], fps, sinusoid = sinusoid, x_dim = x_dim, y_dim = y_dim))
21+
sampler.show_image_from_z(z_array[n-1])
22+
data.append(sampler.morph(z_array[n-1], z_array[0], fps, sinusoid = sinusoid, x_dim = x_dim, y_dim = y_dim))
23+
return data
24+
25+
def write_data_array_as_gif(data_array, filename, fps = 24):
26+
result = []
27+
for i in range(len(data_array)):
28+
result = result + data_array[i]
29+
sampler.save_anim_gif(result, filename, 1.0 / float(fps))
30+

examples/.DS_Store

6 KB
Binary file not shown.

examples/demo.mp4

2.25 MB
Binary file not shown.

examples/demo.webm

2.85 MB
Binary file not shown.

examples/output_linear.gif

5.82 MB
Loading

examples/output_sinusoid.gif

5.77 MB
Loading

0 commit comments

Comments
 (0)