AnyLine line art
AnyLine (TheMisto.ai): sharp line maps for line-conditioned ControlNets such as MistoLine, from the MTEED edge network blended with a line art of the image. MIT code; OpenRAIL++-M weights (commercial use with use restrictions).
experimental Fork of huggingface/controlnet_aux@b1aac31 · backends: portable, kernels
- Paper Tiny and Efficient Model for The Edge Detection Generalization ICCV 2023 workshops · first released 12 Aug 2023
Checkpoint anyline
Paper 2023 Added in 0.2.0
Use it
pip install fastforks Lean install with only what this model needs: pip install fastforks-core
from fastforks import edges
model = edges.load("anyline") # kernels on a supported GPU, else portable PyTorch
result = model(image)
result.edges
result.backend # what ran: mode, device, dtype, kernels fastforks bench anyline 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.
| Backend | dtype | Time per call (ms) | vs original fp16 | Peak memory allocated / reserved | Load (s) | First call (s) |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | not measured | – | – | – | – |
| Original fp16torch.autocast(float16) around the call; huggingface/controlnet_aux@b1aac318b15c anyline, host OpenCV resize, float post-processing | fp16 | 585 | – | 909 MiB/1,002 MiB | 0.1 | 0.59 |
| Portable fp32 | fp32 | not measured | – | – | – | – |
| Portable | fp16 | 50.7 | 12× | 654 MiB/722 MiB | 0.2 | 0.05 |
| Kernels | not measured | – | – | – | – | |
| Portable + torch.compile | not measured here | – | – | – | – | |
| TensorRT | not 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
| Device | Backend | dtype | ms / call | Peak memory | Output vs reference | Input |
|---|---|---|---|---|---|---|
| Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-14 | Original | fp32 | 259 | 1,557 MiB process | – | 1024x1024 |
| Portable | fp16 | 117 | 1,319 MiB process | matches | 1024x1024 | |
| Portable | fp32 | 130 | 2,346 MiB process | matches | 1024x1024 | |
| Kernels | fp32 | not 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
- LicenseRef-CreativeML-OpenRAIL-PlusPlus-M source
- Training data
- Not stated for MTEED (TheMistoAI/MistoLine `Anyline/MTEED.pth`, the TEED network).
- The MTEED weights use the OpenRAIL++-M licence: commercial use is allowed but with use restrictions that must be passed on; the training data terms are not checked.
Our reading of the licences, not legal advice.
Weights
MTEED.pth 248 KB· hosted on Hugging Facefastforks downloads and checks these files on first use (fastforks download anyline).
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 anyline.
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).
| Check | Tolerance | Measured |
|---|---|---|
| CPU fp32, max |diff| | ≤ 0.002 | not recorded |
| cpu_outliers | ≤ 0.0001 | not recorded |
| GPU default dtypes, mean |diff| | ≤ 0.02 | 0.00008 |
| GPU default dtypes, p99 |diff| | ≤ 0.25 | 0.00002 |
Recorded for anyline on RTX 5060 Ti, torch 2.10.0+cu130, 2026-11-17, with these kernels: edge_components
Details
AnyLine preprocessor of MistoLine (TheMisto.ai; controlnet_aux `AnylineDetector`, ComfyUI-Anyline): the MTEED edge network (TEED architecture, weights by TheMisto.ai) blended with a Gaussian-difference line art whose small specks are removed; sharp line maps for line-conditioned ControlNets.
- 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 (654 MiB allocated)
- Options
short_side=1280>= 64· changes the output
- Outputs
edges- CUDA kernels
edge_components
- Apple (MPS)
- fp32, fp16
Limitations
- Layers are blended in float as TheMistoAI/ComfyUI-Anyline; controlnet_aux's `AnylineDetector` blends uint8 arrays, where `1 - (1 - top) * (1 - base)` wraps around, so its maps differ wherever line art is drawn.
Full reference, generated from the repository
AnyLine (TheMisto.ai): sharp line maps for line-conditioned ControlNets such as MistoLine, from the MTEED edge network blended with a line art of the image. MIT code; OpenRAIL++-M weights (commercial use with use restrictions).
Commercial use: yes.
| variant | input | backend | time (ms) | peak memory (MiB, allocated / reserved) |
|---|---|---|---|---|
anyline | synthetic (1080x1920) | original portable kernels | 585 50.7 – | 909 / 1002 654 / 722 – |
anyline | synthetic (1024x1024) | original portable kernels portable + torch.compile TensorRT fp16 | 299 24.0 – 11.6 12.9 (full line map only; memory estimated) | 509 / 562 362 / 384 – 306 / 346 528 / 542 |
Details
- Original code: https://github.com/huggingface/controlnet_aux at
b1aac318b15c - Code licence: MIT (permissive); files:
LICENSE - Weights licence: LicenseRef-CreativeML-OpenRAIL-PlusPlus-M
- Licence evidence: https://github.com/TheMistoAI/ComfyUI-Anyline/blob/40d7b290fe829d50e4e12e7f34498c2d30913b53/LICENSE ; https://huggingface.co/TheMistoAI/MistoLine/blob/1d9d0b3d48b295cf70d80a0f839a3055672f8393/README.md
- Training data: Not stated for MTEED (TheMistoAI/MistoLine
Anyline/MTEED.pth, the TEED network). - Licence note: The MTEED weights use the OpenRAIL++-M licence: commercial use is allowed but with use restrictions that must be passed on; the training data terms are not checked.
- Options:
short_side= 1280 (>= 64; alsoresolution; alsodetect_resolution) - Kernel libraries:
edge_components - Variants:
anyline - 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):
anyline1080x1920 (0.6 GiB peak allocated, 0.7 reserved) anyline1024x1024, first call: portable + torch.compile 40 s (cold Inductor cache), TensorRT fp16 30 s (ONNX + engine).anylineoriginal 1080x1920, original 1024x1024: torch.autocast(float16) around the call; huggingface/controlnet_aux@b1aac318b15c anyline, host OpenCV resize, float post-processinganylineload / first call: original 0.11 s / 0.622 s, portable 0.17 s / 0.053 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).
| variant | kernels error vs original, mean / p99 | GPU, torch | kernels used |
|---|---|---|---|
anyline | 8e-05 / 2e-05 | RTX 5060 Ti, torch 2.10.0+cu130 | edge_components@d6becc089ab3:sm_120 |
Limitations
- Layers are blended in float as TheMistoAI/ComfyUI-Anyline; controlnet_aux's
AnylineDetectorblends uint8 arrays, where1 - (1 - top) * (1 - base)wraps around, so its maps differ wherever line art is drawn.
Example output
No example rendered for this checkpoint yet.