# mmediting
**Repository Path**: mirrors_open-mmlab/mmediting
## Basic Information
- **Project Name**: mmediting
- **Description**: OpenMMLab Multimodal Advanced, Generative, and Intelligent Creation Toolbox. Unlock the magic 🪄: Generative-AI (AIGC), easy-to-use APIs, awsome model zoo, diffusion models, for text-to-image generation, image/video restoration/enhancement, etc.
- **Primary Language**: Unknown
- **License**: Apache-2.0
- **Default Branch**: main
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2021-10-22
- **Last Updated**: 2025-12-14
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
Multimodal Advanced, Generative, and Intelligent Creation (MMagic [em'mædʒɪk])
[](https://pypi.org/project/mmagic/)
[](https://mmagic.readthedocs.io/zh_CN/latest/)
[](https://github.com/open-mmlab/mmagic/actions)
[](https://codecov.io/gh/open-mmlab/mmagic)
[](https://github.com/open-mmlab/mmagic/blob/main/LICENSE)
[](https://github.com/open-mmlab/mmagic/issues)
[](https://github.com/open-mmlab/mmagic/issues)
[](https://openxlab.org.cn/apps/detail/%E6%94%BF%E6%9D%B0/OpenMMLab-Projects)
[📘使用文档](https://mmagic.readthedocs.io/zh_CN/latest/) |
[🛠️安装教程](https://mmagic.readthedocs.io/zh_CN/latest/get_started/install.html) |
[📊模型库](https://mmagic.readthedocs.io/zh_CN/latest/model_zoo/overview.html) |
[🆕更新记录](https://mmagic.readthedocs.io/zh_CN/latest/changelog.html) |
[🚀进行中的项目](https://github.com/open-mmlab/mmagic/projects) |
[🤔提出问题](https://github.com/open-mmlab/mmagic/issues)
[English](README.md) | 简体中文
## 🚀 最新进展
### 最新的 [**MMagic v1.2.0**](https://github.com/open-mmlab/mmagic/releases/tag/v1.2.0) 版本已经在 \[18/12/2023\] 发布:
- 我们的代码仓库中发布了一个先进而强大的图像 inpainting 算法 PowerPaint。 [Click to View](https://github.com/open-mmlab/mmagic/tree/main/projects/powerpaint)
我们正式发布 MMagic v1.0.0 版本,源自 [MMEditing](https://github.com/open-mmlab/mmediting) 和 [MMGeneration](https://github.com/open-mmlab/mmgeneration)。
经过 OpenMMLab 2.0 框架的迭代更新以及与 MMGeneration 的合并,MMEditing 已经成为了一个支持基于 GAN 和 CNN 的底层视觉算法的强大工具。而今天,MMEditing 将更加拥抱生成式 AI(Generative AI),正式更名为 **MMagic**(**M**ultimodal **A**dvanced, **G**enerative, and **I**ntelligent **C**reation),致力于打造更先进、更全面的 AIGC 开源算法库。MMagic 将为广大研究者与 AIGC 爱好者们提供更加快捷灵活的实验支持,助力你的 AIGC 探索之旅。
以下是此次版本发布的重点新功能:
**1. 新算法**
我们支持了4个新任务以及11个新算法。
- Text2Image / Diffusion
- ControlNet
- DreamBooth
- Stable Diffusion
- Disco Diffusion
- GLIDE
- Guided Diffusion
- 3D-aware Generation
- EG3D
- Image Restoration
- NAFNet
- Restormer
- SwinIR
- Image Colorization
- InstColorization
**2. Magic Diffusion Model**
针对 Diffusion Model,我们提供了以下“魔法”
- 支持基于 Stable Diffusion 与 Disco Diffusion 的图像生成.
- 支持 Dreambooth 以及 DreamBooth LoRA 等 Finetune 方法.
- 支持 ControlNet 进行可控性的文本到图像生成.
- 支持 xFormers 加速和优化策略,提高训练与推理效率.
- 支持基于 MultiFrame Render 的视频生成.
- 支持通过 Wrapper 调用 Diffusers 的基础模型以及采样策略.
**3. 框架升级**
通过 OpenMMLab 2.0 框架的 MMEngine 和 MMCV, MMagic 在以下几方面完成升级:
- 重构 DataSample,支持 batch 维度的组合与拆分.
- 重构 DataPreprocessor,并统一各种任务在训练与推理时的数据格式.
- 重构 MultiValLoop 与 MultiTestLoop,同时支持生成类型指标(e.g. FID)与重建类型指标(e.g. SSIM) 的评测,同时支持一次性评测多个数据集
- 支持本地可视化以及使用 tensorboard 或 wandb的可视化.
- 支持 33+ 算法 Pytorch 2.0 加速.
**MMagic** 已经支持了[MMEditing](https://github.com/open-mmlab/mmediting)和[MMGeneration](https://github.com/open-mmlab/mmgeneration)中的全量任务、模型、优化函数和评价指标 ,并基于[MMEngine](https://github.com/open-mmlab/mmengine)统一了各组件接口 😍。
如果想了解更多版本更新细节和历史信息,请阅读[更新日志](docs/zh_cn/changelog.md)。如果想从[旧版本](https://github.com/open-mmlab/mmagic/tree/master) MMEditing 0.x 迁移到新版本 MMagic 1.x,请阅读[迁移文档](docs/zh_cn/migration/overview.md)。
## 📄 目录
- [📖 介绍](#-介绍)
- [🙌 参与贡献](#-参与贡献)
- [🛠️ 安装](#%EF%B8%8F-安装)
- [📊 模型库](#-模型库)
- [🤝 致谢](#-致谢)
- [🖊️ 引用](#%EF%B8%8F-引用)
- [🎫 许可证](#-许可证)
- [🏗️ ️OpenMMLab 的其他项目](#%EF%B8%8F-️openmmlab-的其他项目)
## 📖 介绍
MMagic 是基于 PyTorch 的图像&视频编辑和生成开源工具箱。是 [OpenMMLab](https://openmmlab.com/) 项目的成员之一。
目前 MMagic 支持多种图像和视频的生成/编辑任务。
https://user-images.githubusercontent.com/49083766/233564593-7d3d48ed-e843-4432-b610-35e3d257765c.mp4
### ✨ 主要特性
- **SOTA 算法**
MMagic 提供了处理、编辑、生成图像和视频的 SOTA 算法。
- **强有力且流行的应用**
MMagic 支持了流行的图像修复、图文生成、3D生成、图像修补、抠图、超分辨率和生成等任务的应用。特别是 MMagic 支持了 Stable Diffusion 的微调和许多激动人心的 diffusion 应用,例如 ControlNet 动画生成。MMagic 也支持了 GANs 的插值,投影,编辑和其他流行的应用。请立即开始你的 AIGC 探索之旅!
- **高效的框架**
通过 OpenMMLab 2.0 框架的 MMEngine 和 MMCV, MMagic 将编辑框架分解为不同的组件,并且可以通过组合不同的模块轻松地构建自定义的编辑器模型。我们可以像搭建“乐高”一样定义训练流程,提供丰富的组件和策略。在 MMagic 中,你可以使用不同的 APIs 完全控制训练流程。得益于 [MMSeparateDistributedDataParallel](https://github.com/open-mmlab/mmengine/blob/main/mmengine/model/wrappers/seperate_distributed.py), 动态模型结构的分布式训练可以轻松实现。
### ✨ 最佳实践
- 主分支代码的最佳实践基于 **Python 3.9+** 和 **PyTorch 2.0+** 。
🔝返回目录
## 🙌 参与贡献
越来越多社区贡献者的加入使我们的算法库日益发展。最近由社区贡献的项目包括:
- [SDXL](configs/stable_diffusion_xl/README.md) 来自 @okotaku.
- [AnimateDiff](configs/animatediff/README.md) 来自 @ElliotQi.
- [ViCo](configs/vico/README.md) 来自 @FerryHuang.
- [DragGan](configs/draggan/README.md) 来自 @qsun1.
- [FastComposer](configs/fastcomposer/README.md) 来自 @xiaomile.
为使向 MMagic 中添加项目更加容易,我们开启了 [Projects](projects/README.md) 。
感谢您为改善 MMagic 所做的所有贡献。请参阅 MMCV 中的 [CONTRIBUTING.md](https://github.com/open-mmlab/mmcv/blob/main/CONTRIBUTING_zh-CN.md) 和 MMEngine 中的 [CONTRIBUTING.md](https://github.com/open-mmlab/mmengine/blob/main/CONTRIBUTING_zh-CN.md) 以获取贡献指南。
🔝返回目录
## 🛠️ 安装
MMagic 依赖 [PyTorch](https://pytorch.org/),[MMEngine](https://github.com/open-mmlab/mmengine) 和 [MMCV](https://github.com/open-mmlab/mmcv),以下是安装的简要步骤。
**步骤 1.**
依照[官方教程](https://pytorch.org/get-started/locally/)安装 PyTorch 。
**步骤 2.**
使用 [MIM](https://github.com/open-mmlab/mim) 安装 MMCV,MMEngine 和 MMagic 。
```
pip3 install openmim
mim install 'mmcv>=2.0.0'
mim install 'mmengine'
mim install 'mmagic'
```
**步骤 3.**
验证 MMagic 安装成功。
```shell
cd ~
python -c "import mmagic; print(mmagic.__version__)"
# Example output: 1.0.0
```
**开始使用**
成功安装 MMagic 后,你可以很容易地上手使用 MMagic!仅需几行代码,你就可以使用 MMagic 完成文本生成图像!
```python
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)
```
请参考[快速运行](docs/zh_cn/get_started/quick_run.md)和[推理演示](docs/zh_cn/user_guides/inference.md)获取 MMagic 的基本用法。
**从源码安装 MMagic**
使用以下命令从源码安装 MMagic,你可以选择不使用已发布的稳定版本,而在最新开发的版本上进行实验。
```
git clone https://github.com/open-mmlab/mmagic.git
cd mmagic
pip3 install -e .
```
更详细的安装指南请参考 [安装指南](docs/zh_cn/get_started/install.md) 。
🔝Back to top
## 📊 模型库
支持的算法
|
Conditional GANs
|
Unconditional GANs
|
Image Restoration
|
Image Super-Resolution
|
|
|
|
|
|
|
Video Super-Resolution
|
Video Interpolation
|
Image Colorization
|
Image Translation
|
|
|
|
|
|
|
Inpainting
|
Matting
|
Text-to-Image(Video)
|
3D-aware Generation
|
|
|
|
|
|
请参考[模型库](https://mmagic.readthedocs.io/zh_CN/latest/model_zoo/overview.html)了解详情。
🔝返回目录
## 🤝 致谢
MMagic 是一款由不同学校和公司共同贡献的开源项目。我们感谢所有为项目提供算法复现和新功能支持的贡献者,以及提供宝贵反馈的用户。我们希望该工具箱和基准测试可以为社区提供灵活的代码工具,供用户复现现有算法并开发自己的新模型,从而不断为开源社区提供贡献。
🔝返回目录
## 🖊️ 引用
如果 MMagic 对您的研究有所帮助,请按照如下 bibtex 引用它。
```bibtex
@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}
}
```
```bibtex
@misc{mmediting2022,
title = {{MMEditing}: {OpenMMLab} Image and Video Editing Toolbox},
author = {{MMEditing Contributors}},
howpublished = {\url{https://github.com/open-mmlab/mmediting}},
year = {2022}
}
```
🔝返回目录
## 🎫 许可证
本项目开源自 [Apache 2.0 license](LICENSE)。
🔝返回目录
## 🏗️ ️OpenMMLab 的其他项目
- [MMEngine](https://github.com/open-mmlab/mmengine): OpenMMLab MMEngine.
- [MMCV](https://github.com/open-mmlab/mmcv): OpenMMLab 计算机视觉基础库
- [MIM](https://github.com/open-mmlab/mim): MIM 是 OpenMMlab 项目、算法、模型的统一入口
- [MMPreTrain](https://github.com/open-mmlab/mmpretrain): OpenMMLab 预训练工具箱
- [MMDetection](https://github.com/open-mmlab/mmdetection): OpenMMLab 目标检测工具箱
- [MMDetection3D](https://github.com/open-mmlab/mmdetection3d): OpenMMLab 新一代通用 3D 目标检测平台
- [MMRotate](https://github.com/open-mmlab/mmrotate): OpenMMLab 旋转框检测工具箱与测试基准
- [MMSegmentation](https://github.com/open-mmlab/mmsegmentation): OpenMMLab 语义分割工具箱
- [MMOCR](https://github.com/open-mmlab/mmocr): OpenMMLab 全流程文字检测识别理解工具箱
- [MMPose](https://github.com/open-mmlab/mmpose): OpenMMLab 姿态估计工具箱
- [MMHuman3D](https://github.com/open-mmlab/mmhuman3d): OpenMMLab 人体参数化模型工具箱与测试基准
- [MMSelfSup](https://github.com/open-mmlab/mmselfsup): OpenMMLab 自监督学习工具箱与测试基准
- [MMRazor](https://github.com/open-mmlab/mmrazor): OpenMMLab 模型压缩工具箱与测试基准
- [MMFewShot](https://github.com/open-mmlab/mmfewshot): OpenMMLab 少样本学习工具箱与测试基准
- [MMAction2](https://github.com/open-mmlab/mmaction2): OpenMMLab 新一代视频理解工具箱
- [MMTracking](https://github.com/open-mmlab/mmtracking): OpenMMLab 一体化视频目标感知平台
- [MMFlow](https://github.com/open-mmlab/mmflow): OpenMMLab 光流估计工具箱与测试基准
- [MMagic](https://github.com/open-mmlab/mmagic): OpenMMLab 新一代人工智能内容生成(AIGC)工具箱
- [MMDeploy](https://github.com/open-mmlab/mmdeploy): OpenMMLab 模型部署框架
🔝返回目录
## 欢迎加入 OpenMMLab 社区
扫描下方的二维码可关注 OpenMMLab 团队的 [知乎官方账号](https://www.zhihu.com/people/openmmlab),扫描下方微信二维码添加喵喵好友,进入 MMagic 微信交流社群。【加好友申请格式:研究方向+地区+学校/公司+姓名】
我们会在 OpenMMLab 社区为大家
- 📢 分享 AI 框架的前沿核心技术
- 💻 解读 PyTorch 常用模块源码
- 📰 发布 OpenMMLab 的相关新闻
- 🚀 介绍 OpenMMLab 开发的前沿算法
- 🏃 获取更高效的问题答疑和意见反馈
- 🔥 提供与各行各业开发者充分交流的平台
干货满满 📘,等你来撩 💗,OpenMMLab 社区期待您的加入 👬