# Exporting MMPose models ```bash docker build --progress=plain -f extras/mmdeploy/dockerfile -t rpt_mmdeploy . ./extras/mmdeploy/run_container.sh ```
## ONNX ```bash cd /mmdeploy/ export withFP16="_fp16" cp /RapidPoseTriangulation/extras/mmdeploy/configs/detection_onnxruntime_static-320x320"$withFP16".py configs/mmdet/detection/ python3 ./tools/deploy.py \ configs/mmdet/detection/detection_onnxruntime_static-320x320"$withFP16".py \ /mmpose/projects/rtmpose/rtmdet/person/rtmdet_nano_320-8xb32_coco-person.py \ https://download.openmmlab.com/mmpose/v1/projects/rtmpose/rtmdet_nano_8xb32-100e_coco-obj365-person-05d8511e.pth \ /mmpose/projects/rtmpose/examples/onnxruntime/human-pose.jpeg \ --work-dir work_dir \ --show mv /mmdeploy/work_dir/end2end.onnx /RapidPoseTriangulation/extras/mmdeploy/exports/rtmdet-nano_1x3x320x320"$withFP16".onnx ``` ```bash cd /mmdeploy/ export withFP16="_fp16" cp /RapidPoseTriangulation/extras/mmdeploy/configs/pose-detection_simcc_onnxruntime_static-384x288"$withFP16".py configs/mmpose/ cp /RapidPoseTriangulation/extras/mmdeploy/configs/pose-detection_simcc_onnxruntime_dynamic-384x288"$withFP16".py configs/mmpose/ python3 ./tools/deploy.py \ configs/mmpose/pose-detection_simcc_onnxruntime_static-384x288"$withFP16".py \ /mmpose/projects/rtmpose/rtmpose/body_2d_keypoint/rtmpose-m_8xb256-420e_coco-384x288.py \ https://download.openmmlab.com/mmpose/v1/projects/rtmposev1/rtmpose-m_simcc-body7_pt-body7_420e-384x288-65e718c4_20230504.pth \ /mmpose/projects/rtmpose/examples/onnxruntime/human-pose.jpeg \ --work-dir work_dir \ --show mv /mmdeploy/work_dir/end2end.onnx /RapidPoseTriangulation/extras/mmdeploy/exports/rtmpose-m_1x3x384x288"$withFP16".onnx python3 ./tools/deploy.py \ configs/mmpose/pose-detection_simcc_onnxruntime_dynamic-384x288"$withFP16".py \ /mmpose/projects/rtmpose/rtmpose/body_2d_keypoint/rtmpose-m_8xb256-420e_coco-384x288.py \ https://download.openmmlab.com/mmpose/v1/projects/rtmposev1/rtmpose-m_simcc-body7_pt-body7_420e-384x288-65e718c4_20230504.pth \ /mmpose/projects/rtmpose/examples/onnxruntime/human-pose.jpeg \ --work-dir work_dir \ --show mv /mmdeploy/work_dir/end2end.onnx /RapidPoseTriangulation/extras/mmdeploy/exports/rtmpose-m_Bx3x384x288"$withFP16".onnx python3 ./tools/deploy.py \ configs/mmpose/pose-detection_simcc_onnxruntime_static-384x288"$withFP16".py \ /mmpose/projects/rtmpose/rtmpose/wholebody_2d_keypoint/rtmpose-l_8xb32-270e_coco-wholebody-384x288.py \ https://download.openmmlab.com/mmpose/v1/projects/rtmposev1/rtmpose-l_simcc-coco-wholebody_pt-aic-coco_270e-384x288-eaeb96c8_20230125.pth \ /mmpose/projects/rtmpose/examples/onnxruntime/human-pose.jpeg \ --work-dir work_dir \ --show mv /mmdeploy/work_dir/end2end.onnx /RapidPoseTriangulation/extras/mmdeploy/exports/rtmpose-l_wb_1x3x384x288"$withFP16".onnx python3 ./tools/deploy.py \ configs/mmpose/pose-detection_simcc_onnxruntime_dynamic-384x288"$withFP16".py \ /mmpose/projects/rtmpose/rtmpose/wholebody_2d_keypoint/rtmpose-l_8xb32-270e_coco-wholebody-384x288.py \ https://download.openmmlab.com/mmpose/v1/projects/rtmposev1/rtmpose-l_simcc-coco-wholebody_pt-aic-coco_270e-384x288-eaeb96c8_20230125.pth \ /mmpose/projects/rtmpose/examples/onnxruntime/human-pose.jpeg \ --work-dir work_dir \ --show mv /mmdeploy/work_dir/end2end.onnx /RapidPoseTriangulation/extras/mmdeploy/exports/rtmpose-l_wb_Bx3x384x288"$withFP16".onnx ``` ```bash python3 /RapidPoseTriangulation/extras/mmdeploy/make_extra_graphs.py ``` ```bash python3 /RapidPoseTriangulation/extras/mmdeploy/add_extra_steps.py ```
## TensorRT Run this directly in the inference container (the TensorRT versions need to be the same) ```bash export withFP16="_fp16" trtexec --fp16 \ --onnx=/RapidPoseTriangulation/extras/mmdeploy/exports/rtmdet-nano_1x320x320x3"$withFP16"_extra-steps.onnx \ --saveEngine=end2end.engine mv ./end2end.engine /RapidPoseTriangulation/extras/mmdeploy/exports/rtmdet-nano_1x320x320x3"$withFP16"_extra-steps.engine trtexec --fp16 \ --onnx=/RapidPoseTriangulation/extras/mmdeploy/exports/rtmpose-m_Bx384x288x3"$withFP16"_extra-steps.onnx \ --saveEngine=end2end.engine \ --minShapes=image_input:1x384x288x3 \ --optShapes=image_input:1x384x288x3 \ --maxShapes=image_input:1x384x288x3 mv ./end2end.engine /RapidPoseTriangulation/extras/mmdeploy/exports/rtmpose-m_1x384x288x3"$withFP16"_extra-steps.engine ```
## Benchmark ```bash cd /mmdeploy/ export withFP16="_fp16" python3 ./tools/profiler.py \ configs/mmpose/pose-detection_simcc_onnxruntime_static-384x288"$withFP16".py \ /mmpose/projects/rtmpose/rtmpose/body_2d_keypoint/rtmpose-m_8xb256-420e_coco-384x288.py \ /RapidPoseTriangulation/extras/mmdeploy/testimages/ \ --model /RapidPoseTriangulation/extras/mmdeploy/exports/rtmpose-m_1x3x384x288"$withFP16".onnx \ --shape 384x288 \ --device cuda \ --warmup 50 \ --num-iter 200 ```