-
Notifications
You must be signed in to change notification settings - Fork 49
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
Not able to build on Windows 10 #11
Comments
Hi happy new year, OpenCV 5.0.0-Alpha is still under development, and some functions may not work probably. Consider switching to a stable OpenCV version like 4.5.x. In any case, try below this custom build and make sure to update the paths to the local OpenCV installation #!/bin/bash
CURRENT_DIR=$(cd "$(dirname "$0")"; pwd)
# ONNXRUNTIME_VERSION="1.16.3"
ONNXRUNTIME_VERSION="1.19.2"
ONNXRUNTIME_GPU=0
# Platform check (force Windows-only)
platform="$(uname -s)"
if [[ ! "$platform" =~ ^MINGW32_NT|MINGW64_NT ]]; then
echo "This script is designed for Windows builds only."
exit 1
fi
# Architecture
architecture="$(uname -m)"
case "$architecture" in
x86_64)
ONNXRUNTIME_ARCH="x64"
;;
*)
echo "Unsupported architecture: $architecture"
exit 1
;;
esac
# GPU
if [ ${ONNXRUNTIME_GPU} == 1 ]; then
ONNXRUNTIME_PATH="onnxruntime-win-${ONNXRUNTIME_ARCH}-gpu-${ONNXRUNTIME_VERSION}"
else
ONNXRUNTIME_PATH="onnxruntime-win-${ONNXRUNTIME_ARCH}-${ONNXRUNTIME_VERSION}"
fi
# Download onnxruntime
if [ ! -d "${CURRENT_DIR}/${ONNXRUNTIME_PATH}" ]; then
echo "Downloading onnxruntime ..."
curl -L -O -C - https://github.com/microsoft/onnxruntime/releases/download/v${ONNXRUNTIME_VERSION}/${ONNXRUNTIME_PATH}.zip
unzip ${ONNXRUNTIME_PATH}.zip -d "${CURRENT_DIR}"
fi
ONNXRUNTIME_DIR="${CURRENT_DIR}/${ONNXRUNTIME_PATH}"
# Remove previous build directory
if [ -d "${CURRENT_DIR}/build" ]; then
rm -rf build
fi
mkdir build
cd build
echo "Build Code ..."
# Path to local OpenCV installation
OPENCV_DIR="C:/path/to/opencv" # Update with your OpenCV installation path
OPENCV_INCLUDE_DIR="${OPENCV_DIR}/include"
OPENCV_LIB_DIR="${OPENCV_DIR}/x64/vc15/lib" # Adjust for your compiler
# Generate build files
cmake .. \
-D ONNXRUNTIME_DIR="${ONNXRUNTIME_DIR}" \
-D CMAKE_BUILD_TYPE=Release \
-D OpenCV_DIR="${OPENCV_DIR}" \
-D OpenCV_INCLUDE_DIR="${OPENCV_INCLUDE_DIR}" \
-D OpenCV_LIB_DIR="${OPENCV_LIB_DIR}" \
-D CMAKE_CXX_FLAGS_RELEASE="-O3 -march=native"
# Build the project
cmake --build . --config Release
Let me know if this works! regards, |
Hello Geekgineer, Happy new year and thank you for the response. I will implement and see how it goes. |
I have tried the update you've provided and it seemed to build the project, however running the executable throws an error:
Here is the error when running the executable: I tried building OpenCV 4.5.5, but it gave many errors because it doesn't support Visual Studio 2022 compilers, I'm not willing to use older compilers. So, I tried OpenCV 4.9.0, which also gave same errors, but it was able to build but threw errors at the end. It would be nice if you could implement your project without OpenCV since it's not friendly for modern CUDA version and building opencv can become a nightmare. I tried Ultralytics OpenCV with the ONNX example, and it works only in CPU mode. OpenCV 5's graph engine is too new and doesn't work with Ultralytics examples in GPU mode. I will now try Ultralytics ONNX runtime examples, hopefully I can get the CUDA GPU working on this. Also, I am curious: how exactly is the YOLOv8 model directly interfaced via C++? Are there any documentation or explanations on how to interact with the YOLOv8 model via C++? I spent days trying to find information on this and got nothing but cheap explanations done in python. It's unfortunate that the Computer Vision industry has lost skilled talent in teaching things the proper way using C/C++. |
When using Yolov8: I get the following:
To make Yolov8 model work I had to remove this from line code 636 in YOLO8.hpp:
If I do not remove this, I get the following error (all the way at the bottom) during build:
Also I suggest to implement a try-catch implementation for yolov8.hpp, it helped me to resolve some issues. Here is the code if needed:
|
Hello and happy new year.
Not able to build and get the following error:
Using:
Here is the error:
$ ./build.sh
Here is the
build.sh
file:Here is the
CMakeList.txt
file:Thanks for any help.
The text was updated successfully, but these errors were encountered: