card: update from fastforks 1cbf1671
Browse files
README.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: "fastforks"
|
| 3 |
+
pipeline_tag: "image-to-image"
|
| 4 |
+
license: "other"
|
| 5 |
+
license_name: "see-model-card"
|
| 6 |
+
license_link: "https://github.com/huggingface/controlnet_aux/blob/b1aac318b15c4e65a21bc516dc236ad4bf593d46/src/controlnet_aux/pidi/LICENSE"
|
| 7 |
+
tags:
|
| 8 |
+
- "edges"
|
| 9 |
+
- "edge-detection"
|
| 10 |
+
- "line-art"
|
| 11 |
+
- "controlnet-preprocessor"
|
| 12 |
+
- "cuda"
|
| 13 |
+
- "pytorch"
|
| 14 |
+
- "fastforks"
|
| 15 |
+
- "fastforks-card"
|
| 16 |
+
---
|
| 17 |
+
# PiDiNet soft edges (fastforks)
|
| 18 |
+
|
| 19 |
+
Soft edge preprocessor of ControlNet 1.1 (controlnet_aux `PidiNetDetector`, ComfyUI's "PiDiNet Soft-Edge Lines"): pixel difference networks (Su et al., ICCV 2021), a 0.7 M-parameter edge detector of difference convolutions, here converted to plain depthwise convolutions (the authors' re-parameterization). Research use only.
|
| 20 |
+
|
| 21 |
+
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`.
|
| 22 |
+
|
| 23 |
+
Author weight repos: <https://huggingface.co/lllyasviel/Annotators>.
|
| 24 |
+
|
| 25 |
+
Task: edges. Tier: experimental. Outputs: `edges`. Backends: `portable`.
|
| 26 |
+
|
| 27 |
+
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.
|
| 28 |
+
|
| 29 |
+
## Variants
|
| 30 |
+
|
| 31 |
+
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/pidinet/card.toml).
|
| 32 |
+
|
| 33 |
+
| variant | weights (author link) | SHA-256 | weights licence | commercial use |
|
| 34 |
+
|---|---|---|---|---|
|
| 35 |
+
| `pidinet@1` | [table5_pidinet.pth](https://huggingface.co/lllyasviel/Annotators/resolve/982e7edaec38759d914a963c48c4726685de7d96/table5_pidinet.pth) | `80860ac26725` | LicenseRef-research-only (assumed from code) | **no** |
|
| 36 |
+
|
| 37 |
+
## Licence
|
| 38 |
+
|
| 39 |
+
Original-code strings, recorded as they are (research-use package; check them before any other use). Code: LicenseRef-research-only. Licence files: `LICENSE`.
|
| 40 |
+
|
| 41 |
+
Code licence: LicenseRef-research-only; the authors do not state a separate weights licence.
|
| 42 |
+
|
| 43 |
+
Training data: Not stated for these checkpoints (lllyasviel/Annotators, ControlNet 1.1). The file name matches the paper's table 5 BSDS500 model..
|
| 44 |
+
|
| 45 |
+
Licence evidence: https://github.com/huggingface/controlnet_aux/blob/b1aac318b15c4e65a21bc516dc236ad4bf593d46/src/controlnet_aux/pidi/LICENSE ; https://github.com/hellozhuo/pidinet/blob/master/LICENSE ; https://huggingface.co/lllyasviel/Annotators
|
| 46 |
+
|
| 47 |
+
## Input size
|
| 48 |
+
|
| 49 |
+
any H x W >= 32, padded to a multiple of 32
|
| 50 |
+
Tested up to (portable, fp16, RTX 5060 Ti 16 GB): `pidinet` 1080x1920 (0.3 GiB peak allocated, 0.4 reserved)
|
| 51 |
+
|
| 52 |
+
## Speed and memory
|
| 53 |
+
|
| 54 |
+
### Edges, synthetic, 1080x1920
|
| 55 |
+
|
| 56 |
+
| model | time (ms): original | portable | peak memory (MiB, allocated / reserved): original | portable |
|
| 57 |
+
| --- | --- | --- | --- | --- |
|
| 58 |
+
| `pidinet` | 35.9 | 13.1 | 339 / 368 | 328 / 372 |
|
| 59 |
+
|
| 60 |
+
### Startup and first call
|
| 61 |
+
|
| 62 |
+
| model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
|
| 63 |
+
| --- | --- | --- | --- | --- | --- | --- |
|
| 64 |
+
| `pidinet` | 0.28 | 0.16 | – | 0.06 | 0.01 | – |
|
| 65 |
+
|
| 66 |
+
### torch.compile and TensorRT
|
| 67 |
+
|
| 68 |
+
| 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) |
|
| 69 |
+
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
| 70 |
+
| `pidinet` | 1024x1024 | 6.59 ms | 5.66 ms | 4.50 ms | – | 12.4 s | 20.4 s | 186 / 228 | 166 / 190 | – | 187 / 200 |
|
| 71 |
+
|
| 72 |
+
Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).
|
| 73 |
+
|
| 74 |
+
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.
|
| 75 |
+
|
| 76 |
+
## Accuracy
|
| 77 |
+
|
| 78 |
+
### Parity with the original code
|
| 79 |
+
|
| 80 |
+
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`).
|
| 81 |
+
|
| 82 |
+
## Usage
|
| 83 |
+
|
| 84 |
+
```python
|
| 85 |
+
from fastforks import edges
|
| 86 |
+
|
| 87 |
+
# non-commercial weights: run with FASTFORKS_NONCOMMERCIAL=1 in the environment
|
| 88 |
+
model = edges.load("pidinet") # mode="auto": the preferred backend from recorded measurements
|
| 89 |
+
result = model("photo.jpg")
|
| 90 |
+
result.edges # [H, W] float32 in [0, 1], 1 = line, input resolution
|
| 91 |
+
result.backend # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')
|
| 92 |
+
```
|
| 93 |
+
|
| 94 |
+
Install with `pip install fastforks` (see <https://github.com/kleinicke/fastforks>). Other variants: `pidinet`.
|
| 95 |
+
|
| 96 |
+
## Kernels backend
|
| 97 |
+
|
| 98 |
+
No kernels backend: the converted network is plain convolutions (cuDNN); no custom kernel measured to pay off.
|
| 99 |
+
|
| 100 |
+
<!-- staged from fastforks 1cbf1671 (2026-11-15) -->
|