Comments (4)
最后错误得以解决,是把所有文件都丢到根目录运行去找bug,然后发现是
ort_handler.cpp里面
#ifdef LITEHUB_WIN32
#include "ort_utils.h"
#endif
出现问题
手动引入ort_utils.h后解决
以及 onnx_path = _onnx_path.data();的类型错误
改为 onnx_path = (const wchar_t*)_onnx_path.data();成功解决 可能是编译器的问题(vs2019)
不太理解为什么, 是小白,不过还是把这个po出来把,最后非常感谢大佬
from lite.ai.toolkit.
这个是典型的链接错误,编译出来的example在运行时需要找到对应的动态库。我不太好定位你的问题出在哪里。我是用Mac+CLion+CMake开发的,编译器是clang。你可以尝试下Windows+CLion+CMake+MSVC来编译。 你可以看一下这个关于windows下跑lite.ai的讨论 #6
from lite.ai.toolkit.
关于如何链接编好的lite.ai动态库,CMakeLists的设置可以参考下:
cmake_minimum_required(VERSION 3.17)
project(lite.ai-release)
message(">>>> Current project is: ${CMAKE_SOURCE_DIR}")
set(CMAKE_CXX_STANDARD 11)
# link opencv.
set(OpenCV_DIR ${CMAKE_SOURCE_DIR}/opencv/lib/cmake/opencv4)
find_package(OpenCV 4 REQUIRED)
if (OpenCV_FOUND)
include_directories(${OpenCV_INCLUDE_DIRS})
set(OpenCV_LIBS opencv_highgui opencv_core opencv_imgcodecs opencv_imgproc) # need only
message("=================================================================================")
message(STATUS " OpenCV library status:")
message(STATUS " version: ${OpenCV_VERSION}")
message(STATUS " libraries: ${OpenCV_LIBS}")
message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}")
message("=================================================================================")
else ()
message(FATAL_ERROR "OpenCV library not found")
endif()
# link onnxruntime.
set(ONNXRUNTIME_DIR ${CMAKE_SOURCE_DIR}/onnxruntime/)
set(ONNXRUNTIME_INCLUDE_DIR ${ONNXRUNTIME_DIR}/include)
set(ONNXRUNTIME_LIBRARY_DIR ${ONNXRUNTIME_DIR}/lib)
include_directories(${ONNXRUNTIME_INCLUDE_DIR})
link_directories(${ONNXRUNTIME_LIBRARY_DIR})
# link lite.ai.
set(LITEHUB_DIR ${CMAKE_SOURCE_DIR}/lite.ai)
set(LITEHUB_INCLUDE_DIR ${LITEHUB_DIR}/include)
set(LITEHUB_LIBRARY_DIR ${LITEHUB_DIR}/lib)
include_directories(${LITEHUB_INCLUDE_DIR})
link_directories(${LITEHUB_LIBRARY_DIR})
# add your executable
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/examples/build)
add_executable(lite_yolov5 examples/test_lite_yolov5.cpp)
target_link_libraries(lite_yolov5 lite.ai onnxruntime ${OpenCV_LIBS}) # link lite.ai
对应的动态库目录需要修成你自己的。一个在mac上的参考案例 lite.ai-release
from lite.ai.toolkit.
最后错误得以解决,是把所有文件都丢到根目录运行去找bug,然后发现是
ort_handler.cpp里面
#ifdef LITEHUB_WIN32
#include "ort_utils.h"
#endif
出现问题
手动引入ort_utils.h后解决以及 onnx_path = _onnx_path.data();的类型错误
改为 onnx_path = (const wchar_t*)_onnx_path.data();成功解决 可能是编译器的问题(vs2019)不太理解为什么, 是小白,不过还是把这个po出来把,最后非常感谢大佬
赞👍🏻 ~, onnxruntime在windows下是用的宽字符,代码了应该已经处理,至于为什么还出现这个bug,emmmm......我也很迷 🤔
#ifdef LITE_WIN32
std::wstring _w_onnx_path(ortcv::utils::to_wstring(_onnx_path));
onnx_path = _w_onnx_path.data();
#else
onnx_path = _onnx_path.data();
#endif
initialize_handler();
在lite.ai.defs.h里边有做这个宏判断,你可以查下有没有生效。
#if (defined _WIN32 || defined WINCE || defined __CYGWIN__)
# define LITE_WIN32
#elif defined __GNUC__ && __GNUC__ >= 4 && (defined(__APPLE__))
# define LITE_UNIX
#endif
你试下用最新的代码,旧版本的一些问题已经修复了。
补充下,确实有处宏判断写错了。在ort_handler.cpp原来的代码:
#ifdef LITEHUB_WIN32
#include "ort_utils.h"
#endif
需要修改成
#ifdef LITE_WIN32
#include "ort_utils.h"
#endif
from lite.ai.toolkit.
Related Issues (20)
- How to obtain KPS from using Retinaface implementation HOT 2
- MacOS 下开启 Metal 会崩溃 HOT 4
- MacOS 下开启 Metal 应该使用什么方案 HOT 3
- 求兼容macOS m1 HOT 4
- RESOURCES HOT 1
- Compile on M1 Chip HOT 5
- Example4: Face Recognition using ArcFace. 怎么加速推理时间? HOT 1
- rvm模型用mnn推理结果有误啊 HOT 1
- batch glint inference HOT 2
- MacOS下启用Metal加速后,效果较差,需要如何改进呢? HOT 1
- 加入mrnet的mnn部署 HOT 1
- Docker image invalid tar header HOT 1
- 你好,有OCR的模型部署吗? HOT 2
- [BUG][Tracker] can not found any test model in examples/hub directory HOT 1
- [BUG]libopencv_imgproc.so.409: cannot open shared object file: No such file or directory HOT 4
- Windows 运行 RVM 使用 rvm_mobilenetv3_fp16.onnx 崩溃
- 请问可以支持DNN吗?
- Windows MNN 初始化 RobustVideoMatting 失败
- 如何配置环境调试代码,进行学习呢 HOT 1
- mnn_rvm.cpp 怎么使用动态分辨率的输入 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lite.ai.toolkit.