You are on page 1of 11

Fast Asymmetric Learning for Cascade Object Detection

Pi19404
July 4, 2013

Contents

Contents
Fast Asymmetric Learning for Cascade Object Detection
0.1 0.2 0.3 0.4 Introduction . . . . . . . . . . . . . . Motivation . . . . . . . . . . . . . . . . Implementation . . . . . . . . . . . . . Setup . . . . . . . . . . . . . . . . . . . Directory Setup . . . . . . . 0.4.1 Creating Training File . . . 0.4.2 Viewing The Training Data 0.4.3 Configuration File . . . . . . 0.4.4 Haar Features . . . . . . . . 0.4.5 Train The Classifier . . . . . 0.4.6 Testing the Classifier . . . 0.4.7 Code . . . . . . . . . . . . . . . References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3
3 3 3 4 4 5 6 7 8 9 10 10 10

2 | 11

Fast Asymmetric Learning for Cascade Object Detection

Fast Asymmetric Learning for Cascade Object Detection


0.1 Introduction
In the article we will look at 1 method for object detection.

0.2 Motivation
The motivations of using this technique as opposed to standard haar cascade is reduced training time,seperation of feature extraction and ensemble classification and better performance. The reduced training times helps us is quickly training a classifier for required objects and observed and evaluate the performance of classifier. Seperation of feature extraction and ensemble classification provides us with a way to try out various feature extraction strategies and test the performance .Finally different methods of ensemble classification can be tested out. This user has flexibility in choosing feature extraction and ensemble classification techniques and relatively reduced training time.

0.3 Implementation
The source code is provided along with paper however the original code is only compatible with windows. Changes were made to code so that it can run on Ubuntu Linux platform and tested with latest version of OpenCV. The Visual C++ based GUI is replaced with Qt GUI. Here we are looking to train a cascade classifier to detect object of interest.

3 | 11

Fast Asymmetric Learning for Cascade Object Detection

0.4 Setup
For training the classifier we need a set of positive and negative sample images.

Directory Setup
Create the following Directory structure. create a base directory object_detection.

(a) Directory structure

 Place the positive sample images in sub-directory 1 or training directory  Place the negative samples image in the sub-directory 0 of training directory  Place the test images in test directory  Place the positive validation image in sub-directory 1 of validation directory  Place the negative bootstrap images in the negative directory

Below are typical activities to be carried out for training a ensemble cascade classifier.

 Create Binary Training Data File  Create Binary Training Validation File

4 | 11

Fast Asymmetric Learning for Cascade Object Detection


 Modify the configuration file if required  Select The Training Options  Perform Training  Perform Testing

0.4.1 Creating Training File


Image should be such that the dominant object is the object of interest. In the process of creating the training file the input images of training database are resized to size 24x24 , resultant data and class lable are stored in a binary training file sequentially.

(b) Create Training File

 Go to menu Option Create View/File  Select option Create Binary Training Data File  Select the training database directory created earlier For example /media/windows/pi19404/Haar/training_database

5 | 11

Fast Asymmetric Learning for Cascade Object Detection


 Enter the file name of new training data file to be created For example /media/windows/pi19404/Haar/training_database.dat

The same process is required to be repeated for creating a validation binary data file. Provide as input the validation database path and a new validation file name. validation set is required to to evaluate the performance inorder to decide termination criteria and evaluate the performance during the training process.Validation set only consists of positive examples.
 Go to menu Option Create View/File  Select option Create Binary Training Data File  Select the training database directory created earlier For example /media/windows/pi19404/Haar/validation_database  Enter the file name of new training data file to be created For example /media/windows/pi19404/Haar/validation_database.dat

The images can be in any format that can be processed by OpenCV.

0.4.2 Viewing The Training Data


Once the binary training data file is created,The images stored in the file can be viewed sequentially.This can be performed by accessing the View Training Data Menu option The Next and Previous buttons can be used to browse the images and Exit button can be used to terminate browsing images in the file. The Validation Data can also be viewed in a similar way.

6 | 11

Fast Asymmetric Learning for Cascade Object Detection

(c) View Training Data

0.4.3 Configuration File


The Application uses a configuration file named options.txt The file contains the location of to various files and directorys required during training. Change the path in the option file or copy the created training files to location specified in the configuration file. The main application accepts the base directory name as input and all the paths in the configuration files are relative to the base directory.The option.txt file should be present in the base directory passed as input to the application. Following parameter need to changes/modified according to user environment
 trainset filename - Binary Training Database file name  validset filename - Binary Validation Database file name  classifier filename - File which stores details about weak classifiers  cascade filename - File which stores the details about cascade classifier

7 | 11

Fast Asymmetric Learning for Cascade Object Detection


 FFS WeakClassifiers filename - File whih stored trained weak classifier by FFS algorithm  FFS logfilename - log file for FFS algorithm  ada logfilename - Log file for standard HAAR Classifier  Bootstrap database filename - List of files in bootstrap database  Backup directory name - Backup temporry directory required during training process

The options file contains other parameters like image size,false positive rate of cascade,detection rate of cascade,maximum number of nodes in cascade classifier, max number of features in each node of classifier and other parameters relating to feature extraction methods .
 Go to menu Option Create View/File  Select option Create Binary Training Data File  Select the training database directory created earlier For example /media/windows/pi19404/Haar/validation_database  Enter the file name of new training data file to be created For example /media/windows/pi19404/Haar/validation_database.dat

0.4.4 Haar Features


The Image size is 25x25.Following Haar feature are extracted at each possible scale.Thus we have 5 types of haar features The file classifier.txt contains the array indexs required for calculation of features.The file contains x and y co-ordinates of Rectangular ROI at various spatial position and scale. In the original implementation many position and scales are not specified in the classifier.txt leading to a total feature set of 16232 and individual features set of 4320,4320,2760,2760,2072 for each type of haar feature. The feature set may be sutiable for face detection but may not necessarily suitable for other objects.The classifier.txt needs to be modifier to include all possible translation and scales of

8 | 11

Fast Asymmetric Learning for Cascade Object Detection

(d) Haar Features

haar feature to incorporate a more complete set.But this leads to larger set of features. classifier.txt needs to be placed in the path specified in options.txt file before starting the application. In future this code would be updated to include a more complete feature set and use a more generic approach that listing co-ordinates in a file.

0.4.5 Train The Classifier


After Creating the Training data file,validation data file. Copy the files to the base directory .Make changes in the options file. First step is to select the training parameter which include selection of feature Selection method and ensemble training method.

 Options for feature selection methods :- Adaboost,Asyboost,FSS  Options for ensemble training methods :- Ensemble Cascade Classifier,Linear Asymmetric Classifier and FDA

The feature selection methods will try to select a reduced set of features/weak classifier from a total of 16232 features. At each node of cascade classfier incremental increasing number of features are choosen. This considrably help in improving real time performance.This structure helps in rejecting a lot of candidates. Therotically the number of features selected based on false positive

9 | 11

Fast Asymmetric Learning for Cascade Object Detection rate and detection rate.However this criteria may still lead to large number of features.Hence a upper limit on the number of features is manually specified in options.txt file along with maximum number of nodes,false positive rate and detection rate. Before starting the application place the training and validation dataset files in the path specified by options.txt file .They can be empty files,but the files must be present.Also as mentioned earlier copy the classifier.txt file as per path specified in the options.txt file.

0.4.6 Testing the Classifier


Once training has been completed we would need to test the classifier. This can be accessed from Perform Testing menu

(e) Testing

0.4.7 Code
The code for the testing and training utility can be found at https://github.com/pi19404/m19404/tree/master/objdetect/LAC

10 | 11

Bibliography

Bibliography
[1] Jianxin Wu et al.  Fast Asymmetric Learning for Cascade Face Detection. In: 0162-8828.

doi: 10.1109/TPAMI.2007.1181. 1109/TPAMI.2007.1181.

IEEE Trans. Pattern Anal. Mach. Intell.

30.3 (Mar. 2008), pp. 369382.

url: http://dx.doi.org/10.

issn:

11 | 11