This is the Capstone Project for the Udacity C++ Nanodegree Program. This program can detect up to 80 classes of objects from a sequence of video frames using the You Only Look Once (YOLOv3) Deep Neural Network, originally authored by Joseph Redmon and Ali Farhadi. YOLOv3 forwards the the whole image, or frame, at once saving valuable inference time. It divides the image into a 13x13 grid of cells. Each cell is responsible for predicting a number of bounding boxes in the image. For each bounding box, the network predicts the confidence that the bounding box encloses an object and outputs the probability that the object represents a particular class. Using non-maximum suppression the bounding boxes with low confidence scores (0.5) are eliminated. This technique yields surprisingly fast results.
The following dependencies are required to run the program locally.
- cmake >= 3.17
- All OSes: click here for installation instructions
- make >= 4.3 (Linux, Mac)
- Linux: make is installed by default on most Linux distros
- Mac: install Xcode command line tools to get make
- OpenCV >= 4.5
- The OpenCV 4.5 source code can be found here
- gcc/g++ >= 5.4
- Linux: gcc / g++ is installed by default on most Linux distros
- Mac: same deal as make - install Xcode command line tools
- NOTE: This project is tested using Mac OSX 10.15
- Clone the repository and navigate to the downloaded folder.
git clone https://github.com/justinbellucci/yolo3-object-detection.git
cd yolo3-object-detection
- Download the models in the main project directory.
sudo chmod a+x getModels.sh
./getModels.sh
- Make a build directory in the top level directory:
mkdir build && cd build
- Compile
cmake ..
make
The input to this program can be either a mp4 video file or a webcam. Both methods require the yolov3.weights, yolov3.cfg and coco.names files to be placed in the main project directory. Once run, a window will open and the video will play automatically. Once finished, the program will terminate the window.
// run from build directory
cd build
-
Video file:
./yolo3_detector --video=/my_video.mp4
-
Webcam
./yolo3_detector