Anime line art (fastforks)
Anime line art preprocessor of ControlNet 1.1 (controlnet_aux LineartAnimeDetector, ComfyUI's "Anime Lineart"): a pix2pix U-Net (8 levels, instance norm, 54 M parameters) turns an anime-style image into a clean line drawing at a multiple of 256 px.
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.
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 |
|---|---|---|---|---|
lineart-anime@1 |
netG.pth | ccabdcc3f5cf |
MIT (assumed from code) | yes |
Licence
Original-code strings, recorded as they are (research-use package; check them before any other use). Code: MIT. Licence files: LICENSE.
Code licence: MIT; the authors do not state a separate weights licence.
Training data: Not stated for these checkpoints (lllyasviel/Annotators, ControlNet 1.1); ControlNet 1.1 describes the anime line art model as trained on anime illustrations and their line drawings..
Licence evidence: https://github.com/huggingface/controlnet_aux/blob/b1aac318b15c4e65a21bc516dc236ad4bf593d46/src/controlnet_aux/lineart_anime/LICENSE ; 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): lineart-anime 1080x1920 (0.2 GiB peak allocated, 0.3 reserved)
Speed and memory
Edges, synthetic, 1080x1920
| model | time (ms): original | portable | peak memory (MiB, allocated / reserved): original | portable |
|---|---|---|---|---|
lineart-anime |
25.2 | 8.36 | 407 / 448 | 241 / 284 |
Startup and first call
| model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
|---|---|---|---|---|---|---|
lineart-anime |
0.74 | 0.82 | β | 0.04 | 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) |
|---|---|---|---|---|---|---|---|---|---|---|---|
lineart-anime |
1024x1024 | 3.86 ms | 2.80 ms | 1.54 ms | β | 10.3 s | 13.4 s | 161 / 206 | 180 / 206 | β | 304 / 314 |
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
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("lineart-anime") # 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: lineart-anime.
Kernels backend
No kernels backend: a pix2pix U-Net: cuDNN convolutions and instance norm are the whole time; no custom kernel measured to pay off.