open-mmlab / mmpose

OpenMMLab Pose Estimation Toolbox and Benchmark.
https://mmpose.readthedocs.io/en/latest/
Apache License 2.0
5.9k stars 1.26k forks source link

[Feature] How to convert the RTMPose3D model to onnx #3125

Open 6667777 opened 2 months ago

6667777 commented 2 months ago

What is the feature?

I wanted to convert the RTMPose3D model to onnx, but there was no tutorial to do so. I also tried to convert the RTMPose3D model in the same way as converting RTMPose, but failed

Any other context?

No response

chopin1998 commented 1 month ago

any update?

yangl720 commented 1 month ago

import torch from mmpose.apis import init_model pose_estimator = init_model( './configs/rtmw3d-l_8xb64_cocktail14-384x288.py', 'rtmw3d-l_8xb64_cocktail14-384x288-794dbc78_20240626.pth', device='cpu')

input = torch.randn(1, 3, 384, 288) data_samples = {}

torch.onnx.export( pose_estimator, (input, data_samples), "model.onnx", input_names=["input"], output_names=["output"], verbose=True
)

chopin1998 commented 1 month ago

import torch from mmpose.apis import init_model pose_estimator = init_model( './configs/rtmw3d-l_8xb64_cocktail14-384x288.py', 'rtmw3d-l_8xb64_cocktail14-384x288-794dbc78_20240626.pth', device='cpu')

input = torch.randn(1, 3, 384, 288) data_samples = {}

torch.onnx.export( pose_estimator, (input, data_samples), "model.onnx", input_names=["input"], output_names=["output"], verbose=True )

do you have demo code on pre/post-processing ?