Skip to content

Object Detection using YOLOv5 and OpenCV DNN (C++ and Python)

Notifications You must be signed in to change notification settings

majnas/yolov5_opencv_cpp_python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yolov5_opencv_cpp_python

Object Detection using YOLOv5 and OpenCV DNN (C++ and Python) Original Source

Demo video

yolov5_opencv_python_cpp_demo.mp4
git clone --recursive https://github.com/majnas/yolov5_opencv_cpp_python.git
cd yolov5_opencv_cpp_python/yolov5

# Install dependencies.
pip install -r requirements.txt
pip install onnx

# Download .pt model.
cd models
wget https://github.com/ultralytics/YOLOv5/releases/download/v6.1/YOLOv5s.pt

# Export to ONNX
cd ..
python export.py --weights models/YOLOv5s.pt --include onnx

To use python

    cd py
    python main.py

Figure 1: python prediction for me.png

To compile and run cpp version

    cd cpp
    mkdir build
    cd build
    cmake ..
    make     
    ./app

Figure 2: cpp prediction for me.png

About

Object Detection using YOLOv5 and OpenCV DNN (C++ and Python)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published