mirror of https://github.com/open-mmlab/mmpose
![]() |
||
---|---|---|
.. | ||
README.md | ||
README_CN.md | ||
human-pose.jpeg | ||
main.py | ||
requirements.txt |
README.md
RTMPose inference with ONNXRuntime
This example shows how to run RTMPose inference with ONNXRuntime in Python.
Prerequisites
1. Install onnxruntime inference engine.
Choose one of the following ways to install onnxruntime.
- CPU version
wget https://github.com/microsoft/onnxruntime/releases/download/v1.8.1/onnxruntime-linux-x64-1.8.1.tgz
tar -zxvf onnxruntime-linux-x64-1.8.1.tgz
export ONNXRUNTIME_DIR=$(pwd)/onnxruntime-linux-x64-1.8.1
export LD_LIBRARY_PATH=$ONNXRUNTIME_DIR/lib:$LD_LIBRARY_PATH
- GPU version
pip install onnxruntime-gpu==1.8.1
wget https://github.com/microsoft/onnxruntime/releases/download/v1.8.1/onnxruntime-linux-x64-gpu-1.8.1.tgz
tar -zxvf onnxruntime-linux-x64-gpu-1.8.1.tgz
export ONNXRUNTIME_DIR=$(pwd)/onnxruntime-linux-x64-gpu-1.8.1
export LD_LIBRARY_PATH=$ONNXRUNTIME_DIR/lib:$LD_LIBRARY_PATH
2. Convert model to onnx files
- Install
mim
tool.
pip install -U openmim
- Download
mmpose
model.
# choose one rtmpose model
mim download mmpose --config rtmpose-m_8xb64-270e_coco-wholebody-256x192 --dest .
- Clone
mmdeploy
repo.
git clone https://github.com/open-mmlab/mmdeploy.git
- Convert model to onnx files.
python mmdeploy/tools/deploy.py \
mmdeploy/configs/mmpose/pose-detection_simcc_onnxruntime_dynamic.py \
mmpose/rtmpose-m_8xb64-270e_coco-wholebody-256x192.py \
mmpose/rtmpose-m_simcc-coco-wholebody_pt-aic-coco_270e-256x192-cd5e845c_20230123.pth \
mmdeploy/demo/resources/human-pose.jpg \
--work-dir mmdeploy_model/mmpose/ort \
--device cuda \
--dump-info
Run demo
Install dependencies
pip install -r requirements.txt
Usage:
python main.py \
{ONNX_FILE} \
{IMAGE_FILE} \
--device {DEVICE} \
--save-path {SAVE_PATH}
Description of all arguments
ONNX_FILE
: The path of onnx fileIMAGE_FILE
: The path of image fileDEVICE
: The device to run the model, default iscpu
SAVE_PATH
: The path to save the output image, default isoutput.jpg