P(w|X) - Rose

CSSE463: Image Recognition

Today: Bayesian classifiers
Tomorrow: project day.

Questions?

Day 31
Exam 3 Thursday

Closed book, notes, computer





BUT you may bring notes (index card or 1-side of paper)
You may also want a calculator.
Pdf of review questions ?
Not cumulative: focus is k-means and later.
More hints tomorrow?
Bayesian classifiers

Use training data







P(x|w1)
If 2 classes:


Calculate the probabilities of
p(x)
each feature.
Classes w1 and w2
Say, circles vs. non-circles
A single feature, x
Both classes equally likely
Both types of errors equally
bad
Where should we set the
threshold between classes?
Here?
Where in graph are 2 types of
errors?
P(x|w2)
Circles
Non-circles
x
Detected as
circles
Q1-4
What if we have prior information?

Bayesian probabilities say that if we only
expect 10% of the objects to be circles,
that should affect our classification
Q5-8
Bayesian classifier in general

Bayes rule:


Verify with example
For classifiers:






x = feature(s)
wi = class
P(w|x) = posterior probability
P(w) = prior
P(x) = unconditional probability
Find best class by maximum a
posteriori (MAP) priniciple. Find
class i that maximizes P(wi|x).


Denominator doesn’t affect
calculations
Example:

indoor/outdoor classification
p (b | a ) p ( a )
p (a | b) 
p (b )
p ( x | w i ) p (w i )
p (w i | x ) 
p( x)
Fixed
Learned from
examples
(histogram)
Learned from
training set (or
leave out if
unknown)
Indoor vs. outdoor classification
I can use low-level image info (color,
texture, etc)
 But there’s another source of really helpful
info!

Camera Metadata Distributions
0.16
p(FF|I)
0.14
1
0.12
p(BV|I)
p(FF|O)
0.9
0.1
p(BV|O)
0.8
0.08
0.5
0.04
0.02
0.4
0
p(FF|I)
On
Off
Flash
8.5
10
p(BV|I)
11.5
0
7
p(FF|O)
0.1
5.5
4
0.2
2.5
1
0.3
-6
0.06
0.6
-0.5
0.7
Subject Distance
Scene Brightness
0.35
p(SD|O)
0.1
0.05
0
7
5
4
0.01
0.017
Exposure Time
Subject Distance
p(SD|I)
17
0.022
0.03
0.15
9
0.1
0.12
p(ET|O)
0.07
p(ET|I)
0.05
0
0
p(SD|I)
3
0.2
p(ET|O)
0.2
2
p(ET|I)
0.25
1
0.4
0.3
0
0.6
Why we need Bayes Rule
Problem:
We know conditional probabilities like P(flash was on | indoor)
We want to find conditional probabilities like
P(indoor | flash was on, exp time = 0.017, sd=8 ft, SVM output)
Let w = class of image, and x = all the evidence.
More generally, we know P( x | w ) from the training set (why?)
But we want P(w | x)
p ( x | w i ) p (w i )
p (w i | x ) 
p( x)
Using Bayes Rule
P(w|x) = P(x|w)P(w)/P(x)
The denominator is constant for an image, so
P(w|x) = aP(x|w)P(w)
Q9
Using Bayes Rule
P(w|x) = P(x|w)P(w)/P(x)
The denominator is constant for an image, so
P(w|x) = aP(x|w)P(w)
We have two types of features, from image
metadata (M) and from low-level features, like
color (L)
Conditional independence means P(x|w) =
P(M|w)P(L|w)
P(w|X) = aP(M|w) P(L|w) P(w)
From histograms
From SVM
Priors
(initial bias)
Bayesian network
Efficient way to encode conditional
probability distributions and calculate
marginals
 Use for classification by having the
classification node at the root


Examples
 Indoor-outdoor
classification
 Automatic image orientation detection
Indoor vs. outdoor classification
Each edge in the graph has
an associated matrix of
conditional probabilities
SVM
KL Divergence
EXIF
header
Color
Features
SVM
Texture
Features
Effects of Image Capture Context
Recall for a class C is fraction of C classified correctly
Orientation detection

See IEEE TPAMI paper



Also uses single-feature Bayesian classifier
(answer to #1-4)
Keys:



Hardcopy or posted
4-class problem (North, South, East, West)
Priors really helped here!
You should be able to understand the two
papers (both posted)