Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]libopencv_imgproc.so.409: cannot open shared object file: No such file or directory #402

Open
Flamse opened this issue Mar 19, 2024 · 4 comments

Comments

@Flamse
Copy link

Flamse commented Mar 19, 2024

依照项目部署命令

git clone --depth=1 https://github.com/DefTruth/lite.ai.toolkit.git  # latest
cd lite.ai.toolkit && sh ./build.sh # >= 0.2.0, support Linux only.

和output check代码

cmake_minimum_required(VERSION 3.10)
project(lite_yolov5)
set(CMAKE_CXX_STANDARD 17)

set(lite.ai.toolkit_DIR YOUR-PATH-TO/lite.ai.toolkit/build/install)
find_package(lite.ai.toolkit REQUIRED PATHS ${lite.ai.toolkit_DIR})
if (lite.ai.toolkit_Found)
    message(STATUS "lite.ai.toolkit_INCLUDE_DIRS: ${lite.ai.toolkit_INCLUDE_DIRS}")
    message(STATUS "lite.ai.toolkit_LIBS: ${lite.ai.toolkit_LIBS}")
endif()
add_executable(lite_yolov5 test_lite_yolov5.cpp)
target_link_libraries(lite_yolov5 ${lite.ai.toolkit_LIBS})
mkdir build && cd build && cmake .. && make -j1
./lite_yolov5

OpenCVonnxruntime所有相关的.so文件复制到.exe相同路径下,但是报错:

./lite_yolov5: error while loading shared libraries: libopencv_imgproc.so.409: cannot open shared object file: No such file or directory

会是我的c++编译器和cmake版本问题导致的吗?这两个软件都是通过apt直接安装的。

@DefTruth
Copy link
Owner

需要在可执行文件目录下,export LD_LIBRARY_PATH=$PWD:$LD_LIBRARY_PATH

@DefTruth
Copy link
Owner

重新编译一下库,编译案例的时候输出ite.ai.toolkit_LIBS_DIRS:

cmake_minimum_required(VERSION 3.10)
project(lite_yolov5)
set(CMAKE_CXX_STANDARD 17)

set(lite.ai.toolkit_DIR YOUR-PATH-TO/lite.ai.toolkit/build/install)
find_package(lite.ai.toolkit REQUIRED PATHS ${lite.ai.toolkit_DIR})
if (lite.ai.toolkit_Found)
    message(STATUS "lite.ai.toolkit_INCLUDE_DIRS: ${lite.ai.toolkit_INCLUDE_DIRS}")
    message(STATUS "        lite.ai.toolkit_LIBS: ${lite.ai.toolkit_LIBS}")
    message(STATUS "   lite.ai.toolkit_LIBS_DIRS: ${lite.ai.toolkit_LIBS_DIRS}")
endif()
add_executable(lite_yolov5 test_lite_yolov5.cpp)
target_link_libraries(lite_yolov5 ${lite.ai.toolkit_LIBS})

然后把相关的路径export一下即可

@Flamse
Copy link
Author

Flamse commented Mar 19, 2024

感谢,模型已经成功加载并计算完成。提几个点:

  1. 模型和图片地址根据需要修改
  std::string onnx_path = "../../../../examples/hub/onnx/cv/yolov5s.onnx";
  // ...
  1. 项目对模型输入做了规范,下载项目给出的模型可以完成测试,其他资源处下载的模型可以使用Python对onnx模型文件的输入格式进行修改
terminate called after throwing an instance of 'Ort::Exception'
  what():  Unexpected input data type. Actual: (tensor(float)) , expected: (tensor(float16))
  1. 该项目支持GPU计算吗?

@DefTruth
Copy link
Owner

GPU后续版本会继续支持。也可以通过修改依赖库和lite.ai.toolkit的源码加支持,很好改。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants