Skip to content

rosasalberto/StyleGAN2-TensorFlow-2.x

Repository files navigation

StyleGAN2-TensorFlow-2.x

Unofficial implementation of StyleGAN2 config-f using TensorFlow 2.x.

Official paper from Nvidia: https://arxiv.org/abs/1912.04958
Official repo using TensorFlow 1.x: https://github.com/NVlabs/stylegan2

Stylegan2 random walk in latent space

Extra features

  • Support for TensorFlow custom operations
  • Support for CPU usage

The Conv2D op currently does not support grouped convolutions on the CPU. In consequence, when running with CPU, batch size should be 1.

Download network parameters to weights folder manually https://drive.google.com/drive/folders/1rhuvN90EGsRhvjQq5gio8VYw7f0LojaK?usp=sharing, or simpy run download.py script located in weights folder.

# Create stylegan2 architecture (generator and discriminator) using cuda operations.
model = StyleGan2(resolution, impl='cuda', gpu=True)

# Load stylegan2 'ffhq' (generator and discriminator) using tensorflow operations.
model = StyleGan2(weights='ffhq', impl='ref', gpu=True)

# Load stylegan2 'horse' (generator and discriminator) using tensorflow operations in cpu.
model = StyleGan2(weights='horse', impl='ref', gpu=False)

# Load only generator network with 'car' weights
generator = StyleGan2Generator(weights='car', impl, gpu)

Examples on how to create, load and run the networks can be found in example_how_to_use notebook.
Examples on how to make a random walk in the latent vector and generate a gif, can be found in example_latent_changes notebook.

Training loop and metrics has not been implemented yet. Stay tuned.

About

Unofficial implementation of StyleGAN2 using TensorFlow 2.x.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages