[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
It works when I run this command to convert my yolox into onnx:
python mmdeploy/tools/deploy.py mmdeploy/configs/mmdet/detection/detection_onnxruntime_dynamic.py mmdetection/work_dirs/yolox_l_8xb8-300e_coco/yolox_l_8xb8-300e_coco.py mmdetection/work_dirs/yolox_l_8xb8-300e_coco/epoch_800.pth mmdetection/demo/earmite_bluecat1_0001.jpg --work-dir mmdeploy_model/yolox_onnx --dump-info
After this command, I got deploy.json, pipeline.json, detail.json, output_pytroch.jpg, output_onnxruntime.jpg and end2end.onnx in the dir yolox_onnx.
It doesn't works when I run this command to convert my yolox into ncnn:
python mmdeploy/tools/deploy.py mmdeploy/configs/mmdet/detection/single-stage_ncnn_static-640x640.py mmdetection/work_dirs/yolox_l_8xb8-300e_coco/yolox_l_8xb8-300e_coco.py mmdetection/work_dirs/yolox_l_8xb8-300e_coco/epoch_800.pth mmdetection/demo/earmite_bluecat1_0001.jpg --work-dir mmdeploy_model/yolox_ncnn --dump-info
After this command, I just got deploy.json, pipeline.json, detail.json and end2end.onnx in the dir yolox_ncnn. It seems nothing about ncnn.
(mmdeploy) root@autodl-container-857740b613-70d12b7b:~/autodl-tmp/mmdeploy# python tools/check_env.py
07/31 15:06:50 - mmengine - INFO -
07/31 15:06:50 - mmengine - INFO - **********Environmental information**********
07/31 15:06:51 - mmengine - INFO - sys.platform: linux
07/31 15:06:51 - mmengine - INFO - Python: 3.10.14 (main, May 6 2024, 19:42:50) [GCC 11.2.0]
07/31 15:06:51 - mmengine - INFO - CUDA available: True
07/31 15:06:51 - mmengine - INFO - MUSA available: False
07/31 15:06:51 - mmengine - INFO - numpy_random_seed: 2147483648
07/31 15:06:51 - mmengine - INFO - GPU 0: NVIDIA GeForce RTX 3090
07/31 15:06:51 - mmengine - INFO - CUDA_HOME: /usr/local/cuda
07/31 15:06:51 - mmengine - INFO - NVCC: Cuda compilation tools, release 11.3, V11.3.109
07/31 15:06:51 - mmengine - INFO - GCC: gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
07/31 15:06:51 - mmengine - INFO - PyTorch: 1.11.0
07/31 15:06:51 - mmengine - INFO - PyTorch compiling details: PyTorch built with:
- GCC 7.3
- C++ Version: 201402
- Intel(R) oneAPI Math Kernel Library Version 2023.1-Product Build 20230303 for Intel(R) 64 architecture applications
- Intel(R) MKL-DNN v2.5.2 (Git Hash a9302535553c73243c632ad3c4c80beec3d19a1e)
- OpenMP 201511 (a.k.a. OpenMP 4.5)
- LAPACK is enabled (usually provided by MKL)
- NNPACK is enabled
- CPU capability usage: AVX2
- CUDA Runtime 11.3
- 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.2
- Magma 2.5.2
- Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=11.3, CUDNN_VERSION=8.2.0, CXX_COMPILER=/opt/rh/devtoolset-7/root/usr/bin/c++, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, 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=ON, USE_NNPACK=ON, USE_OPENMP=ON, USE_ROCM=OFF,
07/31 15:06:51 - mmengine - INFO - TorchVision: 0.12.0
07/31 15:06:51 - mmengine - INFO - OpenCV: 4.10.0
07/31 15:06:51 - mmengine - INFO - MMEngine: 0.10.4
07/31 15:06:51 - mmengine - INFO - MMCV: 2.1.0
07/31 15:06:51 - mmengine - INFO - MMCV Compiler: GCC 9.3
07/31 15:06:51 - mmengine - INFO - MMCV CUDA Compiler: 11.3
07/31 15:06:51 - mmengine - INFO - MMDeploy: 1.3.1+bc75c9d
07/31 15:06:51 - mmengine - INFO -
07/31 15:06:51 - mmengine - INFO - **********Backend information**********
07/31 15:06:51 - mmengine - INFO - tensorrt: None
07/31 15:06:51 - mmengine - INFO - ONNXRuntime: 1.18.1
07/31 15:06:51 - mmengine - INFO - ONNXRuntime-gpu: 1.18.1
07/31 15:06:51 - mmengine - INFO - ONNXRuntime custom ops: Available
07/31 15:06:51 - mmengine - INFO - pplnn: None
07/31 15:06:51 - mmengine - INFO - ncnn: 1.0.20240410
07/31 15:06:51 - mmengine - INFO - ncnn custom ops: NotAvailable
07/31 15:06:51 - mmengine - INFO - snpe: None
07/31 15:06:51 - mmengine - INFO - openvino: None
07/31 15:06:51 - mmengine - INFO - torchscript: 1.11.0
07/31 15:06:51 - mmengine - INFO - torchscript custom ops: NotAvailable
07/31 15:06:51 - mmengine - INFO - rknn-toolkit: None
07/31 15:06:51 - mmengine - INFO - rknn-toolkit2: None
07/31 15:06:51 - mmengine - INFO - ascend: None
07/31 15:06:51 - mmengine - INFO - coreml: None
07/31 15:06:51 - mmengine - INFO - tvm: None
07/31 15:06:51 - mmengine - INFO - vacc: None
07/31 15:06:51 - mmengine - INFO -
07/31 15:06:51 - mmengine - INFO - **********Codebase information**********
07/31 15:06:51 - mmengine - INFO - mmdet: 3.3.0
07/31 15:06:51 - mmengine - INFO - mmseg: None
07/31 15:06:51 - mmengine - INFO - mmpretrain: None
07/31 15:06:51 - mmengine - INFO - mmocr: None
07/31 15:06:51 - mmengine - INFO - mmagic: None
07/31 15:06:51 - mmengine - INFO - mmdet3d: None
07/31 15:06:51 - mmengine - INFO - mmpose: None
07/31 15:06:51 - mmengine - INFO - mmrotate: None
07/31 15:06:51 - mmengine - INFO - mmaction: None
07/31 15:06:51 - mmengine - INFO - mmrazor: None
07/31 15:06:51 - mmengine - INFO - mmyolo: None
Error traceback
(mmdeploy) root@autodl-container-857740b613-70d12b7b:~/autodl-tmp# python mmdeploy/tools/deploy.py mmdeploy/configs/mmdet/detection/single-stage_ncnn_static-640x640.py mmdetection/work_dirs/yolox_l_8xb8-300e_coco/yolox_l_8xb8-300e_coco.py mmdetection/work_dirs/yolox_l_8xb8-300e_coco/epoch_800.pth mmdetection/demo/earmite_bluecat1_0001.jpg --work-dir mmdeploy_model/yolox_ncnn --device cuda:0 --dump-info
07/31 15:02:14 - mmengine - WARNING - Failed to search registry with scope "mmdet" 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 "mmdet" is a correct scope, or whether the registry is initialized.
07/31 15:02:14 - mmengine - WARNING - Failed to search registry with scope "mmdet" in the "mmdet_tasks" registry tree. As a workaround, the current "mmdet_tasks" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmdet" is a correct scope, or whether the registry is initialized.
07/31 15:02:16 - mmengine - INFO - Start pipeline mmdeploy.apis.pytorch2onnx.torch2onnx in subprocess
07/31 15:02:16 - mmengine - WARNING - Failed to search registry with scope "mmdet" 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 "mmdet" is a correct scope, or whether the registry is initialized.
07/31 15:02:16 - mmengine - WARNING - Failed to search registry with scope "mmdet" in the "mmdet_tasks" registry tree. As a workaround, the current "mmdet_tasks" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmdet" is a correct scope, or whether the registry is initialized.
Loads checkpoint by local backend from path: mmdetection/work_dirs/yolox_l_8xb8-300e_coco/epoch_800.pth
07/31 15:02:21 - mmengine - WARNING - DeprecationWarning: get_onnx_config will be deprecated in the future.
07/31 15:02:21 - mmengine - INFO - Export PyTorch model to ONNX: mmdeploy_model/yolox_ncnn/end2end.onnx.
07/31 15:02:21 - mmengine - WARNING - Can not find torch.nn.functional.scaled_dot_product_attention, function rewrite will not be applied
07/31 15:02:21 - mmengine - WARNING - Can not find torch._C._jit_pass_onnx_autograd_function_process, function rewrite will not be applied
07/31 15:02:21 - mmengine - WARNING - Can not find mmdet.models.dense_heads.RPNHead.get_bboxes, function rewrite will not be applied
/root/autodl-tmp/mmdeploy/mmdeploy/codebase/mmdet/models/detectors/single_stage.py:80: TracerWarning: Iterating over a tensor might cause the trace to be incorrect. Passing a tensor of different shape won't change the number of iterations executed (and might lead to errors or silently give incorrect results).
img_shape = [int(val) for val in img_shape]
/root/autodl-tmp/mmdeploy/mmdeploy/codebase/mmdet/models/detectors/single_stage.py:80: TracerWarning: Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
img_shape = [int(val) for val in img_shape]
/root/autodl-tmp/mmdeploy/mmdeploy/pytorch/functions/getattribute.py:19: TracerWarning: Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
ret = torch.Size([int(s) for s in ret])
/root/miniconda3/envs/mmdeploy/lib/python3.10/site-packages/torch/functional.py:568: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at /opt/conda/conda-bld/pytorch_1646755897462/work/aten/src/ATen/native/TensorShape.cpp:2228.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
/root/autodl-tmp/mmdeploy/mmdeploy/codebase/mmdet/models/dense_heads/yolox_head.py:240: TracerWarning: torch.tensor results are registered as constants in the trace. You can safely ignore this warning if you use this function to create tensors out of constant variables that would be the same every time you call this function. In any other case, this might cause the trace to be incorrect.
vars = torch.tensor([1, 1, 1, 1], dtype=torch.float32)
/root/autodl-tmp/mmdeploy/mmdeploy/codebase/mmdet/models/dense_heads/yolox_head.py:245: TracerWarning: Converting a tensor to a NumPy array might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
vars.cpu().detach().numpy())
WARNING: The shape inference of mmdeploy::DetectionOutput 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 mmdeploy::DetectionOutput 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 mmdeploy::DetectionOutput type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function.
07/31 15:03:27 - mmengine - INFO - Finish pipeline mmdeploy.apis.pytorch2onnx.torch2onnx
07/31 15:03:28 - mmengine - INFO - Start pipeline mmdeploy.apis.utils.utils.to_backend in main process
Traceback (most recent call last):
File "/root/autodl-tmp/mmdeploy/tools/deploy.py", line 335, in <module>
main()
File "/root/autodl-tmp/mmdeploy/tools/deploy.py", line 259, in main
backend_files = to_backend(
File "/root/autodl-tmp/mmdeploy/mmdeploy/apis/core/pipeline_manager.py", line 356, in _wrap
return self.call_function(func_name_, *args, **kwargs)
File "/root/autodl-tmp/mmdeploy/mmdeploy/apis/core/pipeline_manager.py", line 326, in call_function
return self.call_function_local(func_name, *args, **kwargs)
File "/root/autodl-tmp/mmdeploy/mmdeploy/apis/core/pipeline_manager.py", line 275, in call_function_local
return pipe_caller(*args, **kwargs)
File "/root/autodl-tmp/mmdeploy/mmdeploy/apis/core/pipeline_manager.py", line 107, in __call__
ret = func(*args, **kwargs)
File "/root/autodl-tmp/mmdeploy/mmdeploy/apis/utils/utils.py", line 98, in to_backend
return backend_mgr.to_backend(
File "/root/autodl-tmp/mmdeploy/mmdeploy/backend/ncnn/backend_manager.py", line 141, in to_backend
from_onnx(onnx_path, osp.join(work_dir, onnx_name))
File "/root/autodl-tmp/mmdeploy/mmdeploy/backend/ncnn/onnx2ncnn.py", line 71, in from_onnx
ret_code = call([onnx2ncnn_path, onnx_path, save_param, save_bin])
File "/root/miniconda3/envs/mmdeploy/lib/python3.10/subprocess.py", line 345, in call
with Popen(*popenargs, **kwargs) as p:
File "/root/miniconda3/envs/mmdeploy/lib/python3.10/subprocess.py", line 971, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/root/miniconda3/envs/mmdeploy/lib/python3.10/subprocess.py", line 1863, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: ''
Checklist
Describe the bug
It works when I run this command to convert my yolox into onnx: python mmdeploy/tools/deploy.py mmdeploy/configs/mmdet/detection/detection_onnxruntime_dynamic.py mmdetection/work_dirs/yolox_l_8xb8-300e_coco/yolox_l_8xb8-300e_coco.py mmdetection/work_dirs/yolox_l_8xb8-300e_coco/epoch_800.pth mmdetection/demo/earmite_bluecat1_0001.jpg --work-dir mmdeploy_model/yolox_onnx --dump-info After this command, I got deploy.json, pipeline.json, detail.json, output_pytroch.jpg, output_onnxruntime.jpg and end2end.onnx in the dir yolox_onnx.
It doesn't works when I run this command to convert my yolox into ncnn: python mmdeploy/tools/deploy.py mmdeploy/configs/mmdet/detection/single-stage_ncnn_static-640x640.py mmdetection/work_dirs/yolox_l_8xb8-300e_coco/yolox_l_8xb8-300e_coco.py mmdetection/work_dirs/yolox_l_8xb8-300e_coco/epoch_800.pth mmdetection/demo/earmite_bluecat1_0001.jpg --work-dir mmdeploy_model/yolox_ncnn --dump-info After this command, I just got deploy.json, pipeline.json, detail.json and end2end.onnx in the dir yolox_ncnn. It seems nothing about ncnn.
Reproduction
python mmdeploy/tools/deploy.py mmdeploy/configs/mmdet/detection/single-stage_ncnn_static-640x640.py mmdetection/work_dirs/yolox_l_8xb8-300e_coco/yolox_l_8xb8-300e_coco.py mmdetection/work_dirs/yolox_l_8xb8-300e_coco/epoch_800.pth mmdetection/demo/earmite_bluecat1_0001.jpg --work-dir mmdeploy_model/yolox_ncnn --dump-info
Environment
Error traceback