"how to create a great object detector," a presentation from mathworks
TRANSCRIPT
Copyright © 2014 MathWorks, Inc. 1 Your Company Logo
goes here. See Slide
10 for instructions
Avinash Nehemiah
29 May 2014
How to Create a Great Object Detector
Copyright © 2014 MathWorks, Inc. 2 Your Company Logo
goes here. See Slide
10 for instructions
Objectives
• Learn the key steps to create your own object detector
• This does not have to be a 6 month research project
• Tips and Tricks
• How to create a great object detector
• Design considerations for embedded devices
Copyright © 2014 MathWorks, Inc. 3 Your Company Logo
goes here. See Slide
10 for instructions
Why Create Object Detectors ?
Object detectors help us understand real-world scenes.
Copyright © 2014 MathWorks, Inc. 4 Your Company Logo
goes here. See Slide
10 for instructions
What is Object Detection ?
• Detect and locate an object or class of objects in a scene
• Object detection is NOT recognition
• You can’t perform recognition without detection
Specific Object Class of objects
e.g. Faces
Copyright © 2014 MathWorks, Inc. 5 Your Company Logo
goes here. See Slide
10 for instructions
Getting Started with Object Detection
Goal: Locate object and non-object
regions
• Use training data to “learn” what
object looks like
• Learn how to reject non-object
regions
• More compact representation
than image pixels are used
• Known as features
Object Region
Attribution: Examples in this talk created using INRIA Person Dataset
http://pascal.inrialpes.fr/data/human/
Copyright © 2014 MathWorks, Inc. 6 Your Company Logo
goes here. See Slide
10 for instructions
Object Detection is Data Classification
Machine
Learning
Training Data
Features Classifier
Label: ‘Person’/’Non Person’
Response: Likelihood that input
belongs to labelled class
Learned
Classifier
Copyright © 2014 MathWorks, Inc. 7 Your Company Logo
goes here. See Slide
10 for instructions
Creating an Object Detector
Collect Training
Data
Feature Selection
Evaluate Different
Classifiers
Construct Detector
Optimize for Embedded
Implementation
Design Implementation
Attribution: Examples in this talk created using INRIA Person Dataset
http://pascal.inrialpes.fr/data/human/
Copyright © 2014 MathWorks, Inc. 8 Your Company Logo
goes here. See Slide
10 for instructions
Creating an Object Detector
Collect Training
Data
Feature Selection
Evaluate Different
Classifiers
Construct Detector
Optimize for Embedded
Implementation
Design Implementation
Copyright © 2014 MathWorks, Inc. 9 Your Company Logo
goes here. See Slide
10 for instructions
Training Data
Training Data is Key
• Good sampling of object (positive)
• Different scale, orientation, and
environmental conditions
• Negative data
• Representing environment object
usually appears
• Too few positive samples leads to
insufficient true detection
• Not enough variation in training set
leads to overfitting
• Too few negative samples leads to too
many false positives
Copyright © 2014 MathWorks, Inc. 10 Your Company Logo
goes here. See Slide
10 for instructions
Preparing Data for Training
Label,
Normalize and
Resize
Generate
Negative
Samples
Feature
Extraction
Features #1
Features #2
.
.
.
.
.
.
Features #N
Features #1
Features #2
.
.
.
.
.
.
Features #N
Positive Samples
Negative Samples
Learning Algorithm
Copyright © 2014 MathWorks, Inc. 11 Your Company Logo
goes here. See Slide
10 for instructions
Creating an Object Detector
Collect Training
Data
Feature Selection
Evaluate Different
Classifiers
Construct Detector
Optimize for Embedded
Implementation
Design Implementation
Copyright © 2014 MathWorks, Inc. 12 Your Company Logo
goes here. See Slide
10 for instructions
Feature Extraction
Sparse Dense
SURF HOG Image
Pixels Bag of Words
Feature Extraction
• Representations often invariant to
changes in scale, rotation, illumination
• More compact than storing pixel data
• Feature selection based on nature of
detection problem
• Consider alternatives like convolutional
neural nets
Factors to consider:
• Scale change
• Orientation
differences
• Environmental
conditions
Copyright © 2014 MathWorks, Inc. 13 Your Company Logo
goes here. See Slide
10 for instructions
Creating an Object Detector
Collect Training
Data
Feature Selection
Evaluate Different
Classifiers
Construct Detector
Optimize for Embedded
Implementation
Design Implementation
Copyright © 2014 MathWorks, Inc. 14 Your Company Logo
goes here. See Slide
10 for instructions
Find the Best Classifier-Feature Combination
• Steps
• Use a small subset of training data
• Train several different types of classifiers
• Compare performance
• Cross-validation
• Objective performance metrics
Copyright © 2014 MathWorks, Inc. 15 Your Company Logo
goes here. See Slide
10 for instructions
Important Classification Methods
Supervised Classification
• Support Vector Machines
• E.g. Pedestrian detectors
• Neural Networks
• Great when low variation in orientation and
appearance
Unsupervised Classification
• Gaussian Mixture Model
• Hidden Markov Models
• Works well when large amount of data/classes in
training set
Ensemble Methods
• Adaboost
• E.g. Viola-Jones face detection
• Great when classifier needs to operate in many
different conditions
Copyright © 2014 MathWorks, Inc. 16 Your Company Logo
goes here. See Slide
10 for instructions
Example: Support Vector Machine
Copyright © 2014 MathWorks, Inc. 17 Your Company Logo
goes here. See Slide
10 for instructions
Analyzing Classifier Performance
Option 1: Eye Test
• Look at classification results
Option 2: Receiver Operating Curve
(ROC)
• Means to compare ranges of
performance of classifiers
• Ideal curves are toward the top-
left
• Larger area under the curve is
better
• Do not ignore false alarm rate (
1% of false alarm rate translates
to ~25000/day)
Copyright © 2014 MathWorks, Inc. 18 Your Company Logo
goes here. See Slide
10 for instructions
Creating an Object Detector
Collect Training
Data
Feature Selection
Evaluate Different
Classifiers
Construct Detector
Optimize for Embedded
Implementation
Design Implementation
Copyright © 2014 MathWorks, Inc. 19 Your Company Logo
goes here. See Slide
10 for instructions
Sliding
Window
Object Classifier Label/
Response
Constructing the Detector
Label: ‘Person’/’Non Person’
Response: Distance from boundary
Copyright © 2014 MathWorks, Inc. 20 Your Company Logo
goes here. See Slide
10 for instructions
Constructing the Detector
• Classify patches at each
location and scale
• Resolve detection scores
• Pick strongest bounding box
Copyright © 2014 MathWorks, Inc. 21 Your Company Logo
goes here. See Slide
10 for instructions
Creating an Object Detector
Collect Training
Data
Feature Selection
Evaluate Different
Classifiers
Construct Detector
Optimize for Embedded
Implementation
Design Implementation
Copyright © 2014 MathWorks, Inc. 22 Your Company Logo
goes here. See Slide
10 for instructions
Considerations for Embedded Vision
Memory
• Memory footprint of classifier model
Processing Time
• Classification time for each window-step
• Granularity of sliding window step size
• Cascading-classifiers for faster rejection of negatives
Potential Porting Issues
• Fixed point accuracy
Tip: Consider dimensionality reduction
E.g. For pedestrian detector 99.3% speedup using PCA dimensionality reduction
Copyright © 2014 MathWorks, Inc. 23 Your Company Logo
goes here. See Slide
10 for instructions
Classifier Training Workflow
Collect Training Data
Feature Selection
Evaluate Different
Classifiers
Construct Detector
Optimize for Embedded
Implementation
Few iterations might be necessary to create a GREAT detector
Computer Vision System Toolbox
Parallel Computing Toolbox
Statistics Toolbox
MATLAB Coder ( C/C++)
HDL Coder
Fixed Point Designer
Copyright © 2014 MathWorks, Inc. 24 Your Company Logo
goes here. See Slide
10 for instructions
Key Takeaways
• It is not difficult to create your own object detector
• Smart feature and classifier selection helps create great object
detectors
• Never ever rely on solely the “eye test” for evaluation
• Insufficient training data will hold you back
Copyright © 2014 MathWorks, Inc. 25 Your Company Logo
goes here. See Slide
10 for instructions
Resources
Computer Vision and Machine Learning with MATLAB
• http://www.mathworks.com/products/computer-vision/
• http://www.mathworks.com/machine-learning/index.html
INRIA Person Dataset
• http://pascal.inrialpes.fr/data/human/
Presentations
• http://courses.engr.illinois.edu/cs543/sp2011/lectures/Lecture%20
19%20-%20Sliding%20Window%20Detection%20-
%20Vision_Spring2011.pdf
Contact [email protected] for more information or source code