Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 26

MODULE-3

PART-II

Object Recognition

Ms. Neethu Radha Gopan, Asst. Prof., Dept. of ECE,


Rajagiri School of Engineering & Technology, Kakkanad
Syllabus
Pattern and Pattern Classes


 Pattern
  is an arrangement of descriptors.
 A pattern class is a family of patterns that share some common properties.
 Pattern classes are denoted by , where W is the number of classes.
 3 common pattern arrangements used in practice are – vectors ( for quantitative
descriptions), & strings and trees (for structural descriptions).
 Pattern vectors are represented by bold lower case letters x, y & z and take the form
  𝑥1


𝒙= .

[]
𝑥2

.
.
𝑥𝑛
where each component represents the ith descriptor and n is the total
number of such descriptors associated with the pattern.

Pattern vectors can also be expressed in the form



 Eg:
  To classify 3 types of iris flowers by measuring the width & length of their
petals
 Each petal is described by 2 measurements which gives the pattern vector in the
form
 𝑥= 𝑥 1
[ ]
𝑥2 where & correspond to petal length & width respectively.
 The 3 pattern classes & correspond to the 3 varieties of flowers.
 Since the petals of the flower vary in length & width, the pattern vectors
describing these flowers will also vary not only between different classes but
also within a class.
 Thus each flower becomes a point in the 2D Euclidian space.
 The measurements of petal width & length separated one class of the flower, but
did not successfully separate the other 2 as shown in figure.
Recognition Based On Decision Theoretic Methods


  
Based on decision (discriminant) functions .
 Let represent an n dimensional pattern vector.
 For W pattern classes , the basic problem is to find W decision functions (x), (x),…,
(x) with the property that if x belongs to class , then : (x)(x), j=1,2,…,W & j
 In other words, an unknown pattern x is said to belong to the ith pattern class, if upon
substitution of x into all decision functions, (x) yields the largest numerical value.
 The decision boundary separating class from is given by values of x for which (x)(x),
or by values of x for which(x).

  Common practice is to identify a decision boundary between 2 classes by a single
function (x)(x).
 Thus for patterns of class and for patterns of class
 Various approaches are used to find the decision functions.
1. Matching

 Each class is represented by a prototype pattern vector.


 An unknown pattern is assigned to the class to which it is closest in terms of a
predefined metric.
a) Matching by Minimum Distance Classifier

 Suppose that we define the prototype of each pattern class to be the mean vector of the
patterns of that class:
1
mj  
N j xw j
xj   j=1,2,…,W & is the no. of pattern vectors from class

 One way to determine the class of an unknown pattern vector x is to assign it to the class
of its closest prototype.
 Using the Euclidean distance to determine closeness reduces the problem to computing the
distance measures
D j ( x)  x  m j
1 T
 d
The smallest distance is equivalent to evaluating the functions j ( x )  x T
m j  mj mj
2
 The decision boundary for a minimum distance classifier is
dij ( x)  d i ( x)  d j ( x)
1
 x (mi  m j )  (mi  m j )T (mi  m j )  0
T

2
¹Ï3.a¡G¤Gºû¥­­±¤ÀÃþ½d¨Ò

2 D

1.5

x2
Class C1
0.5 Class C2

-0.5 0 0.5 1 1.5 2 2.5


x1
b) Matching by correlation


 We
  consider it as the basis for finding matches of a sub-image w of size m×n within f(x,y)
which is an image of size M×N , where we assume that mM and n N.
c( x, y )   f ( s, t ) w( x  s, y  t ) -------- (1)
s t
 The correlation function has the disadvantage of being sensitive to changes in the
amplitude of f and w.
 For example, doubling all values of f doubles the value of c(x,y).
 An approach frequently used to overcome this difficulty is to perform matching via the
correlation coefficient
 [ f ( s, t )  f ( s, t )][ w( x  s, y  t )  w]
-------- (2)
 ( x, y )  s t
1
 2
2
 [ f ( s, t )  f ( s, t )]  [ w( x  s, y  t )  w] 
2

s t s t 

 The
  correlation coefficient is scaled in the range -1 to 1, independent of scale
changes in the amplitude of f and w.
 Figure shows arrangement for obtaining the correlation of f and w.
 A template w whose center is at an arbitrary location (x,y).
 The correlation at this point is obtained by equation 2.
 Then the center of the template is incremented to an adjacent location & the
procedure is repeated.
 The complete correlation coefficient is obtained by moving the center of the
template, so that center of w visits every pixel in f.
 After the procedure we look for maximum in to find where the best match occurred.
2. Optimum statistical classifiers


 The
  probability that a particular pattern x comes from class is denoted )
 If the pattern classifier decides that x came from when it actually came from , it incurs a
loss, denoted by .
 The average loss incurred in assigning x to class is
W
rj ( x)   Lkj p ( wk x ) --------- (1)
k 1
 This equation is called conditional average risk or loss in decision theory terminology.
 From basic probability theory, we know that p ( A B )   p ( A) p ( B A)  p ( B )
1 W
 Therefore we can write , rj ( x)  
p( x) k 1
Lkj p ( x wk ) P( wk )

 Here
  ) is the probability density function of patterns from and p() is the probability
of occurrence of class . Since is positive and common to all , it can be dropped
without affecting the expression.
W -------- (2)
rj ( x)   Lkj p ( x wk ) P ( wk )
k 1
 The classifier has W possible classes to choose for any given unknown pattern.
 It computes , , …. for each pattern x and assigns the pattern to the class with the
smallest loss.
 The classifier that minimizes the total average loss is called Bayes classifier.
 Thus the Bayes classifier assigns an unknown pattern x to class , if < j=1,2,…W &
j

 In
  other words x is assigned to class if
W W

L
k 1
ki p ( x wk ) P( wk )   Lqj p ( x wq ) P (wq )
q 1

 The loss for a correct decision is assigned a value ‘0’ and the loss for any incorrect
decision is usually assigned the same non zero value (‘1’).
 Hence we can write Lij  1   ij W
 Substituting this in equation (2), we get rj ( x)   (1  
k 1
kj ) p( x wk ) P ( wk )

 p ( x)  p( x w j ) p( w j )
 The Bayes classifier then assigns a pattern x to class if,
p ( x)  p( x wi ) P( wi )  p( x)  p ( x w j ) P ( w j )

or, equivalently, if p ( x wi ) P ( wi )  p ( x w j ) P ( w j )
 The decision function is of the form

d j ( x)  p( x w j ) P(w j )

 These decision functions are optimal as they minimize the average loss in
misclassification.
3. Neural networks

 The patterns used to estimate the statistical parameters are called training patterns.
 A set of such patterns from each class is called a training set.
 The process by which a training set is used to obtain a decision function is called learning
or training.
 Here we use neural networks in which non linear computing elements called neurons are
interconnected and organized as a network.
 Eg: The Perceptron algorithm is a two-class (binary) classification algorithm.
 It is the simplest type of neural network model.
 It consists of a single node or neuron that takes a row of data (pattern vector) as input and
predicts a class label.

 This
  is achieved by calculating the weighted sum of the inputs and a bias (set to 1).

d(x) is the linear decision function with respect to the components of the pattern vector.
, i=1,2,3….,n, n+1 are the weights which modify the inputs before they are summed
and fed into the threshold element.
 The function that maps the output of the summing function into the output is called the
activation function.
 When d(x)>0, the threshold element causes the output to be +1, indicating that the pattern
vector belongs to class .
 When d(x)<0, the threshold element causes the output to be -1, indicating that the pattern
vector belongs to class .
 If d(x)=0, x lies on the decision surface separating the 2 pattern classes.
Recognition based on Structural Methods
 Previously we dealt with patterns in a quantitative manner.
 Here we consider the structural relations in a pattern’s shape.
 2 approaches
 1. Matching Shape numbers
 The degree of similarity k, between 2 shapes is defined as the largest order for which their
shape numbers still coincide.
 Eg: Let a & b denote shape numbers of closed boundaries represented by 4 directional
chain codes. These 2 shapes have a degree of similarity k, if

where s is the shape no. and subscript is the order.



 The
  distance between the 2 shapes is defined as the inverse of their degree of
similarity.

 This distance satisfies the following properties:

 Either k or D can be used to compare the 2 shapes. If k is used, the larger k is, the
more similar the shapes are. The reverse is true when D is used.
2. String matching


 Suppose
  2 region boundaries, a & b are coded into strings, denoted by respectively.
 Let represent the number of matches between the 2 strings, where a match occurs in the
kth position if
 The number of symbols that do not match is

where |arg| is the length (number of symbols)in the string representation of the argument.
 0, only if a & b are identical.
 A simple measure of similarity between a & b is the ratio
 R is infinite for a perfect match & ‘0’ when none of the corresponding symbols in a & b
match.
 The largest value of R gives the best match.
 Since matching is done symbol by symbol, the starting point on each boundary is
important to reduce the amount of computation.
REFERENCES
25

1. R. C. Gonzalez, R. E. Woods, Digital Image Processing, Pearson


Education, 2007.
26 End of Part II

THANK YOU!

You might also like