ControlNet Mastery: Unlocking Efficient Image Editing with Auto-Prompting and FP8 Optimization

CN
ComfyUI.org
2025-06-13 09:26:56

1. Workflow Overview

mbulrdrhmiu9fhg795hFlux.1 FLUX cn懒人版@2x.png

This workflow is a multi-ControlNet template designed for effortless control, featuring:

  • Dynamic ControlNet Switching: Toggle between HED/Depth/Canny via ImpactSwitch.

  • Auto-Prompting: Uses JoyCaption (Llama-3 based) to generate prompts from images.

  • FP8 Optimization: Low-VRAM models like flux_dev.safetensors for consumer GPUs.

Key Models:

  • Flux-dev-FP8: Base generation model (FP8 quantized).

  • ControlNet-v3 Series: Includes HED/depth/canny control models.

  • Depth-Anything-V2: Depth map generator (requires separate install).


2. Key Nodes

ControlNet Modules:

  1. LoadFluxControlNet

    • Loads HED/depth/canny models from models/controlnet/.

  2. ApplyFluxControlNet

    • Applies ControlNet with adjustable weights (HED:0.4, Depth:0.8, Canny:0.3).

Preprocessors:

  • HEDPreprocessor: Soft-edge maps (ideal for shape retention).

  • DepthAnything_V2: Depth maps (install ComfyUI-Depth-Anything).

  • CannyEdgePreprocessor: Edge sketches (for detail control).

Custom Nodes:

  1. JoyCaption (Install via ComfyUI Manager)

    • Generates prompts using Llama-3.

  2. ImpactSwitch

    • Switches between ControlNet inputs (enable Multi-Input).


3. Workflow Structure

Group

Function

Critical Nodes

HED Soft-Edge

Generates shape-preserving edge maps

LoadFluxControlNet → HEDPreprocessor

Depth Map

Creates spatial depth control

DepthAnything_V2 → ApplyFluxControlNet

Canny Sketch

Extracts crisp edges

CannyEdgePreprocessor → ApplyFluxControlNet

Auto-Prompt

Generates image descriptions

JoyCaption → CLIPTextEncode

Sampling

Produces final output

XlabsSampler → VAEDecode → SaveImage


4. Inputs & Outputs

Inputs:

  • Required: Upload image via LoadImage (e.g., .webp in example).

  • Optional:

    • Resolution (default 1024x1024, edit in EmptyLatentImage).

    • ControlNet weights (adjust in ApplyFluxControlNet).

Outputs:

  • Images saved to /ComfyUI/output/.

  • Real-time previews of HED/depth/canny intermediates.


5. Notes

  1. Model Dependencies:

    • Download depth_anything_v2_vitl_fp32.safetensors to models/depth_anything.

    • Flux models require official download (e.g., flux-dev-fp8).

  2. VRAM:

    • 8GB+ GPU recommended. Disable unused ControlNet branches for low-end GPUs.

  3. Troubleshooting:

    • Poor auto-prompts: Switch JoyCaption to Descriptive/Long mode.

    • Control failure: Verify ImpactSwitch selection (HED=1, Depth=2, Canny=3).

Recommend