# mmgeneration **Repository Path**: open-mmlab/mmgeneration ## Basic Information - **Project Name**: mmgeneration - **Description**: 基于 PyTorch 和 MMCV 的图像和视频生成工具箱,支持多种生成模型如图像生成,条件生成,图像转换的训练和测试。它同时提供了丰富的应用,包含了 GANs 的插值,投影和图像编辑。 - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 42 - **Forks**: 10 - **Created**: 2022-04-18 - **Last Updated**: 2025-04-21 ## Categories & Tags **Categories**: image-processing **Tags**: None ## README
 
OpenMMLab website HOT      OpenMMLab platform TRY IT OUT
 
[![PyPI](https://img.shields.io/pypi/v/mmgen)](https://pypi.org/project/mmgen) [![docs](https://img.shields.io/badge/docs-latest-blue)](https://mmgeneration.readthedocs.io/en/latest/) [![badge](https://github.com/open-mmlab/mmgeneration/workflows/build/badge.svg)](https://github.com/open-mmlab/mmgeneration/actions) [![codecov](https://codecov.io/gh/open-mmlab/mmgeneration/branch/master/graph/badge.svg)](https://codecov.io/gh/open-mmlab/mmgeneration) [![license](https://img.shields.io/github/license/open-mmlab/mmgeneration.svg)](https://github.com/open-mmlab/mmgeneration/blob/master/LICENSE) [![open issues](https://isitmaintained.com/badge/open/open-mmlab/mmgeneration.svg)](https://github.com/open-mmlab/mmgeneration/issues) [![issue resolution](https://isitmaintained.com/badge/resolution/open-mmlab/mmgeneration.svg)](https://github.com/open-mmlab/mmgeneration/issues) [📘Documentation](https://mmgeneration.readthedocs.io/en/latest/) | [🛠️Installation](https://mmgeneration.readthedocs.io/en/latest/get_started.html#installation) | [👀Model Zoo](https://mmgeneration.readthedocs.io/en/latest/modelzoo_statistics.html) | [🆕Update News](https://github.com/open-mmlab/mmgeneration/blob/master/docs/en/changelog.md) | [🚀Ongoing Projects](https://github.com/open-mmlab/mmgeneration/projects) | [🤔Reporting Issues](https://github.com/open-mmlab/mmgeneration/issues) English | [简体中文](README_zh-CN.md) ## What's New MMGeneration has been merged in [MMEditing](https://github.com/open-mmlab/mmediting/tree/1.x). And we have supported new generation tasks and models. We highlight the following new features: - 🌟 Text2Image - ✅ [GLIDE](https://github.com/open-mmlab/mmediting/tree/1.x/projects/glide/configs/README.md) - ✅ [Disco-Diffusion](https://github.com/open-mmlab/mmediting/tree/1.x/configs/disco_diffusion/README.md) - ✅ [Stable-Diffusion](https://github.com/open-mmlab/mmediting/tree/1.x/configs/stable_diffusion/README.md) - 🌟 3D-aware Generation - ✅ [EG3D](https://github.com/open-mmlab/mmediting/tree/1.x/configs/eg3d/README.md) ## Introduction MMGeneration is a powerful toolkit for generative models, especially for GANs now. It is based on PyTorch and [MMCV](https://github.com/open-mmlab/mmcv). The master branch works with **PyTorch 1.5+**.
## Major Features - **High-quality Training Performance:** We currently support training on Unconditional GANs, Internal GANs, and Image Translation Models. Support for conditional models will come soon. - **Powerful Application Toolkit:** A plentiful toolkit containing multiple applications in GANs is provided to users. GAN interpolation, GAN projection, and GAN manipulations are integrated into our framework. It's time to play with your GANs! ([Tutorial for applications](docs/en/tutorials/applications.md)) - **Efficient Distributed Training for Generative Models:** For the highly dynamic training in generative models, we adopt a new way to train dynamic models with `MMDDP`. ([Tutorial for DDP](docs/en/tutorials/ddp_train_gans.md)) - **New Modular Design for Flexible Combination:** A new design for complex loss modules is proposed for customizing the links between modules, which can achieve flexible combination among different modules. ([Tutorial for new modular design](docs/en/tutorials/customize_losses.md))
Training Visualization
GAN Interpolation
GAN Projector
GAN Manipulation
## Highlight - **Positional Encoding as Spatial Inductive Bias in GANs (CVPR2021)** has been released in `MMGeneration`. [\[Config\]](configs/positional_encoding_in_gans/README.md), [\[Project Page\]](https://nbei.github.io/gan-pos-encoding.html) - Conditional GANs have been supported in our toolkit. More methods and pre-trained weights will come soon. - Mixed-precision training (FP16) for StyleGAN2 has been supported. Please check [the comparison](configs/styleganv2/README.md) between different implementations. ## Changelog v0.7.3 was released on 14/04/2023. Please refer to [changelog.md](docs/en/changelog.md) for details and release history. ## Installation MMGeneration depends on [PyTorch](https://pytorch.org/) and [MMCV](https://github.com/open-mmlab/mmcv). Below are quick steps for installation. **Step 1.** Install PyTorch following [official instructions](https://pytorch.org/get-started/locally/), e.g. ```python pip3 install torch torchvision ``` **Step 2.** Install MMCV with [MIM](https://github.com/open-mmlab/mim). ``` pip3 install openmim mim install mmcv-full ``` **Step 3.** Install MMGeneration from source. ``` git clone https://github.com/open-mmlab/mmgeneration.git cd mmgeneration pip3 install -e . ``` Please refer to [get_started.md](docs/en/get_started.md) for more detailed instruction. ## Getting Started Please see [get_started.md](docs/en/get_started.md) for the basic usage of MMGeneration. [docs/en/quick_run.md](docs/en/quick_run.md) can offer full guidance for quick run. For other details and tutorials, please go to our [documentation](https://mmgeneration.readthedocs.io/). ## ModelZoo These methods have been carefully studied and supported in our frameworks:
Unconditional GANs (click to collapse) - ✅ [DCGAN](configs/dcgan/README.md) (ICLR'2016) - ✅ [WGAN-GP](configs/wgan-gp/README.md) (NIPS'2017) - ✅ [LSGAN](configs/lsgan/README.md) (ICCV'2017) - ✅ [GGAN](configs/ggan/README.md) (arXiv'2017) - ✅ [PGGAN](configs/pggan/README.md) (ICLR'2018) - ✅ [StyleGANV1](configs/styleganv1/README.md) (CVPR'2019) - ✅ [StyleGANV2](configs/styleganv2/README.md) (CVPR'2020) - ✅ [StyleGANV3](configs/styleganv3/README.md) (NeurIPS'2021) - ✅ [Positional Encoding in GANs](configs/positional_encoding_in_gans/README.md) (CVPR'2021)
Conditional GANs (click to collapse) - ✅ [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)
Tricks for GANs (click to collapse) - ✅ [ADA](configs/ada/README.md) (NeurIPS'2020)
Image2Image Translation (click to collapse) - ✅ [Pix2Pix](configs/pix2pix/README.md) (CVPR'2017) - ✅ [CycleGAN](configs/cyclegan/README.md) (ICCV'2017)
Internal Learning (click to collapse) - ✅ [SinGAN](configs/singan/README.md) (ICCV'2019)
Denoising Diffusion Probabilistic Models (click to collapse) - ✅ [Improved DDPM](configs/improved_ddpm/README.md) (arXiv'2021)
## Related-Applications - ✅ [MMGEN-FaceStylor](https://github.com/open-mmlab/MMGEN-FaceStylor) ## Contributing We appreciate all contributions to improve MMGeneration. Please refer to [CONTRIBUTING.md](https://github.com/open-mmlab/mmcv/blob/master/CONTRIBUTING.md) in MMCV for more details about the contributing guideline. ## Citation If you find this project useful in your research, please consider cite: ```BibTeX @misc{2021mmgeneration, title={{MMGeneration}: OpenMMLab Generative Model Toolbox and Benchmark}, author={MMGeneration Contributors}, howpublished = {\url{https://github.com/open-mmlab/mmgeneration}}, year={2021} } ``` ## License This project is released under the [Apache 2.0 license](LICENSE). Some operations in `MMGeneration` are with other licenses instead of Apache2.0. Please refer to [LICENSES.md](LICENSES.md) for the careful check, if you are using our code for commercial matters. ## Projects in OpenMMLab - [MMCV](https://github.com/open-mmlab/mmcv): OpenMMLab foundational library for computer vision. - [MIM](https://github.com/open-mmlab/mim): MIM installs OpenMMLab packages. - [MMClassification](https://github.com/open-mmlab/mmclassification): OpenMMLab image classification toolbox and benchmark. - [MMDetection](https://github.com/open-mmlab/mmdetection): OpenMMLab detection toolbox and benchmark. - [MMDetection3D](https://github.com/open-mmlab/mmdetection3d): OpenMMLab's next-generation platform for general 3D object detection. - [MMRotate](https://github.com/open-mmlab/mmrotate): OpenMMLab rotated object detection toolbox and benchmark. - [MMSegmentation](https://github.com/open-mmlab/mmsegmentation): OpenMMLab semantic segmentation toolbox and benchmark. - [MMOCR](https://github.com/open-mmlab/mmocr): OpenMMLab text detection, recognition, and understanding toolbox. - [MMPose](https://github.com/open-mmlab/mmpose): OpenMMLab pose estimation toolbox and benchmark. - [MMHuman3D](https://github.com/open-mmlab/mmhuman3d): OpenMMLab 3D human parametric model toolbox and benchmark. - [MMSelfSup](https://github.com/open-mmlab/mmselfsup): OpenMMLab self-supervised learning toolbox and benchmark. - [MMRazor](https://github.com/open-mmlab/mmrazor): OpenMMLab model compression toolbox and benchmark. - [MMFewShot](https://github.com/open-mmlab/mmfewshot): OpenMMLab fewshot learning toolbox and benchmark. - [MMAction2](https://github.com/open-mmlab/mmaction2): OpenMMLab's next-generation action understanding toolbox and benchmark. - [MMTracking](https://github.com/open-mmlab/mmtracking): OpenMMLab video perception toolbox and benchmark. - [MMFlow](https://github.com/open-mmlab/mmflow): OpenMMLab optical flow toolbox and benchmark. - [MMEditing](https://github.com/open-mmlab/mmediting): OpenMMLab image and video editing toolbox. - [MMGeneration](https://github.com/open-mmlab/mmgeneration): OpenMMLab image and video generative models toolbox. - [MMDeploy](https://github.com/open-mmlab/mmdeploy): OpenMMLab model deployment framework.