- Notifications
You must be signed in to change notification settings - Fork2
[CVPR 2023] GLeaD: Improving GANs with A Generator-Leading Task
EzioBy/glead
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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-leadingtask (bottom), as complementary to the discriminator-leading taskin the original formulation of GANs (upper). D is required toextract representative features that can be adequately decoded byG to reconstruct the input.
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 makesG 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.
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 followStyleGAN-ADA to preprocess the images.
Pre-trained models.The pre-trained GAN models can be found atGoogle 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 |
To train the models under GLeaD, run:
python train_scripts_ffhq.pypython train_scripts_church.pypython 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.
To evaluate the models, run:
python calc_metric_scripts.py
Remember to reset the data_paths and pkl_paths in "pkl_list".
To generate samples with the pre-trained model, run:
python generate.py --outdir=out --trunc=0.7 --seeds=600-605 --network=your_pkl_path
Thanks toStyleGAN-ADA andGGDRfor sharing the code.
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}}