Flor commited on
Commit
733b91c
·
verified ·
1 Parent(s): a0f0777

card: update from fastforks 1cbf1671

Browse files
Files changed (1) hide show
  1. README.md +118 -0
README.md ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: "fastforks"
3
+ pipeline_tag: "keypoint-detection"
4
+ license: "apache-2.0"
5
+ tags:
6
+ - "pose"
7
+ - "pose-estimation"
8
+ - "human-pose-estimation"
9
+ - "keypoint-detection"
10
+ - "cuda"
11
+ - "pytorch"
12
+ - "fastforks"
13
+ - "fastforks-card"
14
+ ---
15
+ # HRNet (fastforks)
16
+
17
+ HRNet (Sun et al. 2019): top-down 2D human pose with a high-resolution CNN that keeps a 1/4-scale branch through the whole network and repeatedly exchanges features with three coarser parallel branches; a 1 x 1 conv on the finest branch gives one heatmap per keypoint, decoded as its maximum moved a quarter heatmap pixel towards the larger neighbour. The mmpose COCO checkpoints (w32 / w48, 256 x 192 and 384 x 288) return the 17 COCO keypoints. Takes person boxes (e.g. from `fastforks.detection`) and crops each at the network size; vendored from mmpose (no mmpose / mmcv dependency). The portable `module()` maps crops to heatmaps.
18
+
19
+ 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/open-mmlab/mmpose> at `5408bc76f5b8`.
20
+
21
+ Task: pose. Tier: stable. Outputs: `keypoints`, `keypoint_scores`, `boxes`, `scores`. Backends: `portable`, `kernels`.
22
+
23
+ Input: one RGB image and a box per person. Output: keypoints with confidence scores for every person.
24
+
25
+ ## Variants
26
+
27
+ 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/pose/models/hrnet/card.toml).
28
+
29
+ | variant | weights (author link) | SHA-256 | weights licence | commercial use |
30
+ |---|---|---|---|---|
31
+ | `hrnet-w32@1` | [hrnet-w32-coco-256x192.pth](https://download.openmmlab.com/mmpose/v1/body_2d_keypoint/topdown_heatmap/coco/td-hm_hrnet-w32_8xb64-210e_coco-256x192-81c58e40_20220909.pth) | `81c58e403a1b` | Apache-2.0 | yes |
32
+ | `hrnet-w32-384@1` | [hrnet-w32-coco-384x288.pth](https://download.openmmlab.com/mmpose/v1/body_2d_keypoint/topdown_heatmap/coco/td-hm_hrnet-w32_8xb64-210e_coco-384x288-ca5956af_20220909.pth) | `ca5956af0765` | Apache-2.0 | yes |
33
+ | `hrnet-w48@1` | [hrnet-w48-coco-256x192.pth](https://download.openmmlab.com/mmpose/v1/body_2d_keypoint/topdown_heatmap/coco/td-hm_hrnet-w48_8xb32-210e_coco-256x192-0e67c616_20220913.pth) | `0e67c6167d6a` | Apache-2.0 | yes |
34
+ | `hrnet-w48-384@1` | [hrnet-w48-coco-384x288.pth](https://download.openmmlab.com/mmpose/v1/body_2d_keypoint/topdown_heatmap/coco/td-hm_hrnet-w48_8xb32-210e_coco-384x288-c161b7de_20220915.pth) | `c161b7defc14` | 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
+ Training data: COCO 2017 (train, instance annotations), ImageNet-1k (ILSVRC 2012 classification) (COCO 2017 keypoints; the HRNet backbone was initialised from ImageNet-1k classification weights).
41
+
42
+ Licence evidence: <https://github.com/open-mmlab/mmpose/blob/5408bc76f5b848cf925a0d1857899011d8c5b497/README.md#license>
43
+
44
+ ## Input size
45
+
46
+ any H x W >= 32, padded to a multiple of 32
47
+ Tested up to (portable, fp16, RTX 5060 Ti 16 GB): `hrnet-w32` 3000x4000 (0.5 GiB peak allocated, 0.5 reserved); `hrnet-w32-384` 3000x4000 (0.7 GiB peak allocated, 0.8 reserved); `hrnet-w48` 3000x4000 (0.5 GiB peak allocated, 0.6 reserved); `hrnet-w48-384` 3000x4000 (0.8 GiB peak allocated, 0.9 reserved)
48
+
49
+ ## Speed and memory
50
+
51
+ ### Pose, synthetic, 1080x1920
52
+
53
+ | model | time (ms): original fp32 | original | portable | kernels | kernels speed-up: vs original | vs portable | peak memory (MiB, allocated / reserved): original | portable | kernels |
54
+ | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
55
+ | `hrnet-w32` | 176 | 190 | 20.3 | 9.79 | 18.0x | 2.1x | 336 / 398 | 195 / 258 | 210 / 262 |
56
+ | `hrnet-w32-384` | 216 | 190 | 38.8 | 19.4 | 9.8x | 2.0x | 653 / 760 | 341 / 434 | 305 / 380 |
57
+ | `hrnet-w48` | 200 | 206 | 32.0 | 15.5 | 12.9x | 2.1x | 440 / 462 | 262 / 322 | 343 / 398 |
58
+ | `hrnet-w48-384` | 276 | 245 | 70.5 | 33.9 | 7.2x | 2.1x | 1014 / 1082 | 408 / 498 | 438 / 498 |
59
+
60
+ ### Startup and first call
61
+
62
+ | model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
63
+ | --- | --- | --- | --- | --- | --- | --- |
64
+ | `hrnet-w32` | 0.45 | 0.25 | 2.53 | 0.38 | 0.56 | 0.28 |
65
+ | `hrnet-w32-384` | 0.42 | 0.25 | 2.04 | 0.23 | 0.57 | 0.25 |
66
+ | `hrnet-w48` | 0.72 | 0.40 | 2.10 | 0.23 | 0.34 | 0.15 |
67
+ | `hrnet-w48-384` | 0.53 | 0.39 | 2.16 | 0.24 | 0.35 | 0.21 |
68
+
69
+ ### torch.compile and TensorRT
70
+
71
+ | 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) |
72
+ | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
73
+ | `hrnet-w32` | 1080x1920 | 20.3 ms | 9.94 ms | 5.18 ms (network on person crops only) | 9.79 ms | 21.1 s | 25.5 s | 195 / 258 | 178 / 214 | 210 / 262 | 216 / 254 |
74
+ | `hrnet-w32-384` | 1080x1920 | 38.8 ms | 19.6 ms | 10.7 ms (network on person crops only) | 19.4 ms | 21.5 s | 26.3 s | 341 / 434 | 211 / 234 | 305 / 380 | 296 / 320 |
75
+ | `hrnet-w48` | 1080x1920 | 32.0 ms | 21.2 ms | 9.46 ms (network on person crops only) | 15.5 ms | 21.3 s | 26.9 s | 262 / 322 | 245 / 282 | 343 / 398 | 346 / 388 |
76
+ | `hrnet-w48-384` | 1080x1920 | 70.5 ms | 46.0 ms | 22.3 ms (network on person crops only) | 33.9 ms | 22.6 s | 28.3 s | 408 / 498 | 278 / 300 | 438 / 498 | 427 / 454 |
77
+
78
+ Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).
79
+
80
+ 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.
81
+
82
+ ## Accuracy
83
+
84
+ ### On public datasets
85
+
86
+ Top-down on the ground-truth person boxes (non-crowd, at least one labelled keypoint), no flip test; people ranked by the mean of their 17 keypoint scores (not mmpose's rescoring and OKS-NMS), so not the papers' AP; pycocotools OKS AP; whole-body models scored on their 17 body keypoints. Original = the original code named under Details, same checkpoint and protocol.
87
+
88
+ | variant | dataset | original fp32 | original fp16 | portable | kernels | note |
89
+ |---|---|---|---|---|---|---|
90
+ | `hrnet-w32` | COCO val2017, ground-truth person boxes, keypoint AP | 75.5 | 75.5 | 76.5 | 76.5 | |
91
+ | `hrnet-w32-384` | COCO val2017, ground-truth person boxes, keypoint AP | 76.7 | 76.7 | 77.6 | 77.7 | |
92
+ | `hrnet-w48` | COCO val2017, ground-truth person boxes, keypoint AP | 76.5 | 76.6 | 76.7 | 76.7 | |
93
+ | `hrnet-w48-384` | COCO val2017, ground-truth person boxes, keypoint AP | 77.0 | 77.0 | 77.7 | 77.6 | |
94
+
95
+ Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 87e1be16, 2026-11-11.
96
+
97
+ ### Parity with the original code
98
+
99
+ Every variant is checked against reference outputs of the original code at its pinned commit. CPU, float32: max |diff| <= 4.6e-05 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.32 and p99 <= 4.8 (absolute error of the output `keypoints`).
100
+
101
+ ## Usage
102
+
103
+ ```python
104
+ from fastforks import pose
105
+
106
+ model = pose.load("hrnet-w32") # mode="auto": the preferred backend from recorded measurements
107
+ result = model("photo.jpg", boxes=[[x0, y0, x1, y1]]) # one box per person, or a fastforks.detection result
108
+ result.keypoints, result.keypoint_scores # [P, K, 2] input pixels, [P, K]
109
+ result.backend # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')
110
+ ```
111
+
112
+ Install with `pip install fastforks` (see <https://github.com/kleinicke/fastforks>). Other variants: `hrnet-w32`, `hrnet-w32-384`, `hrnet-w48`, `hrnet-w48-384`.
113
+
114
+ ## Kernels backend
115
+
116
+ `pose.load("hrnet-w32", mode="kernels")` runs our CUDA kernels (`cudnn_hacc`, `fvm_conv`, `fvm_extra`, `fvm_mb`, `fvm_r3`). 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.
117
+
118
+ <!-- staged from fastforks 1cbf1671 (2026-11-15) -->