Giter Club home page Giter Club logo

ufpa-face-detection's Introduction

Folders:

The main folder "ufpa-face-detection" has code starting with ufd_ and consists of UFPA's version of Viola&Jones's face detector.

Other folders:

  • HaarCascades

Default face detector already trained with OpenCV and saved as XML file. This classifier uses decision stumps as weak learners and does not have tilted (rotated) features

  • Images

Some test images

Simple (in fact stupid) detector to be used as baseline for UFPA's face detection project

  • opencv/sources/apps

Some auxiliary files to be used as example for inserting user code and debugging with OpenCV.

ufpa-face-detection

Face detection for Octave / Matlab based on Viola & Jones' algorithm [1].

This code runs both on Octave and Matlab. Some previous work: OpenCV is the base implementation, written in C++ [3]. Mathworks has its own implementation for Matlab [2]. In [8] there is another implementation for Matlab, which uses the XML generated by OpenCV (representing the cascade detector trained with OpenCV).

Convention: all files (scripts and functions) start with the prefix ufd_ (UFPA face detection).

The face detector should have training and a test stages. The main scripts for training and testing are: ufd_train and ufd_test, respectively. Currently, only ufd_test is implemented.

The default detector assumes a frontal face and was created by Rainer Lienhart. It is stump-based (the weak classifiers are decision stumps) with a base resolution of 20x20 pixels, trained with Gentle Adaboost. See Zhu et al, Real-time face detection using Gentle AdaBoost algorithm and nesting cascade structure, 2012 (http://ieeexplore.ieee.org/document/6473448/)

Development strategy:

  • We will use the training stage of OpenCV and import the classifier in [4] (more than 30k lines). For that, we used code that imports the XML file into Octave / Matlab. Note that Mathworks has support to OpenCV [5] but we will not use it for the sake of compatibility with Octave. This strategy will force us to use the same data structures as OpenCV but will allow to debug our code using OpenCV as a reference.

  • We first concentrated on the test stage (training is not implemented yet), with the following guidelines: 1) use a webcam video capture software to obtain a screenshot as an image file, 2) read the image from Octave / Matlab, convert it to gray scale and show it, 3) calculate the Integral Image, 4) for all required resolutions, calculate the needed parameters and invoke the classifier, 5) draw the rectangles according to the classifier's decisions.

References about algorithms:

[1] Robust Real-Time Face Detection, Paul Viola and Michael Jones, International Journal of Computer Vision 57(2), 137โ€“154, 2004.

[6] http://www.lienhart.de/Prof._Dr._Rainer_Lienhart/Source_Code_files/ICIP2002.pdf (this provides more details about how the Haar features can be calculated)

[10] Improved Boosting Algorithms Using Confidence-rated Predictions. Schapire and Singer, 1999. - The default detector does not use the original Two-class Discrete AdaBoost Algorithm (that is described, e.g., at http://docs.opencv.org/2.4/modules/ml/doc/boosting.html?highlight=weak#id4 )

[11] More info about boosting: http://cbio.mskcc.org/~aarvey/boosting_papers.html

http://rednoah.users.sourceforge.net/facedet/Face%20Detection%20Report.pdf - it is not the original reference, but discusses the normalization using the variance.

References about face detector using OpenCV:

References about training and testing a face detector using OpenCV, but not modifying its code (just invoking command line tools):

References about other softwares (Python, Matlab, Octave, etc.):

[2] http://www.mathworks.com/help/vision/ref/vision.cascadeobjectdetector-class.html

[3] http://docs.opencv.org/master/d7/d8b/tutorial_py_face_detection.html

[4] https://github.com/Itseez/opencv/blob/master/data/haarcascades/haarcascade_frontalface_default.xml

[5] http://www.mathworks.com/help/vision/ug/opencv-interface.html

[7] At http://www.lienhart.de/Prof._Dr._Rainer_Lienhart/Source_Code.html one can find, e.g., Rainer Lienhart, Alexander Kuranov, and Vadim Pisarevsky. Empirical Analysis of Detection Cascades of Boosted Classifiers for Rapid Object Detection. MRL Technical Report, Intel Labs, May 2002, revised Dec. 2002

[8] http://www.mathworks.com/matlabcentral/fileexchange/29437-viola-jones-object-detection (this set of Matlab scripts is a very good starting point to this project: it parses an XML (it seems the format is the old one), implements the classifier and outputs the results)

[9] There are other related codes at "Fileexchange": http://www.mathworks.com/matlabcentral/fileexchange/?search_submit=fileexchange&query=Viola+Jones+Object+Detection&term=Viola+Jones+Object+Detection

ufpa-face-detection's People

Contributors

aldebaro avatar brunoricardojava avatar cleversonahum avatar d3f3r4l avatar lsiddd avatar mracos avatar yuichitakeda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ufpa-face-detection's Issues

Understand OpenCV data structures and design the equivalent in Octave / Matlab

We need to understand how OpenCV computes the features and organizes them in a classifier. See e.g. haarfeatures.h, which has methods such as CvHaarEvaluator::Feature::calc( const cv::Mat &_sum, const cv::Mat &_tilted, size_t y), and traincascade_features.h. Then we need to design the corresponding data structures in Octave / Matlab.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.