|
2 éve | |
---|---|---|
.. | ||
CMakeLists.txt | 3 éve | |
LICENSE | 6 éve | |
README.md | 2 éve | |
bird.jpg | 6 éve | |
bird_yolo_out_py.jpg | 6 éve | |
coco.names | 3 éve | |
getModels.sh | 3 éve | |
object_detection_yolo.cpp | 4 éve | |
object_detection_yolo.py | 4 éve | |
run.mp4 | 6 éve | |
yolov3.cfg | 3 éve |
This repository contains code for the blog post Deep Learning based Object Detection using YOLOv3 with OpenCV ( Python / C++ ).
Run the getModels.sh file from command line to download the needed model files
sudo chmod a+x getModels.sh
./getModels.sh
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
./build/object_detection_yolo --video=run.mp4 --device=cpu
Using GPU
A single image:
./build/object_detection_yolo --image=bird.jpg --device=gpu
./build/object_detection_yolo --video=run.mp4 --device=gpu
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
mkdir build && cd build
cmake ..
cmake --build . --config Release
cd ..
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
Want to become an expert in AI? AI Courses by OpenCV is a great place to start.