jeudi 26 novembre 2020

Getting Smoothly Animated GAN Output

I am working on a TensorFlow GAN that generates abstract art, and I'm hoping to pass in a set of inputs to produce a smooth output animation. I started with the following code to do so:

import tensorflow as tf

# Create a noise vector by sampling a normal distribution
noise_vec = tf.random.normal([100,1])

for i in range(frames):
     tf.concat([noise_vec, [noise_vec[-1]] + 0.1*tf.random.normal([100,1])], 0)

generated_frames = Generator(noise_vec)

As expected, making slight variations to the generator's input produces slight variations in its output, so the frames start out with smooth changes. However, since variance is additive between random variables, the values in the noise vector become more and more extreme for later frames. Since the network was only trained on a single tf.random.normal sampling, it ends up producing ugly results. Is there any way to randomly "step" the noise vector through an animation while keeping values within the range that the generator expects?




Aucun commentaire:

Enregistrer un commentaire