Goal: builds a classifier to categorize images into one of 15 scene types!
1. Tiny images representation + nearest neighbor classifier
Tiny images representation
•
•
• •
Simply resizes each image to a small, fixed resolution (16*16).
You can either resize the images to square while ignoring their aspect ratio or you can crop the center square portion out of each image.
The entire image is just a vector of 16*16 = 256 dimensions. You can use functions (MATLAB): imread, imresize
!4
1. Tiny images representation + nearest neighbor classifier
Nearest neighbor classifier
•
to pick a reasonable value for k).
Instead of 1 nearest neighbor, you can vote based on k nearest neighbors which will increase performance (although you need
Classifiers: Nearest neighbor
Training examples from class 1
Test example
Training examples from class 2
f(x) = label of the training example nearest to x
• Allweneedisadistancefunctionforourinputs • Notrainingrequired!
!5
Slide credit: L. Lazebnik
2. Bag of SIFT representation + nearest neighbor classifier
Bag of SIFT representation
SIFT
Vector Quantization
Bag-of-words model
Resized images
K-means cluster
……
Visual words
Histogram
!6
2 0 1 ……
2. Bag of SIFT representation + nearest neighbor classifier
Bag of SIFT representation
SIFT
201 211 212 213
030 132 231 142
Vector Quantization
Bag-of-words model
Resized images
!7
3. Bag of SIFT representation + linear SVM classifier
SVM
Classifiers(
Classifiers:!Linear!SVM!
margin
x
Supporting vector
x
x
x
x2
x1
o
o
o
xx
x
o o
x
• Find!a!linear’func+on’to!separate!the!classes:! !f(x)!=!sgn(w(⋅!x(+!b)!
Training Images
Training
Image( Features(
Training( Labels(
Classifier( Training(
Trained( Classifier(
•
You can use functions (MATLAB): fitcsvm, predict
!8
3. Bag of SIFT representation + linear SVM classifier
Example: cat facial recognition
Training Phase
SVM
|
Vector Quantization |
|
Vector Quantization |
Training Data
SIFT
Cat
Hyperplane
SVM Model
Cat
Not cat
Not cat
Cat Not cat
Real label
Cat
Cat
Not cat
Not cat
Not cat
SVM model
9
3. Bag of SIFT representation + linear SVM classifier
Example: cat facial recognition
SIFT Vector Quantization
Detection Phase
Training Data
SVM
SVM Model
Test image
SVM Model
SIFT Vector Quantization
Cat
Not cat
SVM Model
Cat
10
Extra bonus: deep learning
Example: Convolutional Neural Network (CNN)
!11




