mlboydaisuke commited on
Commit
72f0e76
·
verified ·
1 Parent(s): ae05363

RTMPose-s LiteRT fp16 (fully-GPU, Pixel 8a corr 0.999, 4ms)

Browse files
Files changed (3) hide show
  1. README.md +56 -0
  2. rtmpose_s_fp16.tflite +3 -0
  3. samples/sample.png +0 -0
README.md ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: LiteRT
4
+ pipeline_tag: keypoint-detection
5
+ tags: [litert, tflite, on-device, android, gpu, pose-estimation, keypoint-detection, rtmpose, mmpose]
6
+ base_model: open-mmlab/mmpose
7
+ ---
8
+
9
+ # RTMPose-s — LiteRT (on-device real-time 2D human pose, fully-GPU)
10
+
11
+ [RTMPose](https://github.com/open-mmlab/mmpose/tree/main/projects/rtmpose) (mmpose, CSPNeXt backbone +
12
+ RTMCC/SimCC head) top-down 2D human pose, converted to **LiteRT** and running **fully on the `CompiledModel`
13
+ GPU** (ML Drift) on Android. Estimates 17 COCO keypoints for a single centered person — the SOTA real-time
14
+ pose model, device-verified end-to-end.
15
+
16
+ ![RTMPose-s — input | skeleton (on-device LiteRT GPU)](samples/sample.png)
17
+
18
+ ## On-device (Pixel 8a, Tensor G3 — verified)
19
+
20
+ | | |
21
+ |---|---|
22
+ | nodes on GPU | **256 / 256** LITERT_CL (full residency) |
23
+ | inference | **~4 ms** (256×192) |
24
+ | size | 11.1 MB (fp16) |
25
+ | accuracy | device-vs-PyTorch SimCC corr **0.999**, keypoints within **0.3 px** (max 1 px) |
26
+
27
+ ```
28
+ image[1,3,256,192] (ImageNet 0-255 norm) →[GPU: CSPNeXt + RTMCC]→ simcc_x[1,17,384], simcc_y[1,17,512]
29
+ ```
30
+
31
+ The SimCC head emits two 1D distributions per keypoint; argmax over the bins (÷ split=2) gives the pixel x/y.
32
+
33
+ ## How it converts (litert-torch) — two numerically-exact re-authorings
34
+
35
+ Both are **on-device-only** Mali issues: they pass the desktop op-check and report full LITERT_CL residency,
36
+ yet the device output was wrong until fixed (*residency ≠ correctness*):
37
+
38
+ 1. **`ScaleNorm` (RMS norm) fp16 overflow → all-zero head.** The RTMCC `ScaleNorm` input reaches ≈ |274|, so
39
+ its channel `Σ x²` ≈ 3.6M **overflows fp16 (max 65504)** on the Mali delegate (which reduces in fp16 even
40
+ for an fp32 graph) → `norm = ∞` → `x/∞ = 0` → the whole head collapses to zero. Fix: scale `x` down by
41
+ S=64 **before** squaring, then rescale (math-identical) — a SafeRMSNorm.
42
+ 2. **GAU attention `act@act` BMM → broadcast-reduce.** The Gated Attention Unit's `q@kᵀ` and `kernel@v` are
43
+ activation×activation batch-matmuls that the Mali delegate mis-computes; at K=17 tokens the exact
44
+ replacement is `(q[:,:,None,:]·k[:,None,:,:]).sum(-1)`.
45
+
46
+ Result: banned ops NONE, all tensors ≤4D, tflite-vs-torch corr **1.0**, device-vs-torch corr **0.999**.
47
+
48
+ ## Preprocessing
49
+
50
+ Center-crop to 3:4, resize to 192×256, ImageNet 0-255 normalize (mean [123.675, 116.28, 103.53], std
51
+ [58.395, 57.12, 57.375]), NCHW planar. Top-down — expects one roughly-centered person.
52
+
53
+ ## License
54
+
55
+ [Apache-2.0](https://github.com/open-mmlab/mmpose/blob/main/LICENSE). Upstream:
56
+ [open-mmlab/mmpose](https://github.com/open-mmlab/mmpose) RTMPose-s.
rtmpose_s_fp16.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:89f2d5c921bd824a39b37fc718550909cbb60d90e1cba48aa88b3ef71fab631d
3
+ size 11139472
samples/sample.png ADDED