Nodes/ComfyUI-Inference-Core-Nodes/[Inference.Core] HED Soft-Edge Lines
ComfyUI Node

[Inference.Core] HED Soft-Edge Lines

Gentler than Canny, forgiving on organic subjects

By LykosAI·Created 2 years ago·Updated about a year ago· 33
[Inference.Core] HED Soft-Edge Lines
  • image
  • IMAGE
safeenable
resolution512

Canny is the classic edge detector, and it's unforgiving: hard binary lines, sensitive to threshold tuning, and it wants clean contours to work with. HED (Holistically-Nested Edge Detection) is the softer alternative - it produces gradient edges of varying thickness rather than a strict on/off line, which makes it a lot more forgiving on organic subjects like people, animals, fabric, or anything without crisp geometric edges. If Canny keeps giving you either too little or too much line for a portrait or a fuzzy-edged scene, HED is usually the fix.

How it works

HED is a learned edge detector - rather than a fixed mathematical threshold like Canny, it's a network trained to predict edge probability per pixel, which is why the output looks like soft gradient lines instead of hard binary strokes. That "holistic" training approach is also why it handles ambiguous, low-contrast, or organic edges more gracefully: it's making a probabilistic judgment call rather than applying a hard cutoff.

The inputs and outputs that matter

  • image - required, your source image.
  • safe (default enable) - a filtering pass that caps extreme output values, avoiding the harsh near-solid-white or near-solid-black patches that can otherwise show up in noisy regions. Leave it enabled unless you have a specific reason to see the raw, unfiltered edge map.
  • resolution (default 512) - working resolution.

One output: IMAGE, the soft-edge map, wired into a softedge/HED ControlNet.

How to install it

ComfyUI Manager: search ComfyUI-Inference-Core-Nodes, install, restart. By hand:

cd ComfyUI/custom_nodes
git clone https://github.com/LykosAI/ComfyUI-Inference-Core-Nodes

then run install.py, or pip install -e .[cuda12] (or .[cuda] / .[rocm] / .[directml] / .[cpu]). Restart ComfyUI. The HED model weights download from Hugging Face the first time you run the node.

Common issues & troubleshooting

If your edges look washed out or blurrier than you expected, that's the intended behavior - HED trades crispness for forgiveness on purpose, and if you actually need hard, precise lines (architecture, mechanical objects, text), Canny is the better tool for that job, not a HED setting you're missing.

If you notice odd blown-out white or black patches in the output, try toggling safe if it's off - it exists specifically to catch that failure mode. And as always: this only produces the conditioning image, so a matching softedge or HED ControlNet checkpoint still needs to be loaded downstream for anything to actually happen to your generation.

CategoryControlNet Preprocessors/Line Extractors

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
safeoptCOMBOenable2 options: enable, disable
resolutionoptINT51264–2048

Outputs (1)

NameTypeDescription
IMAGEIMAGE