Skip to content

improvess/yolov4-opencv-cpp-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yolov4-opencv-cpp-python

Example of performing inference with Darknet YOLO V4, OpenCV 4.4.0 DNN, C++ and Python

Looking for YOLO V5 OpenCV C++/Python inference? Check this repository

Prerequisites

Make sure you have already on your system:

  • OpenCV 4.0+
  • Python 3.7+
  • Any modern Linux OS (tested on Ubuntu 20.04)
  • GCC 9.0+

Running the python script

The python code is here.

git clone https://github.com/doleron/yolov4-opencv-cpp-python.git
cd yolov4-opencv-cpp-python
python python/yolo.py 

If your machine/OpenCV install are CUDA capable you can try out running using the GPU:

git clone https://github.com/doleron/yolov4-opencv-cpp-python.git
cd yolov4-opencv-cpp-python
python python/yolo.py cuda

Running the C++ program

The C++ code is here.

git clone https://github.com/doleron/yolov4-opencv-cpp-python.git
cd yolov4-opencv-cpp-python
g++ -O3 cpp/yolo.cpp -o yolo_example `pkg-config --cflags --libs opencv4`
./yolo_example

Or using CUDA if available:

git clone https://github.com/doleron/yolov4-opencv-cpp-python.git
cd yolov4-opencv-cpp-python
g++ -O3 cpp/yolo.cpp -o yolo_example `pkg-config --cflags --libs opencv4`
./yolo_example cuda

running the examples

PS.: Video sample from https://www.youtube.com/watch?v=NyLF8nHIquM

Which YOLO version should I use?

This repository uses YOLO V4 but it is not the only YOLO version out there. You can read this article to learn more about YOLO versions and choose the more suitable one for you.

About

Example of using YOLO v4 with OpenCV, C++ and Python

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published