DayBreak-u / chineseocr_lite

超轻量级中文ocr,支持竖排文字识别, 支持ncnn、mnn、tnn推理 ( dbnet(1.8M) + crnn(2.5M) + anglenet(378KB)) 总模型仅4.7M
GNU General Public License v2.0
11.83k stars 2.26k forks source link

onnx的cpp工程,cmake找不到OnnxRuntime #366

Open MistEO opened 3 years ago

MistEO commented 3 years ago

这个教程来的

报错

-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19043.
OPENMP FOUND
CMake Error at CMakeLists.txt:55 (find_package):
  By not providing "FindOnnxRuntime.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "OnnxRuntime", but CMake did not find one.

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

    OnnxRuntimeConfig.cmake
    onnxruntime-config.cmake

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

确定目录是对的,因为我手动修改CMakeLists.txt,把第49~54行

# OnnxRuntime
if (OCR_STATIC)
    set(OnnxRuntime_DIR "${CMAKE_CURRENT_SOURCE_DIR}/onnxruntime-static")
else ()
    set(OnnxRuntime_DIR "${CMAKE_CURRENT_SOURCE_DIR}/onnxruntime-shared")
endif ()

改成

# OnnxRuntime
if (OCR_STATIC)
    set(OnnxRuntime_DIR "${CMAKE_CURRENT_SOURCE_DIR}/onnxruntime-static/windows-x64")
else ()
    set(OnnxRuntime_DIR "${CMAKE_CURRENT_SOURCE_DIR}/onnxruntime-shared/windows-x64")
endif ()

就可以正常cmake了

MistEO commented 3 years ago

按上面说的,手动改完了还是不行,cmake能过但是编译报错,onnxruntime的include也不对

换了onnx-1.6的那个压缩包就可以了;看了下应该是onnx-1.7压缩包里目录结构不太对