{"id":20663746,"url":"https://github.com/vita-group/ultra-data-efficient-gan-training","last_synced_at":"2025-04-19T15:56:12.103Z","repository":{"id":77889101,"uuid":"342365072","full_name":"VITA-Group/Ultra-Data-Efficient-GAN-Training","owner":"VITA-Group","description":"[NeurIPS'21] \"Ultra-Data-Efficient GAN Training: Drawing A Lottery Ticket First, Then Training It Toughly\", Tianlong Chen, Yu Cheng, Zhe Gan, Jingjing Liu, Zhangyang Wang ","archived":false,"fork":false,"pushed_at":"2021-12-30T03:00:44.000Z","size":435,"stargazers_count":84,"open_issues_count":1,"forks_count":9,"subscribers_count":15,"default_branch":"main","last_synced_at":"2025-03-29T09:42:07.759Z","etag":null,"topics":["augmentation","data-efficient","data-efficient-gan-training","gan","generative-adversarial-network","lottery-ticket-hypothesis"],"latest_commit_sha":null,"homepage":"https://tianlong-chen.github.io/about/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VITA-Group.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-25T20:04:46.000Z","updated_at":"2024-09-02T12:37:44.000Z","dependencies_parsed_at":"2023-03-11T23:45:32.484Z","dependency_job_id":null,"html_url":"https://github.com/VITA-Group/Ultra-Data-Efficient-GAN-Training","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VITA-Group%2FUltra-Data-Efficient-GAN-Training","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VITA-Group%2FUltra-Data-Efficient-GAN-Training/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VITA-Group%2FUltra-Data-Efficient-GAN-Training/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VITA-Group%2FUltra-Data-Efficient-GAN-Training/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VITA-Group","download_url":"https://codeload.github.com/VITA-Group/Ultra-Data-Efficient-GAN-Training/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249731267,"owners_count":21317342,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["augmentation","data-efficient","data-efficient-gan-training","gan","generative-adversarial-network","lottery-ticket-hypothesis"],"created_at":"2024-11-16T19:19:38.887Z","updated_at":"2025-04-19T15:56:12.089Z","avatar_url":"https://github.com/VITA-Group.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ultra-Data-Efficient GAN Training: Drawing A Lottery Ticket First, Then Training It Toughly\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)\n\nCode for this paper [Ultra-Data-Efficient GAN Training: Drawing A Lottery Ticket First, Then Training It Toughly](https://arxiv.org/abs/2103.00397). [NeurIPS'21]\n\nTianlong Chen, Yu Cheng, Zhe Gan, Jingjing Liu, Zhangyang Wang.\n\n\n\n## Overview\n\nTraining generative adversarial networks (GANs) with limited data generally results in deteriorated performance and collapsed models. To conquerthis challenge, we are inspired by the latest observation of [Kalibhat et al. (2020)](https://arxiv.org/pdf/2010.02350.pdf); [Chen et al.(2021d)](https://openreview.net/pdf?id=1AoMhc_9jER), that one can discover independently trainable and highly sparse subnetworks (a.k.a.,lottery tickets) from GANs. Treating this as aninductive prior, we decompose the data-hungry GAN training into two sequential sub-problems: \n\n- (i) identifying the lottery ticket from the  original GAN;\n- (ii) then training the found sparse subnetwork with aggressive data and feature augmentations.\n\nBoth sub-problems re-use the same small training set of real images. Such a coordinated framework enables us to focus on lower-complexity and more data-efficient sub-problems, effectively stabilizing trainingand improving convergence.\n\n\n\n## Methodology\n\n![](Figs/methods.png)\n\n\n\n## Experiment Results\n\n\u003cimg src = \"Figs/res.png\" align = \"center\" width=\"60%\" hight=\"60%\"\u003e\n\nMore experiments can be found in [our paper]().\n\n\n\n## Implementation\n\n**For the first step, finding the lottery tickets in GAN is referred to this [repo](https://github.com/VITA-Group/GAN-LTH).**\n\nFor the second step, training GAN ticket toughly are provides as follow:\n\n### Environment for SNGAN\n\n```shell\nconda install python3.6\nconda install pytorch1.4.0 -c pytorch\npip install tensorflow-gpu==1.13\npip install imageio\npip install tensorboardx\n```\n\nR.K. Donwload fid statistics from [Fid_Stat](https://www.dropbox.com/sh/lau1g8n0moj1lmi/AACCBGqAhSsjCcpA78VND18ta?dl=0).\n\n### Commands for SNGAN\n\nR.K. Limited data training for SNGAN\n\n- Dataset: CIFAR-10\n\nExample for full model training on 20% limited data (**--ratio 0.2**):\n\n```shell\npython train_less.py -gen_bs 128 -dis_bs 64 --dataset cifar10 --img_size 32 --max_iter 50000 --model sngan_cifar10 --latent_dim 128 --gf_dim 256 --df_dim 128 --g_spectral_norm False --d_spectral_norm True --g_lr 0.0002 --d_lr 0.0002 --beta1 0.0 --beta2 0.9 --init_type xavier_uniform --n_critic 5 --val_freq 20 --exp_name sngan_cifar10_adv_gd_less_0.2 --init-path initial_weights --ratio 0.2\n```\n\nExample for full model training on 20% limited data (**--ratio 0.2**) with AdvAug on G and D:\n\n```shell\npython train_adv_gd_less.py -gen_bs 128 -dis_bs 64 --dataset cifar10 --img_size 32 --max_iter 50000 --model sngan_cifar10 --latent_dim 128 --gf_dim 256 --df_dim 128 --g_spectral_norm False --d_spectral_norm True --g_lr 0.0002 --d_lr 0.0002 --beta1 0.0 --beta2 0.9 --init_type xavier_uniform --n_critic 5 --val_freq 20 --exp_name sngan_cifar10_adv_gd_less_0.2 --init-path initial_weights --gamma 0.01 --step 1 --ratio 0.2\n```\n\nExample for sparse model (i.e., **GAN tickets**) training on 20% limited data (**--ratio 0.2**) with AdvAug on G and D:\n\n```shell\npython train_with_masks_adv_gd_less.py -gen_bs 128 -dis_bs 64 --dataset cifar10 --img_size 32 --max_iter 50000 --model sngan_cifar10 --latent_dim 128 --gf_dim 256 --df_dim 128 --g_spectral_norm False --d_spectral_norm True --g_lr 0.0002 --d_lr 0.0002 --beta1 0.0 --beta2 0.9 --init_type xavier_uniform --n_critic 5 --val_freq 20 --exp_name sngan_cifar10_adv_gd_less_0.2 --init-path initial_weights --gamma 0.01 --step 1 --ratio 0.2 --rewind-path \u003c\u003e\n```\n\n- --rewind-path: the stored path of identified sparse masks\n\n### Environment for BigGAN\n\n```shell\nconda env create -f environment.yml studiogan\n```\n\n### Commands for BigGAN\n\nR.K. Limited data training for BigGAN\n\n- Dataset: TINY ILSVRC\n\nExample: \n\n```shell\npython main_ompg.py -t -e -c ./configs/TINY_ILSVRC2012/BigGAN_adv.json --eval_type valid --seed 42 --mask_path checkpoints/BigGAN-train-0.1 --mask_round 2 --reduce_train_dataset 0.1 --gamma 0.01 \n```\n\n- --mask_path: the stored path of identified sparse masks\n- --mask_round: the sparsity level = 0.8 ^ mask_round\n- --reduce_train_dataset: the size of used limited training data\n- --gamma: hyperparameter for AdvAug. You can set it to 0 to git rid of AdvAug\n\n----------------------------------------------------------\n\n- Dataset: CIFAR100 \n\nExample:\n\n```shell\npython main_ompg.py -t -e -c ./configs/CIFAR100_less/DiffAugGAN_adv.json --ratio 0.2 --mask_path checkpoints/diffauggan_cifar100_0.2 --mask_round 9 --seed 42 --gamma 0.01\n```\n\n- DiffAugGAN_adv.json: it indicate this confirguration use [DiffAug](https://arxiv.org/pdf/2006.10738.pdf).\n\n### Pre-trained Models\n\n- SNGAN / CIFAR-10 / 10% Training Data / 10.74% Remaining Weights\n\nhttps://www.dropbox.com/sh/7v8hn2859cvm7jj/AACyN8FOkMjgMwy5ibVj61IPa?dl=0\n\n- SNGAN / CIFAR-10 / 10% Training Data / 10.74% Remaining Weights + AdvAug on G and D\n\nhttps://www.dropbox.com/sh/gsklrdcjzogqzcd/AAALlIYcWOZuERLcocKIqlEya?dl=0\n\n- BigGAN / CIFAR-10 / 10% Training Data / 13.42% Remaining Weights + DiffAug + AdvAug on G and D\n\nhttps://www.dropbox.com/sh/epuajb1iqn5xma6/AAAD0zwehky1wvV3M3-uesHsa?dl=0\n\n- BigGAN / CIFAR-100 10% / Training Data / 13.42% Remaining Weights + DiffAug + AdvAug on G and D\n\nhttps://www.dropbox.com/sh/y3pqdqee39jpct4/AAAsSebqHwkWmjO_O8Hp0hcEa?dl=0\n\n- BigGAN / Tiny-ImageNet / 10% Training Data / Full model\n\nhttps://www.dropbox.com/sh/2rmvqwgcjir1p2l/AABNEo0B-0V9ZSnLnKF_OUA3a?dl=0\n\n- BigGAN / Tiny-ImageNet / 10% Training Data / Full model + AdvAug on G and D\n\nhttps://www.dropbox.com/sh/pbwjphualzdy2oe/AACZ7VYJctNBKz3E9b8fgj_Ia?dl=0\n\n- BigGAN / Tiny-ImageNet / 10% Training Data / 64% Remaining Weights\n\nhttps://www.dropbox.com/sh/82i9z44uuczj3u3/AAARsfNzOgd1R9sKuh1OqUdoa?dl=0\n\n- BigGAN / Tiny-ImageNet / 10% Training Data / 64% Remaining Weights + AdvAug on G and D\n\nhttps://www.dropbox.com/sh/yknk1joigx0ufbo/AAChMvzCsedejFjY1XxGcaUta?dl=0\n\n## Citation\n\n```\n@misc{chen2021ultradataefficient,\n      title={Ultra-Data-Efficient GAN Training: Drawing A Lottery Ticket First, Then Training It Toughly}, \n      author={Tianlong Chen and Yu Cheng and Zhe Gan and Jingjing Liu and Zhangyang Wang},\n      year={2021},\n      eprint={2103.00397},\n      archivePrefix={arXiv},\n      primaryClass={cs.LG}\n}\n```\n\n\n\n## Acknowledgement\n\nhttps://github.com/VITA-Group/GAN-LTH\n\nhttps://github.com/GongXinyuu/sngan.pytorch\n\nhttps://github.com/VITA-Group/AutoGAN\n\nhttps://github.com/POSTECH-CVLab/PyTorch-StudioGAN\n\nhttps://github.com/mit-han-lab/data-efficient-gans\n\nhttps://github.com/lucidrains/stylegan2-pytorch\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvita-group%2Fultra-data-efficient-gan-training","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvita-group%2Fultra-data-efficient-gan-training","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvita-group%2Fultra-data-efficient-gan-training/lists"}