This is a Julia implementation of Viola-Jones' Object Detection algorithm. Although there is an OpenCV port in Julia, it seems to be ill-maintained. As this algorithm was created for commercial use, there seem to be few widely-used or well-documented implementations of it on GitHub. The implementation this repository is based off is Simon Hohberg's Pythonic repository, as it seems to be well written (and the most starred Python implementation on GitHub, though this is not necessarily a good measure). Julia and Python alike are easy to read and write in — my thinking was that this would be easy enough to replicate in Julia, except for Pythonic classes, where I would have to use
structs (or at least easier to replicate from than, for example, C++ or JS — two other highly-starred repositories.).
I implore collaboration. I am an undergraduate student with no formal education in computer science (or computer vision of any form for that matter); I am certain this code can be refined/optimised by better programmers than myself. This package is still maturing, and as such there are some things I would still like to implement. Please, help me out if you like!
In an over-simplified manner, the Viola-Jones algorithm has some four stages:
- Takes an image, converts it into an array of intensity values (i.e., in grey-scale), and constructs an Integral Image, such that for every element in the array, the Integral Image element is the sum of all elements above and to the left of it. This makes calculations easier for step 2.
- Finds Haar-like Features from Integral Image.
- There is now a training phase using sets of faces and non-faces. This phase uses something called Adaboost (short for Adaptive Boosting). Boosting is one method of Ensemble Learning. There are other Ensemble Learning methods like Bagging, Stacking, &c.. The differences between Bagging, Boosting, Stacking are:
- Bagging uses equal weight voting. Trains each model with a random drawn subset of training set.
- Boosting trains each new model instance to emphasize the training instances that previous models mis-classified. Has better accuracy comparing to bagging, but also tends to overfit.
- Stacking trains a learning algorithm to combine the predictions of several other learning algorithms.
Despite this method being developed at the start of the century, it is blazingly fast compared to some machine learning algorithms, and still widely used.
- Finally, this algorithm uses Cascading Classifiers to identify faces. (See page 12 of the original paper for the specific cascade).
julia> using Pkg
Resolving package versions... Updating `~/.julia/packages/FaceDetection/UcLuv/docs/Project.toml`  ~ FaceDetection v1.1.0 `~/.julia/packages/FaceDetection/UcLuv` ⇒ v1.1.0 Updating `~/.julia/packages/FaceDetection/UcLuv/docs/Manifest.toml`  ~ FaceDetection v1.1.0 `~/.julia/packages/FaceDetection/UcLuv` ⇒ v1.1.0