# StyleGANv2
> [Analyzing and Improving the Image Quality of Stylegan](https://openaccess.thecvf.com/content_CVPR_2020/html/Karras_Analyzing_and_Improving_the_Image_Quality_of_StyleGAN_CVPR_2020_paper.html)
<!-- [ALGORITHM] -->
## Abstract
<!-- [ABSTRACT] -->
The style-based GAN architecture (StyleGAN) yields state-of-the-art results in data-driven unconditional generative image modeling. We expose and analyze several of its characteristic artifacts, and propose changes in both model architecture and training methods to address them. In particular, we redesign the generator normalization, revisit progressive growing, and regularize the generator to encourage good conditioning in the mapping from latent codes to images. In addition to improving image quality, this path length regularizer yields the additional benefit that the generator becomes significantly easier to invert. This makes it possible to reliably attribute a generated image to a particular network. We furthermore visualize how well the generator utilizes its output resolution, and identify a capacity problem, motivating us to train larger models for additional quality improvements. Overall, our improved model redefines the state of the art in unconditional image modeling, both in terms of existing distribution quality metrics as well as perceived image quality.
<!-- [IMAGE] -->
<div align=center>
<img src="https://user-images.githubusercontent.com/28132635/143055738-58b15493-ab87-436d-94fd-c4c19e4a0225.JPG"/>
</div>
## Results and Models
<div align="center">
<b> Results (compressed) from StyleGAN2 config-f trained by MMGeneration</b>
<br/>
<img src="https://user-images.githubusercontent.com/12726765/113825919-25433100-97b4-11eb-84f7-5c66b3cfbc68.png" width="800"/>
</div>
| Model | Comment | FID50k | P&R50k | Config | Download |
| :---------------------------------: | :-------------: | :----: | :-----------: | :--------------------------------------------------------------: | :-----------------------------------------------------------------: |
| stylegan2_config-f_ffhq_1024 | official weight | 2.8134 | 62.856/49.400 | [config](https://github.com/open-mmlab/mmgeneration/tree/master/configs/styleganv2/stylegan2_c2_ffhq_1024_b4x8.py) | [model](https://download.openmmlab.com/mmgen/stylegan2/official_weights/stylegan2-ffhq-config-f-official_20210327_171224-bce9310c.pth) |
| stylegan2_config-f_lsun-car_384x512 | official weight | 5.4316 | 65.986/48.190 | [config](https://github.com/open-mmlab/mmgeneration/tree/master/configs/styleganv2/stylegan2_c2_lsun-car_384x512_b4x8.py) | [model](https://download.openmmlab.com/mmgen/stylegan2/official_weights/stylegan2-car-config-f-official_20210327_172340-8cfe053c.pth) |
| stylegan2_config-f_horse_256 | official weight | - | - | [config](https://github.com/open-mmlab/mmgeneration/tree/master/configs/styleganv2/stylegan2_c2_lsun-horse_256_b4x8_800k.py) | [model](https://download.openmmlab.com/mmgen/stylegan2/official_weights/stylegan2-horse-config-f-official_20210327_173203-ef3e69ca.pth) |
| stylegan2_config-f_church_256 | official weight | - | - | [config](https://github.com/open-mmlab/mmgeneration/tree/master/configs/styleganv2/stylegan2_c2_lsun-church_256_b4x8_800k.py) | [model](https://download.openmmlab.com/mmgen/stylegan2/official_weights/stylegan2-church-config-f-official_20210327_172657-1d42b7d1.pth) |
| stylegan2_config-f_cat_256 | official weight | - | - | [config](https://github.com/open-mmlab/mmgeneration/tree/master/configs/styleganv2/stylegan2_c2_lsun-cat_256_b4x8_800k.py) | [model](https://download.openmmlab.com/mmgen/stylegan2/official_weights/stylegan2-cat-config-f-official_20210327_172444-15bc485b.pth) |
| stylegan2_config-f_ffhq_256 | our training | 3.992 | 69.012/40.417 | [config](https://github.com/open-mmlab/mmgeneration/tree/master/configs/styleganv2/stylegan2_c2_ffhq_256_b4x8_800k.py) | [model](https://download.openmmlab.com/mmgen/stylegan2/stylegan2_c2_ffhq_256_b4x8_20210407_160709-7890ae1f.pth) |
| stylegan2_config-f_ffhq_1024 | our training | 2.8185 | 68.236/49.583 | [config](https://github.com/open-mmlab/mmgeneration/tree/master/configs/styleganv2/stylegan2_c2_ffhq_1024_b4x8.py) | [model](https://download.openmmlab.com/mmgen/stylegan2/stylegan2_c2_ffhq_1024_b4x8_20210407_150045-618c9024.pth) |
| stylegan2_config-f_lsun-car_384x512 | our training | 2.4116 | 66.760/50.576 | [config](https://github.com/open-mmlab/mmgeneration/tree/master/configs/styleganv2/stylegan2_c2_lsun-car_384x512_b4x8.py) | [model](https://download.openmmlab.com/mmgen/stylegan2/stylegan2_c2_lsun-car_384x512_b4x8_1800k_20210424_160929-fc9072ca.pth) |
## FP16 Support and Experiments
Currently, we have supported FP16 training for StyleGAN2, and here are the results for the mixed-precision training. (Experiments for FFHQ1024 will come soon.)
<div align="center">
<b> Evaluation FID for FP32 and FP16 training </b>
<br/>
<img src="https://user-images.githubusercontent.com/12726765/117523645-18e90880-afec-11eb-9327-da14362b8bfd.png" width="600"/>
</div>
As shown in the figure, we provide **3** ways to do mixed-precision training for `StyleGAN2`:
- [stylegan2_c2_fp16_PL-no-scaler](https://github.com/open-mmlab/mmgeneration/tree/master/configs/styleganv2/stylegan2_c2_fp16_partial-GD_PL-no-scaler_ffhq_256_b4x8_800k.py): In this setting, we try our best to follow the official FP16 implementation in [StyleGAN2-ADA](https://github.com/NVlabs/stylegan2-ada). Similar to the official version, we only adopt FP16 training for the higher-resolution feature maps (the last 4 stages in G and the first 4 stages). Note that we do not adopt the `clamp` way to avoid gradient overflow used in the official implementation. We use the `autocast` function from `torch.cuda.amp` package.
- [stylegan2_c2_fp16-globalG-partialD_PL-R1-no-scaler](https://github.com/open-mmlab/mmgeneration/tree/master/configs/styleganv2/stylegan2_c2_fp16-globalG-partialD_PL-R1-no-scaler_ffhq_256_b4x8_800k.py): In this config, we try to adopt mixed-precision training for the whole generator, but in partial discriminator (the first 4 higher-resolution stages). Note that we do not apply the loss scaler in the path length loss and gradient penalty loss. Because we always meet divergence after adopting the loss scaler to scale the gradient in these two losses.
- [stylegan2_c2_apex_fp16_PL-R1-no-scaler](https://github.com/open-mmlab/mmgeneration/tree/master/configs/styleganv2/stylegan2_c2_apex_fp16_PL-R1-no-scaler_ffhq_256_b4x8_800k.py): In this setting, we adopt the [APEX](https://github.com/NVIDIA/apex) toolkit to implement mixed-precision training with multiple loss/gradient scalers. In APEX, you can assign different loss scalers for the generator and the discriminator respectively. Note that we still ignore the gradient scaler in the path length loss and gradient penalty loss.
| Model | Comment | Dataset | FID50k | Config | Download |
| :----------------------------------------------: | :-------------------------------------: | :-----: | :----: | :-----------------------------------------------: | :-------------------------------------------------: |
| stylegan2_config-f_ffhq_256 | baseline | FFHQ256 | 3.992 | [config](https://github.com/open-mmlab/mmgeneration/tree/master/configs/styleganv2/stylegan2_c2_ffhq_256_b4x8_800k.py) | [ckpt](https://download.openmmlab.com/mmgen/stylegan2/stylegan2_c2_ffhq_256_b4x8_20210407_160709-7890ae1f.pth) |
| stylegan2_c2_fp16_partial-GD_PL-no-scaler_ffhq_256_b4x8_800k | partia
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
<项目介绍> 基于 PyTorch 和 MMCV的图像和视频生成工具箱,支持多种生成模型如图像生成,条件生成,图像转换+源代码+文档说明 - 不懂运行,下载完可以私聊问,可远程教学 该资源内项目源码是个人的毕设,代码都测试ok,都是运行成功后才上传资源,答辩评审平均分达到96分,放心下载使用! 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.md文件(如有),仅供学习参考, 切勿用于商业用途。 --------
资源推荐
资源详情
资源评论
收起资源包目录
基于 PyTorch 和 MMCV的图像和视频生成工具箱,支持多种生成模型如图像生成,条件生成,图像转换+源代码+文档说明 (511个子文件)
make.bat 760B
make.bat 760B
CITATION.cff 291B
setup.cfg 663B
filtered_lrelu.cpp 15KB
upfirdn2d.cpp 5KB
bias_act.cpp 4KB
readthedocs.css 218B
filtered_lrelu.cu 66KB
upfirdn2d.cu 23KB
bias_act.cu 6KB
filtered_lrelu_ns.cu 2KB
filtered_lrelu_wr.cu 2KB
filtered_lrelu_rd.cu 2KB
Dockerfile 786B
Dockerfile 527B
.gitignore 1KB
filtered_lrelu.h 4KB
upfirdn2d.h 2KB
bias_act.h 1KB
MANIFEST.in 319B
grass1.jpeg 11KB
horse.jpeg 6KB
audi_a5.jpeg 6KB
GT05.jpg 88KB
4.jpg 63KB
3.jpg 58KB
5.jpg 58KB
2.jpg 53KB
3.jpg 52KB
2.jpg 51KB
33_AB.jpg 50KB
1.jpg 47KB
1.jpg 43KB
6.jpg 40KB
LICENSE 11KB
Makefile 634B
Makefile 634B
quick_run.md 31KB
README.md 15KB
README.md 12KB
customize_runtime.md 12KB
README.md 11KB
README_zh-CN.md 11KB
README.md 10KB
customize_dataset.md 10KB
README.md 9KB
README.md 9KB
README.md 9KB
README.md 8KB
customize_losses.md 7KB
inception_stat.md 7KB
config.md 7KB
applications.md 6KB
applications.md 6KB
ddp_train_gans.md 6KB
ddp_train_gans.md 6KB
get_started.md 5KB
get_started.md 5KB
README.md 5KB
README.md 5KB
changelog.md 5KB
README.md 5KB
README.md 5KB
README.md 4KB
customize_models.md 4KB
README.md 4KB
README.md 4KB
README.md 3KB
README.md 3KB
README.md 3KB
modelzoo_statistics.md 2KB
modelzoo_statistics.md 2KB
LICENSES.md 911B
faq.md 908B
faq.md 459B
switch_language.md 153B
quick_run.md 104B
customize_losses.md 48B
config.md 46B
customize_dataset.md 33B
customize_runtime.md 30B
customize_models.md 30B
changelog.md 21B
baboon.png 540KB
baboon.png 540KB
metrics.py 57KB
base_diffusion.py 42KB
styleganv2_modules.py 41KB
test_sngan_proj_archs.py 37KB
generator_discriminator.py 36KB
gen_auxiliary_loss.py 34KB
generator_discriminator_deep.py 32KB
augment.py 32KB
generator_discriminator.py 31KB
modules.py 29KB
generator_discriminator_v2.py 28KB
pixelwise_loss.py 27KB
styleganv3_modules.py 26KB
modules.py 25KB
共 511 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
奋斗奋斗再奋斗的ajie
- 粉丝: 1211
- 资源: 2591
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功