mmdeploy icon indicating copy to clipboard operation
mmdeploy copied to clipboard

[Bug] mmdeploy模型部署-pytorch转换成onnx

Open 1334233852 opened this issue 7 months ago • 0 comments

Checklist

  • [X] I have searched related issues but cannot get the expected help.
  • [X] 2. I have read the FAQ documentation but cannot get the expected help.
  • [X] 3. The bug has not been fixed in the latest version.

Describe the bug

07/17 20:06:04 - mmengine - WARNING - Failed to search registry with scope "mmpose" in the "Codebases" registry tree. As a workaround, the current "Codebases" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmpose" is a correct scope, or whether the registry is initialized. 07/17 20:06:04 - mmengine - WARNING - Failed to search registry with scope "mmpose" in the "mmpose_tasks" registry tree. As a workaround, the current "mmpose_tasks" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmpose" is a correct scope, or whether the registry is initialized. 07/17 20:06:05 - mmengine - INFO - Start pipeline mmdeploy.apis.pytorch2onnx.torch2onnx in subprocess 07/17 20:06:09 - mmengine - WARNING - Failed to search registry with scope "mmpose" in the "Codebases" registry tree. As a workaround, the current "Codebases" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmpose" is a correct scope, or whether the registry is initialized. 07/17 20:06:09 - mmengine - WARNING - Failed to search registry with scope "mmpose" in the "mmpose_tasks" registry tree. As a workaround, the current "mmpose_tasks" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmpose" is a correct scope, or whether the registry is initialized. Loads checkpoint by local backend from path: ../mmpose/checkpoint/rtmpose-s-triangle-300-2905553d_20240717.pth 07/17 20:06:09 - mmengine - WARNING - DeprecationWarning: get_onnx_config will be deprecated in the future. 07/17 20:06:09 - mmengine - INFO - Export PyTorch model to ONNX: ../rtmpose2onnx\end2end.onnx. 07/17 20:06:09 - mmengine - WARNING - Can not find torch._C._jit_pass_onnx_autograd_function_process, function rewrite will not be applied 07/17 20:06:11 - mmengine - INFO - Execute onnx optimize passes. 07/17 20:06:11 - mmengine - WARNING - Can not optimize model, please build torchscipt extension. More details: https://github.com/open-mmlab/mmdeploy/tree/1.x/docs/en/experimental/onnx_optimizer.md 07/17 20:06:11 - mmengine - INFO - Finish pipeline mmdeploy.apis.pytorch2onnx.torch2onnx 07/17 20:06:11 - mmengine - INFO - Start pipeline mmdeploy.apis.utils.utils.to_backend in main process 07/17 20:06:12 - mmengine - INFO - Finish pipeline mmdeploy.apis.utils.utils.to_backend 07/17 20:06:12 - mmengine - INFO - visualize onnxruntime model start. 07/17 20:06:17 - mmengine - WARNING - Failed to search registry with scope "mmpose" in the "Codebases" registry tree. As a workaround, the current "Codebases" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmpose" is a correct scope, or whether the registry is initialized. 07/17 20:06:17 - mmengine - WARNING - Failed to search registry with scope "mmpose" in the "mmpose_tasks" registry tree. As a workaround, the current "mmpose_tasks" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmpose" is a correct scope, or whether the registry is initialized. 07/17 20:06:17 - mmengine - WARNING - Failed to search registry with scope "mmpose" in the "backend_segmentors" registry tree. As a workaround, the current "backend_segmentors" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmpose" is a correct scope, or whether the registry is initialized. 07/17 20:06:17 - mmengine - INFO - Successfully loaded onnxruntime custom ops from C:\Users\13342\anaconda3\envs\new_env\lib\site-packages\mmdeploy\lib\mmdeploy_onnxruntime_ops.dll Traceback (most recent call last): File "C:\Users\13342\anaconda3\envs\new_env\lib\site-packages\mmdeploy\utils\utils.py", line 41, in target_wrapper result = target(*args, **kwargs) File "C:\Users\13342\anaconda3\envs\new_env\lib\site-packages\mmdeploy\apis\visualize.py", line 72, in visualize_model result = model.test_step(model_inputs)[0] File "C:\Users\13342\anaconda3\envs\new_env\lib\site-packages\mmengine\model\base_model\base_model.py", line 145, in test_step return self._run_forward(data, mode='predict') # type: ignore File "C:\Users\13342\anaconda3\envs\new_env\lib\site-packages\mmengine\model\base_model\base_model.py", line 326, in _run_forward results = self(**data, mode=mode) File "C:\Users\13342\anaconda3\envs\new_env\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl return forward_call(*input, **kwargs) File "C:\Users\13342\anaconda3\envs\new_env\lib\site-packages\mmdeploy\codebase\mmpose\deploy\pose_detection_model.py", line 110, in forward results = self.pack_result(preds, data_samples) File "C:\Users\13342\anaconda3\envs\new_env\lib\site-packages\mmdeploy\codebase\mmpose\deploy\pose_detection_model.py", line 144, in pack_result bbox_centers = gt_instances.bbox_centers AttributeError: 'InstanceData' object has no attribute 'bbox_centers' 07/17 20:06:18 - mmengine - ERROR - G:\VOS_related_Project\KeyPoint\MMPose_Tutorials\2023\0524\mmdeploy\tools\deploy.py - create_process - 83 - visualize onnxruntime model failed.

ERROR:albumentations.check_version:Error fetching version info Traceback (most recent call last): File "C:\Users\13342\anaconda3\envs\new_env\lib\urllib\request.py", line 1348, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "C:\Users\13342\anaconda3\envs\new_env\lib\http\client.py", line 1283, in request self._send_request(method, url, body, headers, encode_chunked) File "C:\Users\13342\anaconda3\envs\new_env\lib\http\client.py", line 1329, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "C:\Users\13342\anaconda3\envs\new_env\lib\http\client.py", line 1278, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "C:\Users\13342\anaconda3\envs\new_env\lib\http\client.py", line 1038, in _send_output self.send(msg) File "C:\Users\13342\anaconda3\envs\new_env\lib\http\client.py", line 976, in send self.connect() File "C:\Users\13342\anaconda3\envs\new_env\lib\http\client.py", line 1455, in connect self.sock = self._context.wrap_socket(self.sock, File "C:\Users\13342\anaconda3\envs\new_env\lib\ssl.py", line 513, in wrap_socket return self.sslsocket_class._create( File "C:\Users\13342\anaconda3\envs\new_env\lib\ssl.py", line 1104, in _create self.do_handshake() File "C:\Users\13342\anaconda3\envs\new_env\lib\ssl.py", line 1375, in do_handshake self._sslobj.do_handshake() TimeoutError: _ssl.c:990: The handshake operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\13342\AppData\Roaming\Python\Python310\site-packages\albumentations\check_version.py", line 29, in fetch_version_info with opener.open(url, timeout=2) as response: File "C:\Users\13342\anaconda3\envs\new_env\lib\urllib\request.py", line 519, in open response = self._open(req, data) File "C:\Users\13342\anaconda3\envs\new_env\lib\urllib\request.py", line 536, in _open result = self._call_chain(self.handle_open, protocol, protocol + File "C:\Users\13342\anaconda3\envs\new_env\lib\urllib\request.py", line 496, in _call_chain result = func(*args) File "C:\Users\13342\anaconda3\envs\new_env\lib\urllib\request.py", line 1391, in https_open return self.do_open(http.client.HTTPSConnection, req, File "C:\Users\13342\anaconda3\envs\new_env\lib\urllib\request.py", line 1351, in do_open raise URLError(err) urllib.error.URLError: <urlopen error _ssl.c:990: The handshake operation timed out> WARNING: The shape inference of prim::Constant type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function. WARNING: The shape inference of prim::Constant type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function. WARNING: The shape inference of prim::Constant type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function. WARNING: The shape inference of prim::Constant type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function. WARNING: The shape inference of prim::Constant type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function. WARNING: The shape inference of prim::Constant type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function. 2024-07-17:20:06:16 - albumentations.check_version - ERROR - Error fetching version info Traceback (most recent call last): File "C:\Users\13342\anaconda3\envs\new_env\lib\urllib\request.py", line 1348, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "C:\Users\13342\anaconda3\envs\new_env\lib\http\client.py", line 1283, in request self._send_request(method, url, body, headers, encode_chunked) File "C:\Users\13342\anaconda3\envs\new_env\lib\http\client.py", line 1329, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "C:\Users\13342\anaconda3\envs\new_env\lib\http\client.py", line 1278, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "C:\Users\13342\anaconda3\envs\new_env\lib\http\client.py", line 1038, in _send_output self.send(msg) File "C:\Users\13342\anaconda3\envs\new_env\lib\http\client.py", line 976, in send self.connect() File "C:\Users\13342\anaconda3\envs\new_env\lib\http\client.py", line 1455, in connect self.sock = self._context.wrap_socket(self.sock, File "C:\Users\13342\anaconda3\envs\new_env\lib\ssl.py", line 513, in wrap_socket return self.sslsocket_class._create( File "C:\Users\13342\anaconda3\envs\new_env\lib\ssl.py", line 1104, in _create self.do_handshake() File "C:\Users\13342\anaconda3\envs\new_env\lib\ssl.py", line 1375, in do_handshake self._sslobj.do_handshake() TimeoutError: _ssl.c:990: The handshake operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\13342\AppData\Roaming\Python\Python310\site-packages\albumentations\check_version.py", line 29, in fetch_version_info with opener.open(url, timeout=2) as response: File "C:\Users\13342\anaconda3\envs\new_env\lib\urllib\request.py", line 519, in open response = self._open(req, data) File "C:\Users\13342\anaconda3\envs\new_env\lib\urllib\request.py", line 536, in _open result = self._call_chain(self.handle_open, protocol, protocol + File "C:\Users\13342\anaconda3\envs\new_env\lib\urllib\request.py", line 496, in _call_chain result = func(*args) File "C:\Users\13342\anaconda3\envs\new_env\lib\urllib\request.py", line 1391, in https_open return self.do_open(http.client.HTTPSConnection, req, File "C:\Users\13342\anaconda3\envs\new_env\lib\urllib\request.py", line 1351, in do_open raise URLError(err) urllib.error.URLError: <urlopen error _ssl.c:990: The handshake operation timed out> 2024-07-17:20:06:17 - root - ERROR - 'InstanceData' object has no attribute 'bbox_centers'

Reproduction

执行的命令行如下所示: !python tools/deploy.py
configs/mmpose/pose-detection_simcc_onnxruntime_dynamic.py
../mmpose/data/rtmpose-s-pig.py
../mmpose/checkpoint/rtmpose-s-triangle-300-2905553d_20240717.pth
../mmpose/data/test_pig/000011.jpg
--work-dir ../rtmpose2onnx
--dump-info

Environment

07/17 20:15:58 - mmengine - INFO - 

07/17 20:15:58 - mmengine - INFO - **********Environmental information**********
07/17 20:16:10 - mmengine - INFO - sys.platform: win32
07/17 20:16:10 - mmengine - INFO - Python: 3.10.14 | packaged by Anaconda, Inc. | (main, May  6 2024, 19:44:50) [MSC v.1916 64 bit (AMD64)]
07/17 20:16:10 - mmengine - INFO - CUDA available: True
07/17 20:16:10 - mmengine - INFO - numpy_random_seed: 2147483648
07/17 20:16:10 - mmengine - INFO - GPU 0,1: NVIDIA GeForce RTX 3090 Ti
07/17 20:16:10 - mmengine - INFO - CUDA_HOME: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3
07/17 20:16:10 - mmengine - INFO - NVCC: Cuda compilation tools, release 11.3, V11.3.58
07/17 20:16:10 - mmengine - INFO - MSVC: 用于 x64 的 Microsoft (R) C/C++ 优化编译器 19.29.30153 版
07/17 20:16:10 - mmengine - INFO - GCC: n/a
07/17 20:16:10 - mmengine - INFO - PyTorch: 1.11.0+cu115
07/17 20:16:10 - mmengine - INFO - PyTorch compiling details: PyTorch built with:
  - C++ Version: 199711
  - MSVC 192829337
  - Intel(R) Math Kernel Library Version 2020.0.2 Product Build 20200624 for Intel(R) 64 architecture applications
  - Intel(R) MKL-DNN v2.5.2 (Git Hash a9302535553c73243c632ad3c4c80beec3d19a1e)
  - OpenMP 2019
  - LAPACK is enabled (usually provided by MKL)
  - CPU capability usage: AVX2
  - CUDA Runtime 11.5
  - NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_80,code=sm_80;-gencode;arch=compute_86,code=sm_86;-gencode;arch=compute_37,code=compute_37
  - CuDNN 8.3.2
  - Magma 2.5.4
  - Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=11.5, CUDNN_VERSION=8.3.2, CXX_COMPILER=C:/actions-runner/_work/pytorch/pytorch/builder/windows/tmp_bin/sccache-cl.exe, CXX_FLAGS=/DWIN32 /D_WINDOWS /GR /EHsc /w /bigobj -DUSE_PTHREADPOOL -openmp:experimental -IC:/actions-runner/_work/pytorch/pytorch/builder/windows/mkl/include -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOCUPTI -DUSE_FBGEMM -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=1.11.0, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=OFF, USE_MPI=OFF, USE_NCCL=OFF, USE_NNPACK=OFF, USE_OPENMP=ON, USE_ROCM=OFF, 

07/17 20:16:10 - mmengine - INFO - TorchVision: 0.12.0+cu115
07/17 20:16:10 - mmengine - INFO - OpenCV: 4.10.0
07/17 20:16:10 - mmengine - INFO - MMEngine: 0.7.1
07/17 20:16:10 - mmengine - INFO - MMCV: 2.0.1
07/17 20:16:10 - mmengine - INFO - MMCV Compiler: MSVC 192930148
07/17 20:16:10 - mmengine - INFO - MMCV CUDA Compiler: 11.5
07/17 20:16:10 - mmengine - INFO - MMDeploy: 1.0.0+bc75c9d
07/17 20:16:10 - mmengine - INFO - 

07/17 20:16:10 - mmengine - INFO - **********Backend information**********
07/17 20:16:10 - mmengine - INFO - tensorrt:	None
07/17 20:16:10 - mmengine - INFO - ONNXRuntime:	None
07/17 20:16:10 - mmengine - INFO - ONNXRuntime-gpu:	1.12.0
07/17 20:16:10 - mmengine - INFO - ONNXRuntime custom ops:	Available
07/17 20:16:10 - mmengine - INFO - pplnn:	None
07/17 20:16:10 - mmengine - INFO - ncnn:	None
07/17 20:16:10 - mmengine - INFO - snpe:	None
07/17 20:16:10 - mmengine - INFO - openvino:	None
07/17 20:16:10 - mmengine - INFO - torchscript:	1.11.0+cu115
07/17 20:16:10 - mmengine - INFO - torchscript custom ops:	NotAvailable
07/17 20:16:10 - mmengine - INFO - rknn-toolkit:	None
07/17 20:16:10 - mmengine - INFO - rknn-toolkit2:	None
07/17 20:16:10 - mmengine - INFO - ascend:	None
07/17 20:16:10 - mmengine - INFO - coreml:	None
07/17 20:16:10 - mmengine - INFO - tvm:	None
07/17 20:16:10 - mmengine - INFO - vacc:	None
07/17 20:16:10 - mmengine - INFO - 

07/17 20:16:10 - mmengine - INFO - **********Codebase information**********
07/17 20:16:10 - mmengine - INFO - mmdet:	3.2.0
07/17 20:16:10 - mmengine - INFO - mmseg:	None
07/17 20:16:10 - mmengine - INFO - mmcls:	None
07/17 20:16:10 - mmengine - INFO - mmocr:	None
07/17 20:16:10 - mmengine - INFO - mmedit:	None
07/17 20:16:10 - mmengine - INFO - mmdet3d:	None
07/17 20:16:10 - mmengine - INFO - mmpose:	1.3.1
07/17 20:16:10 - mmengine - INFO - mmrotate:	None
07/17 20:16:10 - mmengine - INFO - mmaction:	None
07/17 20:16:10 - mmengine - INFO - mmrazor:	None

Error traceback

No response

1334233852 avatar Jul 17 '24 12:07 1334233852