From 6739fd7e2347843d1042c5bedbfd910132b73deb Mon Sep 17 00:00:00 2001 From: yangyifei Date: Fri, 30 Jul 2021 14:50:58 +0800 Subject: [PATCH 1/7] Add BigGAN's benchmark --- configs/biggan/README.md | 77 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 configs/biggan/README.md diff --git a/configs/biggan/README.md b/configs/biggan/README.md new file mode 100644 index 000000000..553618c08 --- /dev/null +++ b/configs/biggan/README.md @@ -0,0 +1,77 @@ +# LARGE SCALE GAN TRAINING FOR HIGH FIDELITY NATURAL IMAGE SYNTHESIS + +## Introduction + +```latex +@inproceedings{ +brock2018large, +title={Large Scale {GAN} Training for High Fidelity Natural Image Synthesis}, +author={Andrew Brock and Jeff Donahue and Karen Simonyan}, +booktitle={International Conference on Learning Representations}, +year={2019}, +url={https://openreview.net/forum?id=B1xsqj09Fm}, +} +``` + +The BigGAN/BigGAN-Deep is a conditional generation model that can generate both high-resolution and high-quality images by scaling up the batch size and number of model parameters. + +We have conducted training BigGAN with CIFAR10(3x32x32) and ImageNet1k(3x128x128) dataset, and the sampling results are showed below +
+ Results from our BigGAN trained in CIFAR10 +
+ +
+ +Evaluation of our trained BIgGAN. +| Models | Dataset | FID (Iter) | IS (Iter) | Config | Download | +|:------------:|:-------:|:--------------:|:---------------:|:------:|:----------:| +| BigGAN 32x32 | CIFAR10 | 9.78(390000) | 8.70(390000) | [config](https://github.com/open-mmlab/mmgeneration/blob/master/configs/biggan/biggan_cifar10_32x32_b25x2_500k.py) | [model](https://download.openmmlab.com/mmgen/biggan/biggan_cifar10_32x32_b25x2_500k_20210728_110906-08b61a44.pth)\|[log](https://download.openmmlab.com/mmgen/biggan/biggan_cifar10_32_b25x2_500k_20210706_171051.log.json) | +| BigGAN 128x128 | ImageNet1k | 12.32(1150000) | 72.7(1150000) | [config](https://github.com/open-mmlab/mmgeneration/blob/master/) | [model](https://download.openmmlab.com/mmgen/biggan/biggan_imagenet1k_128x128_b32x8_1150k_20210730_124753-b14026b7.pth)\|[log](https://download.openmmlab.com/mmgen/biggan/biggan_imagenet1k_128x128_b32x8_1500k_20210726_224316.log.json) | + +Note: This is an earlier version(1150k iter) of BigGAN trained on ImageNet1k, the model with best performance is still on the way. + +## converted weights +Since we havn't finished training our models, we provide you with several pre-trained weights which has already be evaluated. Here, we refer to [BigGAN-PyTorch](https://github.com/ajbrock/BigGAN-PyTorch) and [pytorch-pretrained-BigGAN](https://github.com/huggingface/pytorch-pretrained-BigGAN). + +Evaluation results and download links are provided below. + +| Models | Dataset | FID | IS | Config | Download | Original Download link | +|:-------------------:|:----------:|:--:|:---:|:------:|:--------:|:----------------------:| +| BigGAN 128x128 | ImageNet1k | 10.1414 | 96.728 | [config](https://github.com/open-mmlab/mmgeneration/blob/master/) | [model]( +https://download.openmmlab.com/mmgen/biggan/biggan_imagenet1k_128x128_cvt_BigGAN-PyTorch_rgb_20210730_125223-3e353fef.pth) | [link](https://drive.google.com/open?id=1nAle7FCVFZdix2--ks0r5JBkFnKw8ctW) | +| BigGAN-Deep 128x128 | ImageNet1k | 5.9471 | 107.161 | [config](https://github.com/open-mmlab/mmgeneration/blob/master/) | [model](https://download.openmmlab.com/mmgen/biggan/biggan-deep_imagenet1k_128x128_cvt_hugging-face_rgb_20210728_111659-099e96f9.pth) | [link](https://s3.amazonaws.com/models.huggingface.co/biggan/biggan-deep-128-pytorch_model.bin) | +| BigGAN-Deep 256x256 | ImageNet1k | 11.3151 | 135.107 | [config](https://github.com/open-mmlab/mmgeneration/blob/master/) | [model](https://download.openmmlab.com/mmgen/biggan/biggan-deep_imagenet1k_256x256_cvt_hugging-face_rgb_20210728_111735-28651569.pth) | [link](https://s3.amazonaws.com/models.huggingface.co/biggan/biggan-deep-256-pytorch_model.bin) | +| BigGAN-Deep 512x512 | ImageNet1k | 16.8728 | 124.368 | [config]() | [model](https://download.openmmlab.com/mmgen/biggan/biggan-deep_imagenet1k_512x512_cvt_hugging-face_rgb_20210728_112346-a42585f2.pth) | [link](https://s3.amazonaws.com/models.huggingface.co/biggan/biggan-deep-512-pytorch_model.bin) | + +Sampling results are showed below. +
+ Results from our BigGAN-Deep trained in ImageNet 128x128 with truncation factor 0.4 +
+ +
+ +
+ Results from our BigGAN-Deep with Pre-trained weights in ImageNet 256x256 with truncation factor 0.4 +
+ +
+ +
+ Results from our BigGAN-Deep with Pre-trained weights in ImageNet 512x512 truncation factor 0.4 +
+ +
+Above sampling with truncation trick can be performed by command below + +```python +python demo/conditional_demo.py CONFIG_PATH CKPT_PATH --sample-cfg truncation=0.4 # set truncation value as you want +``` + +## Interpolation + +We will also provide script for image interpolation of conditional models soon. +
+ Image interpolating Results of our BigGAN-Deep +
+ +
\ No newline at end of file From 5a4686323fa28d7483dfdf6764f1caaa1436c15f Mon Sep 17 00:00:00 2001 From: yangyifei Date: Fri, 30 Jul 2021 15:16:25 +0800 Subject: [PATCH 2/7] Modify benchmark and add more configs for users --- ...iggan-deep_128x128_cvt_hugging-face_rgb.py | 33 ++++++++++ ...iggan-deep_256x256_cvt_hugging-face_rgb.py | 33 ++++++++++ ...iggan-deep_512x512_cvt_hugging-face_rgb.py | 33 ++++++++++ configs/_base_/models/biggan_128x128.py | 32 ++++++++++ .../biggan_128x128_cvt_BigGAN-PyTorch_rgb.py | 33 ++++++++++ configs/biggan/README.md | 27 ++++---- .../biggan_imagenet1k_128x128_b32x8_1500k.py | 62 +++++++++++++++++++ 7 files changed, 242 insertions(+), 11 deletions(-) create mode 100644 configs/_base_/models/biggan-deep_128x128_cvt_hugging-face_rgb.py create mode 100644 configs/_base_/models/biggan-deep_256x256_cvt_hugging-face_rgb.py create mode 100644 configs/_base_/models/biggan-deep_512x512_cvt_hugging-face_rgb.py create mode 100644 configs/_base_/models/biggan_128x128.py create mode 100644 configs/_base_/models/biggan_128x128_cvt_BigGAN-PyTorch_rgb.py create mode 100644 configs/biggan/biggan_imagenet1k_128x128_b32x8_1500k.py diff --git a/configs/_base_/models/biggan-deep_128x128_cvt_hugging-face_rgb.py b/configs/_base_/models/biggan-deep_128x128_cvt_hugging-face_rgb.py new file mode 100644 index 000000000..ef88e6fc7 --- /dev/null +++ b/configs/_base_/models/biggan-deep_128x128_cvt_hugging-face_rgb.py @@ -0,0 +1,33 @@ +model = dict( + type='BasiccGAN', + generator=dict( + type='BigGANDeepGenerator', + output_scale=128, + noise_size=128, + num_classes=1000, + base_channels=128, + shared_dim=128, + with_shared_embedding=True, + sn_eps=1e-6, + init_type='ortho', + act_cfg=dict(type='ReLU', inplace=True), + concat_noise=True, + auto_sync_bn=False, + rgb2bgr=True), + discriminator=dict( + type='BigGANDeepDiscriminator', + input_scale=128, + num_classes=1000, + base_channels=128, + sn_eps=1e-6, + init_type='ortho', + act_cfg=dict(type='ReLU', inplace=True), + with_spectral_norm=True), + gan_loss=dict(type='GANLoss', gan_type='hinge')) + +train_cfg = dict( + disc_steps=8, gen_steps=1, batch_accumulation_steps=8, use_ema=True) +test_cfg = None +optimizer = dict( + generator=dict(type='Adam', lr=0.0001, betas=(0.0, 0.999), eps=1e-6), + discriminator=dict(type='Adam', lr=0.0004, betas=(0.0, 0.999), eps=1e-6)) diff --git a/configs/_base_/models/biggan-deep_256x256_cvt_hugging-face_rgb.py b/configs/_base_/models/biggan-deep_256x256_cvt_hugging-face_rgb.py new file mode 100644 index 000000000..d3dba7186 --- /dev/null +++ b/configs/_base_/models/biggan-deep_256x256_cvt_hugging-face_rgb.py @@ -0,0 +1,33 @@ +model = dict( + type='BasiccGAN', + generator=dict( + type='BigGANDeepGenerator', + output_scale=256, + noise_size=128, + num_classes=1000, + base_channels=128, + shared_dim=128, + with_shared_embedding=True, + sn_eps=1e-6, + init_type='ortho', + act_cfg=dict(type='ReLU', inplace=True), + concat_noise=True, + auto_sync_bn=False, + rgb2bgr=True), + discriminator=dict( + type='BigGANDeepDiscriminator', + input_scale=256, + num_classes=1000, + base_channels=128, + sn_eps=1e-6, + init_type='ortho', + act_cfg=dict(type='ReLU', inplace=True), + with_spectral_norm=True), + gan_loss=dict(type='GANLoss', gan_type='hinge')) + +train_cfg = dict( + disc_steps=8, gen_steps=1, batch_accumulation_steps=8, use_ema=True) +test_cfg = None +optimizer = dict( + generator=dict(type='Adam', lr=0.0001, betas=(0.0, 0.999), eps=1e-6), + discriminator=dict(type='Adam', lr=0.0004, betas=(0.0, 0.999), eps=1e-6)) diff --git a/configs/_base_/models/biggan-deep_512x512_cvt_hugging-face_rgb.py b/configs/_base_/models/biggan-deep_512x512_cvt_hugging-face_rgb.py new file mode 100644 index 000000000..5b87aa5bf --- /dev/null +++ b/configs/_base_/models/biggan-deep_512x512_cvt_hugging-face_rgb.py @@ -0,0 +1,33 @@ +model = dict( + type='BasiccGAN', + generator=dict( + type='BigGANDeepGenerator', + output_scale=512, + noise_size=128, + num_classes=1000, + base_channels=128, + shared_dim=128, + with_shared_embedding=True, + sn_eps=1e-6, + init_type='ortho', + act_cfg=dict(type='ReLU', inplace=True), + concat_noise=True, + auto_sync_bn=False, + rgb2bgr=True), + discriminator=dict( + type='BigGANDeepDiscriminator', + input_scale=512, + num_classes=1000, + base_channels=128, + sn_eps=1e-6, + init_type='ortho', + act_cfg=dict(type='ReLU', inplace=True), + with_spectral_norm=True), + gan_loss=dict(type='GANLoss', gan_type='hinge')) + +train_cfg = dict( + disc_steps=8, gen_steps=1, batch_accumulation_steps=8, use_ema=True) +test_cfg = None +optimizer = dict( + generator=dict(type='Adam', lr=0.0001, betas=(0.0, 0.999), eps=1e-6), + discriminator=dict(type='Adam', lr=0.0004, betas=(0.0, 0.999), eps=1e-6)) diff --git a/configs/_base_/models/biggan_128x128.py b/configs/_base_/models/biggan_128x128.py new file mode 100644 index 000000000..29def783a --- /dev/null +++ b/configs/_base_/models/biggan_128x128.py @@ -0,0 +1,32 @@ +model = dict( + type='BasiccGAN', + generator=dict( + type='BigGANGenerator', + output_scale=128, + noise_size=120, + num_classes=1000, + base_channels=96, + shared_dim=128, + with_shared_embedding=True, + sn_eps=1e-6, + init_type='ortho', + act_cfg=dict(type='ReLU', inplace=True), + split_noise=True, + auto_sync_bn=False), + discriminator=dict( + type='BigGANDiscriminator', + input_scale=128, + num_classes=1000, + base_channels=96, + sn_eps=1e-6, + init_type='ortho', + act_cfg=dict(type='ReLU', inplace=True), + with_spectral_norm=True), + gan_loss=dict(type='GANLoss', gan_type='hinge')) + +train_cfg = dict( + disc_steps=8, gen_steps=1, batch_accumulation_steps=8, use_ema=True) +test_cfg = None +optimizer = dict( + generator=dict(type='Adam', lr=0.0001, betas=(0.0, 0.999), eps=1e-6), + discriminator=dict(type='Adam', lr=0.0004, betas=(0.0, 0.999), eps=1e-6)) diff --git a/configs/_base_/models/biggan_128x128_cvt_BigGAN-PyTorch_rgb.py b/configs/_base_/models/biggan_128x128_cvt_BigGAN-PyTorch_rgb.py new file mode 100644 index 000000000..b4a6dbd02 --- /dev/null +++ b/configs/_base_/models/biggan_128x128_cvt_BigGAN-PyTorch_rgb.py @@ -0,0 +1,33 @@ +model = dict( + type='BasiccGAN', + generator=dict( + type='BigGANGenerator', + output_scale=128, + noise_size=120, + num_classes=1000, + base_channels=96, + shared_dim=128, + with_shared_embedding=True, + sn_eps=1e-6, + init_type='ortho', + act_cfg=dict(type='ReLU', inplace=True), + split_noise=True, + auto_sync_bn=False, + rgb2bgr=True), + discriminator=dict( + type='BigGANDiscriminator', + input_scale=128, + num_classes=1000, + base_channels=96, + sn_eps=1e-6, + init_type='ortho', + act_cfg=dict(type='ReLU', inplace=True), + with_spectral_norm=True), + gan_loss=dict(type='GANLoss', gan_type='hinge')) + +train_cfg = dict( + disc_steps=8, gen_steps=1, batch_accumulation_steps=8, use_ema=True) +test_cfg = None +optimizer = dict( + generator=dict(type='Adam', lr=0.0001, betas=(0.0, 0.999), eps=1e-6), + discriminator=dict(type='Adam', lr=0.0004, betas=(0.0, 0.999), eps=1e-6)) diff --git a/configs/biggan/README.md b/configs/biggan/README.md index 553618c08..68e215e0e 100644 --- a/configs/biggan/README.md +++ b/configs/biggan/README.md @@ -13,22 +13,28 @@ url={https://openreview.net/forum?id=B1xsqj09Fm}, } ``` -The BigGAN/BigGAN-Deep is a conditional generation model that can generate both high-resolution and high-quality images by scaling up the batch size and number of model parameters. +The BigGAN/BigGAN-Deep is a conditional generation model that can generate both high-resolution and high-quality images by scaling up the batch size and number of model parameters. -We have conducted training BigGAN with CIFAR10(3x32x32) and ImageNet1k(3x128x128) dataset, and the sampling results are showed below +We have conducted training BigGAN with CIFAR10(3x32x32) and ImageNet1k(3x128x128) dataset, and the sampling results are showed below.
Results from our BigGAN trained in CIFAR10
+
+ Results from our BigGAN trained in ImageNet +
+ +
+ Evaluation of our trained BIgGAN. | Models | Dataset | FID (Iter) | IS (Iter) | Config | Download | |:------------:|:-------:|:--------------:|:---------------:|:------:|:----------:| | BigGAN 32x32 | CIFAR10 | 9.78(390000) | 8.70(390000) | [config](https://github.com/open-mmlab/mmgeneration/blob/master/configs/biggan/biggan_cifar10_32x32_b25x2_500k.py) | [model](https://download.openmmlab.com/mmgen/biggan/biggan_cifar10_32x32_b25x2_500k_20210728_110906-08b61a44.pth)\|[log](https://download.openmmlab.com/mmgen/biggan/biggan_cifar10_32_b25x2_500k_20210706_171051.log.json) | -| BigGAN 128x128 | ImageNet1k | 12.32(1150000) | 72.7(1150000) | [config](https://github.com/open-mmlab/mmgeneration/blob/master/) | [model](https://download.openmmlab.com/mmgen/biggan/biggan_imagenet1k_128x128_b32x8_1150k_20210730_124753-b14026b7.pth)\|[log](https://download.openmmlab.com/mmgen/biggan/biggan_imagenet1k_128x128_b32x8_1500k_20210726_224316.log.json) | +| BigGAN 128x128 | ImageNet1k | 12.32(1150000) | 72.7(1150000) | [config](https://github.com/open-mmlab/mmgeneration/blob/master/configs/biggan/biggan_imagenet1k_128x128_b32x8_1500k.py) | [model](https://download.openmmlab.com/mmgen/biggan/biggan_imagenet1k_128x128_b32x8_1150k_20210730_124753-b14026b7.pth)\|[log](https://download.openmmlab.com/mmgen/biggan/biggan_imagenet1k_128x128_b32x8_1500k_20210726_224316.log.json) | -Note: This is an earlier version(1150k iter) of BigGAN trained on ImageNet1k, the model with best performance is still on the way. +Note: This is an earlier version(1150k iter) of BigGAN trained on `ImageNet1k`, the model with best performance is still on the way. ## converted weights Since we havn't finished training our models, we provide you with several pre-trained weights which has already be evaluated. Here, we refer to [BigGAN-PyTorch](https://github.com/ajbrock/BigGAN-PyTorch) and [pytorch-pretrained-BigGAN](https://github.com/huggingface/pytorch-pretrained-BigGAN). @@ -37,15 +43,14 @@ Evaluation results and download links are provided below. | Models | Dataset | FID | IS | Config | Download | Original Download link | |:-------------------:|:----------:|:--:|:---:|:------:|:--------:|:----------------------:| -| BigGAN 128x128 | ImageNet1k | 10.1414 | 96.728 | [config](https://github.com/open-mmlab/mmgeneration/blob/master/) | [model]( -https://download.openmmlab.com/mmgen/biggan/biggan_imagenet1k_128x128_cvt_BigGAN-PyTorch_rgb_20210730_125223-3e353fef.pth) | [link](https://drive.google.com/open?id=1nAle7FCVFZdix2--ks0r5JBkFnKw8ctW) | -| BigGAN-Deep 128x128 | ImageNet1k | 5.9471 | 107.161 | [config](https://github.com/open-mmlab/mmgeneration/blob/master/) | [model](https://download.openmmlab.com/mmgen/biggan/biggan-deep_imagenet1k_128x128_cvt_hugging-face_rgb_20210728_111659-099e96f9.pth) | [link](https://s3.amazonaws.com/models.huggingface.co/biggan/biggan-deep-128-pytorch_model.bin) | -| BigGAN-Deep 256x256 | ImageNet1k | 11.3151 | 135.107 | [config](https://github.com/open-mmlab/mmgeneration/blob/master/) | [model](https://download.openmmlab.com/mmgen/biggan/biggan-deep_imagenet1k_256x256_cvt_hugging-face_rgb_20210728_111735-28651569.pth) | [link](https://s3.amazonaws.com/models.huggingface.co/biggan/biggan-deep-256-pytorch_model.bin) | -| BigGAN-Deep 512x512 | ImageNet1k | 16.8728 | 124.368 | [config]() | [model](https://download.openmmlab.com/mmgen/biggan/biggan-deep_imagenet1k_512x512_cvt_hugging-face_rgb_20210728_112346-a42585f2.pth) | [link](https://s3.amazonaws.com/models.huggingface.co/biggan/biggan-deep-512-pytorch_model.bin) | +| BigGAN 128x128 | ImageNet1k | 10.1414 | 96.728 | [config](https://github.com/open-mmlab/mmgeneration/blob/master/configs/_base_/models/biggan_128x128_cvt_BigGAN-PyTorch_rgb.py) | [model](https://download.openmmlab.com/mmgen/biggan/biggan_imagenet1k_128x128_cvt_BigGAN-PyTorch_rgb_20210730_125223-3e353fef.pth) | [link](https://drive.google.com/open?id=1nAle7FCVFZdix2--ks0r5JBkFnKw8ctW) | +| BigGAN-Deep 128x128 | ImageNet1k | 5.9471 | 107.161 | [config](https://github.com/open-mmlab/mmgeneration/blob/master/configs/_base_/models/biggan-deep_128x128_cvt_hugging-face_rgb.py) | [model](https://download.openmmlab.com/mmgen/biggan/biggan-deep_imagenet1k_128x128_cvt_hugging-face_rgb_20210728_111659-099e96f9.pth) | [link](https://s3.amazonaws.com/models.huggingface.co/biggan/biggan-deep-128-pytorch_model.bin) | +| BigGAN-Deep 256x256 | ImageNet1k | 11.3151 | 135.107 | [config](https://github.com/open-mmlab/mmgeneration/blob/master/configs/_base_/models/biggan-deep_256x256_cvt_hugging-face_rgb.py) | [model](https://download.openmmlab.com/mmgen/biggan/biggan-deep_imagenet1k_256x256_cvt_hugging-face_rgb_20210728_111735-28651569.pth) | [link](https://s3.amazonaws.com/models.huggingface.co/biggan/biggan-deep-256-pytorch_model.bin) | +| BigGAN-Deep 512x512 | ImageNet1k | 16.8728 | 124.368 | [config](https://github.com/open-mmlab/mmgeneration/blob/master/configs/_base_/models/biggan-deep_512x512_cvt_hugging-face_rgb.py) | [model](https://download.openmmlab.com/mmgen/biggan/biggan-deep_imagenet1k_512x512_cvt_hugging-face_rgb_20210728_112346-a42585f2.pth) | [link](https://s3.amazonaws.com/models.huggingface.co/biggan/biggan-deep-512-pytorch_model.bin) | Sampling results are showed below.
- Results from our BigGAN-Deep trained in ImageNet 128x128 with truncation factor 0.4 + Results from our BigGAN-Deep with Pre-trained weights in ImageNet 128x128 with truncation factor 0.4
@@ -74,4 +79,4 @@ We will also provide script for image interpolation of conditional models soon. Image interpolating Results of our BigGAN-Deep
- \ No newline at end of file + diff --git a/configs/biggan/biggan_imagenet1k_128x128_b32x8_1500k.py b/configs/biggan/biggan_imagenet1k_128x128_b32x8_1500k.py new file mode 100644 index 000000000..a4544a203 --- /dev/null +++ b/configs/biggan/biggan_imagenet1k_128x128_b32x8_1500k.py @@ -0,0 +1,62 @@ +_base_ = [ + '../_base_/models/biggan_128x128.py', + '../_base_/datasets/imagenet_noaug_128.py', '../_base_/default_runtime.py' +] + +# define dataset +# you must set `samples_per_gpu` +data = dict(samples_per_gpu=32, workers_per_gpu=8) + +# adjust running config +lr_config = None +checkpoint_config = dict(interval=5000, by_epoch=False, max_keep_ckpts=10) +custom_hooks = [ + dict( + type='VisualizeUnconditionalSamples', + output_dir='training_samples', + interval=10000), + dict( + type='ExponentialMovingAverageHook', + module_keys=('generator_ema', ), + interval=8, + start_iter=160000, + interp_cfg=dict(momentum=0.9999), + priority='VERY_HIGH') +] + +# Traning sets' datasize 1,281,167 +total_iters = 1500000 + +# use ddp wrapper for faster training +use_ddp_wrapper = True +find_unused_parameters = False + +runner = dict( + type='DynamicIterBasedRunner', + is_dynamic_ddp=False, # Note that this flag should be False. + pass_training_status=True) + +# Note set your inception_pkl's path +inception_pkl = "work_dirs/inception_pkl/imagenet.pkl" +evaluation = dict( + type='GenerativeEvalHook', + interval=10000, + metrics=[ + dict( + type='FID', + num_images=50000, + inception_pkl=inception_pkl, + bgr2rgb=True), + dict(type='IS', num_images=50000) + ], + sample_kwargs=dict(sample_model='ema'), + best_metric=['fid', 'is']) + +metrics = dict( + fid50k=dict( + type='FID', + num_images=50000, + inception_pkl=inception_pkl, + bgr2rgb=True, + inception_args=dict(type='StyleGAN')), + is50k=dict(type='IS', num_images=50000)) From 5f3e8e54b920b0beff2cf000c02b8cb36cda45a0 Mon Sep 17 00:00:00 2001 From: yangyifei Date: Fri, 30 Jul 2021 15:55:04 +0800 Subject: [PATCH 3/7] fix lint --- .../_base_/models/biggan-deep_128x128_cvt_hugging-face_rgb.py | 2 +- .../_base_/models/biggan-deep_256x256_cvt_hugging-face_rgb.py | 2 +- .../_base_/models/biggan-deep_512x512_cvt_hugging-face_rgb.py | 2 +- configs/_base_/models/biggan_128x128_cvt_BigGAN-PyTorch_rgb.py | 2 +- configs/biggan/biggan_imagenet1k_128x128_b32x8_1500k.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/configs/_base_/models/biggan-deep_128x128_cvt_hugging-face_rgb.py b/configs/_base_/models/biggan-deep_128x128_cvt_hugging-face_rgb.py index ef88e6fc7..97a099154 100644 --- a/configs/_base_/models/biggan-deep_128x128_cvt_hugging-face_rgb.py +++ b/configs/_base_/models/biggan-deep_128x128_cvt_hugging-face_rgb.py @@ -13,7 +13,7 @@ act_cfg=dict(type='ReLU', inplace=True), concat_noise=True, auto_sync_bn=False, - rgb2bgr=True), + rgb2bgr=True), discriminator=dict( type='BigGANDeepDiscriminator', input_scale=128, diff --git a/configs/_base_/models/biggan-deep_256x256_cvt_hugging-face_rgb.py b/configs/_base_/models/biggan-deep_256x256_cvt_hugging-face_rgb.py index d3dba7186..947f3da0b 100644 --- a/configs/_base_/models/biggan-deep_256x256_cvt_hugging-face_rgb.py +++ b/configs/_base_/models/biggan-deep_256x256_cvt_hugging-face_rgb.py @@ -13,7 +13,7 @@ act_cfg=dict(type='ReLU', inplace=True), concat_noise=True, auto_sync_bn=False, - rgb2bgr=True), + rgb2bgr=True), discriminator=dict( type='BigGANDeepDiscriminator', input_scale=256, diff --git a/configs/_base_/models/biggan-deep_512x512_cvt_hugging-face_rgb.py b/configs/_base_/models/biggan-deep_512x512_cvt_hugging-face_rgb.py index 5b87aa5bf..2aac48496 100644 --- a/configs/_base_/models/biggan-deep_512x512_cvt_hugging-face_rgb.py +++ b/configs/_base_/models/biggan-deep_512x512_cvt_hugging-face_rgb.py @@ -13,7 +13,7 @@ act_cfg=dict(type='ReLU', inplace=True), concat_noise=True, auto_sync_bn=False, - rgb2bgr=True), + rgb2bgr=True), discriminator=dict( type='BigGANDeepDiscriminator', input_scale=512, diff --git a/configs/_base_/models/biggan_128x128_cvt_BigGAN-PyTorch_rgb.py b/configs/_base_/models/biggan_128x128_cvt_BigGAN-PyTorch_rgb.py index b4a6dbd02..af142296d 100644 --- a/configs/_base_/models/biggan_128x128_cvt_BigGAN-PyTorch_rgb.py +++ b/configs/_base_/models/biggan_128x128_cvt_BigGAN-PyTorch_rgb.py @@ -13,7 +13,7 @@ act_cfg=dict(type='ReLU', inplace=True), split_noise=True, auto_sync_bn=False, - rgb2bgr=True), + rgb2bgr=True), discriminator=dict( type='BigGANDiscriminator', input_scale=128, diff --git a/configs/biggan/biggan_imagenet1k_128x128_b32x8_1500k.py b/configs/biggan/biggan_imagenet1k_128x128_b32x8_1500k.py index a4544a203..52dec40f6 100644 --- a/configs/biggan/biggan_imagenet1k_128x128_b32x8_1500k.py +++ b/configs/biggan/biggan_imagenet1k_128x128_b32x8_1500k.py @@ -37,7 +37,7 @@ pass_training_status=True) # Note set your inception_pkl's path -inception_pkl = "work_dirs/inception_pkl/imagenet.pkl" +inception_pkl = 'work_dirs/inception_pkl/imagenet.pkl' evaluation = dict( type='GenerativeEvalHook', interval=10000, From 9a0f73859d286072d18a17624151d78d74e1e4d7 Mon Sep 17 00:00:00 2001 From: Yangyfaker Date: Mon, 2 Aug 2021 10:56:09 +0800 Subject: [PATCH 4/7] fix pr#80 --- configs/biggan/README.md | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/configs/biggan/README.md b/configs/biggan/README.md index 68e215e0e..80e7d66f3 100644 --- a/configs/biggan/README.md +++ b/configs/biggan/README.md @@ -13,9 +13,9 @@ url={https://openreview.net/forum?id=B1xsqj09Fm}, } ``` -The BigGAN/BigGAN-Deep is a conditional generation model that can generate both high-resolution and high-quality images by scaling up the batch size and number of model parameters. +The `BigGAN/BigGAN-Deep` is a conditional generation model that can generate both high-resolution and high-quality images by scaling up the batch size and the number of model parameters. -We have conducted training BigGAN with CIFAR10(3x32x32) and ImageNet1k(3x128x128) dataset, and the sampling results are showed below. +We have finished training `BigGAN` in `Cifar10` (32x32) and are aligning training performance in `ImageNet1k` (128x128). Some sampled results are shown below for your reference.
Results from our BigGAN trained in CIFAR10
@@ -34,10 +34,10 @@ Evaluation of our trained BIgGAN. | BigGAN 32x32 | CIFAR10 | 9.78(390000) | 8.70(390000) | [config](https://github.com/open-mmlab/mmgeneration/blob/master/configs/biggan/biggan_cifar10_32x32_b25x2_500k.py) | [model](https://download.openmmlab.com/mmgen/biggan/biggan_cifar10_32x32_b25x2_500k_20210728_110906-08b61a44.pth)\|[log](https://download.openmmlab.com/mmgen/biggan/biggan_cifar10_32_b25x2_500k_20210706_171051.log.json) | | BigGAN 128x128 | ImageNet1k | 12.32(1150000) | 72.7(1150000) | [config](https://github.com/open-mmlab/mmgeneration/blob/master/configs/biggan/biggan_imagenet1k_128x128_b32x8_1500k.py) | [model](https://download.openmmlab.com/mmgen/biggan/biggan_imagenet1k_128x128_b32x8_1150k_20210730_124753-b14026b7.pth)\|[log](https://download.openmmlab.com/mmgen/biggan/biggan_imagenet1k_128x128_b32x8_1500k_20210726_224316.log.json) | -Note: This is an earlier version(1150k iter) of BigGAN trained on `ImageNet1k`, the model with best performance is still on the way. +Note: This is an unfinished version (1150k iter) of BigGAN trained on `ImageNet1k`. The model with the best performance is still on the way. -## converted weights -Since we havn't finished training our models, we provide you with several pre-trained weights which has already be evaluated. Here, we refer to [BigGAN-PyTorch](https://github.com/ajbrock/BigGAN-PyTorch) and [pytorch-pretrained-BigGAN](https://github.com/huggingface/pytorch-pretrained-BigGAN). +## Converted weights +Since we havn't finished training our models, we provide you with several pre-trained weights which have been evaluated. Here, we refer to [BigGAN-PyTorch](https://github.com/ajbrock/BigGAN-PyTorch) and [pytorch-pretrained-BigGAN](https://github.com/huggingface/pytorch-pretrained-BigGAN). Evaluation results and download links are provided below. @@ -48,7 +48,7 @@ Evaluation results and download links are provided below. | BigGAN-Deep 256x256 | ImageNet1k | 11.3151 | 135.107 | [config](https://github.com/open-mmlab/mmgeneration/blob/master/configs/_base_/models/biggan-deep_256x256_cvt_hugging-face_rgb.py) | [model](https://download.openmmlab.com/mmgen/biggan/biggan-deep_imagenet1k_256x256_cvt_hugging-face_rgb_20210728_111735-28651569.pth) | [link](https://s3.amazonaws.com/models.huggingface.co/biggan/biggan-deep-256-pytorch_model.bin) | | BigGAN-Deep 512x512 | ImageNet1k | 16.8728 | 124.368 | [config](https://github.com/open-mmlab/mmgeneration/blob/master/configs/_base_/models/biggan-deep_512x512_cvt_hugging-face_rgb.py) | [model](https://download.openmmlab.com/mmgen/biggan/biggan-deep_imagenet1k_512x512_cvt_hugging-face_rgb_20210728_112346-a42585f2.pth) | [link](https://s3.amazonaws.com/models.huggingface.co/biggan/biggan-deep-512-pytorch_model.bin) | -Sampling results are showed below. +Sampling results are shown below.
Results from our BigGAN-Deep with Pre-trained weights in ImageNet 128x128 with truncation factor 0.4
@@ -66,12 +66,18 @@ Sampling results are showed below.
-Above sampling with truncation trick can be performed by command below +Sampling with truncation trick above can be performed by command below. ```python python demo/conditional_demo.py CONFIG_PATH CKPT_PATH --sample-cfg truncation=0.4 # set truncation value as you want ``` - +For converted weights, we provide model configs under `configs/_base_/models` listed as follows: +```python +# biggan_128x128_cvt_BigGAN-PyTorch_rgb.py +# biggan-deep_128x128_cvt_hugging-face_rgb.py +# biggan-deep_256x256_cvt_hugging-face_rgb.py +# biggan-deep_512x512_cvt_hugging-face_rgb.py +``` ## Interpolation We will also provide script for image interpolation of conditional models soon. From e1130780d9d64919893597289849433dd11a064b Mon Sep 17 00:00:00 2001 From: yangyifei Date: Mon, 2 Aug 2021 14:37:37 +0800 Subject: [PATCH 5/7] Add BigGAN's README to homepage --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 28a9f817b..76e440e2a 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,7 @@ These methods have been carefully studied and supported in our frameworks: - ✅ [SNGAN](configs/sngan_proj/README.md) (ICLR'2018) - ✅ [Projection GAN](configs/sngan_proj/README.md) (ICLR'2018) - ✅ [SAGAN](configs/sagan/README.md) (ICML'2019) +- ✅ [BIGGAN/BIGGAN-DEEP](configs/biggan/README.md) (ICLR'2019) From a2496dbd4c6d72c4bd75da858bc4b79175c2c1a3 Mon Sep 17 00:00:00 2001 From: yangyifei Date: Mon, 2 Aug 2021 14:52:51 +0800 Subject: [PATCH 6/7] Add BigGAN's README link to the homepage (chinese version) --- README_zh-CN.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README_zh-CN.md b/README_zh-CN.md index fdcfc802c..c3ea75437 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -88,6 +88,8 @@ v0.2.0 在 30/05/2021 发布。 关于细节和发布历史,请参考 [changel - ✅ [SNGAN](configs/sngan_proj/README.md) (ICLR'2018) - ✅ [Projection GAN](configs/sngan_proj/README.md) (ICLR'2018) - ✅ [SAGAN](configs/sagan/README.md) (ICML'2019) +- ✅ [BIGGAN/BIGGAN-DEEP](configs/biggan/README.md) (ICLR'2019) + From 0def8219fe6526f1a5cc6a91b48ac717403417f2 Mon Sep 17 00:00:00 2001 From: yangyifei Date: Mon, 6 Sep 2021 16:16:37 +0800 Subject: [PATCH 7/7] update biggan-benchmark --- configs/biggan/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configs/biggan/README.md b/configs/biggan/README.md index 6501dcd3c..644af3c54 100644 --- a/configs/biggan/README.md +++ b/configs/biggan/README.md @@ -29,10 +29,10 @@ We have finished training `BigGAN` in `Cifar10` (32x32) and are aligning trainin
Evaluation of our trained BIgGAN. -| Models | Dataset | FID (Iter) | IS (Iter) | Config | Download | +| Models | Dataset | Best FID (Iter) | Best IS (Iter) | Config | Download | |:------------:|:-------:|:--------------:|:---------------:|:------:|:----------:| | BigGAN 32x32 | CIFAR10 | 9.78(390000) | 8.70(390000) | [config](https://github.com/open-mmlab/mmgeneration/blob/master/configs/biggan/biggan_cifar10_32x32_b25x2_500k.py) | [model](https://download.openmmlab.com/mmgen/biggan/biggan_cifar10_32x32_b25x2_500k_20210728_110906-08b61a44.pth)\|[log](https://download.openmmlab.com/mmgen/biggan/biggan_cifar10_32_b25x2_500k_20210706_171051.log.json) | -| BigGAN 128x128 | ImageNet1k | 12.32(1150000) | 72.7(1150000) | [config](https://github.com/open-mmlab/mmgeneration/blob/master/configs/biggan/biggan_imagenet1k_128x128_b32x8_1500k.py) | [model](https://download.openmmlab.com/mmgen/biggan/biggan_imagenet1k_128x128_b32x8_1150k_20210730_124753-b14026b7.pth)\|[log](https://download.openmmlab.com/mmgen/biggan/biggan_imagenet1k_128x128_b32x8_1500k_20210726_224316.log.json) | +| BigGAN 128x128 | ImageNet1k | 10.02(1449000) | 86.8(1449000) | [config](https://github.com/open-mmlab/mmgeneration/blob/master/configs/biggan/biggan_imagenet1k_128x128_b32x8_1500k.py) | [model](https://download.openmmlab.com/mmgen/biggan/biggan_imagenet1k_128x128_b32x8_1449000_20210906_141519-f9128faf.pth?versionId=CAEQMhiBgIDn.ILn3RciIDFiMTZhZjIxYzA2MjQxMTJiMDQzZjQyNWQ5YTVkY2Jl)\|[log](https://download.openmmlab.com/mmgen/biggan/biggan_imagenet1k_128x128_b32x8_1449000_20210906_141519-f9128faf.log.json?versionId=CAEQMhiBgMD5.dfo3RciIDE5OThmOWM0ZDAxYjQxMWJiNTEzMTFlMzAxZWJkOGFm) | Note: This is an unfinished version (1150k iter) of BigGAN trained on `ImageNet1k`. The model with the best performance is still on the way.