openvino编译Inference Engine范例报“ngraph“的错

在Windows上安装好openvino
进入CMD输入:

cd C:\Program Files (x86)\Intel\openvino_2021\bin\
setupvars.bat
cd C:\Program Files (x86)\Intel\openvino_2021\deployment_tools\model_optimizer\install_prerequisites
install_prerequisites_caffe.bat
cd C:\Program Files (x86)\Intel\openvino_2021.2.185\inference_engine\samples\cpp
build_samples_msvc.bat

报错

CMake Error at ngraph_function_creation_sample/CMakeLists.txt:15 (find_package):
  By not providing "Findngraph.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "ngraph", but
  CMake did not find one.

  Could not find a package configuration file provided by "ngraph" with any
  of the following names:

    ngraphConfig.cmake
    ngraph-config.cmake

  Add the installation prefix of "ngraph" to CMAKE_PREFIX_PATH or set
  "ngraph_DIR" to a directory containing one of the above files.  If "ngraph"
  provides a separate development package or SDK, be sure it has been
  installed.

转到项目目录
C:\Program Files (x86)\Intel\openvino_2021.2.185\inference_engine\samples\cpp
打开CMakeLists.txt文件
向其中添加 ngraphConfig.cmake路径
ngraphConfig.cmake文件放在 C:\Program Files (x86)\Intel\openvino_2021.2.185\deployment_tools\ngraph\cmake
CMakeLists.txt文件修改如下:

	##
  # 设置ngraph的CMake路径 C:/Program Files (x86)/Intel/openvino_2021.2.185/deployment_tools/ngraph/cmake
  set(ngraph_DIR "C:/Program Files (x86)/Intel/openvino_2021.2.185/deployment_tools/ngraph/cmake")
  find_package (ngraph REQUIRED)
  if(ngraph_FOUND)
      INCLUDE_DIRECTORIES(${ngraph_INCLUDE_DIRS})
      message(STATUS "ngraph library status:")
      message(STATUS "    version: ${ngraph_VERSION}")
      message(STATUS "    libraries: ${NGRAPH_LIBRARIES}")
      message(STATUS "    include path: ${NGRAPH_INCLUDE_DIRS}")
  endif()
  ##

如下图所示
在这里插入图片描述生成的项目地址在

 C:\Users\Administrator\Documents\Intel\OpenVINO\inference_engine_cpp_samples_build\

在inference_engine_cpp_samples_build文件夹中的intel64\Release文件夹里面可以找到编译好的可执行文件(.exe)

参考文献:

运行exe报错
出现dll加载错误 : 找不到tbb.dll ngraph.dll
在环境变量中添加

C:\Program Files (x86)\Intel\openvino_2021.2.185\deployment_tools\ngraph\lib
C:\Program Files (x86)\Intel\openvino_2021.2.185\deployment_tools\inference_engine\external\tbb\bin

参考文献


版权声明:本文为fuyouzhiyi原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。