---
title: "DiffBIR-新一代超分技术，免费开源的照片修复工具"
canonical: "https://96p.net/articles/stable-diffusion/41467/DiffBIR-%E6%96%B0%E4%B8%80%E4%BB%A3%E8%B6%85%E5%88%86%E6%8A%80%E6%9C%AF%EF%BC%8C%E5%85%8D%E8%B4%B9%E5%BC%80%E6%BA%90%E7%9A%84%E7%85%A7%E7%89%87%E4%BF%AE%E5%A4%8D%E5%B7%A5%E5%85%B7"
---

# DiffBIR-新一代超分技术，免费开源的照片修复工具

> 发布时间：2023-12-19
> 栏目：StableDiffusion

<div>
<section data-website="https://www.mdnice.com" style="margin-bottom: 0px;">
<h2></h2>
</section>
<section data-website="https://www.mdnice.com" style="margin-bottom: 0px;">
<section data-website="https://www.mdnice.com">
<section data-website="https://www.mdnice.com">
<section data-website="https://www.mdnice.com" style="padding-right: 10px; padding-left: 10px; text-align: left; line-height: 1.6; letter-spacing: 0.034em; color: #3f3f3f; font-size: 16px; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;">
<h2 style="font-weight: bold; color: black; font-size: 22px; text-align: center; background-image: url('https://www.96p.net/bizimg/mmbiz.qpic.cn/mmbiz_png/snVNX7xXtfr60icb5waPANGJz0BcWqNWnJ0eFEC2CzibGDPzicQLgU7ibJ6nwlicuqg4JEVo6LDhQv8Jbib1mjiavQYOA/640?wx_fmt=png&amp;from=appmsg'); background-position: center center; background-repeat: no-repeat; background-attachment: initial; background-origin: initial; background-clip: initial; background-size: 50px; margin-top: 1em; margin-bottom: 10px;"><span style="display: none;"></span><span style="display: inline-block; height: 38px; line-height: 42px; color: #48b378; background-position: left center; background-repeat: no-repeat; background-attachment: initial; background-origin: initial; background-clip: initial; background-size: 63px; margin-top: 38px; font-size: 18px; margin-bottom: 10px;">前言</span></h2>
<figure style="margin-top: 10px; margin-bottom: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center;"><img alt="《DiffBIR-新一代超分技术，免费开源的照片修复工具》- 投稿作者:AI小分队 - 发布于:GetAI社区" data-imgfileid="100001689" data-ratio="0.7981481481481482" src="https://www.96p.net/bizimg/mmbiz.qpic.cn/mmbiz_jpg/snVNX7xXtfr60icb5waPANGJz0BcWqNWntkJMRiaXibvdrqOibiaibQDAYE7Qk1NfBz7ia6JT1vBNc3zT6JRjF0OicsAcQ/640" data-type="jpeg" data-w="1080" style="display: block; margin-right: auto; margin-left: auto; border-radius: 4px; margin-bottom: 25px; height: auto !important;" title="《DiffBIR-新一代超分技术，免费开源的照片修复工具》- 投稿作者:AI小分队 - 发布于:GetAI社区" /></figure>
<p style="padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;">当提到人工智能照片修复时，你或许会联想到像SD这样的生成式模型。但是，仅靠生成模型并不总能够提供理想的结果，因为这些模型有时会过度发挥其"想象力"，产生的图像可能与原始照片相去甚远。</p>
<p style="padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;">今天我们要介绍的AI照片修复模型则有效地克服了这一挑战。该模型不仅能够清除噪点和模糊，恢复老照片中的细节，让它们变得生动和丰富，而且确保修复后的图像忠于原照片的内容，这一创新性的修复算法模型，名为DiffBIR。</p>
<h2 style="font-weight: bold; color: black; font-size: 22px; text-align: center; background-image: url('https://www.96p.net/bizimg/mmbiz.qpic.cn/mmbiz_png/snVNX7xXtfr60icb5waPANGJz0BcWqNWnJ0eFEC2CzibGDPzicQLgU7ibJ6nwlicuqg4JEVo6LDhQv8Jbib1mjiavQYOA/640?wx_fmt=png&amp;from=appmsg'); background-position: center center; background-repeat: no-repeat; background-attachment: initial; background-origin: initial; background-clip: initial; background-size: 50px; margin-top: 1em; margin-bottom: 10px;"><span style="display: none;"></span><span style="display: inline-block; height: 38px; line-height: 42px; color: #48b378; background-position: left center; background-repeat: no-repeat; background-attachment: initial; background-origin: initial; background-clip: initial; background-size: 63px; margin-top: 38px; font-size: 18px; margin-bottom: 10px;">简介</span></h2>
<figure style="margin-top: 10px; margin-bottom: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center;"><img alt="《DiffBIR-新一代超分技术，免费开源的照片修复工具》- 投稿作者:AI小分队 - 发布于:GetAI社区" data-imgfileid="100001687" data-ratio="0.30648148148148147" src="https://www.96p.net/bizimg/mmbiz.qpic.cn/mmbiz_jpg/snVNX7xXtfr60icb5waPANGJz0BcWqNWnhWkv9y4tUicngUJuHgOW5svUuh6tW0SUtYsYNticXRCbAmLsEzePLpmA/640" data-type="jpeg" data-w="1080" style="display: block; margin-right: auto; margin-left: auto; border-radius: 4px; margin-bottom: 25px; height: auto !important;" title="《DiffBIR-新一代超分技术，免费开源的照片修复工具》- 投稿作者:AI小分队 - 发布于:GetAI社区" /></figure>
<p style="padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;">DiffBIR是由清华大学和上海人工智能实验室联合研发的创新技术。该技术结合了双阶段网络架构，首阶段利用模型如SwinIR之类的高效算法，专注于消除图像中因编码失真和JPEG压缩引起的各类低级退化问题。</p>
<p style="padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;">第二阶段，引入类似于Stable Diffusion这样的预训练模型作为图像先验知识，以指导系统渲染出高品质的视觉输出。DiffBIR的关键特性包括：</p>
<ul style="margin-top: 8px; margin-bottom: 8px; padding-left: 25px; color: black;">
<li>
<section style="margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;">整合端到端网络设计，能够全面恢复图像中受损的高频和低频细节。</section>
</li>
<li>
<section style="margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;">利用高效的生成模型作为先验，实现盲复原，消除了依赖对高质量图像的限制。</section>
</li>
<li>
<section style="margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;">具备优化的算法，显著改善了人像及常规场景图像的复原效果，超越了传统技术的表现。</section>
</li>
<li>
<section style="margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;">模型设计轻量且高效，适合部署到多种设备，满足实际操作的需求。</section>
</li>
<li>
<section style="margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;">提供用户友好的命令行接口和Web演示，使得用户能够轻松体验到先进的图像恢复功能。</section>
</li>
<li>
<section style="margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;">完全开源的模型与代码，支持用户进行个性化的训练和二次开发。</section>
</li>
</ul>
<p style="padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;">DiffBIR开辟了图像盲复原的新路径，既保证了出色的恢复效果，又免去了寻找高质量参照图像的工作。它的应用范围广泛，适合用于旧照片修复、摄像头图像增强等多个领域。</p>
<p style="padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;">下面介绍这个开源项目的使用方式。</p>
<h2 style="font-weight: bold; color: black; font-size: 22px; text-align: center; background-image: url('https://www.96p.net/bizimg/mmbiz.qpic.cn/mmbiz_png/snVNX7xXtfr60icb5waPANGJz0BcWqNWnJ0eFEC2CzibGDPzicQLgU7ibJ6nwlicuqg4JEVo6LDhQv8Jbib1mjiavQYOA/640?wx_fmt=png&amp;from=appmsg'); background-position: center center; background-repeat: no-repeat; background-attachment: initial; background-origin: initial; background-clip: initial; background-size: 50px; margin-top: 1em; margin-bottom: 10px;"><span style="display: none;"></span><span style="display: inline-block; height: 38px; line-height: 42px; color: #48b378; background-position: left center; background-repeat: no-repeat; background-attachment: initial; background-origin: initial; background-clip: initial; background-size: 63px; margin-top: 38px; font-size: 18px; margin-bottom: 10px;">项目下载</span></h2>
<blockquote style="border-top: none; border-right: none; border-bottom: none; font-size: 0.9em; overflow: auto; background: #fbf9fd; color: #6a737d; margin-bottom: 20px; margin-top: 20px; padding: 15px 20px; line-height: 27px; border-left-color: #35b378;">
<p style="line-height: 26px; font-size: 15px; color: #595959;">项目地址：https://github.com/XPixelGroup/DiffBIR</p>
</blockquote>
<p style="padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;">首先先将源码下载下来，下面是具体的 git 命令：</p>
<pre style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;"><span style="display: block; background: url('https://www.96p.net/bizimg/mmbiz.qpic.cn/mmbiz_svg/kSiaeFj92SMyLY2U6D1OWAia8WaaVy2BQoyuzweDht2ZMUU1p5jF73gL49O4I5Q6AwaXPrjSsxk1PWL0ptAaMDyevbDfKjgXHM/640?wx_fmt=svg&amp;from=appmsg') 10px 10px / 40px no-repeat #282c34; height: 30px; width: 100%; margin-bottom: -7px; border-radius: 5px;"></span><code style="overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;">git <span style="color: #e6c07b; line-height: 26px;">clone</span> https://github.com/XPixelGroup/DiffBIR.git<br /><span style="color: #e6c07b; line-height: 26px;">cd</span> DiffBIR<br /><br /><span style="color: #5c6370; font-style: italic; line-height: 26px;"># 创建虚拟环境</span><br />conda create -n diffbir python=3.9<br /><span style="color: #5c6370; font-style: italic; line-height: 26px;"># 激活虚拟环境</span><br />conda activate diffbir<br /><span style="color: #5c6370; font-style: italic; line-height: 26px;"># 安装相关依赖</span><br />pip install -r requirements.txt<br /></code></pre>
<p style="padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;">如果你是 Windows 的电脑，在安装依赖之前，因为里面有一个依赖包是不支持 Windows 系统的，所以需要额外先执行如下命令：</p>
<pre style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;"><span style="display: block; background: url('https://www.96p.net/bizimg/mmbiz.qpic.cn/mmbiz_svg/kSiaeFj92SMyLY2U6D1OWAia8WaaVy2BQoyuzweDht2ZMUU1p5jF73gL49O4I5Q6AwaXPrjSsxk1PWL0ptAaMDyevbDfKjgXHM/640?wx_fmt=svg&amp;from=appmsg') 10px 10px / 40px no-repeat #282c34; height: 30px; width: 100%; margin-bottom: -7px; border-radius: 5px;"></span><code style="overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;">pip install https://huggingface.co/r4ziel/xformers_pre_built/resolve/main/triton-2.0.0-cp310-cp310-win_amd64.whl<br /><span style="color: #5c6370; font-style: italic; line-height: 26px;"># 升级pip 然后安装 triton</span><br />pip install triton<br /></code></pre>
<p style="padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;">源码下载好了，在环境安装完成之后，在跑起来之前还需要先下载模型。</p>
<p style="padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;">在项目目录下，手动创建 <code style="font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #28ca71;">weights</code>目录，用来存放使用到的模型，下载下面的两个模型放在目录下。general_full_v1.ckptgeneral_swinir_v1.ckpt接下来执行下面的脚本，就可以在本地启用服务了,</p>
<pre style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;"><span style="display: block; background: url('https://www.96p.net/bizimg/mmbiz.qpic.cn/mmbiz_svg/kSiaeFj92SMyLY2U6D1OWAia8WaaVy2BQoyuzweDht2ZMUU1p5jF73gL49O4I5Q6AwaXPrjSsxk1PWL0ptAaMDyevbDfKjgXHM/640?wx_fmt=svg&amp;from=appmsg') 10px 10px / 40px no-repeat #282c34; height: 30px; width: 100%; margin-bottom: -7px; border-radius: 5px;"></span><code style="overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;">python gradio_diffbir.py \<br />--ckpt weights/general_full_v1.ckpt \<br />--config configs/model/cldm.yaml \<br />--reload_swinir \<br />--swinir_ckpt weights/general_swinir_v1.ckpt \<br />--device cuda<br /></code></pre>
<p style="padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;">在浏览器中打开 http://localhost:7860/</p>
<p style="padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;"><img alt="《DiffBIR-新一代超分技术，免费开源的照片修复工具》- 投稿作者:AI小分队 - 发布于:GetAI社区" data-imgfileid="100001686" data-ratio="0.6416666666666667" src="https://www.96p.net/bizimg/mmbiz.qpic.cn/mmbiz_jpg/snVNX7xXtfr60icb5waPANGJz0BcWqNWnViaWpCnRyiak0BeXu6KP5RsHq77XZZW6bYsxaibF290gFwCyOTX2UgFyw/640" data-type="jpeg" data-w="1080" style="display: block; margin-right: auto; margin-left: auto; border-radius: 4px; margin-bottom: 25px; height: auto !important;" title="《DiffBIR-新一代超分技术，免费开源的照片修复工具》- 投稿作者:AI小分队 - 发布于:GetAI社区" />选择你想要修复的图片，然后根据需要调整配置，就可以用来修复图片啦。</p>
<figure style="margin-top: 10px; margin-bottom: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center;"><img alt="《DiffBIR-新一代超分技术，免费开源的照片修复工具》- 投稿作者:AI小分队 - 发布于:GetAI社区" data-imgfileid="100001688" data-ratio="1.1287037037037038" src="https://www.96p.net/bizimg/mmbiz.qpic.cn/mmbiz_jpg/snVNX7xXtfr60icb5waPANGJz0BcWqNWnRu2cFkPI971icjnvc1GicnUqre3xN8Nm7UP866lQdsumyukr89K4ib1zQ/640" data-type="jpeg" data-w="1080" style="display: block; margin-right: auto; margin-left: auto; border-radius: 4px; margin-bottom: 25px; height: auto !important;" title="《DiffBIR-新一代超分技术，免费开源的照片修复工具》- 投稿作者:AI小分队 - 发布于:GetAI社区" /></figure>
<h2 style="font-weight: bold; color: black; font-size: 22px; text-align: center; background-image: url('https://www.96p.net/bizimg/mmbiz.qpic.cn/mmbiz_png/snVNX7xXtfr60icb5waPANGJz0BcWqNWnJ0eFEC2CzibGDPzicQLgU7ibJ6nwlicuqg4JEVo6LDhQv8Jbib1mjiavQYOA/640?wx_fmt=png&amp;from=appmsg'); background-position: center center; background-repeat: no-repeat; background-attachment: initial; background-origin: initial; background-clip: initial; background-size: 50px; margin-top: 1em; margin-bottom: 10px;"><span style="display: none;"></span><span style="display: inline-block; height: 38px; line-height: 42px; color: #48b378; background-position: left center; background-repeat: no-repeat; background-attachment: initial; background-origin: initial; background-clip: initial; background-size: 63px; margin-top: 38px; font-size: 18px; margin-bottom: 10px;">在线体验</span></h2>
<p style="padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;">如果你不想自己安装环境就想先体验一下，可以访问下面的链接，当网站的访问人数较多时，有可能会出现计算资源不足的情况，这个时候就等等再试就行。https://openxlab.org.cn/apps/detail/linxinqi/DiffBIR-official</p>
<p style="padding-bottom: 8px; padding-top: 1em; color: #4a4a4a; line-height: 1.75em;">下面是这个网页的体验效果，可以看到，修复的效果真的很惊艳。<img alt="《DiffBIR-新一代超分技术，免费开源的照片修复工具》- 投稿作者:AI小分队 - 发布于:GetAI社区" data-imgfileid="100001690" data-ratio="0.5259259259259259" src="https://www.96p.net/bizimg/mmbiz.qpic.cn/mmbiz_jpg/snVNX7xXtfr60icb5waPANGJz0BcWqNWnPnI9g87SXucgOV6icPFwJ4eM0rqZ59l3txLywGQTH1AGQsIPtuMETEA/640" data-type="jpeg" data-w="1080" style="display: block; margin-right: auto; margin-left: auto; border-radius: 4px; margin-bottom: 25px; height: auto !important;" title="《DiffBIR-新一代超分技术，免费开源的照片修复工具》- 投稿作者:AI小分队 - 发布于:GetAI社区" /></p>
</section>
<section data-website="https://www.mdnice.com" style="padding-right: 10px; padding-left: 10px; text-align: left; line-height: 1.6; letter-spacing: 0.034em; color: #3f3f3f; font-size: 16px; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;"></section>
</section>
</section>
</section>
</div>
<p>&nbsp;</p>
