mmdeploy icon indicating copy to clipboard operation
mmdeploy copied to clipboard

a problem occured when calling mmdeploy_detector_create_by_path

Open IronManTwo opened this issue 2 years ago • 17 comments

C++When I call the function mmdeploy_detector_create,The return value is 6。 route There are .engine file and .onnx file,What's the next step? Please ask everyone. Thank you

IronManTwo avatar Sep 03 '22 01:09 IronManTwo

@lvhan028

tpoisonooo avatar Sep 03 '22 01:09 tpoisonooo

MMDeploy Is there a problem with the environment? @lvhan028

IronManTwo avatar Sep 03 '22 01:09 IronManTwo

Please share the arguments when calling the API. Probably because the model_path is wrong, using SDK model path, which is the directory you passed to --work-dir

lvhan028 avatar Sep 04 '22 07:09 lvhan028

C + + code parameters are as follows: const char* model_path = "D:\YQL4\mmdeploy\work_dir"; int status{}; mmdeploy_detector_t detector{}; status = mmdeploy_detector_create_by_path(model_path, device_name, 0, &detector); //status = 6; if (status != MMDEPLOY_SUCCESS ) { fprintf(stderr, "failed to create detector, code: %d\n", (int)status); return 1; } model_ Path has the following files: end2end.engine、end2end.onnx Where should I continue to investigate?Thank you, boss

IronManTwo avatar Sep 05 '22 01:09 IronManTwo

Have you converted the model with --dump-info? It is supposed to have deploy.json and pipeline.json in D:\YQL4\mmdeploy\work_dir

lvhan028 avatar Sep 05 '22 02:09 lvhan028

Thank you very much. The new file is as follows:

  1. deploy.json
  2. detail.json
  3. pipeline.json But mmdeploy_ detector_ create_ by_ The return value of path is still 6 Is there any other influence?boss

IronManTwo avatar Sep 05 '22 06:09 IronManTwo

The C + + running log is as follows: [2022-09-05 15:46:36.515] [mmdeploy] [info] [model.cpp:95] Register 'DirectoryModel' [2022-09-05 15:46:37.693] [mmdeploy] [info] [model.cpp:38] DirectoryModel successfully load model D:\YQL4\mmdeploy\work_dir [2022-09-05 15:46:37.694] [mmdeploy] [error] [device_impl.cpp:147] 0, -1 [2022-09-05 15:46:37.696] [mmdeploy] [error] [pipeline.cpp:27] exception caught: invalid argument (1) failed to create detector, code: 6 @lvhan028

IronManTwo avatar Sep 05 '22 07:09 IronManTwo

the same error

nqthai309 avatar Sep 05 '22 09:09 nqthai309

"[2022-09-05 15:46:37.694] [mmdeploy] [error] [device_impl.cpp:147] 0, -1" Have you built mmdeploy SDK? How did you integrate mmdeploy libs to your project? Could you kindly provide reproducing steps? I cannot reproduce your issue now.

lvhan028 avatar Sep 05 '22 09:09 lvhan028

@lvhan028 Boss,The SDK is built as follows:

  1. https://github.com/open-mmlab/mmdeploy/blob/master/docs/en/01-how-to-build/windows.md ,First get opencv pplcv
  2. https://github.com/open-mmlab/mmdeploy/blob/master/docs/en/02-how-to-run/prebuilt_package_windows.md#tensorrt-3 , Generate exe executor with the path given by tensorrt
  3. C + + calls these exe programs with shellexecute a function C + + dependent library files include:

C:\Users\Administrator\source\repos\C++_And_Python\mmdeploy-0.7.0-windows-amd64-cuda11.1-tensorrt8.2.3.0\sdk\lib mmdeploy.lib; mmdeploy_classifier.lib; mmdeploy_common.lib; mmdeploy_core.lib; mmdeploy_cpu_device.lib; mmdeploy_cpu_transform_impl.lib;mmdeploy_detector.lib; mmdeploy_directory_model.lib; mmdeploy_execution.lib; mmdeploy_executor.lib; mmdeploy_graph.lib; mmdeploy_mmcls.lib; mmdeploy_mmdet.lib; mmdeploy_mmedit.lib; mmdeploy_mmocr.lib; mmdeploy_mmpose.lib; mmdeploy_mmrotate.lib; mmdeploy_mmseg.lib; mmdeploy_model.lib; mmdeploy_net_module.lib; mmdeploy_opencv_utils.lib; mmdeploy_pipeline.lib; mmdeploy_pose_detector.lib; mmdeploy_restorer.lib; mmdeploy_rotated_detector.lib; mmdeploy_segmentor.lib; mmdeploy_text_detector.lib; mmdeploy_text_recognizer.lib; mmdeploy_transform.lib; mmdeploy_transform_module.lib; spdlog.lib; nvinfer.lib; opencv_world460.lib; Is there any other influence? boss@lvhan028

“[2022-09-05 15:46:37.694] [mmdeploy] [error] [device_impl.cpp:147] 0, -1” 您是否构建了 mmdeploy SDK?您是如何将 mmdeploy 库集成到您的项目中的? 您能否提供复制步骤?我现在无法重现您的问题。

IronManTwo avatar Sep 06 '22 06:09 IronManTwo

@lvhan028 Boss,The SDK is built as follows:

  1. https://github.com/open-mmlab/mmdeploy/blob/master/docs/en/01-how-to-build/windows.md ,First get opencv pplcv
  2. https://github.com/open-mmlab/mmdeploy/blob/master/docs/en/02-how-to-run/prebuilt_package_windows.md#tensorrt-3 , Generate exe executor with the path given by tensorrt
  3. C + + calls these exe programs with shellexecute a function Is there any other influence? boss@lvhan028

IronManTwo avatar Sep 06 '22 06:09 IronManTwo

C + + dependent library files include:

C:\Users\Administrator\source\repos\C++_And_Python\mmdeploy-0.7.0-windows-amd64-cuda11.1-tensorrt8.2.3.0\sdk\lib mmdeploy.lib; mmdeploy_classifier.lib; mmdeploy_common.lib; mmdeploy_core.lib; mmdeploy_cpu_device.lib; mmdeploy_cpu_transform_impl.lib;mmdeploy_detector.lib; mmdeploy_directory_model.lib; mmdeploy_execution.lib; mmdeploy_executor.lib; mmdeploy_graph.lib; mmdeploy_mmcls.lib; mmdeploy_mmdet.lib; mmdeploy_mmedit.lib; mmdeploy_mmocr.lib; mmdeploy_mmpose.lib; mmdeploy_mmrotate.lib; mmdeploy_mmseg.lib; mmdeploy_model.lib; mmdeploy_net_module.lib; mmdeploy_opencv_utils.lib; mmdeploy_pipeline.lib; mmdeploy_pose_detector.lib; mmdeploy_restorer.lib; mmdeploy_rotated_detector.lib; mmdeploy_segmentor.lib; mmdeploy_text_detector.lib; mmdeploy_text_recognizer.lib; mmdeploy_transform.lib; mmdeploy_transform_module.lib; spdlog.lib; nvinfer.lib; opencv_world460.lib;

IronManTwo avatar Sep 06 '22 06:09 IronManTwo

There is no 'mmdeploy_cuda_device.lib' or 'mmdeploy_trt_net.lib' or 'mmdeploy_ort_net.lib' Please using exact the following command to build mmdeploy from source.

Make sure to set option -DMMDEPLOY_TARGET_DEVICES="cpu;cuda"

cd $env:MMDEPLOY_DIR
mkdir build -ErrorAction SilentlyContinue
cd build
cmake .. -G "Visual Studio 16 2019" -A x64 -T v142 `
  -DMMDEPLOY_BUILD_SDK=ON `
  -DMMDEPLOY_BUILD_EXAMPLES=ON `
  -DMMDEPLOY_BUILD_SDK_PYTHON_API=ON `
  -DMMDEPLOY_TARGET_DEVICES="cpu;cuda" `
  -DMMDEPLOY_TARGET_BACKENDS="trt" `
  -Dpplcv_DIR="$env:PPLCV_DIR/pplcv-build/install/lib/cmake/ppl" `
  -DTENSORRT_DIR="$env:TENSORRT_DIR" `
  -DCUDNN_DIR="$env:CUDNN_DIR"

cmake --build . --config Release -- /m
cmake --install . --config Release

lvhan028 avatar Sep 07 '22 03:09 lvhan028

@lvhan028 Boss,The method you recommend will be missing 'mmdeploy_ort_net.lib' The commands I use are as follows:

  1. cmake .. -G "Visual Studio 16 2019" -A x64 -T v142 -DMMDEPLOY_TARGET_BACKENDS="trt" -DTENSORRT_DIR="C:\Program Files\NVIDIA GPU Computing Toolkit\tensorrt\TensorRT-8.4.3.1" -DCUDNN_DIR="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3"
  2. cmake .. -G "Visual Studio 16 2019" -A x64 -T v142 -DMMDEPLOY_BUILD_SDK=ON -DMMDEPLOY_BUILD_EXAMPLES=ON -DMMDEPLOY_BUILD_SDK_PYTHON_API=OFF -DMMDEPLOY_BUILD_SDK_CXX_API=ON -DMMDEPLOY_TARGET_DEVICES="cuda" -DMMDEPLOY_TARGET_BACKENDS="trt" -Dpplcv_DIR="D:\YQL4\ppl.cv\pplcv-build\install\lib\cmake\ppl" -DTENSORRT_DIR="C:\Program Files\NVIDIA GPU Computing Toolkit\tensorrt\TensorRT-8.4.3.1" -DCUDNN_DIR="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3" Is there a problem with my operation?Please give me more advice,Thank you

IronManTwo avatar Sep 08 '22 07:09 IronManTwo

@lvhan028 Boss,From your professional perspective, do you recommend a detailed tutorial of C++connection model? I will deploy it according to the tutorial. Thank you, boss

IronManTwo avatar Sep 14 '22 09:09 IronManTwo

Sorry for being late. When you use the prebuild package, this is no need to build mmdeploy from source. The command you are using is right. @irexyc could you help investigating this issue?

lvhan028 avatar Sep 20 '22 06:09 lvhan028

@IronManTwo

看了你上面的回复,感觉有一些乱,根据路径mmdeploy-0.7.0-windows-amd64-cuda11.1-tensorrt8.2.3.0\sdk\lib似乎你用到了预编译包,但是你给的lib目录下面又出现了opencv_world460.lib, nvinfer.lib等预编译包中没有的文件,另外不知道你的example是怎么编译的。预编译包中的bin目录下的相关exe可以跑你转的模型么?

方便通过Openmmlab小喵加一下mmdpeloy的微信群,然后群里聊么,效率高一些。 https://github.com/open-mmlab/mmdeploy/blob/master/README_zh-CN.md

irexyc avatar Sep 20 '22 06:09 irexyc

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] avatar Dec 17 '22 01:12 github-actions[bot]

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.

github-actions[bot] avatar Dec 23 '22 01:12 github-actions[bot]