Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"files.associations": {
"sstream": "cpp"
}
}
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions examples/YoloX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ void YoloX::preprocess(float* dst, //

std::vector<YoloX::Object> YoloX::decodeOutputs(const float* prob, float confThresh) const
{
std::vector<GridAndStride> gridStrides = this->genereateGridsAndStrides(IMG_W, m_strides);
std::vector<GridAndStride> 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::GridAndStride> YoloX::genereateGridsAndStrides(int targetSize, const std::vector<int>& strides) const
std::vector<YoloX::GridAndStride> YoloX::generateGridsAndStrides(int targetSize, const std::vector<int>& strides) const
{
std::vector<YoloX::GridAndStride> gridStrides;
for (auto stride : strides) {
Expand Down
2 changes: 1 addition & 1 deletion examples/YoloX.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class YoloX : public ImageRecognitionOrtSessionHandlerBase

struct GridAndStride;

std::vector<GridAndStride> genereateGridsAndStrides(int targetSize, const std::vector<int>& strides) const;
std::vector<GridAndStride> generateGridsAndStrides(int targetSize, const std::vector<int>& strides) const;

std::vector<Object> generateYoloXProposals(const float* prob, const std::vector<GridAndStride>& gridStrides,
float confThresh) const;
Expand Down
2 changes: 1 addition & 1 deletion scripts/install_onnx_runtime.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions src/OrtSessionHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
*
*/

#include <onnxruntime/core/session/onnxruntime_c_api.h>
#include <onnxruntime/core/session/onnxruntime_cxx_api.h>

#include <../onnxruntime/include/onnxruntime/core/session/onnxruntime_c_api.h>
#include <../onnxruntime/include/onnxruntime/core/session/onnxruntime_cxx_api.h>


#if ENABLE_TENSORRT
#include <onnxruntime/core/providers/tensorrt/tensorrt_provider_factory.h>
Expand Down