mmdeploy icon indicating copy to clipboard operation
mmdeploy copied to clipboard

Convert mmpose:TopDownAffine Transform to cuda compatible

Open yeeyangtee opened this issue 2 years ago • 2 comments

mmdeploy/csrc/mmdeploy/codebase/mmpose/topdown_affine.cpp I am trying to modify the above file to allow preprocessing on cuda.

The model I am using is HRNet.

TopDownAffine uses cv2.warpaffine, but at inference it only performs crop and resize, so this could be easily changed to a cuda compatible transform.

Before doing that, is there a way to quickly put in an existing cuda-resize Transform to replace TopDownAffine in the pipeline and look at the potential speed gain?

My current workflow is:

  • Rewrite .cpp code at topdown_affine.cpp to perform resize, and import from the cuda kernel here.
  • Rebuild tensorRT using commands here
  • Reconvert model with tools/deploy.py

yeeyangtee avatar Sep 09 '22 16:09 yeeyangtee

@lvhan028

tpoisonooo avatar Sep 09 '22 16:09 tpoisonooo

You can have a look for pipeline.json. There is a field names transforms in tasks. You could rearange transforms here. But for postprocess in mmpose, it uses the scale and center which is calculated on preprocess, so you may need to rewrite the code here too.

You could provide your simplified preprocessing / postprocess code here and we can think how to add it to the cpp code.

irexyc avatar Sep 14 '22 06:09 irexyc

Currently, the TopDownAffine can be processed on gpu.

irexyc avatar Apr 26 '23 06:04 irexyc