Skip to content
/ glead Public

[CVPR 2023] GLeaD: Improving GANs with A Generator-Leading Task

Notifications You must be signed in to change notification settings

EzioBy/glead

Repository files navigation

GLeaD: Improving GANs with A Generator-Leading Task

GLeaD: Improving GANs with A Generator-Leading Task
Qingyan Bai, Ceyuan Yang, Yinghao Xu, Xihui liu, Yujiu Yang, Yujun Shen
Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) 2023

Figure: Concept diagram of our proposed generator-leading task (bottom), as complementary to the discriminator-leading task in the original formulation of GANs (upper). D is required to extract representative features that can be adequately decoded by G to reconstruct the input.

[Paper] [Project Page]

This work aims at improving Generative adversarial network (GAN) with a generator-leading task. GAN is formulated as a two-player game between a generator (G) and a discriminator (D), where D is asked to differentiate whether an image comes from real data or is produced by G. Under such a formulation, D plays as the rule maker and hence tends to dominate the competition. Towards a fairer game in GANs, we propose a new paradigm for adversarial training, which makes G assign a task to D as well. Specifically, given an image, we expect D to extract representative features that can be adequately decoded by G to reconstruct the input. That way, instead of learning freely, D is urged to align with the view of G for domain classification.

Preparing

Environment. Pytorch 1.8.1 + CUDA 11.1 + Python 3.8. Use the following script to install other packages:

pip install -r requirements.txt

Data. Please download FFHQ for face domain, and LSUN Church and Bedroom for indoor and outdoor scene, respectively. Note that we follow StyleGAN-ADA to preprocess the images.

Pre-trained models. The pre-trained GAN models can be found at Google Drive for reproduction. The following table could also be of use - Ours* indicates the model is trained with a combined strategy of GLeaD and GGDR, as in Table 1 in the paper:

Model Link
FFHQ_Ours Google Drive
FFHQ_Ours* Google Drive
Church_Ours Google Drive
Church_Ours* Google Drive
Bedroom_Ours Google Drive
Bedroom_Ours* Google Drive

Training

To train the models under GLeaD, run:

python train_scripts_ffhq.py
python train_scripts_church.py
python train_scripts_bedroom.py

where the "reg_target_fake" option indicates the regularization strategy - using GLeaD (gfwimage) or GGDR (gfeat) when discriminating generated images. And "data" indicates the path of the dataset, "outdir" indicates the output directory, and "gpus" means the GPU amount for training.

Evaluating

To evaluate the models, run:

python calc_metric_scripts.py

Remember to reset the data_paths and pkl_paths in "pkl_list".

Generating

To generate samples with the pre-trained model, run:

python generate.py --outdir=out --trunc=0.7 --seeds=600-605 --network=your_pkl_path

Acknowledgement

Thanks to StyleGAN-ADA and GGDR for sharing the code.

BibTeX

If you find our work helpful for your research, please consider to cite:

@inproceedings{bai2023glead,
    author    = {Bai, Qingyan and Yang, Ceyuan and Xu, Yinghao and Liu, Xihui and Yang, Yujiu and Shen, Yujun},
    title     = {GLeaD: Improving GANs With a Generator-Leading Task},
    booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
    year      = {2023},
    pages     = {12094-12104}
}

Releases

No releases published

Packages

No packages published