teed / README.md
Flor's picture
card: update from fastforks 1cbf1671
d50a908 verified
|
Raw History Blame Contribute Delete
4.65 kB
---
library_name: "fastforks"
pipeline_tag: "image-to-image"
license: "mit"
tags:
- "edges"
- "edge-detection"
- "line-art"
- "controlnet-preprocessor"
- "cuda"
- "pytorch"
- "fastforks"
- "fastforks-card"
---
# TEED edges (fastforks)
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.
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`.
Task: edges. Tier: experimental. Outputs: `edges`. Backends: `portable`.
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`](https://github.com/kleinicke/fastforks/blob/main/src/fastforks/edges/models/teed/card.toml).
| variant | weights (author link) | SHA-256 | weights licence | commercial use |
|---|---|---|---|---|
| `teed@1` | [teed_5_model.pth](https://raw.githubusercontent.com/xavysp/TEED/40fa4b1391dc6424f88989d0ca75d5b592c8681d/checkpoints/BIPED/5/5_model.pth) | `0322caf70f58` | MIT | yes |
## Licence
Original-code strings, recorded as they are (research-use package; check them before any other use). Code: MIT. Licence files: `LICENSE`.
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.).
Licence evidence: https://github.com/xavysp/TEED/blob/40fa4b1391dc6424f88989d0ca75d5b592c8681d/LICENSE ; https://github.com/xavysp/TEED/tree/40fa4b1391dc6424f88989d0ca75d5b592c8681d/checkpoints/BIPED/5
## 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)
## Speed and memory
### Edges, synthetic, 1080x1920
| model | time (ms): original | portable | peak memory (MiB, allocated / reserved): original | portable |
| --- | --- | --- | --- | --- |
| `teed` | 29.6 | 4.09 | 149 / 184 | 122 / 146 |
### Startup and first call
| model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
| --- | --- | --- | --- | --- | --- | --- |
| `teed` | 0.13 | 0.16 | – | 0.08 | 0.01 | – |
### torch.compile and TensorRT
| model | input | time: portable | compile | TensorRT fp16 | kernels | preparation: compile (cold first call) | ONNX + engine build | peak MiB (alloc / reserved): portable | compile | kernels | TensorRT (engine + torch) |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| `teed` | 1024x1024 | 2.54 ms | 1.10 ms | 0.799 ms | – | 9.06 s | 12.5 s | 68 / 88 | 71 / 104 | – | 106 / 120 |
Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).
Hardware, protocol and caveats: [benchmarks](https://github.com/kleinicke/fastforks/blob/main/docs/benchmarks.md) (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
### 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
```python
from fastforks import edges
model = edges.load("teed") # 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: `teed`.
## Kernels backend
No kernels backend: a 58 k-parameter CNN that runs in a few ms; no custom kernel measured to pay off.
<!-- staged from fastforks 1cbf1671 (2026-11-15) -->