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
- 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
-
- 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
Want to become an expert in AI? AI Courses by OpenCV is a great place to start.