open-mmlab / mmdeploy

OpenMMLab Model Deployment Framework
https://mmdeploy.readthedocs.io/en/latest/
Apache License 2.0
2.61k stars 602 forks source link

[Bug] [mmdeploy] [error] [instance_segmentation.cpp:78] invalid argument (1) #2567

Closed JonyJiang123 closed 7 months ago

JonyJiang123 commented 7 months ago

Checklist

Describe the bug

use demo sdk to predict swin-transformer trt model (mask-rcnn_swin-t-p4-w7_fpn_1x_coco.py), get this error

Reproduction

from mmdeploy.apis import inference_model from mmdeploy_runtime import Detector import cv2

detector = Detector(model_path='work_dir/trt/swin-transformer/', device_name=device, device_id=0) image = cv2.imread('mmdetection/data/1909/1909-ascus/17_8.png') print(image.shape) bboxes, labels, masks = detector(image)

Environment

11/24 11:29:34 - mmengine - INFO - 

11/24 11:29:34 - mmengine - INFO - **********Environmental information**********
11/24 11:29:36 - mmengine - INFO - sys.platform: win32
11/24 11:29:36 - mmengine - INFO - Python: 3.7.16 (default, Jan 17 2023, 16:06:28) [MSC v.1916 64 bit (AMD64)]
11/24 11:29:36 - mmengine - INFO - CUDA available: True
11/24 11:29:36 - mmengine - INFO - numpy_random_seed: 2147483648
11/24 11:29:36 - mmengine - INFO - GPU 0: NVIDIA GeForce RTX 3090 Ti
11/24 11:29:36 - mmengine - INFO - CUDA_HOME: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3        
11/24 11:29:36 - mmengine - INFO - NVCC: Cuda compilation tools, release 11.3, V11.3.58
11/24 11:29:36 - mmengine - INFO - MSVC: 用于 x64 的 Microsoft (R) C/C++ 优化编译器 19.37.32825 版
11/24 11:29:36 - mmengine - INFO - GCC: n/a
11/24 11:29:36 - mmengine - INFO - PyTorch: 1.12.1+cu113
11/24 11:29:36 - 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.6.0 (Git Hash 52b5f107dd9cf10910aaa19cb47f3abf9b349815)
  - 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.3.2  (built against CUDA 11.5)
  - Magma 2.5.4
  - Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=11.3, 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.12.1, 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,

11/24 11:29:36 - mmengine - INFO - TorchVision: 0.13.1+cu113
11/24 11:29:36 - mmengine - INFO - OpenCV: 4.8.1
11/24 11:29:36 - mmengine - INFO - MMEngine: 0.10.1
11/24 11:29:36 - mmengine - INFO - MMCV: 2.0.1
11/24 11:29:36 - mmengine - INFO - MMCV Compiler: MSVC 192930148
11/24 11:29:36 - mmengine - INFO - MMCV CUDA Compiler: 11.3
11/24 11:29:36 - mmengine - INFO - MMDeploy: 1.3.0+
11/24 11:29:36 - mmengine - INFO -
11/24 11:29:36 - mmengine - INFO - rknn-toolkit:        None
11/24 11:29:36 - mmengine - INFO - rknn-toolkit2:       None
11/24 11:29:36 - mmengine - INFO - ascend:      None
11/24 11:29:36 - mmengine - INFO - coreml:      None
11/24 11:29:36 - mmengine - INFO - tvm: None
11/24 11:29:36 - mmengine - INFO - vacc:        None
11/24 11:29:36 - mmengine - INFO -

11/24 11:29:36 - mmengine - INFO - **********Codebase information**********
11/24 11:29:36 - mmengine - INFO - mmdet:       3.0.0
11/24 11:29:36 - mmengine - INFO - mmseg:       None
11/24 11:29:36 - mmengine - INFO - mmpretrain:  1.1.1
11/24 11:29:36 - mmengine - INFO - mmocr:       None
11/24 11:29:36 - mmengine - INFO - mmagic:      None
11/24 11:29:36 - mmengine - INFO - mmdet3d:     None
11/24 11:29:36 - mmengine - INFO - mmpose:      None
11/24 11:29:36 - mmengine - INFO - mmrotate:    None
11/24 11:29:36 - mmengine - INFO - mmaction:    None
11/24 11:29:36 - mmengine - INFO - mmrazor:     None
11/24 11:29:36 - mmengine - INFO - mmyolo:      None

Error traceback

oading mmdeploy_trt_net.dll ... loading mmdeploy_ort_net.dll ... [2023-11-24 10:57:21.832] [mmdeploy] [info] [model.cpp:35] [DirectoryModel] Load model: "work_dir/trt/swin-transformer/" [2023-11-24 10:57:22.873] [mmdeploy] [warning] [trt_net.cpp:24] TRTNet: TensorRT was linked against cuDNN 8.9.0 but loaded cuDNN 8.3.2 [2023-11-24 10:57:22.876] [mmdeploy] [warning] [trt_net.cpp:24] TRTNet: TensorRT was linked against cuDNN 8.9.0 but loaded cuDNN 8.3.2 [2023-11-24 10:57:23.724] [mmdeploy] [warning] [trt_net.cpp:24] TRTNet: CUDA lazy loading is not enabled. Enabling it can significantly reduce device memory usage and speed up TensorRT initialization. See "Lazy Loading" section of CUDA documentation https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#lazy-loading (640, 1280, 3) [2023-11-24 10:57:23.750] [mmdeploy] [error] [instance_segmentation.cpp:78] invalid argument (1)

JonyJiang123 commented 7 months ago

But I use api to predict, It's works well. Here is api code: model_cfg = 'mmdetection/configs/myconfig/mask-rcnn_swin-t-p4-w7_fpn_1x_coco.py' deploy_cfg = 'mmdeploy/configs/mmdet/detection/detection_tensorrt_dynamic-320x320-1344x1344.py' backend_files = ['work_dir/trt/swin-transformer/end2end.engine'] img = 'mmdetection/data/1909/1909-ascus/17_8.png' device = 'cuda' result = inference_model(model_cfg, deploy_cfg, backend_files, img, device) print(result)

irexyc commented 7 months ago

@JonyJiang123

deploy_cfg 不对, configs/mmdet/detection 对应的task是object detection,swin transformer 应该是 Instance Segmentation,你应该用configs/mmdet/instance-seg 下面的

github-actions[bot] commented 7 months ago

This issue is marked as stale because it has been marked as invalid or awaiting response for 7 days without any further response. It will be closed in 5 days if the stale label is not removed or if there is no further response.

github-actions[bot] commented 7 months ago

This issue is closed because it has been stale for 5 days. Please open a new issue if you have similar issues or you have any new updates now.