编译onnxruntime+OpenVINO,提示“Unsupported OpenVINO version“(已解决)

发布时间:2024年01月23日

编译OnnxRuntime+OpenVINO,提示"Unsupported OpenVINO version"(已解决)

昨天刚填完编译OnnxRuntime+OneDNN的坑,今天编译了一天的OnnxRuntime+OpenVINO,一直接提示Unsupported OpenVINO version,无法编译通过。

CMake Error at CMakeLists.txt:1253 (message):
  Unsupported OpenVINO version:


-- Configuring incomplete, errors occurred!
Traceback (most recent call last):
  File "G:\FromGithub\onnxruntime\tools\ci_build\build.py", line 2684, in <module>
    sys.exit(main())
  File "G:\FromGithub\onnxruntime\tools\ci_build\build.py", line 2542, in main
    generate_build_tree(
  File "G:\FromGithub\onnxruntime\tools\ci_build\build.py", line 1422, in generate_build_tree
    run_subprocess(
  File "G:\FromGithub\onnxruntime\tools\ci_build\build.py", line 798, in run_subprocess
    return run(*args, cwd=cwd, capture_stdout=capture_stdout, shell=shell, env=my_env)
  File "G:\FromGithub\onnxruntime\tools\python\util\run.py", line 49, in run
    completed_process = subprocess.run(
  File "E:\Python\Python39\lib\subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,

查来查去,原来是自己下载OpenVINO ToolKit包时(w_openvino_toolkit_windows_2023.2.0.13089.cfd42bd2cb0_x86_64.zip),觉得名字太长了,改了一个CMake在是处理onnxruntime\cmake\CMakeList.txt文件时,无法通过路径来判断OpenVino的版本,如下代码

 # Check OpenVINO version for support
  if (${VER} MATCHES "2022.1" OR $ENV{INTEL_OPENVINO_DIR} MATCHES "2022.1")
    set(OPENVINO_VERSION "2022.1")
    add_definitions(-DOPENVINO_2022_1=1)
  elseif (${VER} MATCHES "2022.2" OR $ENV{INTEL_OPENVINO_DIR} MATCHES "2022.2")
    set(OPENVINO_VERSION "2022.2")
    add_definitions(-DOPENVINO_2022_2=1)
  elseif ($ENV{INTEL_OPENVINO_DIR} MATCHES "2022.3")
    set(OPENVINO_VERSION "2022.3")
    add_definitions(-DOPENVINO_2022_3=1)
  elseif ($ENV{INTEL_OPENVINO_DIR} MATCHES "2023.0")
    set(OPENVINO_VERSION "2023.0")
    add_definitions(-DOPENVINO_2023_0=1)
  elseif ($ENV{INTEL_OPENVINO_DIR} MATCHES "2023.1")
    set(OPENVINO_VERSION "2023.1")
    add_definitions(-DOPENVINO_2023_1=1)
  elseif ($ENV{INTEL_OPENVINO_DIR} MATCHES "openvino")
    set(OPENVINO_VERSION "2023.1")
    add_definitions(-DOPENVINO_2023_1=1)
  else()
    message(FATAL_ERROR "Unsupported OpenVINO version: ${INTEL_OPENVINO_DIR}")
  endif()

其中,INTEL_OPENVINO_DIR就是“setupvars.bat”所在文件夹。
导致一直提示"Unsupported OpenVINO version",坑,实在是坑!
注意,解压或安装的文件夹名需要包含版本号(如CMakeList.txt文件中的版本号)或 openvino(还区分大小写?!),最后路径如:“F:\openvino\”,编译通过。
CMake也有语法,也有错误提示,只是自己没早发现…

文章来源:https://blog.csdn.net/TyroneKing/article/details/135759933
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。