open-mmlab / mmdeploy

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

window11搭建mmdeploy环境,在检测时出现RuntimeError: failed to create detector #2573

Open wuningaixiaoteng opened 11 months ago

wuningaixiaoteng commented 11 months ago

Checklist

Describe the bug

运行以下脚本时, from mmdeploy_runtime import Detector import cv2

读取图片

img = cv2.imread('D:\yolov8\mm1\mmdeploy\demo\resources\det.jpg')

创建检测器

detector = Detector(model_path='D:\yolov8\mm1\work_dir\trt\resnet', device_name='cuda', device_id=0)

执行推理

bboxes, labels, _ = detector(img)

使用阈值过滤推理结果,并绘制到原图中

indices = [i for i in range(len(bboxes))] for index, bbox, label_id in zip(indices, bboxes, labels): [left, top, right, bottom], score = bbox[0:4].astype(int), bbox[4] if score < 0.3: continue cv2.rectangle(img, (left, top), (right, bottom), (0, 255, 0)) cv2.imwrite('output_detection.png', img)

出现 loading mmdeploy_ort_net.dll ... [2023-11-29 10:14:34.200] [mmdeploy] [info] [model.cpp:35] [DirectoryModel] Load model: "D:\yolov8\mm1\work_dir\trt\resnet" [2023-11-29 10:14:34.200] [mmdeploy] [error] [common.cpp:67] Device "cuda" not found Traceback (most recent call last): File "D:/yolov8/mm1/mmdeploy/detect.py", line 8, in detector = Detector(model_path='D:\yolov8\mm1\work_dir\trt\resnet', device_name='cuda', device_id=0) RuntimeError: failed to create detector错误,应该如何解决呢

Reproduction

运行的脚本: from mmdeploy_runtime import Detector import cv2

读取图片

img = cv2.imread('D:\yolov8\mm1\mmdeploy\demo\resources\det.jpg')

创建检测器

detector = Detector(model_path='D:\yolov8\mm1\work_dir\trt\resnet', device_name='cuda', device_id=0)

执行推理

bboxes, labels, _ = detector(img)

使用阈值过滤推理结果,并绘制到原图中

indices = [i for i in range(len(bboxes))] for index, bbox, label_id in zip(indices, bboxes, labels): [left, top, right, bottom], score = bbox[0:4].astype(int), bbox[4] if score < 0.3: continue cv2.rectangle(img, (left, top), (right, bottom), (0, 255, 0))

cv2.imwrite('output_detection.png', img)

只修改了图片路径和model_path路径

Environment

11/29 10:28:52 - mmengine - INFO - sys.platform: win32
11/29 10:28:52 - mmengine - INFO - Python: 3.8.18 | packaged by conda-forge | (default, Oct 10 2023, 15:37:54) [MSC v.1929 64 bit (AMD64)]
11/29 10:28:52 - mmengine - INFO - CUDA available: True
11/29 10:28:52 - mmengine - INFO - numpy_random_seed: 2147483648
11/29 10:28:52 - mmengine - INFO - GPU 0: NVIDIA GeForce GTX 1650
11/29 10:28:52 - mmengine - INFO - CUDA_HOME: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2
11/29 10:28:52 - mmengine - INFO - NVCC: Cuda compilation tools, release 10.2, V10.2.8
11/29 10:28:52 - mmengine - INFO - MSVC: 用于 x64 的 Microsoft (R) C/C++ 优化编译器 19.36.32534 版
11/29 10:28:52 - mmengine - INFO - GCC: n/a
11/29 10:28:52 - mmengine - INFO - PyTorch: 1.10.2+cu102
11/29 10:28:52 - 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.2.3 (Git Hash 7336ca9f055cf1bfa13efb658fe15dc9b41f0740)
  - OpenMP 2019
  - LAPACK is enabled (usually provided by MKL)
  - CPU capability usage: AVX2
  - CUDA Runtime 10.2
  - 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_37,code=compute_37
  - CuDNN 7.6.5
  - Magma 2.5.4
  - Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=10.2, CUDNN_VERSION=7.6.5, CXX_COMPILER=C:/w/b/windows/tmp_bin/sccache-cl.exe, CXX_FLAGS=/DWIN32 /D_WINDOWS /GR /EHsc /w /bigobj -DUSE_PTHREADPOOL -openmp:experimental -IC:/w/b/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.10.2, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=OFF, USE_NNPACK=OFF, USE_OPENMP=ON, 

11/29 10:28:52 - mmengine - INFO - TorchVision: 0.11.3+cu102
11/29 10:28:52 - mmengine - INFO - OpenCV: 4.8.1
11/29 10:28:52 - mmengine - INFO - MMEngine: 0.9.1
11/29 10:28:52 - mmengine - INFO - MMCV: 2.0.1
11/29 10:28:52 - mmengine - INFO - MMCV Compiler: MSVC 192930148
11/29 10:28:52 - mmengine - INFO - MMCV CUDA Compiler: 10.2
11/29 10:28:52 - mmengine - INFO - MMDeploy: 1.3.0+8b19586
11/29 10:28:52 - mmengine - INFO - 

11/29 10:28:52 - mmengine - INFO - **********Backend information**********
11/29 10:28:52 - mmengine - INFO - tensorrt:    8.5.1.7
11/29 10:28:52 - mmengine - INFO - tensorrt custom ops: Available
11/29 10:28:52 - mmengine - INFO - ONNXRuntime: 1.8.1
11/29 10:28:52 - mmengine - INFO - ONNXRuntime-gpu: None
11/29 10:28:52 - mmengine - INFO - ONNXRuntime custom ops:  Available
11/29 10:28:52 - mmengine - INFO - pplnn:   None
11/29 10:28:52 - mmengine - INFO - ncnn:    None
11/29 10:28:53 - mmengine - INFO - snpe:    None
11/29 10:28:53 - mmengine - INFO - openvino:    None
11/29 10:28:53 - mmengine - INFO - torchscript: 1.10.2+cu102
11/29 10:28:53 - mmengine - INFO - torchscript custom ops:  NotAvailable
11/29 10:28:53 - mmengine - INFO - rknn-toolkit:    None
11/29 10:28:53 - mmengine - INFO - rknn-toolkit2:   None
11/29 10:28:53 - mmengine - INFO - ascend:  None
11/29 10:28:53 - mmengine - INFO - coreml:  None
11/29 10:28:53 - mmengine - INFO - tvm: None
11/29 10:28:53 - mmengine - INFO - vacc:    None
11/29 10:28:53 - mmengine - INFO - 

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

Error traceback

No response

UselessHua commented 7 months ago

Hello, I have the same problem as you. Have you solved it? Can you tell me why such an error occurs?

wang1528186571 commented 7 months ago

Hello, I have the same problem as you. Have you solved it? Can you tell me why such an error occurs?

metoo please tell me

UselessHua commented 7 months ago

@wuningaixiaoteng 配置mmdeploy-1.3.1-windows-amd64-cuda11.8开发环境

wang1528186571 commented 7 months ago

@wuningaixiaoteng 配置mmdeploy-1.3.1-windows-amd64-cuda11.8开发环境

下载他那个配置好的包吗? 在他github里那个

UselessHua commented 7 months ago

@wuningaixiaoteng 配置mmdeploy-1.3.1-windows-amd64-cuda11.8开发环境

下载他那个配置好的包吗? 在他github里那个

是的,配置include 和 lib 就行了

LLH-Harward commented 3 months ago

@wuningaixiaoteng 配置mmdeploy-1.3.1-windows-amd64-cuda11.8开发环境

下载他那个配置好的包吗? 在他github里那个

是的,配置include 和 lib 就行了

请问需要如何配置呀