Skip to content

JustasBart/yolov8_CPP_Inference_OpenCV_ONNX

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yolov8/yolov5 Inference C++

NOTE:

As been discovered by several people by now this seems to work with OpenCV 4.7.0 (And earlier) but the GPU inference may not work for OpenCV 4.8.0 and newer.

Usage:

git clone https://github.com/JustasBart/yolov8_CPP_Inference_OpenCV_ONNX
cd yolov8_CPP_Inference_OpenCV_ONNX

Edit the main.cpp to change the projectBasePath to match your user.

mkdir build
cd build
cmake ..
make
./Yolov8CPPInference

yolov8s.onnx:

image

yolov5s.onnx:

image

This repository is based on OpenCVs dnn API to run an ONNX exported model of either yolov5/yolov8 (In theory should work for yolov6 and yolov7 but not tested). Note that for this example the networks are exported as rectangular (640x480) resolutions, but it would work for any resolution that you export as although you might want to use the letterBox approach for square images depending on your use-case.

The main branch version is based on using Qt as a GUI wrapper the main interest here is the Inference class file which shows how to transpose yolov8 models to work as yolov5 models.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published