Flor commited on
Commit
6e43f6d
·
verified ·
1 Parent(s): e7dacce

card: update from fastforks 1cbf1671

Browse files
Files changed (1) hide show
  1. README.md +116 -0
README.md ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: "fastforks"
3
+ pipeline_tag: "depth-estimation"
4
+ license: "openrail++"
5
+ tags:
6
+ - "depth"
7
+ - "mono-depth"
8
+ - "monocular-depth"
9
+ - "cuda"
10
+ - "pytorch"
11
+ - "fastforks"
12
+ - "fastforks-card"
13
+ base_model:
14
+ - "Stable-X/yoso-normal-v0-3"
15
+ ---
16
+ # StableNormal turbo (fastforks)
17
+
18
+ StableNormal turbo (Ye et al., SIGGRAPH Asia 2024): surface normals in one step (YOSO, v0.3); a Stable Diffusion 2 UNet denoises a normals latent with the image latent fed through a ControlNet encoder.
19
+
20
+ 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/Stable-X/StableNormal> at `594b934630ab`.
21
+
22
+ Author weight repos: <https://huggingface.co/Stable-X/yoso-normal-v0-3>.
23
+
24
+ Task: depth. Tier: experimental. Outputs: `normals`. Backends: `portable`, `kernels`.
25
+
26
+ Input: one RGB image. Output: a depth or inverse-depth map. `kind` (a card field, `result.kind`) says what the numbers mean: `metric` = metres; `scale_invariant`, `affine_invariant`, `affine_invariant_log` (log depth) and `affine_invariant_inverse` are relative (unknown scale or shift, not metres). Metric models that use the focal length take `model(image, intrinsics=K)` (K `[3, 3]`, pixels of the input): `metric3d-vit-large` and `da3metric-large` need it for correct metres (`da3metric-large`: metres = output x focal / 300; without `intrinsics=` a 300 px focal length is assumed, wrong for a real camera). `unidepth-v2-vitl14`, `unik3d-vitl`, `depth-pro` and MoGe estimate the camera themselves (given `intrinsics=` replace `fx`); `zoedepth-nk` and the relative models (`da3mono-large` too) take none. Normals-only models (`kind` `none`) return `result.normals` `[B, H, W, 3]` (unit vectors, camera frame: x right, y down, z forward).
27
+
28
+ ## Variants
29
+
30
+ 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/depth/models/stablenormal/card.toml).
31
+
32
+ | variant | weights (author link) | SHA-256 | weights licence | commercial use |
33
+ |---|---|---|---|---|
34
+ | `stablenormal-turbo@1` | [unet/diffusion_pytorch_model.fp16.safetensors](https://huggingface.co/Stable-X/yoso-normal-v0-3/resolve/2202fcb69960d94b437e06c19c556a12ceeb57c0/unet/diffusion_pytorch_model.fp16.safetensors)<br>[vae/diffusion_pytorch_model.fp16.safetensors](https://huggingface.co/Stable-X/yoso-normal-v0-3/resolve/2202fcb69960d94b437e06c19c556a12ceeb57c0/vae/diffusion_pytorch_model.fp16.safetensors)<br>[text_encoder/model.fp16.safetensors](https://huggingface.co/Stable-X/yoso-normal-v0-3/resolve/2202fcb69960d94b437e06c19c556a12ceeb57c0/text_encoder/model.fp16.safetensors)<br>[controlnet/diffusion_pytorch_model.fp16.safetensors](https://huggingface.co/Stable-X/yoso-normal-v0-3/resolve/2202fcb69960d94b437e06c19c556a12ceeb57c0/controlnet/diffusion_pytorch_model.fp16.safetensors) | `b966130575b7`<br>`3e4c08995484`<br>`bc1827c46545`<br>`d54aabc094e3` | Apache-2.0 | yes |
35
+
36
+ ## Licence
37
+
38
+ Original-code strings, recorded as they are (research-use package; check them before any other use). Code: Apache-2.0. Licence files: `LICENSE`.
39
+
40
+ Derived from Stable Diffusion 2: the CreativeML OpenRAIL++-M use restrictions (Attachment A, <https://huggingface.co/stabilityai/stable-diffusion-2/blob/main/LICENSE-MODEL>) apply to these weights and to their redistribution, in addition to the terms above.
41
+
42
+ Training data: Stable Diffusion 2 (LAION-5B subsets) fine-tuned on synthetic and real normals datasets (Hypersim, Replica, ScanNet and others per the StableNormal paper, arXiv 2406.16864).
43
+
44
+ Licence evidence: https://github.com/Stable-X/StableNormal/blob/594b934630ab3bc71f35c77d14ec7feb98480cd0/LICENSE.txt (Apache-2.0); https://huggingface.co/Stable-X/yoso-normal-v0-3/blob/2202fcb69960d94b437e06c19c556a12ceeb57c0/README.md (license: apache-2.0)
45
+
46
+ ## Input size
47
+
48
+ any H x W >= 1, resized or padded inside the model
49
+ Tested up to (portable, fp16, RTX 5060 Ti 16 GB): `stablenormal-turbo` 3000x4000 (3.6 GiB peak allocated, 4.8 reserved)
50
+
51
+ ## Speed and memory
52
+
53
+ ### Depth, synthetic
54
+
55
+ | model | input | time (ms): original fp32 | original | portable | kernels | kernels speed-up: vs original | vs portable | peak memory (MiB, allocated / reserved): original | portable | kernels |
56
+ | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
57
+ | `stablenormal-turbo` | 994x1482 | – | 299 | 289 | 180 | 1.7x | 1.6x | 4156 / 4374 | 3463 / 3628 | 3037 / 3172 |
58
+
59
+ ### Startup and first call
60
+
61
+ | model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
62
+ | --- | --- | --- | --- | --- | --- | --- |
63
+ | `stablenormal-turbo` | 6.36 | 2.94 | 3.25 | 1.13 | 0.54 | 0.35 |
64
+
65
+ ### torch.compile and TensorRT
66
+
67
+ | 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) |
68
+ | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
69
+ | `stablenormal-turbo` | 994x1482 | 289 ms | 238 ms | 118 ms | 180 ms | 76.3 s | 198 s | 3463 / 3628 | 3019 / 3106 | 3037 / 3172 | 5587 / 5626 |
70
+
71
+ Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).
72
+
73
+ 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.
74
+
75
+ ## Accuracy
76
+
77
+ ### On public datasets
78
+
79
+ AbsRel / delta1 after a least-squares scale + shift fit (in disparity space for inverse-depth models), mean over images. Original = the original code named under Details, same checkpoint and protocol.
80
+
81
+ | variant | dataset | original fp32 | original fp16 | portable | kernels | note |
82
+ |---|---|---|---|---|---|---|
83
+ | `stablenormal-turbo` | iBims-1 normals, mean / median angle deg, % < 11.25 / < 30 deg | 17.46 / 8.26 / 63.83 / 82.71 | 17.46 / 8.26 / 63.83 / 82.70 | 17.46 / 8.26 / 63.83 / 82.71 | 17.46 / 8.26 / 63.83 / 82.71 | |
84
+
85
+ Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks aee4b565, 2026-11-13.
86
+
87
+ ### Parity with the original code
88
+
89
+ Every variant is checked against reference outputs of the original code at its pinned commit. CPU, float32: max |diff| <= 1e-05 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.00046 and p99 <= 0.0021 (absolute error of the output `normals`).
90
+
91
+ ## Limitations
92
+
93
+ - Normals only: no depth.
94
+ - Diffusion model: the seeded noise comes from a CPU generator; upstream draws it from the unseeded global RNG, so its outputs vary from call to call (slightly).
95
+ - Upstream's `Predictor` wrapper (pre-resize to a multiple of 64 near 1024 px, uint8 round trip, LANCZOS back) is not applied: the runners follow its pipeline (768 px).
96
+ - A traced or exported module reuses the noise of its traced shape.
97
+
98
+ ## Usage
99
+
100
+ ```python
101
+ from fastforks import depth
102
+
103
+ model = depth.load("stablenormal-turbo") # mode="auto": the preferred backend from recorded measurements
104
+ result = model("room.jpg")
105
+ result.normals # [H, W] float32 tensor; result.kind says what the maps mean
106
+ # models that take a camera: model("room.jpg", intrinsics=K), K [3, 3] in pixels
107
+ result.backend # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')
108
+ ```
109
+
110
+ Install with `pip install fastforks` (see <https://github.com/kleinicke/fastforks>). Other variants: `stablenormal-turbo`.
111
+
112
+ ## Kernels backend
113
+
114
+ `depth.load("stablenormal-turbo", mode="kernels")` runs our CUDA kernels (`cudnn_hacc`). It needs a prebuilt kernel for your GPU architecture (downloaded from <https://huggingface.co/fastforks/kernels> on first use) and a recent NVIDIA driver; if there is none it raises `BackendUnavailableError` with the reason and never falls back silently. `mode="auto"` picks `kernels` when it can run and logs the choice.
115
+
116
+ <!-- staged from fastforks 1cbf1671 (2026-11-15) -->