SDXL Image Generation Guided by a Canny Edge Map
High-fidelity image generation from a canny edge map + text prompt using SDXL. A dedicated canny ControlNet, sharper structural adherence than the general-purpose Union variant for edge-based tasks. Pair with the Canny Edge Annotator to turn a source photo into the edge map this model expects.
What it does
ControlNet XL Canny generates a new image that matches the outlines of a canny edge map while following a text prompt for the style, mood, and content. It is a ControlNet adapter on top of Stable Diffusion XL (SDXL): instead of leaving SDXL to imagine the layout from scratch, you give it the edge structure of a reference photo (or a sketch / line art), and SDXL fills in the rest. The result is image generation with strong structural control, same composition, completely new style. This is a dedicated canny model (trained only for canny), which gives sharper structural adherence than the more general ControlNet-Union variant on edge-based tasks. The xinsir release was trained on 10M+ carefully captioned images and outperforms other open-source canny models (diffusers/controlnet-canny-sdxl-1.0, TheMistoAI/MistoLine) on both aesthetic score and perceptual control.
Problem it solves
- Composition-locked generation – Keep the exact layout, perspective, and outlines of a reference image while changing everything else (style, lighting, materials, era)
- Sketch / line art to image – Turn a hand-drawn sketch or a clean line drawing into a fully rendered image
- Style transfer with structure intact – Reimagine a scene in watercolor, anime, photorealism, etc., without losing the original geometry
- Architectural / product visualization – Generate alternate renderings of a building, room, or product where the structural lines must be respected
- Stronger control than Union-Canny – When the structural fidelity of edges matters most, this dedicated model adheres more sharply than the general Union variant
- High-resolution output – Native 1024×1024 generation that matches SDXL quality
Input/Output
- Input:
- Canny edge map (grayscale image with white edges on black background) — typically produced by the Canny Edge Annotator node from a source photo
- Text prompt describing the desired image (style, content, mood)
- Negative prompt (optional) — what to avoid (e.g., "blurry, low quality, watermark")
- Options: Strength of canny edge guidance (0.0 – 2.0, default 1.0)
- 0.0 = ignore the edges entirely · 2.0 = strictly follow them
- 0.8 – 1.2 works well for most structural tasks
- Number of diffusion steps (20 – 30, default 25)
- 20 – 30 gives good quality
- Classifier-free guidance (CFG) scale (default 5)
- 5.0 – 7.5 is typical for SDXL
- Random seed (-1 for random, or a fixed integer for reproducibility)
- Output image width (512 / 768 / 1024) — the control image is resized to match
- Output image height (512 / 768 / 1024) — the control image is resized to match
- Advanced — Negative prompt (leave empty for no negative guidance)
- Output: Generated image
- Up to 1024 × 1024 (native SDXL resolution; bucket resolutions also supported)
- Photorealistic or stylized depending on the prompt
- Structure follows the canny edge map; everything else follows the text prompt
Accuracy & Speed
Output resolution | Up to 1024 × 1024 (native SDXL) |
VRAM requirement | ~8 GB |
Default diffusion steps | 25 (20 – 30 gives good quality) |
Aesthetic score (Laion) | 6.03 — best vs. diffusers/controlnet-canny-sdxl-1.0 (5.93) and TheMistoAI/MistoLine (5.82) |
Perceptual similarity (lower = better control) | 0.4200 — best vs. diffusers/controlnet-canny-sdxl-1.0 (0.5053) and TheMistoAI/MistoLine (0.5387) |
Strength vs. Union variant | Sharper structural adherence on edge-based tasks (dedicated canny model) |
Technical Details
Model type | ControlNet adapter for SDXL (canny-conditioned) |
Base model | stabilityai/stable-diffusion-xl-base-1.0 |
Conditioning input | Canny edge map (grayscale) |
Architecture | ControlNet (Zhang et al., 2023) on the SDXL UNet |
Training data | 10M+ carefully filtered & captioned images (Midjourney, LAION-5B, Danbooru, etc.) |
Captioning model | CogVLM (for general images); WD tagger (for anime/comic images) |
Training compute | 64+ NVIDIA A100s, effective batch size 2,560 (single-stage training, multi-resolution) |
Tricks used in training | Data augmentation, multiple loss, multi-resolution, random masking on canny inputs |
Recommended VAE | madebyollin/sdxl-vae-fp16-fix |
Supported Frameworks | Hugging Face Diffusers ( StableDiffusionXLControlNetPipeline, ControlNetModel), Safetensors |
Compliance & Provenance
Provider | Open-source (xinsir) |
Provider type | Specialized |
License | Apache 2.0 |
EU AI Act risk class | Minimal Risk |
Art. 50 transparency | Not applicable |
Region availability | Available globally |
Training data summary |
For more on how we classify models and mark outputs, see our AI Policy.
Model Source
- HuggingFace: https://huggingface.co/xinsir/controlnet-canny-sdxl-1.0
- License: apache-2.0