[来源关键摘录] 确认三位作者的 NVIDIA 归属,提供实现和模型,并说明主要材料采用 CC BY-NC 4.0 许可。
[正文前段节选] Skip to content
Navigation Menu
Appearance settings
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
Repository navigation
NotificationsYou must be signed in to change notification settings
Fork3.1k (3.1k)
Star14.4k (14.4k)You must be signed in to star a repository
StyleGAN - Official TensorFlow Implementation
arxiv.org/abs/1812.04948
Custom properties
444 watching
Report repository
BranchesTags
Open more actions menu
Latest commit
Folders and files
Last commit message
Last commit date
dataset_tool.py
generate_figures.py
pretrained_example.py
run_metrics.py
stylegan-teaser.png
View all files
Repository files navigation
StyleGAN — Official TensorFlow Implementation
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
Tero Karras (NVIDIA), Samuli Laine (NVIDIA), Timo Aila (NVIDIA)
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 ★★★
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:
Main folder.
├ stylegan-paper.pdf
High-quality version of the paper PDF.
├ stylegan-video.mp4
High-quality version of the result video.
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.
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.
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.
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.
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. The script reproduces the figures from our paper in order to illustrate style mixing, noise inputs, and truncation:
> python generate_figures.py
results/figure02-uncurated-ffhq.png # https://drive.google.com/uc?id=1U3r1xgcD7o-Fd0SBRpq8PXYajm7_30cu
results/figure03-style-mixing.png # https://drive.google.com/uc?id=1U-nlMDtpnf1RcYkaFQtbh5oxnhA97hy6
results/figure04-noise-detail.png # https://drive.google.com/uc?id=1UX3m39u_DTU6eLnEW6MqGzbwPFt2R9cG
results/figure05-noise-components.png # https://drive.google.com/uc?id=1UQKPcvYVeWMRccGMbs2pPD9PVv1QDyp_
results/figure08-truncation-trick.png # https://drive.google.com/uc?id=1ULea0C12zGlxdDQFNLXOWZCHi3QNfk_v
results/figure10-uncurated-bedrooms.png # https://drive.google.com/uc?id=1UEBnms1XMfj78OHj3_cx80mUf_m9DUJr
results/figure11-uncurated-cars.png # https://drive.google.com/uc?id=1UO-4JtAs64Kun5vIj10UXqAJ1d5Ir1Ke
results/figure12-uncurated-cats.png # https://drive.google.com/uc?id=1USnJc14prlu3QAYxstrtlfXC9sDWPA-W
The pre-trained networks are stored as standard pickle files on Google Drive:
# Load pre-trained network.
[...内容已截断,完整版请查看原文或 Wayback 快照]