I have install onnxruntime and tensorrt in this command MMCV_WITH_OPS=1 MMCV_WITH_TRT=1 MMCV_WITH_ORT=1 pip install -e . and set env export ONNX_BACKEND=MMCVTensorRT. I have successfully verify the pipeline pth->onnx->trt in yolov3.
successfully convert the yolox model to onnx in the following command:python tools/deployment/pytorch2onnx.py ../model_store/haiyangshengwu_Yolox_tiny_416/haiyangshengwu_Yolox_tiny_416.py ../model_store/haiyangshengwu_Yolox_tiny_416/latest.pth --output-file ../model_store/haiyangshengwu_Yolox_tiny_416/haiyangshengwu_Yolox_tiny_416.onnx --test-img /media/gyj/c1a9654c-8209-4be0-9416-e22679fc0040/1.datasets/2.object_detect/haiyangshengwu/JPEGImages/Angelas20201117_165705.217.jpg --shape 416
but when I convert the onnx model into tensorrt in this command: python tools/deployment/onnx2tensorrt.py ../model_store/haiyangshengwu_Yolox_tiny_416/haiyangshengwu_Yolox_tiny_416.py ../model_store/haiyangshengwu_Yolox_tiny_416/haiyangshengwu_Yolox_tiny_416.onnx --trt-file ../model_store/haiyangshengwu_Yolox_tiny_416/haiyangshengwu_Yolox_tiny_416.trt --input-img demo/demo.jpg --shape 416 --verify error occured:Traceback (most recent call last): File "tools/deployment/onnx2tensorrt.py", line 254, in <module> verbose=args.verbose) File "tools/deployment/onnx2tensorrt.py", line 45, in onnx2tensorrt max_workspace_size=max_workspace_size) File "/home/gyj/software/mmcv/mmcv/tensorrt/tensorrt_utils.py", line 65, in onnx2trt raise RuntimeError(f'parse onnx failed:\n{error_msgs}') RuntimeError: parse onnx failed: In node -1 (importRange): UNSUPPORTED_NODE: Assertion failed: inputs.at(0).isInt32() && "For range operator with dynamic inputs, this version of TensorRT only supports INT32!"
I have install onnxruntime and tensorrt in this command
MMCV_WITH_OPS=1 MMCV_WITH_TRT=1 MMCV_WITH_ORT=1 pip install -e .
and set envexport ONNX_BACKEND=MMCVTensorRT
. I have successfully verify the pipeline pth->onnx->trt in yolov3.python tools/deployment/pytorch2onnx.py ../model_store/haiyangshengwu_Yolox_tiny_416/haiyangshengwu_Yolox_tiny_416.py ../model_store/haiyangshengwu_Yolox_tiny_416/latest.pth --output-file ../model_store/haiyangshengwu_Yolox_tiny_416/haiyangshengwu_Yolox_tiny_416.onnx --test-img /media/gyj/c1a9654c-8209-4be0-9416-e22679fc0040/1.datasets/2.object_detect/haiyangshengwu/JPEGImages/Angelas20201117_165705.217.jpg --shape 416
python tools/deployment/onnx2tensorrt.py ../model_store/haiyangshengwu_Yolox_tiny_416/haiyangshengwu_Yolox_tiny_416.py ../model_store/haiyangshengwu_Yolox_tiny_416/haiyangshengwu_Yolox_tiny_416.onnx --trt-file ../model_store/haiyangshengwu_Yolox_tiny_416/haiyangshengwu_Yolox_tiny_416.trt --input-img demo/demo.jpg --shape 416 --verify
error occured:Traceback (most recent call last): File "tools/deployment/onnx2tensorrt.py", line 254, in <module> verbose=args.verbose) File "tools/deployment/onnx2tensorrt.py", line 45, in onnx2tensorrt max_workspace_size=max_workspace_size) File "/home/gyj/software/mmcv/mmcv/tensorrt/tensorrt_utils.py", line 65, in onnx2trt raise RuntimeError(f'parse onnx failed:\n{error_msgs}') RuntimeError: parse onnx failed: In node -1 (importRange): UNSUPPORTED_NODE: Assertion failed: inputs.at(0).isInt32() && "For range operator with dynamic inputs, this version of TensorRT only supports INT32!"