gitmyhub

stylegan2

Python ★ 11k updated 2y ago

StyleGAN2 - Official TensorFlow Implementation

NVIDIA Research's AI model that generates photorealistic images of faces, cars, and animals from scratch, and can blend the visual style of two generated images together.

PythonTensorFlow 1.14CUDADockersetup: hardcomplexity 5/5

StyleGAN2 is NVIDIA Research's official code release for a model that generates photorealistic images from scratch. The model is a generative adversarial network, a type of AI system trained to produce new images that look indistinguishable from real photographs. StyleGAN2 was released alongside a research paper that identified quality problems in the original StyleGAN model and proposed fixes for them.

The code comes with pre-trained models for several categories: human faces (at 1024x1024 pixel resolution), cars, cats, churches, and horses. To generate new images, you point the code at one of those pre-trained model files and run a command that produces a batch of PNG images. A truncation setting controls the trade-off between variety and quality in the output.

One notable capability is style mixing, where the visual characteristics of two different generated images can be blended together at varying degrees. This lets you combine, for example, the hair and pose of one generated face with the skin tone and age of another. The paper also notes that this version is significantly easier to invert, meaning you can detect whether a given image was produced by the model.

Running this code requires a high-end NVIDIA graphics card with at least 16 gigabytes of memory, along with the CUDA toolkit and TensorFlow 1.14 or 1.15. TensorFlow 2 is not supported. The README recommends Linux, though Windows is also possible with some extra setup. A Docker configuration is included for those who prefer containers.

A newer successor called StyleGAN2-ADA-PyTorch is noted in the README and available separately. This repository uses a custom NVIDIA license that permits non-commercial research use.

Where it fits