MMDeploy installation and pth to ONNX

reference:

https://github.com/open-mmlab/mmdeploy/blob/main/README_zh-CN.md

MMDeploy installation guide

        MMDeploy is  an OpenMMLab  model deployment toolbox that provides a unified deployment experience for each algorithm library . Based on MMDeploy, developers can easily generate the SDK required for the specified hardware from the training repo, saving a lot of adaptation time.

1. MMDeploy installation

        Front installation: MMPose installation guide

conda activate mmpose
cd E:\pythonproject\

(1) MMDeploy

1. Install the MMDeploy model conversion tool (including trt/ort custom operators) 

pip install mmdeploy==1.0.0

2. Install the MMDeploy SDK reasoning tool. You can choose one of them to download and install according to whether you need GPU reasoning. The following is to support onnxruntime-gpu tensorrt reasoning: but I only need to switch to ONNX, so I will not install tensorrt later.


pip install mmdeploy-runtime-gpu==1.0.0

3. Download the mmdeploy folder to E:\pythonproject\

git clone https://github.com/open-mmlab/mmdeploy.git
cd mmdeploy

(2) onnxruntime

pip install onnxruntime-gpu==1.8.1

(3) Print installation information

python tools\check_env.py

2. Test whether the installation is successful

        Refer to the deployment documentation of RTMPose, try to use the hand-keypoint model in RTMPose to test whether MMDeploy is running normally.

1. Hand detection model

python tools/deploy.py configs/mmdet/detection/detection_onnxruntime_static.py  \
    ../mmpose/projects/rtmpose/rtmdet/hand/rtmdet_nano_320-8xb32_hand.py \
    https://download.openmmlab.com/mmpose/v1/projects/rtmposev1/rtmdet_nano_8xb32-300e_hand-267f9c8f.pth \
    demo/resources/hand.jpg \
    --work-dir rtmpose-ort/rtmdet-nano \
    --device cuda \
    --show \
    --dump-info

 2. Hand key point model

python tools/deploy.py configs/mmpose/pose-detection_simcc_onnxruntime_dynamic.py \
    ../mmpose/projects/rtmpose/rtmpose/hand_2d_keypoint/rtmpose-m_8xb32-210e_coco-wholebody-hand-256x256.py \
    https://download.openmmlab.com/mmpose/v1/projects/rtmposev1/rtmpose-m_simcc-hand5_pt-aic-coco_210e-256x256-74fb594_20230320.pth \
    demo/resources/hand.jpg \
    --work-dir rtmpose-ort/rtmpose-m \
    --device cuda  \
    --dump-info

 

# 手部模型关键点,mobilenet
python tools/deploy.py configs/mmpose/pose-detection_onnxruntime_static.py \
../mmpose/configs/hand_2d_keypoint/topdown_heatmap/onehand10k/td-hm_mobilenetv2_8xb64-210e_onehand10k-256x256.py \
https://download.openmmlab.com/mmpose/hand/mobilenetv2/mobilenetv2_onehand10k_256x256-f3a3d90e_20210330.pth \
demo/resources/0.bmp \
--work-dir rtmpose-ort/rtmpose-mbnet \
--device cuda  \
--dump-info

3. Problem solving

1. An error will be reported when mmdeploy is doing visualization: removing --show will not affect onnx export.

Guess you like

Origin blog.csdn.net/weixin_44855366/article/details/131223019