HigherHRNet-Human-Pose-Estimation
HigherHRNet-Human-Pose-Estimation copied to clipboard
libtorch or tensorrt
hi,thank your code. Can this model be converted to Library or tensorRT? hope your relpy!
hi,thank your code. Can this model be converted to Libtorch or tensorRT? hope your reply!
I try to convert the model to .pt, but failed
Number of Layers
Conv2d : 302 layers BatchNorm2d : 301 layers ReLU : 270 layers Bottleneck : 4 layers BasicBlock : 108 layers Upsample : 28 layers HighResolutionModule : 8 layers ConvTranspose2d : 1 layers
=> loading model from output\coco_kpt\pose_higher_hrnet\w32_512_adam_lr1e-3\model_best.pth.tar
loading annotations into memory...
=> classes: ['background', 'ball']
Done (t=0.02s)
creating index...
index created!
Traceback (most recent call last):
File "D:/gc/Higher-HRNet-Human-Pose-Estimation/tools/valid.py", line 231, in
Process finished with exit code 1
I try to convert HRNet model for human pose estimation(https://github.com/leoxiaobin/deep-high-resolution-net.pytorch) to TensorRT and success, however the outputs of the unconverted model and converted model were significantly different.
I try to convert HRNet model for human pose estimation(https://github.com/leoxiaobin/deep-high-resolution-net.pytorch) to TensorRT and success, however the outputs of the unconverted model and converted model were significantly different.
May I know exactly how did you convert it to TensorRT?
tensorrt don't support upsample
I try to convert HRNet model for human pose estimation(https://github.com/leoxiaobin/deep-high-resolution-net.pytorch) to TensorRT and success, however the outputs of the unconverted model and converted model were significantly different.
Have you managed to solve it?
tensorrt don't support upsample
It does, what it does not support the Upsample layer is the ONNX-TRT parser. However if you use a TORCH-TRT parser (such as torch2trt) you can get the Upsample layer to work in TensorRT.
tensorrt don't support upsample
It does, what it does not support the Upsample layer is the ONNX-TRT parser. However if you use a TORCH-TRT parser (such as torch2trt) you can get the Upsample layer to work in TensorRT.
when I try to convert the pytorch model to trt model ,I get this error:
Done (t=0.00s) creating index... index created! Warning: Encountered known unsupported method torch.Tensor.get_device /home/liu/.conda/envs/python37/lib/python3.7/site-packages/torch/nn/modules/upsampling.py:129: UserWarning: nn.Upsample is deprecated. Use nn.functional.interpolate instead. warnings.warn("nn.{} is deprecated. Use nn.functional.interpolate instead.".format(self.name)) Warning: Encountered known unsupported method torch.nn.functional.interpolate Warning: Encountered known unsupported method torch.nn.functional.interpolate Warning: Encountered known unsupported method torch.nn.functional.interpolate Warning: Encountered known unsupported method torch.nn.functional.interpolate Warning: Encountered known unsupported method torch.nn.functional.interpolate Warning: Encountered known unsupported method torch.nn.functional.interpolate Warning: Encountered known unsupported method torch.nn.functional.interpolate Warning: Encountered known unsupported method torch.nn.functional.interpolate Warning: Encountered known unsupported method torch.nn.functional.interpolate Warning: Encountered known unsupported method torch.nn.functional.interpolate Warning: Encountered known unsupported method torch.nn.functional.interpolate Warning: Encountered known unsupported method torch.nn.functional.interpolate Warning: Encountered known unsupported method torch.nn.functional.interpolate Warning: Encountered known unsupported method torch.nn.functional.interpolate Warning: Encountered known unsupported method torch.nn.functional.interpolate Warning: Encountered known unsupported method torch.nn.functional.interpolate Warning: Encountered known unsupported method torch.nn.functional.interpolate Warning: Encountered known unsupported method torch.nn.functional.interpolate Warning: Encountered known unsupported method torch.nn.functional.interpolate Warning: Encountered known unsupported method torch.nn.functional.interpolate Warning: Encountered known unsupported method torch.nn.functional.interpolate Warning: Encountered known unsupported method torch.nn.functional.interpolate Warning: Encountered known unsupported method torch.nn.functional.interpolate Warning: Encountered known unsupported method torch.nn.functional.interpolate Warning: Encountered known unsupported method torch.nn.functional.interpolate Warning: Encountered known unsupported method torch.nn.functional.interpolate Warning: Encountered known unsupported method torch.nn.functional.interpolate Warning: Encountered known unsupported method torch.nn.functional.interpolate [TensorRT] ERROR: (Unnamed Layer* 1036) [Concatenation]: all concat input tensors must have the same dimensions except on the concatenation axis (0), but dimensions mismatched at input 1 at index 1. Input 0 shape: [1,32,128,160], Input 1 shape: [1,12,128,160] Traceback (most recent call last):
could you tell me how to convert it ?thanks
@121649982 , in your case the problem seems to lay here:
Warning: Encountered known unsupported method torch.Tensor.get_device /home/liu/.conda/envs/python37/lib/python3.7/site-packages/torch/nn/modules/upsampling.py:129: UserWarning: nn.Upsample is deprecated. Use nn.functional.interpolate instead.
Then in here:
[TensorRT] ERROR: (Unnamed Layer* 1036) [Concatenation]: all concat input tensors must have the same dimensions except on the concatenation axis (0), but dimensions mismatched at input 1 at index 1. Input 0 shape: [1,32,128,160], Input 1 shape: [1,12,128,160]
It seems you are trying to concatenate tensor1: [1,32,128,160] and tensor2: [1,12,128,160] on dimension 0 (first one) and it seems to me you want to concatenate on dimension 1, since for the concatenation operation all the dimensions must match except in the concatenation dimension.
But looking at the problem in perspective, I think that, under the hood, this is a problem related to the ONN-TRT parser. Because of your first warning. You trying to export the model to ONNX before exporting it to TRT, and it happens that the Upsample layer it is not yet supported on the ONNX-TRT parser.
I am not familiarized with this project, I just entered here because I was researching bout TRT and libtorch and thought about contributing since I have faced the same problem. For more info check this. Good luck!
Try to use torch2trt package
could you tell me how to convert it ?thanks
You can modify the cat.py file in the converter folder of torch2trt. I can convert successfully, but the output is very different.
I try to convert HRNet model for human pose estimation(https://github.com/leoxiaobin/deep-high-resolution-net.pytorch) to TensorRT and success, however the outputs of the unconverted model and converted model were significantly different.
can you share your code ? thanks