Home

Awesome

<div id="top" align="center"> <img src="docs/en/_static/image/mmagic-logo.png" width="500px"/> <div>&nbsp;</div> <div align="center"> <font size="10"><b>M</b>ultimodal <b>A</b>dvanced, <b>G</b>enerative, and <b>I</b>ntelligent <b>C</b>reation (MMagic [em'mædʒɪk])</font> </div> <div>&nbsp;</div> <div align="center"> <b><font size="5">OpenMMLab website</font></b> <sup> <a href="https://openmmlab.com"> <i><font size="4">HOT</font></i> </a> </sup> &nbsp;&nbsp;&nbsp;&nbsp; <b><font size="5">OpenMMLab platform</font></b> <sup> <a href="https://platform.openmmlab.com"> <i><font size="4">TRY IT OUT</font></i> </a> </sup> </div> <div>&nbsp;</div>

PyPI docs badge codecov license open issues issue resolution Open in OpenXLab

📘Documentation | 🛠️Installation | 📊Model Zoo | 🆕Update News | 🚀Ongoing Projects | 🤔Reporting Issues

English | 简体中文

</div> <div align="center"> <a href="https://openmmlab.medium.com/" style="text-decoration:none;"> <img src="https://user-images.githubusercontent.com/25839884/218352562-cdded397-b0f3-4ca1-b8dd-a60df8dca75b.png" width="3%" alt="" /></a> <img src="https://user-images.githubusercontent.com/25839884/218346358-56cc8e2f-a2b8-487f-9088-32480cceabcf.png" width="3%" alt="" /> <a href="https://discord.gg/raweFPmdzG" style="text-decoration:none;"> <img src="https://user-images.githubusercontent.com/25839884/218347213-c080267f-cbb6-443e-8532-8e1ed9a58ea9.png" width="3%" alt="" /></a> <img src="https://user-images.githubusercontent.com/25839884/218346358-56cc8e2f-a2b8-487f-9088-32480cceabcf.png" width="3%" alt="" /> <a href="https://twitter.com/OpenMMLab" style="text-decoration:none;"> <img src="https://user-images.githubusercontent.com/25839884/218346637-d30c8a0f-3eba-4699-8131-512fb06d46db.png" width="3%" alt="" /></a> <img src="https://user-images.githubusercontent.com/25839884/218346358-56cc8e2f-a2b8-487f-9088-32480cceabcf.png" width="3%" alt="" /> <a href="https://www.youtube.com/openmmlab" style="text-decoration:none;"> <img src="https://user-images.githubusercontent.com/25839884/218346691-ceb2116a-465a-40af-8424-9f30d2348ca9.png" width="3%" alt="" /></a> </div>

🚀 What's New <a><img width="35" height="20" src="https://user-images.githubusercontent.com/12782558/212848161-5e783dd6-11e8-4fe0-bbba-39ffb77730be.png"></a>

New release MMagic v1.2.0 [18/12/2023]:

We are excited to announce the release of MMagic v1.0.0 that inherits from MMEditing and MMGeneration.

After iterative updates with OpenMMLab 2.0 framework and merged with MMGeneration, MMEditing has become a powerful tool that supports low-level algorithms based on both GAN and CNN. Today, MMEditing embraces Generative AI and transforms into a more advanced and comprehensive AIGC toolkit: MMagic (Multimodal Advanced, Generative, and Intelligent Creation). MMagic will provide more agile and flexible experimental support for researchers and AIGC enthusiasts, and help you on your AIGC exploration journey.

We highlight the following new features.

1. New Models

We support 11 new models in 4 new tasks.

2. Magic Diffusion Model

For the Diffusion Model, we provide the following "magic" :

3. Upgraded Framework

By using MMEngine and MMCV of OpenMMLab 2.0 framework, MMagic has upgraded in the following new features:

MMagic has supported all the tasks, models, metrics, and losses in MMEditing and MMGeneration and unifies interfaces of all components based on MMEngine 😍.

Please refer to changelog.md for details and release history.

Please refer to migration documents to migrate from old version MMEditing 0.x to new version MMagic 1.x .

<div id="table" align="center"></div>

📄 Table of Contents

📖 Introduction

MMagic (Multimodal Advanced, Generative, and Intelligent Creation) is an advanced and comprehensive AIGC toolkit that inherits from MMEditing and MMGeneration. It is an open-source image and video editing&generating toolbox based on PyTorch. It is a part of the OpenMMLab project.

Currently, MMagic support multiple image and video generation/editing tasks.

https://user-images.githubusercontent.com/49083766/233564593-7d3d48ed-e843-4432-b610-35e3d257765c.mp4

✨ Major features

✨ Best Practice

<p align="right"><a href="#table">🔝Back to Table of Contents</a></p>

🙌 Contributing

More and more community contributors are joining us to make our repo better. Some recent projects are contributed by the community including:

Projects is opened to make it easier for everyone to add projects to MMagic.

We appreciate all contributions to improve MMagic. Please refer to CONTRIBUTING.md in MMCV and CONTRIBUTING.md in MMEngine for more details about the contributing guideline.

<p align="right"><a href="#table">🔝Back to Table of Contents</a></p>

🛠️ Installation

MMagic depends on PyTorch, MMEngine and MMCV. Below are quick steps for installation.

Step 1. Install PyTorch following official instructions.

Step 2. Install MMCV, MMEngine and MMagic with MIM.

pip3 install openmim
mim install mmcv>=2.0.0
mim install mmengine
mim install mmagic

Step 3. Verify MMagic has been successfully installed.

cd ~
python -c "import mmagic; print(mmagic.__version__)"
# Example output: 1.0.0

Getting Started

After installing MMagic successfully, now you are able to play with MMagic! To generate an image from text, you only need several lines of codes by MMagic!

from mmagic.apis import MMagicInferencer
sd_inferencer = MMagicInferencer(model_name='stable_diffusion')
text_prompts = 'A panda is having dinner at KFC'
result_out_dir = 'output/sd_res.png'
sd_inferencer.infer(text=text_prompts, result_out_dir=result_out_dir)

Please see quick run and inference for the basic usage of MMagic.

Install MMagic from source

You can also experiment on the latest developed version rather than the stable release by installing MMagic from source with the following commands:

git clone https://github.com/open-mmlab/mmagic.git
cd mmagic
pip3 install -e .

Please refer to installation for more detailed instruction.

<p align="right"><a href="#table">🔝Back to Table of Contents</a></p>

📊 Model Zoo

<div align="center"> <b>Supported algorithms</b> </div> <table align="center"> <tbody> <tr align="center" valign="bottom"> <td> <b>Conditional GANs</b> </td> <td> <b>Unconditional GANs</b> </td> <td> <b>Image Restoration</b> </td> <td> <b>Image Super-Resolution</b> </td> </tr> <tr valign="top"> <td> <ul> <li><a href="configs/sngan_proj/README.md">SNGAN/Projection GAN (ICLR'2018)</a></li> <li><a href="configs/sagan/README.md">SAGAN (ICML'2019)</a></li> <li><a href="configs/biggan/README.md">BIGGAN/BIGGAN-DEEP (ICLR'2018)</a></li> </ul> </td> <td> <ul> <li><a href="configs/dcgan/README.md">DCGAN (ICLR'2016)</a></li> <li><a href="configs/wgan-gp/README.md">WGAN-GP (NeurIPS'2017)</a></li> <li><a href="configs/lsgan/README.md">LSGAN (ICCV'2017)</a></li> <li><a href="configs/ggan/README.md">GGAN (ArXiv'2017)</a></li> <li><a href="configs/pggan/README.md">PGGAN (ICLR'2018)</a></li> <li><a href="configs/singan/README.md">SinGAN (ICCV'2019)</a></li> <li><a href="configs/styleganv1/README.md">StyleGANV1 (CVPR'2019)</a></li> <li><a href="configs/styleganv2/README.md">StyleGANV2 (CVPR'2019)</a></li> <li><a href="configs/styleganv3/README.md">StyleGANV3 (NeurIPS'2021)</a></li> <li><a href="configs/draggan/README.md">DragGan (2023)</a></li> </ul> </td> <td> <ul> <li><a href="configs/swinir/README.md">SwinIR (ICCVW'2021)</a></li> <li><a href="configs/nafnet/README.md">NAFNet (ECCV'2022)</a></li> <li><a href="configs/restormer/README.md">Restormer (CVPR'2022)</a></li> </ul> </td> <td> <ul> <li><a href="configs/srcnn/README.md">SRCNN (TPAMI'2015)</a></li> <li><a href="configs/srgan_resnet/README.md">SRResNet&SRGAN (CVPR'2016)</a></li> <li><a href="configs/edsr/README.md">EDSR (CVPR'2017)</a></li> <li><a href="configs/esrgan/README.md">ESRGAN (ECCV'2018)</a></li> <li><a href="configs/rdn/README.md">RDN (CVPR'2018)</a></li> <li><a href="configs/dic/README.md">DIC (CVPR'2020)</a></li> <li><a href="configs/ttsr/README.md">TTSR (CVPR'2020)</a></li> <li><a href="configs/glean/README.md">GLEAN (CVPR'2021)</a></li> <li><a href="configs/liif/README.md">LIIF (CVPR'2021)</a></li> <li><a href="configs/real_esrgan/README.md">Real-ESRGAN (ICCVW'2021)</a></li> </ul> </td> </tr> </td> </tr> </tbody> <tbody> <tr align="center" valign="bottom"> <td> <b>Video Super-Resolution</b> </td> <td> <b>Video Interpolation</b> </td> <td> <b>Image Colorization</b> </td> <td> <b>Image Translation</b> </td> </tr> <tr valign="top"> <td> <ul> <li><a href="configs/edvr/README.md">EDVR (CVPR'2018)</a></li> <li><a href="configs/tof/README.md">TOF (IJCV'2019)</a></li> <li><a href="configs/tdan/README.md">TDAN (CVPR'2020)</a></li> <li><a href="configs/basicvsr/README.md">BasicVSR (CVPR'2021)</a></li> <li><a href="configs/iconvsr/README.md">IconVSR (CVPR'2021)</a></li> <li><a href="configs/basicvsr_pp/README.md">BasicVSR++ (CVPR'2022)</a></li> <li><a href="configs/real_basicvsr/README.md">RealBasicVSR (CVPR'2022)</a></li> </ul> </td> <td> <ul> <li><a href="configs/tof/README.md">TOFlow (IJCV'2019)</a></li> <li><a href="configs/cain/README.md">CAIN (AAAI'2020)</a></li> <li><a href="configs/flavr/README.md">FLAVR (CVPR'2021)</a></li> </ul> </td> <td> <ul> <li><a href="configs/inst_colorization/README.md">InstColorization (CVPR'2020)</a></li> </ul> </td> <td> <ul> <li><a href="configs/pix2pix/README.md">Pix2Pix (CVPR'2017)</a></li> <li><a href="configs/cyclegan/README.md">CycleGAN (ICCV'2017)</a></li> </ul> </td> </tr> </td> </tr> </tbody> <tbody> <tr align="center" valign="bottom"> <td> <b>Inpainting</b> </td> <td> <b>Matting</b> </td> <td> <b>Text-to-Image(Video)</b> </td> <td> <b>3D-aware Generation</b> </td> </tr> <tr valign="top"> <td> <ul> <li><a href="configs/global_local/README.md">Global&Local (ToG'2017)</a></li> <li><a href="configs/deepfillv1/README.md">DeepFillv1 (CVPR'2018)</a></li> <li><a href="configs/partial_conv/README.md">PConv (ECCV'2018)</a></li> <li><a href="configs/deepfillv2/README.md">DeepFillv2 (CVPR'2019)</a></li> <li><a href="configs/aot_gan/README.md">AOT-GAN (TVCG'2019)</a></li> <li><a href="configs/stable_diffusion/README.md">Stable Diffusion Inpainting (CVPR'2022)</a></li> </ul> </td> <td> <ul> <li><a href="configs/dim/README.md">DIM (CVPR'2017)</a></li> <li><a href="configs/indexnet/README.md">IndexNet (ICCV'2019)</a></li> <li><a href="configs/gca/README.md">GCA (AAAI'2020)</a></li> </ul> </td> <td> <ul> <li><a href="projects/glide/configs/README.md">GLIDE (NeurIPS'2021)</a></li> <li><a href="configs/guided_diffusion/README.md">Guided Diffusion (NeurIPS'2021)</a></li> <li><a href="configs/disco_diffusion/README.md">Disco-Diffusion (2022)</a></li> <li><a href="configs/stable_diffusion/README.md">Stable-Diffusion (2022)</a></li> <li><a href="configs/dreambooth/README.md">DreamBooth (2022)</a></li> <li><a href="configs/textual_inversion/README.md">Textual Inversion (2022)</a></li> <li><a href="projects/prompt_to_prompt/README.md">Prompt-to-Prompt (2022)</a></li> <li><a href="projects/prompt_to_prompt/README.md">Null-text Inversion (2022)</a></li> <li><a href="configs/controlnet/README.md">ControlNet (2023)</a></li> <li><a href="configs/controlnet_animation/README.md">ControlNet Animation (2023)</a></li> <li><a href="configs/stable_diffusion_xl/README.md">Stable Diffusion XL (2023)</a></li> <li><a href="configs/animatediff/README.md">AnimateDiff (2023)</a></li> <li><a href="configs/vico/README.md">ViCo (2023)</a></li> <li><a href="configs/fastcomposer/README.md">FastComposer (2023)</a></li> <li><a href="projects/powerpaint/README.md">PowerPaint (2023)</a></li> </ul> </td> <td> <ul> <li><a href="configs/eg3d/README.md">EG3D (CVPR'2022)</a></li> </ul> </td> </tr> </td> </tr> </tbody> </table>

Please refer to model_zoo for more details.

<p align="right"><a href="#table">🔝Back to Table of Contents</a></p>

🤝 Acknowledgement

MMagic is an open source project that is contributed by researchers and engineers from various colleges and companies. We wish that the toolbox and benchmark could serve the growing research community by providing a flexible toolkit to reimplement existing methods and develop their own new methods.

We appreciate all the contributors who implement their methods or add new features, as well as users who give valuable feedbacks. Thank you all!

<a href="https://github.com/open-mmlab/mmagic/graphs/contributors"> <img src="https://contrib.rocks/image?repo=open-mmlab/mmagic" /> </a> <p align="right"><a href="#table">🔝Back to Table of Contents</a></p>

🖊️ Citation

If MMagic is helpful to your research, please cite it as below.

@misc{mmagic2023,
    title = {{MMagic}: {OpenMMLab} Multimodal Advanced, Generative, and Intelligent Creation Toolbox},
    author = {{MMagic Contributors}},
    howpublished = {\url{https://github.com/open-mmlab/mmagic}},
    year = {2023}
}
@misc{mmediting2022,
    title = {{MMEditing}: {OpenMMLab} Image and Video Editing Toolbox},
    author = {{MMEditing Contributors}},
    howpublished = {\url{https://github.com/open-mmlab/mmediting}},
    year = {2022}
}
<p align="right"><a href="#table">🔝Back to Table of Contents</a></p>

🎫 License

This project is released under the Apache 2.0 license. Please refer to LICENSES for the careful check, if you are using our code for commercial matters.

<p align="right"><a href="#table">🔝Back to Table of Contents</a></p>

🏗️ ️OpenMMLab Family

<p align="right"><a href="#table">🔝Back to Table of Contents</a></p>