This project is the Capstone project.
It aims to detect objects from an image or sequence of frames from a video by using the You Only Look Once (YOLO) Deep Neural Network.
Furthermore, this project follows Object Oriented Programming (OOP) and the latest C++ features (e. g. STL threads, locks, smart pointers).
The core of the project is OpenCV and the Intel Inference Engine from OpenVINO. You can find more documentation about these two projects in here and here respectively.
OpenCV is supported in almost every operating system. On the other hand, OpenVINO only supports Linux and macOS up to version 10.13. Nevertheless, this project works for 10.15 as well.
- Ubuntu 16.04 LTS or later.
- macOS 10.15.
- cmake >= 3.11
- make >= 4.2 (Linux, Mac)
- gcc/g++ >= 9.2
- OpenCV >= 4.1.2
- OpenVINO >= 2019_R3.1
- yaml-cpp >= 0.6.3
Model weights can be downloaded with this script.
A good place to store these models is resources/
under a models/
directory that you have to create.
In order to install both libraries you can follow these installation links below.
Note: macOS is only supported until version 10.13. However, this project works with 10.15 even if the installer says it's not supported.
- Clone this repo.
This project relies on googletest as a thirdparty library.
- Compile the project.
make build
Look into the Makefile to see how the app is built.
- Run it.
Go to usage.
The tests are implemented using googletest framework.
These can be found under test/
directory.
Coding style is addressed by using clang-format
tool and the configuration can be found in .clang-format.
This inherits Google's style rules plus a minor change.
The documentation regarding Google's convention can be found in this site.
Once built the binary can parse inputs such as a configuration file and the input for the system.
Parameters
input
: Absolute path to a resource (image or video).configuration
: Name of a YAML file.
How to run it
./build/yolo_object_detection \
--configuration=conf.yml \
--input=$(realpath resources/videos/overpass.mp4)
You can find it in here.
Point | File | Lines |
---|---|---|
The project demonstrates an understanding of C++ functions and control structures. | all | - |
The project reads data from a file and process the data, or the program writes data to a file. | main.cpp | 11-15 |
The project accepts user input and processes the input. | main.cpp | 8,10,17 |
Point | File | Lines |
---|---|---|
The project uses Object Oriented Programming techniques. | all | - |
Classes use appropriate access specifiers for class members. | all | - |
Class constructors utilize member initialization lists. | detection_output.cpp | 3 |
The project follows the Rule of 5. | all | - |
Classes abstract implementation details from their interfaces. | region.cpp | 5 |
Classes encapsulate behavior. | model.h, model.cpp | - |
Classes follow an appropriate inheritance hierarchy. | all | - |
Overloaded functions allow the same function to operate on different parameters. | - | - |
Derived class functions override virtual base class functions. | detection_output.h | 13 |
Templates generalize functions in the project. | queue_fps.h | - |
Point | File | Lines |
---|---|---|
The project makes use of references in function declarations. | all | - |
The project uses destructors appropriately. | all | - |
The project uses scope / Resource Acquisition Is Initialization (RAII) where appropriate. | model.cpp | 32-34 |
The project follows the Rule of 5. | all | - |
The project uses move semantics to move data, instead of copying it, where possible. | model.cpp | 6-8 |
The project uses smart pointers instead of raw pointers. | yolo.cpp | 38-42 |
Point | File | Lines |
---|---|---|
The project uses multithreading. | yolo.cpp | 27, 28, 47, 49 |
A promise and future is used in the project. | - | - |
A mutex or lock is used in the project. | queue_fps.h | 25, 36, 48, 64 |
A condition variable is used in the project. | - | - |