-
Notifications
You must be signed in to change notification settings - Fork 693
Open
Labels
Description
Checklist
- I have searched related issues but cannot get the expected help.
- 2. I have read the FAQ documentation but cannot get the expected help.
- 3. The bug has not been fixed in the latest version.
Describe the bug
With latest mmdet-3.x/mmdeploy-dev1.x branch, running 'python tools/deploy.py' get error before generatiing onnx file.
Reproduction
1, preparation
mmcv
mim install "mmcv>=2.0.0rc1"
mmdet
- git clone https://github.com/open-mmlab/mmdetection.git -b 3.x
cd mmdetection
pip install -v -e .
mmengine
- git clone https://github.com/open-mmlab/mmengine.git
cd mmdetection
pip install -v -e .
data(weight file .pth and config file .py)
mim download mmdet --config faster-rcnn_r50_fpn_1x_coco --dest .
2, before running, I changed some code to run the following commands
- comment out deepcopy in mmdeploy/codebase/mmdet/models/detectors/two_stage.py, because it failed in my env
# data_samples = copy.deepcopy(data_samples)
- change data type from list to dict ( located in mmdeploy/codebase/mmdet/deploy/object_detection.py), in order to fit BaseDataPreprocessor in mmengine.
# data = []
data = dict(inputs=[], data_samples=[])
for img in imgs:
# prepare data
if isinstance(img, np.ndarray):
# TODO: remove img_id.
data_ = dict(img=img, img_id=0)
else:
# TODO: remove img_id.
data_ = dict(img_path=img, img_id=0)
# build the data pipeline
data_ = test_pipeline(data_)
# data.append(data_)
data['inputs'].append(data_['inputs'])
data['data_samples'].append(data_['data_samples'])
# data = data[0]
if data_preprocessor is not None:
data = data_preprocessor(data, False)
return data, data['inputs']
3, running commands
-
except code modified above, nothing changed
-
python tools\deploy.py configs\mmdet\detection\detection_tensorrt_dynamic-320x320-1344x1344.py ..\faster-rcnn_r50_fpn_1x_coco.py ..\faster_rcnn_r50_fpn_1x_coco_20200130-047
c8118.pth ..\mmdetection\demo\demo.jpg --work-dir work_dir --show --device cuda:0 --dump-info -
When debug into inside of code, error occured here(torch/onnx/utils.py#444):
graph_inputs = list(graph.inputs())
- The calling pipeline:
torch.onnx.export(export.py)
--> wrapper(rewriter_utils.py)
--> model_to_graph_custom_optimizer(optimizer.py)
--> _model_to_graph(torch.onnx.utils)
--> _create_jit_graph(torch.onnx.utils) line 444)
Environment
(trt8.4) D:\1-code\mmlab\mmdeploy>python tools\check_env.py
09/13 21:29:51 - mmengine - INFO -
09/13 21:29:51 - mmengine - INFO - **********Environmental information**********
09/13 21:29:54 - mmengine - INFO - sys.platform: win32
09/13 21:29:54 - mmengine - INFO - Python: 3.9.12 (main, Apr 4 2022, 05:22:27) [MSC v.1916 64 bit (AMD64)]
09/13 21:29:54 - mmengine - INFO - CUDA available: True
09/13 21:29:54 - mmengine - INFO - numpy_random_seed: 2147483648
09/13 21:29:54 - mmengine - INFO - GPU 0: NVIDIA GeForce RTX 3060 Laptop GPU
09/13 21:29:54 - mmengine - INFO - CUDA_HOME: D:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3
09/13 21:29:54 - mmengine - INFO - NVCC: Cuda compilation tools, release 11.3, V11.3.58
09/13 21:29:54 - mmengine - INFO - MSVC: 用于 x64 的 Microsoft (R) C/C++ 优化编译器 19.29.30146 版
09/13 21:29:54 - mmengine - INFO - GCC: n/a
09/13 21:29:54 - mmengine - INFO - PyTorch: 1.11.0+cu113
09/13 21:29:54 - 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.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.4
- Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=11.3, CUDNN_VERSION=8.2.0, 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_XNNP
ACK -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,
09/13 21:29:54 - mmengine - INFO - TorchVision: 0.12.0+cu113
09/13 21:29:54 - mmengine - INFO - OpenCV: 4.6.0
09/13 21:29:54 - mmengine - INFO - MMEngine: 0.1.0
09/13 21:29:54 - mmengine - INFO - MMCV: 2.0.0rc1
09/13 21:29:54 - mmengine - INFO - MMCV Compiler: MSVC 192829924
09/13 21:29:54 - mmengine - INFO - MMCV CUDA Compiler: 11.3
09/13 21:29:54 - mmengine - INFO - MMDeploy: 0.7.0+0aad635
09/13 21:29:54 - mmengine - INFO -
09/13 21:29:54 - mmengine - INFO - **********Backend information**********
09/13 21:29:54 - mmengine - INFO - onnxruntime: None ops_is_avaliable : False
09/13 21:29:54 - mmengine - INFO - tensorrt: 8.4.3.1 ops_is_avaliable : False
09/13 21:29:55 - mmengine - INFO - ncnn: None ops_is_avaliable : False
09/13 21:29:55 - mmengine - INFO - pplnn_is_avaliable: False
09/13 21:29:55 - mmengine - INFO - openvino_is_avaliable: False
09/13 21:29:55 - mmengine - INFO - snpe_is_available: False
09/13 21:29:55 - mmengine - INFO -
09/13 21:29:55 - mmengine - INFO - **********Codebase information**********
09/13 21:29:55 - mmengine - INFO - mmdet: 3.0.0rc0
09/13 21:29:55 - mmengine - INFO - mmseg: None
09/13 21:29:55 - mmengine - INFO - mmcls: None
09/13 21:29:55 - mmengine - INFO - mmocr: None
09/13 21:29:55 - mmengine - INFO - mmedit: None
09/13 21:29:55 - mmengine - INFO - mmdet3d: None
09/13 21:29:55 - mmengine - INFO - mmpose: None
09/13 21:29:55 - mmengine - INFO - mmrotate: NoneError traceback
the same as https://github.com/open-mmlab/mmdeploy/issues/803#issuecomment-1200153598.