Create README.md
Browse files
README.md
CHANGED
|
@@ -1,91 +0,0 @@
|
|
| 1 |
-
## The GAN is dead; long live the GAN! A Modern Baseline GAN (R3GAN)<br><sub>Official PyTorch implementation of the NeurIPS 2024 paper</sub>
|
| 2 |
-
|
| 3 |
-

|
| 4 |
-
|
| 5 |
-
**The GAN is dead; long live the GAN! A Modern Baseline GAN**<br>
|
| 6 |
-
Nick Huang, [Aaron Gokaslan](https://skylion007.github.io/), [Volodymyr Kuleshov](https://www.cs.cornell.edu/~kuleshov/), [James Tompkin](https://www.jamestompkin.com)
|
| 7 |
-
|
| 8 |
-
OpenReview: https://openreview.net/forum?id=OrtN9hPP7V
|
| 9 |
-
|
| 10 |
-
arXiv: https://arxiv.org/abs/2501.05441
|
| 11 |
-
|
| 12 |
-
HuggingFace: https://huggingface.co/papers/2501.05441
|
| 13 |
-
|
| 14 |
-
<br>
|
| 15 |
-
Abstract: There is a widely-spread claim that GANs are difficult to train, and GAN architectures in the literature are littered with empirical tricks. We provide evidence against this claim and build a modern GAN baseline in a more principled manner. First, we derive a well-behaved regularized relativistic GAN loss that addresses issues of mode dropping and non-convergence that were previously tackled via a bag of ad-hoc tricks. We analyze our loss mathematically and prove that it admits local convergence guarantees, unlike most existing relativistic losses. Second, this loss allows us to discard all ad-hoc tricks and replace outdated backbones used in common GANs with modern architectures. Using StyleGAN2 as an example, we present a roadmap of simplification and modernization that results in a new minimalist baseline. Despite being simple, our approach surpasses StyleGAN2 on FFHQ, ImageNet, CIFAR, and Stacked MNIST datasets, and compares favorably against state-of-the-art GANs and diffusion models.
|
| 16 |
-
|
| 17 |
-
## Requirements
|
| 18 |
-
|
| 19 |
-
Our code requires the same packages as the official StyleGAN3 repo. However, we have updated the code so it is compatible with the latest version of the required packages (including PyTorch, etc).
|
| 20 |
-
|
| 21 |
-
## Getting started
|
| 22 |
-
To generate images using a given model, run:
|
| 23 |
-
|
| 24 |
-
```
|
| 25 |
-
# Generate 8 images using pre-trained FFHQ 256x256 model
|
| 26 |
-
gen_images.py --seeds=0-7 --outdir=out --network=ffhq-256x256.pkl
|
| 27 |
-
|
| 28 |
-
# Generate 64 airplane images using pre-trained CIFAR10 model
|
| 29 |
-
gen_images.py --seeds=0-63 --outdir=out --class=0 --network=cifar10.pkl
|
| 30 |
-
```
|
| 31 |
-
|
| 32 |
-
To reproduce the main results from our paper, run the following commands:
|
| 33 |
-
|
| 34 |
-
```
|
| 35 |
-
# CIFAR10
|
| 36 |
-
python train.py --outdir=./training-runs --data=./datasets/cifar10.zip --gpus=8 --batch=512 --mirror=1 --aug=1 --cond=1 --preset=CIFAR10 --tick=1 --snap=200
|
| 37 |
-
|
| 38 |
-
# FFHQ 64x64
|
| 39 |
-
python train.py --outdir=./training-runs --data=./datasets/ffhq-64x64.zip --gpus=8 --batch=256 --mirror=1 --aug=1 --preset=FFHQ-64 --tick=1 --snap=200
|
| 40 |
-
|
| 41 |
-
# FFHQ 256x256
|
| 42 |
-
python train.py --outdir=./training-runs --data=./datasets/ffhq-256x256.zip --gpus=8 --batch=256 --mirror=1 --aug=1 --preset=FFHQ-256 --tick=1 --snap=200
|
| 43 |
-
|
| 44 |
-
# ImageNet 32x32
|
| 45 |
-
python train.py --outdir=./training-runs --data=./datasets/imagenet-32x32.zip --gpus=32 --batch=4096 --mirror=1 --aug=1 --cond=1 --preset=ImageNet-32 --tick=1 --snap=200
|
| 46 |
-
|
| 47 |
-
# Imagenet 64x64
|
| 48 |
-
python train.py --outdir=./training-runs --data=./datasets/imagenet-64x64.zip --gpus=64 --batch=4096 --mirror=1 --aug=1 --cond=1 --preset=ImageNet-64 --tick=1 --snap=200
|
| 49 |
-
```
|
| 50 |
-
|
| 51 |
-
The easiest way to explore different training settings is to modify [`train.py`](./train.py) directly.
|
| 52 |
-
|
| 53 |
-
## Pre-trained models
|
| 54 |
-
|
| 55 |
-
We provide pre-trained models for our proposed training configuration (config E) on each dataset:
|
| 56 |
-
|
| 57 |
-
- [https://huggingface.co/brownvc/R3GAN-CIFAR10](https://huggingface.co/brownvc/R3GAN-CIFAR10)
|
| 58 |
-
- [https://huggingface.co/brownvc/R3GAN-FFHQ-64x64](https://huggingface.co/brownvc/R3GAN-FFHQ-64x64)
|
| 59 |
-
- [https://huggingface.co/brownvc/R3GAN-FFHQ-256x256](https://huggingface.co/brownvc/R3GAN-FFHQ-256x256)
|
| 60 |
-
- [https://huggingface.co/brownvc/R3GAN-ImgNet-32x32](https://huggingface.co/brownvc/R3GAN-ImgNet-32x32)
|
| 61 |
-
- [https://huggingface.co/brownvc/R3GAN-ImgNet-64x64](https://huggingface.co/brownvc/R3GAN-ImgNet-64x64)
|
| 62 |
-
|
| 63 |
-
## Preparing datasets
|
| 64 |
-
We use the same dataset format and dataset preprocessing tool as StyleGAN3 and EDM, refer to their repos for more details.
|
| 65 |
-
|
| 66 |
-
## Quality metrics
|
| 67 |
-
We support the following metrics:
|
| 68 |
-
|
| 69 |
-
* `fid50k_full`: Fréchet inception distance against the full dataset.
|
| 70 |
-
* `kid50k_full`: Kernel inception distance against the full dataset.
|
| 71 |
-
* `pr50k3_full`: Precision and recall against the full dataset.
|
| 72 |
-
* `is50k`: Inception score for CIFAR-10.
|
| 73 |
-
|
| 74 |
-
Refer to the StyleGAN3 code base for more details.
|
| 75 |
-
|
| 76 |
-
## Citation
|
| 77 |
-
|
| 78 |
-
```
|
| 79 |
-
@inproceedings{
|
| 80 |
-
huang2024the,
|
| 81 |
-
title={The {GAN} is dead; long live the {GAN}! A Modern {GAN} Baseline},
|
| 82 |
-
author={Nick Huang and Aaron Gokaslan and Volodymyr Kuleshov and James Tompkin},
|
| 83 |
-
booktitle={The Thirty-eighth Annual Conference on Neural Information Processing Systems},
|
| 84 |
-
year={2024},
|
| 85 |
-
url={https://openreview.net/forum?id=OrtN9hPP7V}
|
| 86 |
-
}
|
| 87 |
-
```
|
| 88 |
-
|
| 89 |
-
## Acknowledgements
|
| 90 |
-
|
| 91 |
-
The authors thank Xinjie Jayden Yi for contributing to the proof and Yu Cheng for helpful discussion. For compute, the authors thank Databricks Mosaic Research. Nick Huang was supported by a Brown University Division of Research Seed Award, and James Tompkin was supported by NSF CAREER 2144956. Volodymyr Kuleshov was supported by NSF CAREER 2145577 and NIH MIRA 1R35GM15124301.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|