File size: 3,807 Bytes
bf8fe4a
 
ef64732
 
 
 
 
 
 
 
 
 
 
 
bf8fe4a
ef64732
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
---
license: apache-2.0
language:
- en
base_model:
- RTMPose-M
pipeline_tag: image-classification
tags:
- Axera
- RTMPose
- Pose Estimation
- Keypoint Detection
- SimCC
- OpenMMLab
---

# RTMPose-M

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.

Compatible with Pulsar2 version: 6.0.

## Model Info

| Item | Value |
| :--- | :--- |
| **Architecture** | RTMPose-M (CSPNeXt + SimCC Head) |
| **Parameters** | 13.58M |
| **Input** | 1x256x192x3 (NHWC, uint8, BGR) |
| **Output** | simcc_x (1,17,384), simcc_y (1,17,512) |
| **Keypoints** | 17 (COCO format) |
| **Source** | [OpenMMLab MMPose](https://github.com/open-mmlab/mmpose) |

## Convert tools links:

For those who are interested in model conversion, you can try to export axmodel through:
- [The repo of AXera Platform](https://github.com/AXERA-TECH/ax-samples), where you can get the detailed guide.
- [Pulsar2 Link, How to Convert ONNX to axmodel](https://pulsar2-docs.readthedocs.io/en/latest/pulsar2/introduction.html)

## Support Platform

- **AX650N/AX8850**
  - [M4N-Dock(爱芯派Pro)](https://wiki.sipeed.com/hardware/zh/maixIV/m4ndock/m4ndock.html)
  - [M.2 Accelerator card](https://docs.m5stack.com/en/ai_hardware/LLM-8850_Card)

### Performance Statistics

#### AX650N

| Model | Latency(ms) npu3 |
| :--- | :---: |
| **rtmpose_m** | 2.881 |

## Conversion Pipeline

1. **Export ONNX** — Download official RTMPose-M from OpenMMLab and fix batch dim:

```bash
python export_onnx.py
```

2. **Replace HardSigmoid** — Replace HardSigmoid ops with Mul+Add+Clip for better NPU quantization:

```bash
python replace_hardsigmoid.py
```

3. **Compile axmodel** — Use Pulsar2 with the provided `config.json` to quantize and compile:

```bash
pulsar2 build --target_hardware AX650 --config config.json --input rtmpose_m_256x192_no_hs.onnx --output_dir AX650
```

## How to use

Download all files from this repository to the device.

### python env requirement

#### pyaxengine

https://github.com/AXERA-TECH/pyaxengine

```bash
wget https://github.com/AXERA-TECH/pyaxengine/releases/download/0.1.3.rc2/axengine-0.1.3-py3-none-any.whl
pip install axengine-0.1.3-py3-none-any.whl
```

### Inference with AX650 Host, such as M4N-Dock(爱芯派Pro)

Input image:

![](test.jpg)

run
```bash
python3 ax_infer.py -m rtmpose_m_npu3.axmodel -i test.jpg
```

```bash
root@ax650:~/data# python3 ax_infer.py -m rtmpose_m_npu3.axmodel -i test.jpg
[INFO] Available providers:  ['AxEngineExecutionProvider']
[INFO] Using provider: AxEngineExecutionProvider
[INFO] Chip type: ChipType.MC50
[INFO] VNPU type: VNPUType.DISABLED
[INFO] Engine version: 2.10.1s
[INFO] Model type: 2 (triple core)
[INFO] Compiler version: 6.0 93b95f7f
Model input: name=input, shape=[1, 256, 192, 3], dtype=uint8
Forward: 3.38 ms (avg of 10 runs)
simcc_x: shape=(1, 17, 384), range=[-0.58, 0.88]
simcc_y: shape=(1, 17, 512), range=[-0.49, 0.88]
kpts above 0.3: 17/17
  kp00: ( 359.6,   83.3)  score=0.6773
  kp01: ( 370.0,   79.2)  score=0.6950
  kp02: ( 359.6,   77.1)  score=0.6878
  kp03: ( 384.6,   79.2)  score=0.7398
  kp04: ( 359.6,   79.2)  score=0.6385
  kp05: ( 403.3,  106.3)  score=0.7596
  kp06: ( 367.9,  116.7)  score=0.7683
  kp07: ( 432.5,  152.1)  score=0.4699
  kp08: ( 342.9,  158.3)  score=0.6831
  kp09: ( 445.0,  177.1)  score=0.3021
  kp10: ( 305.4,  179.2)  score=0.5798
  kp11: ( 432.5,  212.5)  score=0.7872
  kp12: ( 399.2,  218.7)  score=0.8110
  kp13: ( 432.5,  289.6)  score=0.7358
  kp14: ( 372.1,  279.2)  score=0.8252
  kp15: ( 470.0,  356.2)  score=0.6704
  kp16: ( 399.2,  345.8)  score=0.8183
Saved: ax_result.jpg
```

Output image:

![](ax_result.jpg)