HED soft edges (ControlNet 1.1) (fastforks)
Soft edge preprocessor of ControlNet 1.1 (controlnet_aux HEDdetector, ComfyUI's "HED Soft-Edge Lines"): lllyasviel's Apache-2.0 re-implementation of holistically-nested edge detection, a VGG-style network whose five side outputs are averaged into a soft edge map (RGB input, smoother edges than the original HED).
This repo is the model card only: it holds no weights. fastforks downloads the authors' weights from the links below and checks them against the SHA-256 in the model card. Code: https://github.com/kleinicke/fastforks. Kernels for the kernels backend: https://huggingface.co/fastforks/kernels. Original code: https://github.com/huggingface/controlnet_aux at b1aac318b15c.
Author weight repos: https://huggingface.co/lllyasviel/Annotators.
Task: edges. Tier: experimental. Outputs: edges. Backends: portable, kernels.
Input: one RGB image. Output: a line / edge map [H, W] in [0, 1] at the input size (1 = line), the ControlNet preprocessors (line art, HED, PiDiNet, TEED / Anyline); M-LSD also returns straight line segments.
Variants
Weights are the authors' files (not hosted here). SHA-256 shortened to 12 hex digits; the full hashes are in card.toml.
| variant | weights (author link) | SHA-256 | weights licence | commercial use |
|---|---|---|---|---|
hed@1 |
ControlNetHED.pth | 5ca93762ffd6 |
Apache-2.0 | yes |
Licence
Original-code strings, recorded as they are (research-use package; check them before any other use). Code: Apache-2.0. Licence files: LICENSE.
Training data: Not stated for these checkpoints (lllyasviel/Annotators, ControlNet 1.1); HED (Xie and Tu) trains on BSDS500; this re-trained model states no data..
Licence evidence: https://github.com/huggingface/controlnet_aux/blob/b1aac318b15c4e65a21bc516dc236ad4bf593d46/src/controlnet_aux/hed/__init__.py ; https://huggingface.co/lllyasviel/Annotators
Input size
any H x W >= 32, padded to a multiple of 32
Tested up to (portable, fp16, RTX 5060 Ti 16 GB): hed 1080x1920 (0.2 GiB peak allocated, 0.2 reserved)
Speed and memory
Edges, synthetic, 1080x1920
| model | time (ms): original | portable | kernels | kernels speed-up: vs portable | peak memory (MiB, allocated / reserved): original | portable | kernels |
|---|---|---|---|---|---|---|---|
hed |
38.5 | 11.3 | 8.25 | 1.4x | 300 / 324 | 187 / 224 | 193 / 264 |
Startup and first call
| model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
|---|---|---|---|---|---|---|
hed |
0.24 | 0.18 | 0.31 (1024x1024) | 0.06 | 0.01 | 0.12 (1024x1024) |
torch.compile and TensorRT
| model | input | time: portable | compile | TensorRT (fp16 unless shown) | kernels | preparation: compile (cold first call) | ONNX + engine build | peak MiB (alloc / reserved): portable | compile | kernels | TensorRT (engine + torch) |
|---|---|---|---|---|---|---|---|---|---|---|---|
hed |
1024x1024 | 6.02 ms | 4.81 ms | 2.57 ms | 4.44 ms | 9.37 s | 11.6 s | 117 / 146 | 137 / 166 | 121 / 146 | 170 / 178 |
hed |
1080x1920 | 11.3 ms | 8.25 ms | 4.96 ms | 8.25 ms | 11.7 s | 13.9 s | 187 / 224 | 197 / 224 | 193 / 264 | 259 / 280 |
Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).
Hardware, protocol and caveats: benchmarks (RTX 5060 Ti 16 GB, sm_120). Original = the original code named above at the precision of portable (fp16, or (fp32) where fp16 is unsupported or not finite); original fp32 = its default fp32 run. Peak memory is the torch allocator's.
Accuracy
On public datasets
All 200 BSDS500 test images. The benchmark uses the official boundary correspondence with a tolerance of 0.0075 of the image diagonal. ODS, OIS and AP use 99 thresholds on 8-bit predictions without thinning. The first 75 BSDS500 test images by filename. Scores use the official boundary correspondence at 0.0075 of the image diagonal and 99 thresholds on 8-bit predictions without thinning. Original = the original code named under Details, same checkpoint and protocol.
| variant | dataset | original fp32 | portable | portable fp32 | kernels | note |
|---|---|---|---|---|---|---|
hed |
BSDS500 test (200 images), boundary ODS / OIS / AP % | 61.96 / 63.49 / 61.47 | 61.95 / 63.51 / 61.47 | |||
hed |
BSDS500 test (first 75 images), boundary ODS / OIS / AP % | 61.63 / 62.62 / 61.38 | 61.64 / 62.61 / 61.38 | 61.63 / 62.64 / 61.38 | 61.64 / 62.61 / 61.38 |
Measured on portable: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 5f4a908a0, 2026-11-19; portable32: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 3bf0bac7, 2026-11-17; kernels: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 67dbea00e, 2026-11-20.
Parity with the original code
Every variant is checked against reference outputs of the original code at its pinned commit. CPU, float32: max |diff| <= 0.002 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.02 and p99 <= 0.25 (absolute error of the output edges).
Usage
from fastforks import edges
model = edges.load("hed") # mode="auto": the preferred backend from recorded measurements
result = model("photo.jpg")
result.edges # [H, W] float32 in [0, 1], 1 = line, input resolution
result.backend # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')
Install with pip install fastforks (see https://github.com/kleinicke/fastforks). Other variants: hed.
Kernels backend
edges.load("hed", mode="kernels") runs our CUDA kernels (igev, cutlass_conv, cudnn_hacc). It needs a prebuilt kernel for your GPU architecture (downloaded from https://huggingface.co/fastforks/kernels on first use) and a recent NVIDIA driver; if there is none it raises BackendUnavailableError with the reason and never falls back silently. mode="auto" picks kernels when it can run and logs the choice.