Models · Edges and lines

TEED edges

TEED (Soria et al., 2023): a tiny edge detector (58 k parameters) that draws soft edge maps for the soft-edge ControlNet, quantized to a few levels by default. MIT code and weights (trained on BIPED, a research-use dataset; see the card).

experimental Fork of huggingface/controlnet_aux@b1aac31 · backends: portable, kernels

Checkpoint teed

Paper 2023 Added in 0.2.0

Portable, RTX 5060 Ti 16 GB 4.09 ms 1080x1920, fp16
vs the faster original 7.2× original fp16: 29.6 ms
Peak memory 122 MiB original: 149 MiB
Accuracy vs original fp32 – no test-set run

Use it

pip install fastforks

Lean install with only what this model needs: pip install fastforks-core

from fastforks import edges

model = edges.load("teed")  # kernels on a supported GPU, else portable PyTorch
result = model(image)
result.edges
result.backend  # what ran: mode, device, dtype, kernels
fastforks bench teed

Times the model on this machine. load(…, mode="portable") or mode="kernels" picks a backend; usage guide.

Speed and memory

Every backend on one GPU (RTX 5060 Ti 16 GB) and the same input, the authors’ code included. Kernels runs fp16. Portable runs fp16 on CUDA.

BackenddtypeTime per call (ms)vs original fp16Peak memory
allocated / reserved
Load (s)First call (s)
Original fp32fp32not measured ––––
Original fp16torch.autocast(float16) around the call; huggingface/controlnet_aux@b1aac318b15c teed, host OpenCV resize, float post-processingfp16 29.6–149 MiB/184 MiB0.10.09
Portable fp32fp32not measured ––––
Portablefp16 4.097.2×122 MiB/146 MiB0.20.01
Kernelsnot measured ––––
Portable + torch.compilenot measured here ––––
TensorRTnot measured here ––––

Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-14. First call, 3 warm-up, peak reset, median of 3 rounds x median of 5. Ratios divide two times of this table (same GPU, same input). Original fp16 is the authors’ own precision option, else torch.autocast. torch.compile and TensorRT: build time instead of load time. TensorRT memory (engine, not comparable) is the GPU memory the engine took, read from the driver because TensorRT allocates outside PyTorch, so it can't be compared with the PyTorch peaks of the other rows.

Other devices

DeviceBackenddtypems / callPeak memoryOutput vs referenceInput
Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-14Originalfp3225.8 1,434 MiB process–1024x1024
Portablefp1616.7 1,313 MiB processmatches1024x1024
Portablefp3220.1 1,314 MiB processmatches1024x1024
Kernelsfp32not implemented–1024x1024

CUDA memory is torch’s peak allocated / reserved; Apple has no such counter, so the Mac rows show the process footprint (weights, Python and torch included). “Output vs reference” compares the device’s output with the stored golden output under the card’s tolerance; – = not checked on that device. Kernels “not implemented” = no kernels for this model on that backend yet: it runs portable there.

Licence and weights

Commercial use allowed

Code
MIT LICENSE
Weights
MIT source
Training data

Our reading of the licences, not legal advice.

Weights

teed_5_model.pth 249 KB· hosted on raw.githubusercontent.com

fastforks downloads and checks these files on first use (fastforks download teed).

Accuracy

The test set through the authors’ code and through ours: same checkpoint, same protocol. The distance between the original’s fp32 and fp16 runs is what half precision alone costs; our runs should stay within it.

Accuracy not measured for teed.

Closeness to the original

Beyond the test-set scores: the raw output of ours against the original’s fp32 output on the same input, pixel by pixel. 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).

CheckToleranceMeasured
CPU fp32, max |diff|≤ 0.002 not recorded
GPU default dtypes, mean |diff|≤ 0.02 0.00023
GPU default dtypes, p99 |diff|≤ 0.25 0.00137

Recorded for teed on RTX 5060 Ti, torch 2.10.0+cu130, 2026-11-17, with these kernels: smish

Details

Tiny and efficient edge detector (Soria et al., ICCV 2023 workshops; controlnet_aux `TEEDdetector`, ComfyUI's "TEED Soft-Edge Lines"): a 58 k-parameter network whose four outputs are averaged into a soft edge map, quantized to a few levels by default.

Input / output
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.
Input size
any H x W >= 32, padded to a multiple of 32; tested up to 1080x1920 (122 MiB allocated)
Options
  • short_side=512>= 64· changes the output
  • safe_steps=20 to 255· changes the output
Outputs
edges
CUDA kernels
  • smish
Apple (MPS)
fp32, fp16
Full reference, generated from the repository

TEED (Soria et al., 2023): a tiny edge detector (58 k parameters) that draws soft edge maps for the soft-edge ControlNet, quantized to a few levels by default. MIT code and weights (trained on BIPED, a research-use dataset; see the card).

Commercial use: yes.

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
teedsynthetic (1080x1920)original
portable
kernels
29.6
4.09
–
149 / 184
122 / 146
–
teedsynthetic (1024x1024)original
portable
kernels
portable + torch.compile
TensorRT fp16
15.8
2.54
–
1.10
0.799
89 / 110
68 / 88
–
71 / 104
106 / 120
Details
  • Original code: https://github.com/huggingface/controlnet_aux at b1aac318b15c
  • Code licence: MIT (permissive); files: LICENSE
  • Weights licence: MIT
  • Licence evidence: https://github.com/xavysp/TEED/blob/40fa4b1391dc6424f88989d0ca75d5b592c8681d/LICENSE ; https://github.com/xavysp/TEED/tree/40fa4b1391dc6424f88989d0ca75d5b592c8681d/checkpoints/BIPED/5
  • Training data: BIPED (Barcelona Images for Perceptual Edge Detection) (BIPED (the repository's checkpoints/BIPED folder and README); the dataset is for non-commercial use.)
  • Options: short_side = 512 (>= 64; also resolution; also detect_resolution), safe_steps = 2 (0 to 255)
  • Kernel libraries: smish
  • Variants: teed
  • Outputs: edges
  • Input size: any H x W >= 32, padded to a multiple of 32
  • Tested up to (portable, fp16, RTX 5060 Ti 16 GB): teed 1080x1920 (0.1 GiB peak allocated, 0.1 reserved)
  • teed 1024x1024, first call: portable + torch.compile 9 s (cold Inductor cache), TensorRT fp16 12 s (ONNX + engine).
  • teed original 1080x1920, original 1024x1024: torch.autocast(float16) around the call; huggingface/controlnet_aux@b1aac318b15c teed, host OpenCV resize, float post-processing
  • teed load / first call: original 0.13 s / 0.083 s, portable 0.16 s / 0.005 s
  • Protocol, first call, 3 warm-up, peak reset, median of 3 rounds x median of 5

Parity

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).

variantkernels error vs original, mean / p99GPU, torchkernels used
teed0.00023 / 0.00137RTX 5060 Ti, torch 2.10.0+cu130smish@c9aaf63e6ef7:sm_120

Example output

No example rendered for this checkpoint yet.