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8 |
+
tags:
|
| 9 |
+
- Axera
|
| 10 |
+
- RTMPose
|
| 11 |
+
- Pose Estimation
|
| 12 |
+
- Keypoint Detection
|
| 13 |
+
- SimCC
|
| 14 |
+
- OpenMMLab
|
| 15 |
---
|
| 16 |
+
|
| 17 |
+
# RTMPose-M
|
| 18 |
+
|
| 19 |
+
This version of **RTMPose-M** (256x192) has been converted to run on the Axera NPU using **mixed w16/fp32** quantization. It is optimized for real-time human pose estimation with 17 COCO keypoints using the SimCC decoding approach.
|
| 20 |
+
|
| 21 |
+
Compatible with Pulsar2 version: 6.0.
|
| 22 |
+
|
| 23 |
+
## Model Info
|
| 24 |
+
|
| 25 |
+
| Item | Value |
|
| 26 |
+
| :--- | :--- |
|
| 27 |
+
| **Architecture** | RTMPose-M (CSPNeXt + SimCC Head) |
|
| 28 |
+
| **Parameters** | 13.58M |
|
| 29 |
+
| **Input** | 1x256x192x3 (NHWC, uint8, BGR) |
|
| 30 |
+
| **Output** | simcc_x (1,17,384), simcc_y (1,17,512) |
|
| 31 |
+
| **Keypoints** | 17 (COCO format) |
|
| 32 |
+
| **Source** | [OpenMMLab MMPose](https://github.com/open-mmlab/mmpose) |
|
| 33 |
+
|
| 34 |
+
## Convert tools links:
|
| 35 |
+
|
| 36 |
+
For those who are interested in model conversion, you can try to export axmodel through:
|
| 37 |
+
- [The repo of AXera Platform](https://github.com/AXERA-TECH/ax-samples), where you can get the detailed guide.
|
| 38 |
+
- [Pulsar2 Link, How to Convert ONNX to axmodel](https://pulsar2-docs.readthedocs.io/en/latest/pulsar2/introduction.html)
|
| 39 |
+
|
| 40 |
+
## Support Platform
|
| 41 |
+
|
| 42 |
+
- **AX650N/AX8850**
|
| 43 |
+
- [M4N-Dock(爱芯派Pro)](https://wiki.sipeed.com/hardware/zh/maixIV/m4ndock/m4ndock.html)
|
| 44 |
+
- [M.2 Accelerator card](https://docs.m5stack.com/en/ai_hardware/LLM-8850_Card)
|
| 45 |
+
- **AX630C**
|
| 46 |
+
- [爱芯派2](https://axera-pi-2-docs-cn.readthedocs.io/zh-cn/latest/index.html)
|
| 47 |
+
- [Module-LLM](https://docs.m5stack.com/zh_CN/module/Module-LLM)
|
| 48 |
+
- [LLM630 Compute Kit](https://docs.m5stack.com/zh_CN/core/LLM630%20Compute%20Kit)
|
| 49 |
+
|
| 50 |
+
### Performance Statistics
|
| 51 |
+
|
| 52 |
+
#### AX650N
|
| 53 |
+
|
| 54 |
+
| Model | Latency(ms) npu3 |
|
| 55 |
+
| :--- | :---: |
|
| 56 |
+
| **rtmpose_m** | 2.881 |
|
| 57 |
+
|
| 58 |
+
## Conversion Pipeline
|
| 59 |
+
|
| 60 |
+
1. **Export ONNX** — Download official RTMPose-M from OpenMMLab and fix batch dim:
|
| 61 |
+
|
| 62 |
+
```bash
|
| 63 |
+
python export_onnx.py
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
2. **Replace HardSigmoid** — Replace HardSigmoid ops with Mul+Add+Clip for better NPU quantization:
|
| 67 |
+
|
| 68 |
+
```bash
|
| 69 |
+
python replace_hardsigmoid.py
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
3. **Compile axmodel** — Use Pulsar2 with the provided `config.json` to quantize and compile:
|
| 73 |
+
|
| 74 |
+
```bash
|
| 75 |
+
pulsar2 build --target_hardware AX650 --config config.json --input rtmpose_m_256x192_no_hs.onnx --output_dir AX650
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
## How to use
|
| 79 |
+
|
| 80 |
+
Download all files from this repository to the device.
|
| 81 |
+
|
| 82 |
+
### python env requirement
|
| 83 |
+
|
| 84 |
+
#### pyaxengine
|
| 85 |
+
|
| 86 |
+
https://github.com/AXERA-TECH/pyaxengine
|
| 87 |
+
|
| 88 |
+
```bash
|
| 89 |
+
wget https://github.com/AXERA-TECH/pyaxengine/releases/download/0.1.3.rc2/axengine-0.1.3-py3-none-any.whl
|
| 90 |
+
pip install axengine-0.1.3-py3-none-any.whl
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
### Inference with AX650 Host, such as M4N-Dock(爱芯派Pro)
|
| 94 |
+
|
| 95 |
+
Input image:
|
| 96 |
+
|
| 97 |
+

|
| 98 |
+
|
| 99 |
+
run
|
| 100 |
+
```bash
|
| 101 |
+
python3 ax_infer.py -m rtmpose_m_npu3.axmodel -i test.jpg
|
| 102 |
+
```
|
| 103 |
+
|
| 104 |
+
```bash
|
| 105 |
+
root@ax650:~/data# python3 ax_infer.py -m rtmpose_m_npu3.axmodel -i test.jpg
|
| 106 |
+
[INFO] Available providers: ['AxEngineExecutionProvider']
|
| 107 |
+
[INFO] Using provider: AxEngineExecutionProvider
|
| 108 |
+
[INFO] Chip type: ChipType.MC50
|
| 109 |
+
[INFO] VNPU type: VNPUType.DISABLED
|
| 110 |
+
[INFO] Engine version: 2.10.1s
|
| 111 |
+
[INFO] Model type: 2 (triple core)
|
| 112 |
+
[INFO] Compiler version: 6.0 93b95f7f
|
| 113 |
+
Model input: name=input, shape=[1, 256, 192, 3], dtype=uint8
|
| 114 |
+
Forward: 3.38 ms (avg of 10 runs)
|
| 115 |
+
simcc_x: shape=(1, 17, 384), range=[-0.58, 0.88]
|
| 116 |
+
simcc_y: shape=(1, 17, 512), range=[-0.49, 0.88]
|
| 117 |
+
kpts above 0.3: 17/17
|
| 118 |
+
kp00: ( 359.6, 83.3) score=0.6773
|
| 119 |
+
kp01: ( 370.0, 79.2) score=0.6950
|
| 120 |
+
kp02: ( 359.6, 77.1) score=0.6878
|
| 121 |
+
kp03: ( 384.6, 79.2) score=0.7398
|
| 122 |
+
kp04: ( 359.6, 79.2) score=0.6385
|
| 123 |
+
kp05: ( 403.3, 106.3) score=0.7596
|
| 124 |
+
kp06: ( 367.9, 116.7) score=0.7683
|
| 125 |
+
kp07: ( 432.5, 152.1) score=0.4699
|
| 126 |
+
kp08: ( 342.9, 158.3) score=0.6831
|
| 127 |
+
kp09: ( 445.0, 177.1) score=0.3021
|
| 128 |
+
kp10: ( 305.4, 179.2) score=0.5798
|
| 129 |
+
kp11: ( 432.5, 212.5) score=0.7872
|
| 130 |
+
kp12: ( 399.2, 218.7) score=0.8110
|
| 131 |
+
kp13: ( 432.5, 289.6) score=0.7358
|
| 132 |
+
kp14: ( 372.1, 279.2) score=0.8252
|
| 133 |
+
kp15: ( 470.0, 356.2) score=0.6704
|
| 134 |
+
kp16: ( 399.2, 345.8) score=0.8183
|
| 135 |
+
Saved: ax_result.jpg
|
| 136 |
+
```
|
| 137 |
+
|
| 138 |
+
Output image:
|
| 139 |
+
|
| 140 |
+

|
| 141 |
+
|