SkillAgentSearch skills...

Stylegan

StyleGAN - Official TensorFlow Implementation

Install / Use

/learn @NVlabs/Stylegan
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

StyleGAN — Official TensorFlow Implementation

Python 3.6 TensorFlow 1.10 cuDNN 7.3.1 License CC BY-NC

Teaser image Picture: These people are not real – they were produced by our generator that allows control over different aspects of the image.

This repository contains the official TensorFlow implementation of the following paper:

A Style-Based Generator Architecture for Generative Adversarial Networks<br> Tero Karras (NVIDIA), Samuli Laine (NVIDIA), Timo Aila (NVIDIA)<br> https://arxiv.org/abs/1812.04948

Abstract: We propose an alternative generator architecture for generative adversarial networks, borrowing from style transfer literature. The new architecture leads to an automatically learned, unsupervised separation of high-level attributes (e.g., pose and identity when trained on human faces) and stochastic variation in the generated images (e.g., freckles, hair), and it enables intuitive, scale-specific control of the synthesis. The new generator improves the state-of-the-art in terms of traditional distribution quality metrics, leads to demonstrably better interpolation properties, and also better disentangles the latent factors of variation. To quantify interpolation quality and disentanglement, we propose two new, automated methods that are applicable to any generator architecture. Finally, we introduce a new, highly varied and high-quality dataset of human faces.

For business inquiries, please visit our website and submit the form: NVIDIA Research Licensing

★★★ NEW: StyleGAN2-ADA-PyTorch is now available; see the full list of versions here ★★★

Resources

Material related to our paper is available via the following links:

  • Paper: https://arxiv.org/abs/1812.04948
  • Video: https://youtu.be/kSLJriaOumA
  • Code: https://github.com/NVlabs/stylegan
  • FFHQ: https://github.com/NVlabs/ffhq-dataset

Additional material can be found on Google Drive:

| Path | Description | :--- | :---------- | StyleGAN | Main folder. | ├  stylegan-paper.pdf | High-quality version of the paper PDF. | ├  stylegan-video.mp4 | High-quality version of the result video. | ├  images | Example images produced using our generator. | │  ├  representative-images | High-quality images to be used in articles, blog posts, etc. | │  └  100k-generated-images | 100,000 generated images for different amounts of truncation. | │     ├  ffhq-1024x1024 | Generated using Flickr-Faces-HQ dataset at 1024×1024. | │     ├  bedrooms-256x256 | Generated using LSUN Bedroom dataset at 256×256. | │     ├  cars-512x384 | Generated using LSUN Car dataset at 512×384. | │     └  cats-256x256 | Generated using LSUN Cat dataset at 256×256. | ├  videos | Example videos produced using our generator. | │  └  high-quality-video-clips | Individual segments of the result video as high-quality MP4. | ├  ffhq-dataset | Raw data for the Flickr-Faces-HQ dataset. | └  networks | Pre-trained networks as pickled instances of dnnlib.tflib.Network. |    ├  stylegan-ffhq-1024x1024.pkl | StyleGAN trained with Flickr-Faces-HQ dataset at 1024×1024. |    ├  stylegan-celebahq-1024x1024.pkl | StyleGAN trained with CelebA-HQ dataset at 1024×1024. |    ├  stylegan-bedrooms-256x256.pkl | StyleGAN trained with LSUN Bedroom dataset at 256×256. |    ├  stylegan-cars-512x384.pkl | StyleGAN trained with LSUN Car dataset at 512×384. |    ├  stylegan-cats-256x256.pkl | StyleGAN trained with LSUN Cat dataset at 256×256. |    └  metrics | Auxiliary networks for the quality and disentanglement metrics. |       ├  inception_v3_features.pkl | Standard Inception-v3 classifier that outputs a raw feature vector. |       ├  vgg16_zhang_perceptual.pkl | Standard LPIPS metric to estimate perceptual similarity. |       ├  celebahq-classifier-00-male.pkl | Binary classifier trained to detect a single attribute of CelebA-HQ. |       └ ⋯ | Please see the file listing for remaining networks.

Licenses

All material, excluding the Flickr-Faces-HQ dataset, is made available under Creative Commons BY-NC 4.0 license by NVIDIA Corporation. You can use, redistribute, and adapt the material for non-commercial purposes, as long as you give appropriate credit by citing our paper and indicating any changes that you've made.

For license information regarding the FFHQ dataset, please refer to the Flickr-Faces-HQ repository.

inception_v3_features.pkl and inception_v3_softmax.pkl are derived from the pre-trained Inception-v3 network by Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jonathon Shlens, and Zbigniew Wojna. The network was originally shared under Apache 2.0 license on the TensorFlow Models repository.

vgg16.pkl and vgg16_zhang_perceptual.pkl are derived from the pre-trained VGG-16 network by Karen Simonyan and Andrew Zisserman. The network was originally shared under Creative Commons BY 4.0 license on the Very Deep Convolutional Networks for Large-Scale Visual Recognition project page.

vgg16_zhang_perceptual.pkl is further derived from the pre-trained LPIPS weights by Richard Zhang, Phillip Isola, Alexei A. Efros, Eli Shechtman, and Oliver Wang. The weights were originally shared under BSD 2-Clause "Simplified" License on the PerceptualSimilarity repository.

System requirements

  • Both Linux and Windows are supported, but we strongly recommend Linux for performance and compatibility reasons.
  • 64-bit Python 3.6 installation. We recommend Anaconda3 with numpy 1.14.3 or newer.
  • TensorFlow 1.10.0 or newer with GPU support.
  • One or more high-end NVIDIA GPUs with at least 11GB of DRAM. We recommend NVIDIA DGX-1 with 8 Tesla V100 GPUs.
  • NVIDIA driver 391.35 or newer, CUDA toolkit 9.0 or newer, cuDNN 7.3.1 or newer.

Using pre-trained networks

A minimal example of using a pre-trained StyleGAN generator is given in pretrained_example.py. When executed, the script downloads a pre-trained StyleGAN generator from Google Drive and uses it to generate an image:

> python pretrained_example.py
Downloading https://drive.google.com/uc?id=1MEGjdvVpUsu1jB4zrXZN7Y4kBBOzizDQ .... done

Gs                              Params    OutputShape          WeightShape
---                             ---       ---                  ---
latents_in                      -         (?, 512)             -
...
images_out                      -         (?, 3, 1024, 1024)   -
---                             ---       ---                  ---
Total                           26219627

> ls results
example.png # https://drive.google.com/uc?id=1UDLT_zb-rof9kKH0GwiJW_bS9MoZi8oP

A more advanced example is given in [generate_figures.py](./generate_figures.py

Related Skills

View on GitHub
GitHub Stars14.4k
CategoryDevelopment
Updated18h ago
Forks3.2k

Languages

Python

Security Score

80/100

Audited on Apr 6, 2026

No findings