Skip to content

Short project to test the DNN inference using OpenCV in C++

Notifications You must be signed in to change notification settings

esmitt/yolo-detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Object Detection with OpenCV DNN

This C++ project implements an object detection application using OpenCV's Deep Neural Network (DNN) module. The application reads video frames, performs object detection using a YOLO model, and displays the results in a GUI window.

This is a console-based application, using OpenCV and OpenCV contributition.

Output image of the program running

Prerequisites

  • OpenCV: Ensure OpenCV is installed with contrib modules. If find_package(OpenCV REQUIRED) does not locate OpenCV, specify the path in the CMakeLists.txt file.

  • Weights YOLO:

Ensure that the model/ directory contains coco_classes.txt, coco_colors.txt, yolov3.cfg, and yolov3.weights at the same level as the src/ and include/ directories. Please, unzip the model.zip file with "extract here".

For the you have to download from https://pjreddie.com/media/files/yolov3.weights. Feel free to explore the YOLO webpage

How to run?

	detection.exe <filename.mp4>

Inference Engine Configuration

The inference engine is set with the following lines in opencvinferenceengine.cpp:

m_network.setPreferableBackend(cv::dnn::DNN_BACKEND_OPENCV);
m_network.setPreferableTarget(cv::dnn::DNN_TARGET_OPENCL);

You can modify these settings as needed to change the backend or target for inference.

Notes

This code has not been tested on a Linux-based machine due to the lack of availability. However, it has been successfully built using GitHub Actions with a Linux-based configuration.

About

Short project to test the DNN inference using OpenCV in C++

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published