ComfyUI Node Runs on cloud

PiDiNet Soft-Edge Lines

The softedge preprocessor I'd actually reach for

By Fannovel16·Created 3 years ago·Updated 4 months ago· 4,132
PiDiNet Soft-Edge Lines
  • image
  • IMAGE
safeenable
resolution512

PiDiNet is the softedge preprocessor most people should default to. It does the same job as HED - extract soft, gradient edges for a softedge ControlNet - but the lines come out cleaner and a little more coherent, without the faint noise HED sometimes drags in. It's also a lightweight model, so it's quick. When someone asks "which softedge should I use," this is the honest answer more often than not.

How it works

PiDiNet (Pixel Difference Networks, weights: table5_pidinet.pth) is a compact edge-detection network. Like HED it produces a soft grayscale edge map where line strength varies rather than snapping to pure black-and-white, which is exactly what a softedge ControlNet is trained to read. The value of softedge over Canny is forgiveness: it captures organic subjects - faces, hair, cloth, plants - where hard edge detection either misses lines or fragments them. PiDiNet's particular strength is doing that with tidy output, so the ControlNet gets a clear structural signal instead of a slightly grubby one.

The KB framing is worth keeping in mind: softedge (HED and PiDiNet both) is the pick for organic subjects where perfect edge detection is unrealistic, exactly the situation Canny struggles with.

The inputs and output

Two inputs carry the weight:

  • image - your source.
  • resolution (default 512) - processing size; match it to your render.

And the one toggle:

  • safe (default enable) - safe mode, which quantizes edge intensities so the ControlNet doesn't over-read faint gradients into imaginary structure. Keep it on for normal use; disable only if you're deliberately hunting for the last scraps of fine detail and can tolerate a bit more noise.

The single output is an IMAGE - the soft-edge map - which wires into a ControlNet Apply node with a softedge ControlNet (control_v11p_sd15_softedge). PiDiNet output also feeds control_scribble if you want a scribble-flavored result. The map is inert until the ControlNet model is loaded.

Installing it

ComfyUI Manager: search ComfyUI's ControlNet Auxiliary Preprocessors, install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/Fannovel16/comfyui_controlnet_aux
pip install -r requirements.txt

Restart ComfyUI. The small table5_pidinet.pth weight downloads from HuggingFace on first run - quick, because it's a light model.

Where people get burned

The main thing to know is comparative, not a bug: PiDiNet and HED target the same softedge ControlNet, so if one isn't giving you what you want, swap to the other - it's a single-node change. My default is PiDiNet for cleaner lines, HED when PiDiNet feels too sparse for a busy subject. Don't agonize; try both and keep the map that looks right.

Second, the classic mismatch: softedge output belongs in a softedge (or scribble) ControlNet. Pipe it into a Canny or lineart model and you'll get soup, because those models expect hard thin lines, not soft gradients.

And the universal reminder that trips up every ControlNet beginner: the preprocessor only produces the hint image. Nothing conditions your generation until you've loaded the matching softedge ControlNet and passed the map through a ControlNet Apply node.

CategoryControlNet Preprocessors/Line Extractors

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
safeoptCOMBOenable2 options: enable, disable
resolutionoptINT51264–16384

Outputs (1)

NameTypeDescription
IMAGEIMAGE