diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..c607f2d --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.associations": { + "sstream": "cpp" + } +} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 55a0d25..15b9678 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,13 +5,12 @@ set (CMAKE_CXX_STANDARD 17) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) -set(onnxruntime_INSTALL_PREFIX /usr/local) +set(onnxruntime_INSTALL_PREFIX /home/whoami/Documents/Hanvon/onnx_runtime_cpp/onnxruntime) set(onnxruntime_INCLUDE_DIRS ${onnxruntime_INSTALL_PREFIX}/include/onnxruntime ${onnxruntime_INSTALL_PREFIX}/include/onnxruntime/core/session ) -find_library(onnxruntime_LIBS NAMES onnxruntime PATHS /usr/local/lib) find_package(CUDA QUIET) diff --git a/examples/YoloX.cpp b/examples/YoloX.cpp index 6c890d3..aa773e8 100644 --- a/examples/YoloX.cpp +++ b/examples/YoloX.cpp @@ -44,14 +44,14 @@ void YoloX::preprocess(float* dst, // std::vector YoloX::decodeOutputs(const float* prob, float confThresh) const { - std::vector gridStrides = this->genereateGridsAndStrides(IMG_W, m_strides); + std::vector gridStrides = this->generateGridsAndStrides(IMG_W, m_strides); return this->generateYoloXProposals(prob, gridStrides, confThresh); } /** * @brief https://github.com/Megvii-BaseDetection/YOLOX/blob/main/demo/MegEngine/cpp/yolox.cpp#L64 */ -std::vector YoloX::genereateGridsAndStrides(int targetSize, const std::vector& strides) const +std::vector YoloX::generateGridsAndStrides(int targetSize, const std::vector& strides) const { std::vector gridStrides; for (auto stride : strides) { diff --git a/examples/YoloX.hpp b/examples/YoloX.hpp index 892b629..6e60335 100644 --- a/examples/YoloX.hpp +++ b/examples/YoloX.hpp @@ -62,7 +62,7 @@ class YoloX : public ImageRecognitionOrtSessionHandlerBase struct GridAndStride; - std::vector genereateGridsAndStrides(int targetSize, const std::vector& strides) const; + std::vector generateGridsAndStrides(int targetSize, const std::vector& strides) const; std::vector generateYoloXProposals(const float* prob, const std::vector& gridStrides, float confThresh) const; diff --git a/scripts/install_onnx_runtime.bash b/scripts/install_onnx_runtime.bash index b053ff8..105596c 100755 --- a/scripts/install_onnx_runtime.bash +++ b/scripts/install_onnx_runtime.bash @@ -10,7 +10,7 @@ sudo apt-get update sudo apt install -y --no-install-recommends zlib1g-dev readonly ONNXRUNTIME_VERSION="v1.14.1" -git clone --recursive -b ${ONNXRUNTIME_VERSION} https://github.com/Microsoft/onnxruntime +# git clone --recursive -b ${ONNXRUNTIME_VERSION} https://github.com/Microsoft/onnxruntime cd onnxruntime INSTALL_PREFIX="/usr/local" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0405c48..9f3943b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.10) set(LIBRARY_NAME ${PROJECT_NAME}) +find_library(onnxruntime_LIBS NAMES onnxruntime PATHS /home/whoami/Documents/Hanvon/onnx_runtime_cpp) + + file(GLOB SOURCE_FILES ${PROJECT_SOURCE_DIR}/src/ImageClassificationOrtSessionHandler.cpp ${PROJECT_SOURCE_DIR}/src/ImageRecognitionOrtSessionHandlerBase.cpp diff --git a/src/OrtSessionHandler.cpp b/src/OrtSessionHandler.cpp index b749b1c..bfaf759 100644 --- a/src/OrtSessionHandler.cpp +++ b/src/OrtSessionHandler.cpp @@ -5,8 +5,10 @@ * */ -#include -#include + +#include <../onnxruntime/include/onnxruntime/core/session/onnxruntime_c_api.h> +#include <../onnxruntime/include/onnxruntime/core/session/onnxruntime_cxx_api.h> + #if ENABLE_TENSORRT #include