0% found this document useful (0 votes)
19 views69 pages

Lec - PR Own

Uploaded by

Srijani Goswami
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views69 pages

Lec - PR Own

Uploaded by

Srijani Goswami
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 69

Lecture 16

Introduction to pattern recognition

1. What is pattern recognition


2. Stages of pattern recognition
3. Techniques for pattern recognition

4. Mathematical morphology
What is pattern recognition?
What is pattern recognition? the act of taking in raw image
and taking an action based on the “category” of patterns
shown in the data
• Patterns are elements or formation happened in
repeatedly manner

• Example: sorting
incomingFish on a
conveyor according to
species using optical
sensing”
How?
1. Set up a camera
2. Take some sample images
3. Process the images
4. Extract features
– Length
– Lightness
– Width
– Number and shape of fins
– Position of the mouth, etc…
Pattern Classification System
• Preprocessing
– Image processing
– Segment (isolate) interested objects (fishes) from one another
and from the background

• Feature Extraction
– Reduce the data by measuring certain features

• Classification
– Divide the feature space into decision region
– Pattern representation and description
How to do Classification
• Example: use the length of the fish as a possible
feature for discrimination
• The length is a poor feature alone!
• Select the lightness as a possible feature
Feature Selection
• The length is a poor feature alone!
• Select the lightness as a possible feature
Threshold decision
• Move decision boundary toward smaller values of
lightness in order to minimize the cost (reduce the
number of sea bass that are classified salmon!)

• Task of decision theory


Feature Vector
• Adopt the lightness and add the width of the fish to the
feature vector xT = [x1, x2]

• Straight line decision boundary


Is this a good decision boundary?
Decision Boundary Choice
• Our satisfaction is premature because the aim of
designing a classifier is to correctly classify new
(test)input
• Better decision boundary
Pattern Recognition Stages
• Sensing
– Use of a transducer (camera or microphone)
– PR system depends on the bandwidth, the resolution sensitivity
distortion of the transducer
• Segmentation and grouping
– Patterns should be well separated and should not overlap
• Feature extraction
– Discriminative features
– Invariant features with respect to translation, rotation, and scale
• Classification
– Use the feature vector provided by a feature extractor to assign
the object to a category
• Post Processing
– Exploit context-dependent information to improve performance
PR system Design Cycle

1. Data collection
2. Feature Choice
3. Model Choice
4. Training
5. Evaluation
6. Computational
Complexity
Data Collection
• Data Collection
– How do we know when we have collected an adequately large and
representative set of examples for training and testing the system?
• Choice of Features
– Depends on the characteristics of the problem domain
– Simple to extract, invariant to irrelevant transformations, insensitive to noise
• Model Choice
– Unsatisfied with the performance of our fish classifier and want to jump to
another class of model
• Training
– Use data to determine the classifier
– (Many different procedures for training classifiers and choosing models)
• Evaluation
– Measure the error rate (or performance)
– Possibly switch from one set of features to another one
• Computational Complexity
– What is the trade-off between computational ease and performance?
– How does an algorithm scale as a function of the number of features,
patterns, or categories?
Learning and Adaptation
• Supervised learning
– A teacher provides a category label for each pattern in the
training set

• Unsupervised learning
– The system forms clusters or “natural groupings” of the
unlabeled input patterns
Baysian Decision Theory
• Fundamental statistical approach
• Assumes relevant probabilities are known, compute the probability
of the event observed, then make optimal decisions
P(B | A)P( A)
• Bayes’ Theorem: P( A | B) 
P(B)
• Example:
Suppose at Laurier, 50% are girl students, 30% are science students,
among science students, 20% are girl students. If onemeet a girl
student at Laurier, what is the probability that she is ascience student.
B – girl students, A – science students. Then
P( A)  30% P(B)
 50% P(B | A) 
20%
P(B | A)P( A) 0.2  0.3 0.06
P( A | B)     0.12
P(B) 0.5 0.5
Unsupervised Learning
• Often called clustering. The system is not given a set of
labeled patterns for training. Instead the system
establishes the classes itself based on the regularities of
the patterns
• Clustering Separate Clouds
– Methods work fine when clusters form well separated compact
clouds
Less well when there are great differences in the number of
samples in different clusters
Hierarchical Clustering
•Sometimes clusters are not disjoint, but may have
subclusters, which in turn having sub-subclusters, etc.
•Consider partitioning n samples into clusters
•Start with n cluster, each one containing exactly one sample
•Then partition into n-1 clusters, then into n-2, etc.
Image pattern recognition
• To identify objects represented by images

• Techniques for image pattern recognition


– Image pre-processing
– Mathematical morphology
– Segmentation
– Object representation and description
– Object recognition

• Investigate binary image. Binary image can be


represented as a set of value 1 pixels. Set operations
can be applied to the binary image
1, (x, y)  A
C(x, y) 
0, (x, y)  A
What is Morphology
• A word from biology

• Mathematical morphology

a tool for extracting image components that is useful in


representation and description of region shape,
boundaries, skeletons, convex hull

• Pre-, post-processing: morphological filtering,


thinning,pruning
Basic concepts from set theory
Given sets A, B, subsets of rectangular set on X-Y plane
1. The complement of A:
Ac  {w | w  A}

2. The union of A and B:


A  B  {w | w  A and w  B}
3. The intersection of A and B:
A  B  {w | w  A or w  B}
4. The difference of A and B:
A  B  {w | w  A and w  B}
5. The reflection of A:
  {w | w  b, for w  A}
6. The translate of A by
(A) ) z  {c | c  a  z, for a  A} z  (z1, z2 ) :
Structure elements
• A small sets for subimages used to probe an image for
properties of interest
• Examples
How to probe
• Pad the image with 0’s to a rectangular image, large
enough for element at the boundary
• Minimum pad the structure element
• Probe the image with the center of SE on each value 1
pixel of the image.
Erosion
• Given set A and B. The erosion of A by B:
AB  {z | (B) z  A}
Dilation
• Given set A and B. The dilation of A by B:
A  B  {z | (B̂) z ∩ A  }
Erosion
• Given set A and B
• The erosion of A by B: AB  {z | (B) z  A}
Duality
• Erosion and dilation are duals of each other
( AB)c  Ac  B̂
( A B)  cAc B̂
Opening
• The opening of A by SE B
A ∘ B  ( AB)  B
Closing
The closing of A by SE B
A  B  ( A  B)B
Properties of opening and closing

( A  B)c  Ac ∘ B̂
( A ∘ B)  A  B̂
c c

A∘ B  A
if C  D, then C ∘ B  D ∘ B
( A ∘ B) ∘ B  A ∘ B
A B  A
if C  D, then C  B  D  B
( A  B)  B  A  B
Construct filters by morphological operation
Hit or miss transformation
• A basic tool for shape detection
A  B  ( AB) [ Ac(W  D)]
Basic morphological algorithm
• Extracting boundaries, connected components, the
convex hull, and skeleton of a region
• Boundary  ( A)  A  ( AB)
extraction:
Hole filling
• Let X 0 be all 0’s. Continue the following computing
X k ( X k 1  B) Ac , k  1, 2, 3,...
until X k  X k 1
Extraction of connected components
• Let X 0 be all 0’s. Continue the following computing
X k ( X k 1  B) A, k  1, 2, 3,...
until X k  X k 1
Convex hull
• Let X 0 be all 0’s. Continue the following computing

X  A, i  1, 2, 3, 4
i
0
 1, 2, 3, 4, k  1, 2, 3...
Xki ( X k 1  Bi ) ∩ A, i
until X i  X i , then let Di  Xi
k k 1 k
4

C( A) 

i1
Di
Thinning and Thickening
• The thinning of A by SE B
A  B  A  ( A  B)  A ∩ ( A B)c
• Thinning by a sequence of SE
{B}  {B1, B 2 , B 3,..., B n }
A {B}  ((..(( A  B1)  B2 )...)  Bn )
Thickening
• The thickening of A by SE B
A □ B  A  ( A  B)
• Thickening by a sequence of SE
{B}  {B1, B2 , B3,..., B n }
A □{B}  ((..(( A □ B1) □ B2 )...) □ Bn )
Skeletons
K

S ( A) 
∪ S ( A)
k 0
k

Sk ( A)  ( AkB)  ( AkB) ∘ B
( AkB)  ((...(( AB)B)...)B)
K  max{k | ( AkB)  }
Pruning
• Pruning is done by the following four steps
X1  A {B}
8

X2 

k 1
( X1 * B k )

X 3  ( X 2  H ) ∩ A
X 4  X1 ∪ X 3
Morphological Reconstruction
• Geodesic dilation
D(1)
G
(F )  (F  B) ∩ G
D (F )  D(1) (F )[D(n1) (F )]
(n)
G G G

• Morphological reconstruction by dilation


R D (F ) D (k) (F ), where D (k) (F )  (k 1)
G G G DG (F )

• Geodesic erosion
E(1) (F )  (FB) G
G
E (n) (F )  E(1) (F )[E(n1) (F )]
G G G

• Morphological reconstruction by erosion


R E (F )  E ( k) (F ), where E (k) (F )  (k 1)
G G G EG (F )
Simple applications
Gray-Scale Morphology
• Structure element
• Dilation [ f  b ]( x, y )  max{ f ( x  s, y  t )}
( s ,t )b

• Erosion [ f b](x, y)  min{ f (x  s, y  t)}


( s,t )b

• Opening f ∘ b  ( f b)  b
• Closing f  b  ( f  b)b

You might also like