Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree...

31
EEE 6209 – Digital Image Processing © Dr. S. M. Mahbubur Rahman Object Recognition Outline Patterns and Classes Decision-Theoretic Methods Minimum Distance Classifier Matching by Correlations Bayes Classifiers Assignments

Transcript of Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree...

Page 1: Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree of class separability depends strongly on the choice of descriptors selected for

EEE 6209 – Digital Image Processing

© Dr. S. M. Mahbubur Rahman

Object Recognition

Outline

Patterns and Classes

Decision-Theoretic Methods

Minimum Distance Classifier

Matching by Correlations

Bayes Classifiers

Assignments

Page 2: Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree of class separability depends strongly on the choice of descriptors selected for

EEE 6209 – Digital Image Processing

© Dr. S. M. Mahbubur Rahman

Object Recognition

Patterns & Classes Patterns are usually vectors comprising qualitative or structural descriptors. Say there are n number of patterns (often referred to as features)

[ ]Tnxxxx ,,,, 321 =x

Class is a family of patterns that share common properties. Say there are W number of classes

Wωωωω ,,,, 321

Classical works is known as Fisher discriminant analysis (1963)

Page 3: Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree of class separability depends strongly on the choice of descriptors selected for

EEE 6209 – Digital Image Processing

© Dr. S. M. Mahbubur Rahman

Object Recognition

widthpetal

length petal

2

1

==

x

x

setosa Iris

r versicoloIris

virginicaIris

3

2

1

===

ωωω

2-Patterns

3-Classes

Example

Page 4: Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree of class separability depends strongly on the choice of descriptors selected for

EEE 6209 – Digital Image Processing

© Dr. S. M. Mahbubur Rahman

Object Recognition

Choice of Features Degree of class separability depends strongly on the choice of descriptors selected for an application

Patterns can be noisy. See noisy signature in the figure. Other quantitative features can be statistical moments, Fourier descriptors, etc. ( )

( )

( )nn rx

rx

rx

θ

θθ

=

==

22

11

Features with structural relations include the size and positions of minutiae that describes the ridge properties of fingerprints called primitive components such as abrupt endings, branching, merging and disconnected segments.

Page 5: Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree of class separability depends strongly on the choice of descriptors selected for

EEE 6209 – Digital Image Processing

© Dr. S. M. Mahbubur Rahman

Object Recognition

Choice of Features String of primitive components (say a and b) associated with a boundary shape often adequately describes structural patterns from head-to-tail

patterns⇒abababab

Hierarchical ordering of patterns often produces tree structure of the problem of classification.

Page 6: Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree of class separability depends strongly on the choice of descriptors selected for

EEE 6209 – Digital Image Processing

© Dr. S. M. Mahbubur Rahman

Object Recognition

Choice of Features

Satellite image

Tree description of image

Page 7: Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree of class separability depends strongly on the choice of descriptors selected for

EEE 6209 – Digital Image Processing

© Dr. S. M. Mahbubur Rahman

Object Recognition

Feature Selection Noisy features are refined using the criterion of maximum relevancy and minimum redundancy of the features among the classes.

An example of selection of features use Fisher criterion that uses the maximum of the ratio between inter-class and intra-class distances of the features to select only the discriminative set of features.

Refinement of features not only improves the classification accuracy but also reduces the computational complexity.

Page 8: Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree of class separability depends strongly on the choice of descriptors selected for

EEE 6209 – Digital Image Processing

© Dr. S. M. Mahbubur Rahman

Object Recognition

Decision-Theoretic Recognition Let the decision functions be ( ) ( ) ( )xxx Wddd ,,, 21

A pattern x belongs to a class if iω

( ) ( ) jiWjdd ji ≠=> ;,,2,1 xx

Ties are resolved arbitrarily.

Decision boundary of classes and is iω jω( ) ( ) ( ) 0=−⇒ xxx jiij ddd

such that ( )( ) jij

iij

•d

•d

classpattern 0

classpattern 0

⇒<

⇒>

x

x

Page 9: Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree of class separability depends strongly on the choice of descriptors selected for

EEE 6209 – Digital Image Processing

© Dr. S. M. Mahbubur Rahman

Object Recognition

Minimum Distance Classifier Use Euclidean distance of feature vectors to determine a class

Let is the number of pattern vectors of class . Then mean of pattern vector is

jN

WjN

j

jj

j ,,2,1 1

== ∑∈ωx

xm

The distance of a given pattern vector from the mean vector is

x

( )

( ) 21

,,2,1

jTj

Tjj

TT

jj WjD

mmxmmxxx

mxx

+−−=

=−=

Page 10: Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree of class separability depends strongly on the choice of descriptors selected for

EEE 6209 – Digital Image Processing

© Dr. S. M. Mahbubur Rahman

Object Recognition

Minimum Distance Classifier Since the term is independent of class label j the decision function is

( ) Wj d jTjj

Tj ,,2,1

2

1=−= mmmxx

The decision boundary is ( ) ( ) ( )

( ) ( ) ( ) 02

1 =+−−−=

−=

jiT

jijiT

jiij ddd

mmmmmmx

xxx

xxT

The decision surface is perpendicular to the bisector of the line segment joining and im jm

bisector hyperplane 3

bisector plane 3

bisector line2

⇒>⇒=⇒=

n

n

n

Page 11: Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree of class separability depends strongly on the choice of descriptors selected for

EEE 6209 – Digital Image Processing

© Dr. S. M. Mahbubur Rahman

Object Recognition

Minimum Distance Classifier Example

( ) ( ) ( )09.88.2 21

2112

=−+=−=

xx

ddd xxx

The decision functions are

( )

1.103.13.4 2

1

21

1111

−+=

−=

xx

d TT mmmxx

The decision boundary is

setosa Iris Class

r versicoloIris Class

2

1

⇒⇒

ωω

=

=

3.0

5.1 and

3.1

3.421 mm

( )

17.13.05.1 2

1

21

2222

−+=

−=

xx

d TT mmmxx

Page 12: Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree of class separability depends strongly on the choice of descriptors selected for

EEE 6209 – Digital Image Processing

© Dr. S. M. Mahbubur Rahman

Object Recognition

Minimum Distance Classifier Decision boundary of two classes is a line

( )( ) 212

112

classpattern 0

classpattern 0

•d

•d

⇒<⇒>

x

x

Page 13: Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree of class separability depends strongly on the choice of descriptors selected for

EEE 6209 – Digital Image Processing

© Dr. S. M. Mahbubur Rahman

Object Recognition

Minimum Distance Classifier Minimum distance classifier is computationally very fast

The classifier shows optimum performance if the distribution of patterns for each class about its mean is in the form of a spherical hyper-cloud in n-dimensional space

Example of large mean separation and small class spread happens in designing E-13B font character set used by the American Banker’s Association.

The 14 characters were designed on 9x7 grid to facilitate reading. The characters are printed using magnetic materials. Scanning produces 1D electrical waveform which are distinct.

Page 14: Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree of class separability depends strongly on the choice of descriptors selected for

EEE 6209 – Digital Image Processing

© Dr. S. M. Mahbubur Rahman

Object Recognition

E-13B font character used by American Banker’s Association.

The mean vectors are 14,,2,1 =j jm

High classification speed is obtained using the minimum distance classifier

Area of waveform remains approximately constant and zero derivative near the middle of the character

Minimum Distance Classifier

Page 15: Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree of class separability depends strongly on the choice of descriptors selected for

EEE 6209 – Digital Image Processing

© Dr. S. M. Mahbubur Rahman

Object Recognition

Let the template for recognition is

The correlation coefficient can be measured using Fourier transform efficiently

( )yxw ,

The correlation coefficients

Matching by Correlation

( )( )[ ] ( ) ( )[ ]

( )[ ] ( ) ( )[ ] 21

22,,,

,,,,

++−++−

++−++−=

∑∑∑∑

∑∑∑∑

s ts t

s ts t

tysxftysxfwtsw

tysxftysxfwtswyxγ

( ) ( ) ( )( ) ( )vuWvuF

yxwyxfyx

,,

,,,∗=

⊗=γ

The maximum correlation gives the positional information of the template

( )11 ≤≤− γ

Page 16: Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree of class separability depends strongly on the choice of descriptors selected for

EEE 6209 – Digital Image Processing

© Dr. S. M. Mahbubur Rahman

Object Recognition

Matching by Correlation

Template matching

(a) (b)

(c) (d)

(a) Satellite image of hurricane (b) Template of eye of storm

(c) Correlation coefficients (d) Position of eye estimated

Page 17: Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree of class separability depends strongly on the choice of descriptors selected for

EEE 6209 – Digital Image Processing

© Dr. S. M. Mahbubur Rahman

Object Recognition

Let the probability that a pattern in test comes from the class is

Bayes Classifier

Let denote the loss when the classifier decides came from the class , when its actual class is

xiω

ijL xjω iω

Since the pattern may belong to anyone of the classes, the average loss incurred in assigning to the class is

x Wx jω

( )x|ip ω

( ) ( )∑=

=W

kkkjj pLr

1

| xx ω

Using Bayes formula the conditional average risk or loss can be written as

( ) ( ) ( ) ( )k

W

kkkjj PpL

pr ωω∑

=

=1

|1

xx

x

Page 18: Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree of class separability depends strongly on the choice of descriptors selected for

EEE 6209 – Digital Image Processing

© Dr. S. M. Mahbubur Rahman

Object Recognition

Here

Bayes Classifier kω( )kp ω|x PDF of patterns in class

( )kP ω Probability of occurrence of class kω

Since the term is positive and common to all , when it can be dropped for estimating smallest or largest value of the loss. Hence, the average loss function reduces to

( )xp ( )xjrWj ,,2,1 =

( ) ( ) ( )k

W

kkkjj PpLr ωω∑

=

=1

|xx

The classifier that minimizes the total average risk is called the Bayes classifier

Page 19: Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree of class separability depends strongly on the choice of descriptors selected for

EEE 6209 – Digital Image Processing

© Dr. S. M. Mahbubur Rahman

Object Recognition

The classifier assigns an unknown pattern in the class only if , i.e.,

Bayes Classifier iωx

( ) ( ) jiWjrr ji ≠=< ;,,2,1for xx

( ) ( ) ( ) ( ) jijPpLPpL q

W

qqqjk

W

kkki ≠∀<∑∑

==

||11

ωωωω xx

The loss function is zero and unity for correct and incorrect decisions, respectively. Hence,

ijijL δ−=1

The average loss function becomes

( ) ( ) ( ) ( )

( ) ( ) ( )jj

k

W

kkkjj

Ppp

Ppr

ωω

ωωδ

|

|11

xx

xx

−=

−=∑=

Page 20: Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree of class separability depends strongly on the choice of descriptors selected for

EEE 6209 – Digital Image Processing

© Dr. S. M. Mahbubur Rahman

Object Recognition

The Bayes classifier assigns the unknown pattern in the class only if

Bayes Classifier

iωx

( ) ( ) ( ) ( ) ( ) ( ) || jjii PppPpp ωωωω xxxx −<−

In other words, the classifier considers

In conclusion, the decision function of Bayes classifier under the 0-1 loss function is a conditional density given by

jiWj ≠= ;,,2,1for

( ) ( ) ( ) ( ) || jjii PpPp ωωωω xx > jiWj ≠= ;,,2,1for

( ) ( ) ( )jjj Ppd ωω|xx = Wj ,,2,1for =

Page 21: Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree of class separability depends strongly on the choice of descriptors selected for

EEE 6209 – Digital Image Processing

© Dr. S. M. Mahbubur Rahman

Object Recognition

The Bayes classifier needs PDF of patterns in each of the classes and the probability of occurrence of each class

Bayes Classifier

( ) jP ω

The PMFs are usually inferred from previous knowledge or training set of the problem. Fro example, if all classes are equally likely then

The PDFs need multivariate analysis since the dimension of is n. In practice, analytical solutions are obtained assuming parametric PDFs for patterns in a class.

( )W

P j

1=ω

( )jp ω|x

( )jp ω|xx

Page 22: Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree of class separability depends strongly on the choice of descriptors selected for

EEE 6209 – Digital Image Processing

© Dr. S. M. Mahbubur Rahman

Object Recognition

Naïve Bayes Classifier The Bayes classifier assuming Gaussian PDF of patterns in each of the classes is known as Naïve Bayes classifier. Example for two equi-probable patterns has a decision boundary at 0x The decision function is

( ) ( ) ( )( )

( )j

mx

j

jjj PePpd j

j

ωπσ

ωω σ 2

2

2

22

1|

−−

== xx

On the decision boundary ( ) ( )0201 xdxd =

If classes are equi-probable

2,1for =j

( ) ( )21 ωω PP =

Then, is s.t. 0x

( ) ( )2010 || ωω xpxp =

Page 23: Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree of class separability depends strongly on the choice of descriptors selected for

EEE 6209 – Digital Image Processing

© Dr. S. M. Mahbubur Rahman

Object Recognition

Naïve Bayes Classifier The Naïve Bayes classifier assuming multivariate Gaussian PDF of patterns with dimension n can be obtained. The PDF for j-th pattern class is

( )( )

( ) ( )jjT

j

ep

j

nj

mxCmx

Cx

−−− −

=1

21

21

22

1|

πω

where

{ } ∑∈

≈=jj

jj NE

ωx

xxm1Mean vector

Covariance-Matrix ( )( ){ }( )∑

−≈

−−=

j

Tjj

T

j

Tjjjj

N

E

ωx

mmxx

mxmxC

1

The off-diagonal elements cjk are zero when xj and xk are uncorrelated

Page 24: Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree of class separability depends strongly on the choice of descriptors selected for

EEE 6209 – Digital Image Processing

© Dr. S. M. Mahbubur Rahman

Object Recognition

Naïve Bayes Classifier Using ln as monotonic function the decision function of Bayes classifier becomes

Considering multivariate Gaussian as prior for pattern classes

( ) ( ) ( )( )( ) ( )jj

jjj

pP

Ppd

ωω

ωω

|lnln

|ln

x

xx

+=

= Wj ,,2,1for =

( ) ( ) ( )( ) ( ) ( ) ( )[ ]( ) ( ) ( )[ ]jj

Tjjj

jjT

jjj

jjj

P

nP

pPd

mxCmxC

mxCmxC

xx

−−−−=

−−−−−=

+=

1

1

2

1ln

2

1ln

2

1ln

2

12ln

2ln

|lnln

ω

πω

ωω Wj ,,2,1for =

Decision function is hyperquadratic

Page 25: Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree of class separability depends strongly on the choice of descriptors selected for

EEE 6209 – Digital Image Processing

© Dr. S. M. Mahbubur Rahman

Object Recognition

Naïve Bayes Classifier If the covariance matrix is equal for all classes, i.e.,

The linear decision function in terms of hyper-plane is obtained by eliminating all terms except with terms having j

Wj ,,2,1for =

( ) ( ) jT

jjT

jj Pd mCmmCxx 11

2

1ln −− −+= ω

Bayes classifer becomes minimum distance classifier (hyper-spehers) when (i) pattern classes are Gaussian, (ii) covariance matrix is identity matrix and (iii) all classes are equally likely

CC =j

Wj ,,2,1for =

If the covariance matrix and classes have IC = ( )W

P j

1 =ω

( ) jT

jjT

jd mmmxx2

1 −= Wj ,,2,1for =

Page 26: Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree of class separability depends strongly on the choice of descriptors selected for

EEE 6209 – Digital Image Processing

© Dr. S. M. Mahbubur Rahman

Object Recognition

Naïve Bayes Classifier Examples of 2 pattern classes each having 3 dimensions of patterns.

−−==311

131

113

16

121 CC

=

1

1

3

4

11m

=

3

3

1

4

11m

( ) ( )2

1 11 == ωω PP

Given that

The decision function

( ) jT

jjT

jd mCmmCxx 11

2

1 −− −= 2,1for =j

Here

−−

−−=−

844

484

4481C

Since ( )( ) 5.5884

5.14

3212

11

−++−=−=

xxxd

xd

x

x

The decision surface

( ) ( ) 4888 32121 +−−=− xxxdd xx

Page 27: Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree of class separability depends strongly on the choice of descriptors selected for

EEE 6209 – Digital Image Processing

© Dr. S. M. Mahbubur Rahman

Object Recognition

Naïve Bayes Classifier Examples of 3 pattern classes each having 4 dimensions of patterns in classifying objects of multispectral images.

The patterns are

====

4

3

2

1

x

x

x

x Visible blue (Band-1)

Visible green (Band-2)

Visible red (Band-3)

Infra red (Band-4)

The classes are

===

3#

2#

1#

class

class

class Water body

Urban development

Vegetation

Page 28: Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree of class separability depends strongly on the choice of descriptors selected for

EEE 6209 – Digital Image Processing

© Dr. S. M. Mahbubur Rahman

Object Recognition

Bayes Classifier (a) (b) (c)

(d) (e) (f)

(g) (h) (i)

(a)-(d) Four spectral images, (e) training regions for 3-type of objects (f) classification results of training sets (observe errors shown in black dots) (g) water body (h) urban area (i) vegetation for whole image

Page 29: Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree of class separability depends strongly on the choice of descriptors selected for

EEE 6209 – Digital Image Processing

© Dr. S. M. Mahbubur Rahman

Object Recognition

Bayes Classifier Confusion matrix for the results of classification

( )3

1 =jP ω

Condition is

3,2,1for =j

Page 30: Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree of class separability depends strongly on the choice of descriptors selected for

EEE 6209 – Digital Image Processing

© Dr. S. M. Mahbubur Rahman

Object Recognition

Assignment Problem #1

Problem #2

theory

Page 31: Object Recognition EEE 6209 – Digital Image ProcessingObject Recognition Choice of Features Degree of class separability depends strongly on the choice of descriptors selected for

EEE 6209 – Digital Image Processing

© Dr. S. M. Mahbubur Rahman

Object Recognition

Assignment Problem #3

#2