11/9/2015 1
Object detection as supervised classification
Tues Nov 10 Kristen Grauman UT Austin
Today
- Supervised classification
- Window-based generic object detection
– basic pipeline – boosting classifiers – face detection as case study
Object detection as supervised classification Tues Nov 10 Kristen - - PDF document
11/9/2015 Object detection as supervised classification Tues Nov 10 Kristen Grauman UT Austin Today Supervised classification Window-based generic object detection basic pipeline boosting classifiers face detection as case
11/9/2015 1
Tues Nov 10 Kristen Grauman UT Austin
– basic pipeline – boosting classifiers – face detection as case study
11/9/2015 2 Recognizing flat, textured
covers, posters) Reading license plates, zip codes, checks Fingerprint recognition Frontal face detection
11/9/2015 3
– (Choose a representation) – Learn or fit parameters of model / classifier
function that will predict the labels of new examples.
classification?
– Mistakes made – Cost associated with the mistakes
“four” “nine”
?
Training examples Novel input
11/9/2015 4
function that will predict the labels of new examples.
– L(4→9): Loss of classifying a 4 as a 9 – L(9→4): Loss of classifying a 9 as a 4
total risk
4 9 using | 4 9 Pr 9 4 using | 9 4 Pr ) ( L s L s s R
Feature value x
Optimal classifier will minimize total risk. At decision boundary, either choice of label yields same expected loss. If we choose class “four” at boundary, expected loss is: If we choose class “nine” at boundary, expected loss is:
4) (9 ) | 9 is class ( 4) (4 ) | 4 is (class 4) (9 ) | 9 is class ( L P L P L P x x x 9) (4 ) | 4 is class ( L P x
11/9/2015 5
Feature value x
Optimal classifier will minimize total risk. At decision boundary, either choice of label yields same expected loss. So, best decision boundary is at point x where T
loss; i.e., choose “four” if
9) (4 ) | 4 is P(class 4) (9 ) | 9 is class ( L L P x x
Feature value x
Optimal classifier will minimize total risk. At decision boundary, either choice of label yields same expected loss. So, best decision boundary is at point x where T
loss; i.e., choose “four” if
9) (4 ) | 4 is P(class 4) (9 ) | 9 is class ( L L P x x
P(4 | x) P(9 | x)
11/9/2015 6
Basic probability
– probability of X given that we already know Y continuous X discrete X called a PDF
Source: Stev e Seitz
histogram (a “non-parametric” distribution)
Feature x = Hue P(x|skin) Feature x = Hue P(x|not skin)
Percentage of skin pixels in each bin
11/9/2015 7
histogram (a “non-parametric” distribution)
Feature x = Hue P(x|skin) Feature x = Hue P(x|not skin) Now we get a new image, and want to label each pixel as skin or non-skin. What’s the probability we care about to do skin detection?
posterior prior likelihood
Where does the prior come from? Why use a prior?
11/9/2015 8
Now for every pixel in a new image, we can estimate probability that it is generated by skin. Classify pixels based on these probabilities
Brighter pixels higher probability
Gary Bradski, 1998
11/9/2015 9
Gary Bradski, 1998
Using skin color-based face detection and pose estimation as a video-based interface
densities and priors then evaluate posterior probabilities using Bayes’ theorem
probabilities
Slide f rom Christopher M. Bishop, MSR Cambridge
11/9/2015 10
This same procedure applies in more general circumstances
.Kanade
Example: face detection
– dimension = # pixels – each face can be thought
dimensional space
Object Detection Applied to Faces and Cars". IEEE Conference
http://www-2.cs.cmu.edu/afs/cs.cmu.edu/user/hws/ww w/CVPR00.pdf
Source: Stev e Seitz
– basic pipeline – boosting classifiers – face detection as case study
11/9/2015 11
– Choose a representation – Learn or fit parameters of model / classifier
Window-based models Building an object model
Car/non-car Classifier
Yes, car. No, not a car. Given the representation, train a binary classifier
11/9/2015 12
Window-based models Generating and scoring candidates
Car/non-car Classifier
Window-based object detection: recap
Car/non-car Classifier Feature extraction
Training examples
Training: 1. Obtain training data 2. Define features 3. Define classifier Given new image: 1. Slide window 2. Score by classifier
11/9/2015 13
Discriminative classifier construction
106 examples
Nearest neighbor Shakhnarovich, Viola, Darrell 2003 Berg, Berg, Malik 2005... Neural networks LeCun, Bottou, Bengio, Haffner 1998 Rowley , Baluja, Kanade 1998 … Support V ector Machines Conditional Random Fields McCallum, Freitag, Pereira 2000; Kumar, Hebert 2003 … Guyon, V apnik Heisele, Serre, Poggio, 2001,…
Slide adapted from Antonio Torralba
Boosting Viola, Jones 2001, Torralba et al. 2004, Opelt et al. 2006,…
W eak Classifier 1
Slide credit: Paul Viola
11/9/2015 14
W eights Increased
W eak Classifier 2
11/9/2015 15
W eights Increased
W eak Classifier 3
11/9/2015 16
Final classifier is a combination of weak classifiers
– Find the weak learner that achieves the lowest weighted training error – Raise weights of training examples misclassified by current weak learner
learners (weight of each learner is directly proportional to its accuracy)
learners depend on the particular boosting scheme (e.g., AdaBoost)
Slide credit: Lana Lazebnik
11/9/2015 17
Main idea:
– Represent local texture with efficiently computable “rectangular” features within window of interest – Select discriminative features to be weak classifiers – Use boosted combination of them as final classifier – Form a cascade of such classifiers, rejecting clear negatives quickly
11/9/2015 18
Feature output is difference between adjacent regions Efficiently computable with integral image: any sum can be computed in constant time. “Rectangular” filters
Value at (x,y) is sum of pixels above and to the left of (x,y)
Integral image
Lana Lazebnik
11/9/2015 19
Cumulative row sum: s(x, y) = s(x–1, y) + i(x, y) Integral image: ii(x, y) = ii(x, y−1) + s(x, y)
ii(x, y-1) s(x-1, y) i(x, y)
Lana Lazebnik
Computing sum within a rectangle
values of the integral image at the corners of a rectangle
image values within the rectangle can be computed as:
sum = A – B – C + D
required for any size of rectangle!
D B C A
Lana Lazebnik
11/9/2015 20
Feature output is difference between adjacent regions Efficiently computable with integral image: any sum can be computed in constant time Avoid scaling images scale features directly for same cost “Rectangular” filters
Value at (x,y) is sum of pixels above and to the left of (x,y)
Integral image
Considering all possible filter parameters: position, scale, and type: 180,000+ possible features associated with each 24 x 24 window
Which subset of these features should we use to determine if a window has a face? Use AdaBoost both to select the informative features and to form the classifier
11/9/2015 21
that best separates positive (faces) and negative (non- faces) training examples, in terms of weighted error.
Outputs of a possible rectangle feature on faces and non-faces.
… Resulting weak classifier: For next round, reweight the examples according to errors, choose another filter/threshold combo.
Perceptual and Sensory Augmented Computing Visual Object Recognition Tutorial Visual Object Recognition Tutorial
AdaBoost Algorithm
Start with uniform weights
examples Evaluate weighted error for each feature, pick best. Re-weight the examples: Incorrectly classified -> more weight Correctly classified -> less weight Final classifier is combination of the weak ones, weighted according to error they had. Freund & Schapire 1995
{x1,…xn}
For T rounds
11/9/2015 22
Perceptual and Sensory Augmented Computing Visual Object Recognition Tutorial Visual Object Recognition Tutorial
First two features selected
image has a lot of possible windows to search.
11/9/2015 23
discard windows that clearly appear to be negative
each stage
its target rates have been met
enough, then add another stage
negative training examples for the next stage
11/9/2015 24
Train with 5K positives, 350M negatives Real-time detector using 38 layer cascade 6061 features in all layers
[Implementation available in OpenCV]
Faces Non-faces
Train cascade of classifiers with AdaBoost
Selected features, thresholds, and weights New image
face windows
CVPR 2001.
11/9/2015 25
Perceptual and Sensory Augmented Computing Visual Object Recognition Tutorial Visual Object Recognition Tutorial
Perceptual and Sensory Augmented Computing Visual Object Recognition Tutorial Visual Object Recognition Tutorial
11/9/2015 26
Perceptual and Sensory Augmented Computing Visual Object Recognition Tutorial Visual Object Recognition Tutorial
Perceptual and Sensory Augmented Computing Visual Object Recognition Tutorial Visual Object Recognition Tutorial
Can we use the same detector?
11/9/2015 27
Perceptual and Sensory Augmented Computing Visual Object Recognition Tutorial Visual Object Recognition Tutorial
Paul Viola, ICCV tutorial
Everingham, M., Sivic, J. and Zisserman, A. "Hello! My name is... Buffy" - Automatic naming of characters in TV video, BMVC 2006. http://www.robots.ox.ac.uk/~vgg/research/nface/index.html
Frontal faces detected and then tracked, character names inferred with alignment of script and subtitles.
11/9/2015 28
http://www.apple.com/ilife/iphoto/
Slide credit: Lana Lazebnik
11/9/2015 29
Things iPhoto thinks are faces
Slide credit: Lana Lazebnik
Can be trained to recognize pets!
http://www.maclife.com/article/news/iphotos_faces_recognizes_cats
Slide credit: Lana Lazebnik
11/9/2015 30
http://www.wired.com/2015/06/facebook-can-recognize-even-dont-show-face/ Wired, June 15, 2015
http://www.3ders.org/articles/20150812-japan-3d-printed-privacy-visors- will-block-facial-recognition-software.html
11/9/2015 31
examples
(SVMs, CNNs,…)
– especially for many-class problems
Slide credit: Lana Lazebnik
Perceptual and Sensory Augmented Computing Visual Object Recognition Tutorial Visual Object Recognition Tutorial
descriptors:
11/9/2015 32
Perceptual and Sensory Augmented Computing Visual Object Recognition Tutorial Visual Object Recognition Tutorial
30,000,000 evaluations!
linearly with number of classes
Perceptual and Sensory Augmented Computing Visual Object Recognition Tutorial Visual Object Recognition Tutorial
11/9/2015 33
Perceptual and Sensory Augmented Computing Visual Object Recognition Tutorial Visual Object Recognition Tutorial
representations assuming a fixed 2d structure; or must assume fixed viewpoint
with holistic appearance-based descriptions
Perceptual and Sensory Augmented Computing Visual Object Recognition Tutorial Visual Object Recognition Tutorial
Figur e cr edit: Der ek Hoiem
Sliding window Detector’s view
11/9/2015 34
Perceptual and Sensory Augmented Computing Visual Object Recognition Tutorial Visual Object Recognition Tutorial
(expensive)
can lead to sensitivity to partial occlusions
Image credit: Adam, Rivlin, & Shimshoni
– Model/representation/classifier choice – Sliding window and classifier scoring
– Exemplar of basic paradigm – Plus key ideas: rectangular features, Adaboost for feature selection, cascade