FLUX.1 Dev ControlNet Union Pro 2.0
模型概述
該模型是一個用於文本生成圖像任務的ControlNet,支持canny、soft edge、depth、pose、gray等多種控制模式,可與FLUX.1-dev基礎模型配合使用生成高質量圖像。
模型特點
多控制模式支持
支持canny、soft edge、depth、pose、gray等多種控制模式
改進的控制效果
相比前代版本,改進了canny和pose的控制效果和美學表現
體積優化
移除了模式嵌入,模型體積更小
多重控制支持
可與其他ControlNet聯合使用,實現多重條件控制
模型能力
文本生成圖像
圖像條件控制
多條件聯合控制
使用案例
創意設計
人像生成
根據姿勢圖生成高質量人像
生成符合姿勢要求且具有美學價值的人像
場景生成
根據深度圖生成3D場景
生成符合深度關係的逼真場景
藝術創作
藝術風格轉換
根據邊緣圖生成不同藝術風格的圖像
保持原始結構的同時應用不同藝術風格
🚀 FLUX.1-dev-ControlNet-Union-Pro-2.0
本倉庫包含由 Shakker Labs 發佈的用於 FLUX.1-dev 模型的統一 ControlNet。我們提供了一個 在線演示。社區提供的 FP8 量化版本可在 ABDALLALSWAITI/FLUX.1-dev-ControlNet-Union-Pro-2.0-fp8 中找到。
✨ 主要特性
與 Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro 相比:
- 移除了模式嵌入,模型尺寸更小。
- 在 Canny 和姿態控制方面有所改進,控制效果和美學表現更佳。
- 增加了對軟邊緣的支持,移除了對平鋪模式的支持。
📚 詳細文檔
模型卡片
- 此 ControlNet 由 6 個雙塊和 0 個單塊組成,移除了模式嵌入。
- 我們使用包含 2000 萬張高質量通用和人物圖像的數據集,從零開始對模型進行了 30 萬步的訓練。訓練分辨率為 512x512,使用 BFloat16 格式,批量大小為 128,學習率為 2e-5,引導係數從 [1, 7] 中均勻採樣。我們將文本丟棄率設置為 0.20。
- 該模型支持多種控制模式,包括 Canny、軟邊緣、深度、姿態和灰度。您可以像使用普通的 ControlNet 一樣使用它。
- 此模型可以與其他 ControlNet 聯合使用。
展示示例
控制模式 | 示例圖片 |
---|---|
Canny | ![]() |
軟邊緣 | ![]() |
姿態 | ![]() |
深度 | ![]() |
灰度 | ![]() |
💻 使用示例
基礎用法
import torch
from diffusers.utils import load_image
from diffusers import FluxControlNetModel, FluxControlNetPipeline
base_model = 'black-forest-labs/FLUX.1-dev'
controlnet_model_union = 'Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro-2.0'
controlnet = FluxControlNetModel.from_pretrained(controlnet_model_union, torch_dtype=torch.bfloat16)
pipe = FluxControlNetPipeline.from_pretrained(base_model, controlnet=controlnet, torch_dtype=torch.bfloat16)
pipe.to("cuda")
# 替換為其他條件圖像
control_image = load_image("./conds/canny.png")
width, height = control_image.size
prompt = "A young girl stands gracefully at the edge of a serene beach, her long, flowing hair gently tousled by the sea breeze. She wears a soft, pastel-colored dress that complements the tranquil blues and greens of the coastal scenery. The golden hues of the setting sun cast a warm glow on her face, highlighting her serene expression. The background features a vast, azure ocean with gentle waves lapping at the shore, surrounded by distant cliffs and a clear, cloudless sky. The composition emphasizes the girl's serene presence amidst the natural beauty, with a balanced blend of warm and cool tones."
image = pipe(
prompt,
control_image=control_image,
width=width,
height=height,
controlnet_conditioning_scale=0.7,
control_guidance_end=0.8,
num_inference_steps=30,
guidance_scale=3.5,
generator=torch.Generator(device="cuda").manual_seed(42),
).images[0]
高級用法
import torch
from diffusers.utils import load_image
# https://github.com/huggingface/diffusers/pull/11350
# 您可以通過從源代碼安裝最新版本直接從 diffusers 導入
# from diffusers import FluxControlNetPipeline, FluxControlNetModel
# 目前使用本地文件
from pipeline_flux_controlnet import FluxControlNetPipeline
from controlnet_flux import FluxControlNetModel
base_model = 'black-forest-labs/FLUX.1-dev'
controlnet_model_union = 'Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro-2.0'
controlnet = FluxControlNetModel.from_pretrained(controlnet_model_union, torch_dtype=torch.bfloat16)
pipe = FluxControlNetPipeline.from_pretrained(base_model, controlnet=[controlnet], torch_dtype=torch.bfloat16) # 使用列表以啟用多 ControlNet
pipe.to("cuda")
# 替換為其他條件圖像
control_image = load_image("./conds/canny.png")
width, height = control_image.size
prompt = "A young girl stands gracefully at the edge of a serene beach, her long, flowing hair gently tousled by the sea breeze. She wears a soft, pastel-colored dress that complements the tranquil blues and greens of the coastal scenery. The golden hues of the setting sun cast a warm glow on her face, highlighting her serene expression. The background features a vast, azure ocean with gentle waves lapping at the shore, surrounded by distant cliffs and a clear, cloudless sky. The composition emphasizes the girl's serene presence amidst the natural beauty, with a balanced blend of warm and cool tones."
image = pipe(
prompt,
control_image=[control_image, control_image], # 嘗試使用不同的條件,如 Canny 和深度、姿態和深度
width=width,
height=height,
controlnet_conditioning_scale=[0.35, 0.35],
control_guidance_end=[0.8, 0.8],
num_inference_steps=30,
guidance_scale=3.5,
generator=torch.Generator(device="cuda").manual_seed(42),
).images[0]
推薦參數
您可以調整 controlnet_conditioning_scale
和 control_guidance_end
以獲得更強的控制效果和更好的細節保留。為了獲得更好的穩定性,我們強烈建議使用詳細的提示詞,在某些情況下,多條件控制會有所幫助。
- Canny:使用
cv2.Canny
,controlnet_conditioning_scale = 0.7
,control_guidance_end = 0.8
。 - 軟邊緣:使用 AnylineDetector,
controlnet_conditioning_scale = 0.7
,control_guidance_end = 0.8
。 - 深度:使用 depth-anything,
controlnet_conditioning_scale = 0.8
,control_guidance_end = 0.8
。 - 姿態:使用 DWPose,
controlnet_conditioning_scale = 0.9
,control_guidance_end = 0.65
。 - 灰度:使用
cv2.cvtColor
,controlnet_conditioning_scale = 0.9
,control_guidance_end = 0.8
。
📄 許可證
本項目使用 flux-1-dev-non-commercial-license 許可證。
🔗 相關資源
- InstantX/FLUX.1-dev-IP-Adapter
- InstantX/FLUX.1-dev-Controlnet-Canny
- Shakker-Labs/FLUX.1-dev-ControlNet-Depth
- Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro
🙏 致謝
本模型由 Shakker Labs 開發。最初的想法受到 xinsir/controlnet-union-sdxl-1.0 的啟發。保留所有權利。
📑 引用
如果您在研究中發現本項目有用,請通過以下方式引用我們:
@misc{flux-cn-union-pro-2,
author = {Shakker-Labs},
title = {ControlNet-Union},
year = {2025},
howpublished={\url{https://huggingface.co/Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro-2.0}},
}
Stable Diffusion V1 5
Openrail
穩定擴散是一種潛在的文本到圖像擴散模型,能夠根據任何文本輸入生成逼真的圖像。
圖像生成
S
stable-diffusion-v1-5
3.7M
518
Stable Diffusion Inpainting
Openrail
基於穩定擴散的文本到圖像生成模型,具備圖像修復能力
圖像生成
S
stable-diffusion-v1-5
3.3M
56
Stable Diffusion Xl Base 1.0
SDXL 1.0是基於擴散的文本生成圖像模型,採用專家集成的潛在擴散流程,支持高分辨率圖像生成
圖像生成
S
stabilityai
2.4M
6,545
Stable Diffusion V1 4
Openrail
穩定擴散是一種潛在文本到圖像擴散模型,能夠根據任意文本輸入生成逼真圖像。
圖像生成
S
CompVis
1.7M
6,778
Stable Diffusion Xl Refiner 1.0
SD-XL 1.0優化器模型是Stability AI開發的圖像生成模型,專為提升SDXL基礎模型生成的圖像質量而設計,特別擅長最終去噪步驟處理。
圖像生成
S
stabilityai
1.1M
1,882
Stable Diffusion 2 1
基於擴散的文本生成圖像模型,支持通過文本提示生成和修改圖像
圖像生成
S
stabilityai
948.75k
3,966
Stable Diffusion Xl 1.0 Inpainting 0.1
基於Stable Diffusion XL的潛在文本到圖像擴散模型,具備通過遮罩進行圖像修復的功能
圖像生成
S
diffusers
673.14k
334
Stable Diffusion 2 Base
基於擴散的文生圖模型,可根據文本提示生成高質量圖像
圖像生成
S
stabilityai
613.60k
349
Playground V2.5 1024px Aesthetic
其他
開源文生圖模型,能生成1024x1024分辨率及多種縱橫比的美學圖像,在美學質量上處於開源領域領先地位。
圖像生成
P
playgroundai
554.94k
723
Sd Turbo
SD-Turbo是一款高速文本生成圖像模型,僅需單次網絡推理即可根據文本提示生成逼真圖像。該模型作為研究原型發佈,旨在探索小型蒸餾文本生成圖像模型。
圖像生成
S
stabilityai
502.82k
380
精選推薦AI模型
Llama 3 Typhoon V1.5x 8b Instruct
專為泰語設計的80億參數指令模型,性能媲美GPT-3.5-turbo,優化了應用場景、檢索增強生成、受限生成和推理任務
大型語言模型
Transformers 支持多種語言

L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-Tiny是一個基於SODA數據集訓練的超小型對話模型,專為邊緣設備推理設計,體積僅為Cosmo-3B模型的2%左右。
對話系統
Transformers 英語

C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
基於RoBERTa架構的中文抽取式問答模型,適用於從給定文本中提取答案的任務。
問答系統 中文
R
uer
2,694
98