openvinotoolkit / openvino

OpenVINO™ is an open-source toolkit for optimizing and deploying AI inference
https://docs.openvino.ai
Apache License 2.0
6.79k stars 2.16k forks source link

Windows, OpenCV with IE, Access violation in InfEngineNgraphNet::setInputs #1220

Closed lahavy closed 4 years ago

lahavy commented 4 years ago

I am using Win 10, and compiled OpenCV with inference engine and ngraph I get an exception from the following line: auto inp = std::make_shared(ngraph::element::f32, ngraph::Shape(shape));

while shape is: 1,3,60,64

I also tried the pre-compiled OCV binaries coming with openVINO and got an exception (not sure it is the same one)

dkurt commented 4 years ago

Please fill issue carefully - include all the details how OpenCV is compiled, which environment is used (compiler)

Have you tried to use existing OpenVINO package?

lahavy commented 4 years ago

opencv 4.3.0 sources were downloaded from https://opencv.org/opencv-4-3-0/

used cmake 3.15.1 with the following extra flags:

  1. WITH_INF_ENGINE
  2. inferenceEngineDIR = C:\Program Files (x86)\IntelSWTools\openvino_2020.1.033\deployment_tools\inference_engine\share
  3. WITH_NGRAPH
  4. ngraph_DIR = C:\Program Files (x86)\IntelSWTools\openvino_2020.1.033\deployment_tools\ngraph\cmake

Compiler: Visual studio 15 (2017)

I was able to run one of the python detection samples included with OpenVino correctly, but I need it to work from OpenCV ,which my solution is already integrated to.

BTW, the input I use is caffe model, which has not passed the Model Optimizer

dkurt commented 4 years ago

Please try the latest master branch or use prebuilt binaries https://github.com/opencv/opencv/releases/tag/4.3.0 or share the model so we can reproduce it. Thanks!

lahavy commented 4 years ago

Thanks for your help! The issue was I didn't copy plugins.xml with the inference dlls

lahavy commented 4 years ago

Release mode x64, runs without an issue with my compiled version of OpenCV.

When trying to run in debug mode with my compiled version of OpenCV I get the following error: "the code execution cannot proceed because ngraph.dll was not found"

Please note that ngraphd.dll does exist + when replacing opencv_dnn430d.dll with your downloaded binaries it works. So my question is how to compile opencv_dnn with ngraphd.dll?

dkurt commented 4 years ago

I think this is not a problem with OpenCV, can you check your application?

ilyachur commented 4 years ago

Looks like you try to build debug version.

ngraphd.dll is a debug version of nGraph library. If you need it, you can build nGraph in Debug mode. Also check that ngraphd.dll can be found in your path.

lahavy commented 4 years ago

opencv dnn is linked to ngraph.lib and thus looks for ngraph.dll In order to make OCV linked with ngraphd.dll it has to be linked with ngraphd.lib which is missing in openvino toolkit. where can I get ngraphd.lib?