Tim M 57b5cefde5 Updated all `.md` files to contain newest image 2 роки тому
..
CMakeLists.txt 0a515262bb Added cfg files and more updates 3 роки тому
LICENSE a4d19d446e added object detection using yolov3 6 роки тому
README.md 57b5cefde5 Updated all `.md` files to contain newest image 2 роки тому
bird.jpg a4d19d446e added object detection using yolov3 6 роки тому
bird_yolo_out_py.jpg e7d012f15f Updated Readme and make it more comprehensible 6 роки тому
coco.names 0a515262bb Added cfg files and more updates 3 роки тому
getModels.sh 0a515262bb Added cfg files and more updates 3 роки тому
object_detection_yolo.cpp 37cb6bff6b Add gpu support 4 роки тому
object_detection_yolo.py d2b80e906a added gpu support for object_detection_yolo 4 роки тому
run.mp4 a4d19d446e added object detection using yolov3 6 роки тому
yolov3.cfg 0a515262bb Added cfg files and more updates 3 роки тому

README.md

Deep Learning based Object Detection using YOLOv3 with OpenCV

This repository contains code for the blog post Deep Learning based Object Detection using YOLOv3 with OpenCV ( Python / C++ ).

YOLOv3 detections

download

Download the Models

Run the getModels.sh file from command line to download the needed model files

  sudo chmod a+x getModels.sh
  ./getModels.sh

How to run the code

Command line usage for object detection using YOLOv3

  • Python

    • Using CPU

    • A single image:

      python3 object_detection_yolo.py --image=bird.jpg --device 'cpu'
      
    • A video file:

      python3 object_detection_yolo.py --video=run.mp4 --device 'cpu'
      
    • Using GPU

    • A single image:

      python3 object_detection_yolo.py --image=bird.jpg --device 'gpu'
      
    • A video file:

      python3 object_detection_yolo.py --video=run.mp4 --device 'gpu'
      
  • C++:

    • Using CPU

    • A single image:

    ./build/object_detection_yolo --image=bird.jpg --device=cpu
    
    • A video file:
     ./build/object_detection_yolo --video=run.mp4 --device=cpu
    
    • Using GPU

    • A single image:

    ./build/object_detection_yolo --image=bird.jpg --device=gpu
    
    • A video file:
     ./build/object_detection_yolo --video=run.mp4 --device=gpu
    

Compilation examples

  • Using g++
g++ -ggdb pkg-config --cflags --libs /usr/local/Cellar/opencv3/3.4.2/lib/pkgconfig/opencv.pc object_detection_yolo.cpp -o object_detection_yolo.out
  • Using CMake

    • On Unix systems
  mkdir build && cd build
  cmake ..
  cmake --build . --config Release
  cd ..
  • On Windows systems
  mkdir build
  cd build
  cmake -G "Visual Studio 16 2019" ..
  cmake --build . --config Release
  cd ..

Note: To run on Windows system, change syntax accordingly:

.\build\Release\object_detection_yolo --video=run.mp4 --device=gpu

Results of YOLOv3

AI Courses by OpenCV

Want to become an expert in AI? AI Courses by OpenCV is a great place to start.