Qwen-Image InstantX ControlNet
使用Qwen千問Image InstantX ControlNet產生圖像,支援canny、軟邊緣、深度、姿態
關於
The Qwen-Image InstantX Union ControlNet workflow is designed to generate high-quality images using the Qwen-Image model with advanced ControlNet capabilities. This workflow integrates multiple control techniques such as canny edge detection, soft edge, depth, and pose estimation to offer fine-grained control over the image generation process.
By leveraging these techniques, users can create images that adhere closely to specific visual constraints or stylistic guidelines. Technically, the workflow utilizes a combination of nodes including SaveImage, LoadImage, and PreviewImage to handle image data, while specialized nodes like 0e306186-0dda-4b49-bfcb-98cab32901d9 and f8e756aa-94b4-4c02-943d-2e7910344622 are used to apply the ControlNet transformations. The FluxKontextImageScale node further refines the scaling of images, ensuring that the output maintains high fidelity to the input parameters.
您提供的內容
- 正在讀取工作流程
在 ComfyUI 中執行。 此工作流程無法在此頁面上執行。請在已載入所有內容的 Comfy Cloud 中開啟,或下載到您自己的 ComfyUI。
在 Cloud 中試用工作流程內部
節點圖的唯讀預覽。請在 Comfy Cloud 中開啟,或下載後編輯節點。
Loading the graph
Open full-size workflow preview從程式碼使用此工作流程
可行時會根據工作流程圖和輸入內容產生;否則會顯示儲存的範例。執行可能產生費用的程式碼前,請檢查認證資訊和端點。
What you need
- Runs on
- Comfy Cloud
- 金鑰
- COMFY_API_KEY
需要付費 Cloud 方案與點數。
# Python 3.10+: pip install comfy-sdk==0.4.0
import os
from comfy_sdk import Comfy
api_key = os.environ.get("COMFY_API_KEY", "").strip()
if not api_key: raise RuntimeError("Set COMFY_API_KEY")
os.environ.setdefault("COMFY_BASE_URL", "https://cloud.comfy.org")
client = Comfy(api_key=api_key)
workflow = client.workflows.from_json({
"60": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "ComfyUI",
"images": [
"111:8",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"71": {
"class_type": "LoadImage",
"inputs": {
"image": "image_qwen_image_instantx_controlnet_input_image.jpg"
},
"_meta": {
"title": "Load Image"
}
},
"73": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"112:22",
0
]
},
"_meta": {
"title": "Preview Image"
}
},
"113": {
"class_type": "FluxKontextImageScale",
"inputs": {
"image": [
"71",
0
]
},
"_meta": {
"title": "FluxKontextImageScale"
}
},
"111:3": {
"class_type": "KSampler",
"inputs": {
"cfg": 1,
"denoise": 1,
"latent_image": [
"111:76",
0
],
"model": [
"111:66",
0
],
"negative": [
"111:85",
1
],
"positive": [
"111:85",
0
],
"sampler_name": "euler",
"scheduler": "simple",
"seed": 498544006715206,
"steps": 4
},
"_meta": {
"title": "KSampler"
}
},
"111:37": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "qwen_image_fp8_e4m3fn.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"111:38": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "qwen_2.5_vl_7b_fp8_scaled.safetensors",
"device": "default",
"type": "qwen_image"
},
"_meta": {
"title": "Load CLIP"
}
},
"111:39": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "qwen_image_vae.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"111:6": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"111:38",
0
],
"text": "Post-apocalyptic style clothing, long wavy hair, rough texture, exotic woman, tattered coarse-woven linen fabric, wearing a hood, mechanical aesthetics, mainly in dark gray tones, low-saturation earthy yellow, sense of impact and rebellion, doomsday aesthetics, grotesque aesthetics, works of art, backlighting, film photography, professional photography works, clear visible face, emotional and atmospheric dynamic photography, Fujichrome color positive film, shot with a 17mm Hasselblad ultra-wide-angle lens, f/1.2 large aperture, side backlighting, artistic light, hair light, Rembrandt light, 8K high-definition image quality, delicate real human skin texture."
},
"_meta": {
"title": "CLIP Text Encode (Positive Prompt)"
}
},
"111:66": {
"class_type": "ModelSamplingAuraFlow",
"inputs": {
"model": [
"111:80",
0
],
"sampling": "flow",
"shift": 3.1000000000000005
},
"_meta": {
"title": "ModelSamplingAuraFlow"
}
},
"111:7": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"111:38",
0
],
"text": ""
},
"_meta": {
"title": "CLIP Text Encode (Negative Prompt)"
}
},
"111:76": {
"class_type": "VAEEncode",
"inputs": {
"pixels": [
"112:22",
0
],
"vae": [
"111:39",
0
]
},
"_meta": {
"title": "VAE Encode"
}
},
"111:8": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"111:3",
0
],
"vae": [
"111:39",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"111:80": {
"class_type": "LoraLoaderModelOnly",
"inputs": {
"lora_name": "Qwen-Image-Lightning-4steps-V1.0.safetensors",
"model": [
"111:37",
0
],
"strength_model": 1
},
"_meta": {
"title": "Load LoRA"
}
},
"111:84": {
"class_type": "ControlNetLoader",
"inputs": {
"control_net_name": "Qwen-Image-InstantX-ControlNet-Union.safetensors"
},
"_meta": {
"title": "Load ControlNet Model"
}
},
"111:85": {
"class_type": "ControlNetApplyAdvanced",
"inputs": {
"control_net": [
"111:84",
0
],
"end_percent": 1,
"image": [
"112:22",
0
],
"negative": [
"111:7",
0
],
"positive": [
"111:6",
0
],
"start_percent": 0,
"strength": 1,
"vae": [
"111:39",
0
]
},
"_meta": {
"title": "Apply ControlNet"
}
},
"112:10": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "lotus-depth-d-v1-1.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"112:14": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "vae-ft-mse-840000-ema-pruned.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"112:16": {
"class_type": "SamplerCustomAdvanced",
"inputs": {
"guider": [
"112:19",
0
],
"latent_image": [
"112:23",
0
],
"noise": [
"112:18",
0
],
"sampler": [
"112:21",
0
],
"sigmas": [
"112:28",
0
]
},
"_meta": {
"title": "SamplerCustomAdvanced"
}
},
"112:18": {
"class_type": "DisableNoise",
"inputs": {},
"_meta": {
"title": "DisableNoise"
}
},
"112:19": {
"class_type": "BasicGuider",
"inputs": {
"conditioning": [
"112:68",
0
],
"model": [
"112:10",
0
]
},
"_meta": {
"title": "Basic Guider"
}
},
"112:20": {
"class_type": "BasicScheduler",
"inputs": {
"denoise": 1,
"model": [
"112:10",
0
],
"scheduler": "normal",
"steps": 1
},
"_meta": {
"title": "BasicScheduler"
}
},
"112:21": {
"class_type": "KSamplerSelect",
"inputs": {
"sampler_name": "euler"
},
"_meta": {
"title": "KSamplerSelect"
}
},
"112:22": {
"class_type": "ImageInvert",
"inputs": {
"image": [
"112:8",
0
]
},
"_meta": {
"title": "Invert Image Colors"
}
},
"112:23": {
"class_type": "VAEEncode",
"inputs": {
"pixels": [
"113",
0
],
"vae": [
"112:14",
0
]
},
"_meta": {
"title": "VAE Encode"
}
},
"112:28": {
"class_type": "SetFirstSigma",
"inputs": {
"sigma": 999.0000000000002,
"sigmas": [
"112:20",
0
]
},
"_meta": {
"title": "SetFirstSigma"
}
},
"112:68": {
"class_type": "LotusConditioning",
"inputs": {},
"_meta": {
"title": "LotusConditioning"
}
},
"112:8": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"112:16",
0
],
"vae": [
"112:14",
0
]
},
"_meta": {
"title": "VAE Decode"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)問答
需下載 diffusion 模型 'lotus-depth-d-v1-1.safetensors' 及 VAE 模型 'vae-ft-mse-840000-ema-pruned.safetensors',可從 Huggingface 或 Modelscope 取得。
本流程以高品質圖像生成為主,不適合即時應用,較適合對處理時間要求不高的專案。
依專案需求選擇:canny 用於邊緣偵測、soft edge 產生柔順過渡、depth 創造 3D 效果、pose 控制身體姿勢。
可以,可同時設定多個節點,實現複合控制,產生更複雜與自訂的圖像輸出。