开源项目解析
ControlNet
给扩散模型加条件控制。九种结构信号:Canny 边缘、直线、HED 边界、涂鸦、人体姿势、语义分割、深度、法线、线稿。
用结构信号控画面线稿/姿势/深度已停更但仍是事实标准
读懂层
2 张 · 架构图 / 流程图
DeepWiki 架构页 · 2025-04-18 索引 · 核验 2026-08-16
DeepWiki 架构页 · 抓取 2026-08-16 · 核验 2026-08-16
它管哪几个决定
画面构图线稿 / 姿势 / 深度约束
自持能力
权重在不在本地可下载到本地
种子能不能填不涉及
换掉它要动几处几处
控制模型本地加载,换一种信号换一个预处理器 + 一个模型
动手层
文档代码结构踩过的坑实测 未做
装它要过哪几关
- 1conda env create -f environment.yaml && conda activate control仓库给了环境文件,别自己拼依赖
- 2SD 模型放 ControlNet/models/控制模型和检测器模型分两个目录,混放会加载不到
- 3检测器模型放 ControlNet/annotator/ckpts/HED、MiDaS、OpenPose 各是一个单独的权重,用哪种信号才需要下哪个
- 4python gradio_<信号>2image.py九个信号九个脚本:canny / hough / hed / scribble / pose / seg / depth / normal 各跑各的
改哪个文件能改什么
config.py`save_memory = True` 就是低显存模式的开关 —— **8GB 卡靠它,改这一行**annotator/各种检测器。想换一种结构信号,从这里找对应的预处理器test_imgs/官方测试图。复现不出论文效果时先拿它对一遍,排除是自己图的问题坑在哪一处
带 issue 编号的来自:github issues 按回复数排序 · 核验 2026-08-16
config.py 的 save_memory官方原话:这个特性仍在测试,不保证所有显卡都成功。issue #3「Low VRAM tests」至今开着、挂着 help wanted 标签,目标是从 8GB 往 6GB 压 —— 开了跑不起来是已知情况,不是你装错了
输出细节官方明说结果细节仍会被扩散过程改动 —— 它锁的是结构不是像素
线稿模型仓库标注为待风险评估、至今未发布。九种信号里这一种拿不到
更新之后issue #255「Bad renders after last ControlNet update」(已关闭)—— 更新后画质变差是出现过的,回归前先留一版能用的
训练侧想自己训:#165 多卡训练 RuntimeError、#224 人体姿势训练效果不理想,都开着。推理成熟,训练这条线坑多
教程
官方文档、作者本人的视频,以及 ComfyUI 官方给的原生工作流示例。每条都验过还打得开。
项目自述
以下是仓库 README 的开头部分(原文引用,抓取 2026-08-17)。读全文 ↗
News: A nightly version of ControlNet 1.1 is released!
ControlNet 1.1 is released. Those new models will be merged to this repo after we make sure that everything is good.
Below is ControlNet 1.0
Official implementation of Adding Conditional Control to Text-to-Image Diffusion Models.
ControlNet is a neural network structure to control diffusion models by adding extra conditions.
It copys the weights of neural network blocks into a "locked" copy and a "trainable" copy.
The "trainable" one learns your condition. The "locked" one preserves your model.
Thanks to this, training with small dataset of image pairs will not destroy the production-ready diffusion models.
The "zero convolution" is 1×1 convolution with both weight and bias initialized as zeros.
Before training, all zero convolutions output zeros, and ControlNet will not cause any distortion.
No layer is trained from scratch. You are still fine-tuning. Your original model is safe.
This allows training on small-scale or even personal devices.
This is also friendly to merge/replacement/offsetting of models/weights/blocks/layers.
FAQ
Q: But wait, if the weight of a conv layer is zero, the gradient will also be zero, and the network will not learn anything. Why "zero convolution" works?
A: This is not true. See an explanation here.
Stable Diffusion + ControlNet
By repeating the above simple structure 14 times, we can control stable diffusion in this way:
In this way, the ControlNet can reuse the SD encoder as a deep, strong, robust, and powerful backbone to learn diverse controls. Many evidences (like this and this) validate that the SD encoder is an excellent backbone.
Note that the way we connect layers is computational efficient. The original SD encoder does not need to store gradients (the locked original SD Encoder Block 1234 and Middle). The required GPU memory is not much larger than original SD, although many layers are added. Great!
Features & News
2023/0/14 - We released ControlNet 1.1. Those new models will be merged to this repo after we make sure that everything is good.
2023/03/03 - We released a discussion - Precomputed ControlNet: Speed up ControlNet by 45%, but is it necessary?
2023/02/26 - We released a blog - Ablation Study: Why ControlNets use deep encoder? What if it was lighter? Or even an MLP?
2023/02/20 - Implementation for non-prompt mode released. See also Guess Mode / Non-Prompt Mode.
2023/02/12 - Now you can play with any community model by Transferring the ControlNet.
2023/02/11 - Low VRAM mode is added. Please use this mode if you are using 8GB GPU(s) or if you want larger batch size.
Production-Ready Pretrained Models
First create a new conda environment
conda env create -f environment.yaml
conda activate control
All models and detectors can be downloaded from our Hugging Face page. Make sure that SD models are put in "ControlNet/models" and detectors are put in "ControlNet/annotator/ckpts". Make sure that you download all necessary pretrained weights and detector models from that Hugging Face page, including HED edge detection model, Midas depth estimation model, Openpose, and so on.
We provide 9 Gradio apps with thes
……(后略,见原文)判断
优势
- 九种结构信号覆盖了构图控制的绝大多数场景
- 低显存模式让 8GB 卡不出局
- 事实上的构图控制标准,社区模型最多
局限
- 停更 30 个月(最后提交 2024-02-25)—— 它是构图控制的事实标准,但标准本身冻在了 SD1.5 时代
- 结果细节仍会被扩散过程改动(官方明说)—— 它锁的是结构不是像素
- 线稿模型至今未发布,仓库标注为待风险评估
不适用
不需要精确构图的场景 —— 多一道预处理不划算。
同管这些决定的其它项目
ComfyUI节点式工作流底座。图像 / 视频 / 音频 / 3D / 文本共用一个底座。…IP-Adapter用图片当提示词,锁住风格或人物。仅 22M 参数。…kohya sd-scripts训练脚本集:覆盖 SD1.x/2.x、SDXL、SD3/3.5、FLUX.1;202…musubi-tuner视频模型的 LoRA 训练器。同一套代码训 Wan 2.1/2.2、HunyuanV…DiffSynth-Studio魔搭扩散模型工程框架,覆盖图像、视频、音乐推理与训练;近期加入 FLUX.3、MOS…ToonflowAI 创作平台:无限画布、AI Agent、可视化工作流,支持图像、视频、分镜和短剧…infinite-canvas面向 AI 创作的无限画布工作台:生图、参考图编辑、视频生成、Agent 助手、画布…open-ai-canvas面向 AI 影视创作的无限画布:多模态生成、分镜编排、素材管理、Agent 工作流。…VOZEB PRO把统一创作 Agent、画布、短剧生产线、素材库和商业运营后台放进同一套 Next.…OpenMontage让 Agent 编排视频生产:通过声明式流水线组织素材、生成、字幕、音频与合成。…motion-skills动效技能索引:55 个技能分成 18 个安装包,覆盖短视频、数据动画、网页动效、3D…ComfyUI-ManagerComfyUI 的节点管理器:装节点、装模型、修依赖、查注册表。ComfyUI 生态…ComfyUI 官方工作流模板ComfyUI 内置的那批官方工作流模板与子图蓝图的真身仓库。…waoowaoo把一部小说灌进去,自动拆角色、拆场景、出分镜,再合成整集短剧。中英双界面。…魔因漫创桌面端 AI 影视工具(Electron):剧本 → 角色 → 场景 → 导演 → …BigBanana AI Director一站式 AI 短剧 / 漫剧工作台,四阶段:剧本 → 视觉资产 → 分镜制作 → 导…AI Shortfilm Prompts一个 Claude Code 技能:把任意一个想法变成电影语言的、模型直接能用的视频…Awesome Seedance 2 Prompts整理好的 Seedance 2.0 视频提示词库,README 自述逾六千条,覆盖电…歸藏的提示词库中文 AI 圈里流传最广的个人提示词仓库之一,存放作者为各家模型撰写的提示词。…MidJourney 风格与关键词参考一份带示例图的风格与关键词对照表:同一个提示词加不同风格词,画面变成什么样,逐个列出…AI Visual Prompt Cookbook171 套结构化提示词风格、342 张预览;JSON 模板支持 v2.1 / v2.…
github README + docs/low_vram.md + DeepWiki 架构页 · 核验 2026-10-19 | 判断栏可报错。