Pattern Recognition Systems

64
Pattern Recognition Systems One field is concerned with systems that recognize patterns with a classification scheme that has already been determined. Example: Character recognition, the categories (26 letter of alphabet) are already known. Referred to as pattern classification. Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

description

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth. Pattern Recognition Systems. One field is concerned with systems that recognize patterns with a classification scheme that has already been determined. Example: Character recognition, the categories (26 letter of alphabet) are already known. - PowerPoint PPT Presentation

Transcript of Pattern Recognition Systems

Page 1: Pattern Recognition Systems

Pattern Recognition Systems

• One field is concerned with systems that recognize patterns with a classification scheme that has already been determined.– Example: Character recognition, the

categories (26 letter of alphabet) are already known.

– Referred to as pattern classification.

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

Page 2: Pattern Recognition Systems

Pattern Recognition Systems

• Other field is concerned with obtaining a classifier for a set of patterns where the categories are not initially known.– Example: Clustering data concerning

patients to see whether patients can be grouped in a way that helps indicate diagnoses.

– Referred to as Pattern clustering

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

Page 3: Pattern Recognition Systems

Pattern Classification

• Attempt to pick the correct category when presented with a pattern.– Solution is very problem specific

• Character recognition will be different from recognizing the tank in the battle field

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

Page 4: Pattern Recognition Systems

Design a Fuzzy Pattern Classifier

• Pattern Features– Create fuzzy sets that represent features

in the data that are considered important.• Example: ratio of the character’s height to its

width may be important while the size of a character is not!

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

Page 5: Pattern Recognition Systems

Design a Fuzzy Pattern Classifier

• Defining the System– fuzzy sets are used to convert crisp inputs to

grades that are then combined by a pattern classifier to obtain grades for each of the possible classification categories.•Highly problem dependent!

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

Page 6: Pattern Recognition Systems

Design a Fuzzy Pattern Classifier

• Testing the System– use known and unknown test sets.– Typically, the system will not perform as well as

desired at first.•One may have to test a fuzzy classifier

– find why it gave a wrong result,– make changes to improve the classifier.

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

Page 7: Pattern Recognition Systems

Application: Character Recognition

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

• Goal: design a system that will pick the correct character when it is given a bit map representation of a printed or written input character.– Example: classifying the ten digits o

through 9.

Page 8: Pattern Recognition Systems

Pattern Features

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

• INPUT– bit map

• 25 horizontal X 37 vertical pixels (925 pixel field)

• each pixel have a 0 or 1 associated with it.

Page 9: Pattern Recognition Systems

Pattern Features

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

• Creating a rule set dealing with 925 inputs would be extremely difficult and time consuming.

• Fuzzify the input, resulting in a compact summary of the overall state of the bit map.

Page 10: Pattern Recognition Systems

Fuzzy sets for the Horizontal Position

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

• Define five triangular-shaped fuzzy sets for the horizontal position.– xS = 0:24;– xL = eqshape(3,xS,5);– xG = shapeval(xL, xS);

Page 11: Pattern Recognition Systems

Fuzzy sets for the Vertical Position

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

• Define seven triangular-shaped fuzzy sets for the vertical position.– yS = 0:36;– yL = eqshape(3,yS,7);– yG = shapeval(yL, yS);

Page 12: Pattern Recognition Systems

Fuzzify the input pixel

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

• Given any pixel (horizontal x and verticle

y), the membership of that pixel can be calculated for each of 5 horizontal and 7 vertical regions.– G1 = fuzzyval (xS,xG,x);– G2 = fuzzyval (yS,yG,x);

Page 13: Pattern Recognition Systems

Crate 5 x 7 regions of the 2-D bitmap

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

• Find all combinations of intersections between the two groups of fuzzy sets– G3 = allcomb(‘min’, G1, g2);

• G3 wil be a 35-element column vector of grades associated with the 35 regions of the 2-D bit map

Page 14: Pattern Recognition Systems

Multiple Pixels

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

• If vectors X and Y represent the input pixels, then– G1 = fuzzyval(xS, xG, X);– G2 = fuzzyval(yS,yG, Y); and– G3 = allcomb(‘min’, G1, G2);

• G3 represents a 35 -element column for every pixel crossed by all of the input pixels

Page 15: Pattern Recognition Systems

Single Grade for each 5 x 7 regions

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

• Taking the union of all grades associated with each square region:– G = or (G3 ’ ) ’;

• We now have 35 grades, each grade measuring to what extent the user’s drawn character passed through a different region.

• 925-pixel bit map ----> 35 grades!

Page 16: Pattern Recognition Systems

Defining the System

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

• Once the good features have been found, one can define a system to transform the feature grades into the grades for each class.

Page 17: Pattern Recognition Systems

Defining the System

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

• Zero:• G0 = and([ or( G([2 7])); or( G([3 8]));

or( G([4 9]));• or( G([11 12])); or( G([16 17]));

or( G([21 22]));• or( G([14 15])); or( G([19 20]));

or( G([24 25]));• or( G([27 32])); or( G([28 33]));

or( G([29 34]));• not( G([13 18 23]) ) ]);

Page 18: Pattern Recognition Systems

Defining the System

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

• One:

Page 19: Pattern Recognition Systems

Defining the System

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

• One:• G1 = or([ and([ G([5 9 18 27 31]);• not(G([1 2 3 6 7 11 25 29 30 33 34 35])) ]);• and([ G([1 7 18 29 35]);• not(G([3 4 5 9 10 15 21 26 27 31 32 33])) ]);• and([ G([1 6 11 16 21 26 31]);• not(G([3 4 5 8 10 13 15 18 20 23 25 ...• 28 30 33 34 35])) ]);• and([ G([2 3 4 5]);• not(G([6 7 10 11 12 15 16 17 20 25 30 35]));• or( G([8 9]));• or( G([13 14]));• or( G([18 19]));• or( G([23 24]));• or( G([28 29]));• or( G([33 34])); ]) ]);

Page 20: Pattern Recognition Systems

Defining the System

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

• Two:• G2 = and([ somewhat(G(2));• G([3 32 33 34]);• or( G([6 7])); or( G([30 25]));

or( G([4 5]));• not([ G([22 28]); and(G([10

15])) ]) ]);

Page 21: Pattern Recognition Systems

Defining the System

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

• Three:• G3 = and([ G([2 3 19 32 33 34]);• or( G([9 10]) );• or( G([14 15]) );• not( G([5 16 21]) ) ]);

Page 22: Pattern Recognition Systems

Defining the System

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

• Four:• G4 = and([ or([ and(G([4 14 19 29])); and(G([5 15 20

30])) • and(G([3 13 18 28])) ]);• or([and(G([12 14 15])); and(G([17 19 20]));• and(G([22 24])) ]);• not([ G([1 2 6 7]); and(G([32 33 34])) ]) ]);

Page 23: Pattern Recognition Systems

Defining the System

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

• Once the grades for each class have been found, they can be combined into a single grade vector, cG– cG = [G0 G1 G2 G3 G4 G5 G6 G7 G8

G9];• THEN THE MAXIMUMGRADE CHARACTERS CAN

BE FOUND

– C = cS(find(cG >= max(cG)));

Page 24: Pattern Recognition Systems

Testinging the System

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

• Demo– Matlab : numrec

Page 25: Pattern Recognition Systems

Pattern Clustering

Fuzzy Logic: Intellicence, Control, and Information, J Yen and R Langari, Prentice Hall

• Unsupervised Clustering– Find interesting patterns or groupings

in a given set of data.• Example: perform the task of

“segmenting” the images (I.e., partitioning pixels on an image into regions that correspond to different objects or different faces of objects in the images).

Page 26: Pattern Recognition Systems

Pattern Clustering

Fuzzy Logic: Intellicence, Control, and Information, J Yen and R Langari, Prentice Hall

• Conventional clustering algorithms find a “Hard partition” of a given dataset based on certain criteria that evaluate the goodness of a partition.– “Hard Partition” - each datum belongs to

exactly one cluster of the partition.– In many real-world clustering problems,

some data points partially belong to multiple clusters (eg. A pixel in a MRI may correspond to a mixture of two different types of tissues.

Page 27: Pattern Recognition Systems

Soft Clustering Algorithms

Fuzzy Logic: Intelligence, Control, and Information, J. Yen and R. Langari, Prentice Hall

• Find a “soft partition” of a given data set based on certain criteria.– A datum can partially belong to

multiple clusters– In practice, most soft clustering

algorithms do generate a soft partition that also forms a fuzzy partition.

Page 28: Pattern Recognition Systems

Fuzzy C-Means Algorithm

Fuzzy Logic: Intelligence, Control, and Information, J. Yen and R. Langari, Prentice Hall

• Best known fuzzy clustering algorithm– produces a constrained soft partition

• I.e. cj(xi) = 1

• Both fuzzy c-means and probabilistic clustering produce a partition of similar properties, the clustering criteria underlying these algorithms are very different!

Page 29: Pattern Recognition Systems

Fuzzy C-Means Algorithm

Fuzzy Logic: Intelligence, Control, and Information, J. Yen and R. Langari, Prentice Hall

• Generalizes a hard clustering algorithm called the c-means algorithm– Hard C-Means algorithm (HCM) aims

to identify compact well-separated clusters

• compact cluster has a “ball like” shape• the center of the ball is called the center

or the prototype of the cluster.

Page 30: Pattern Recognition Systems

Example of two clusters that are not compact and well separated

Fuzzy Logic: Intellicence, Control, and Information, J Yen and R Langari, Prentice Hall

Page 31: Pattern Recognition Systems

Example of two clusters that are compact, but not well separated

Fuzzy Logic: Intellicence, Control, and Information, J Yen and R Langari, Prentice Hall

Page 32: Pattern Recognition Systems

Fuzzy C-Means Algorithm

Fuzzy Logic: Intelligence, Control, and Information, J. Yen and R. Langari, Prentice Hall

• Like HCM, fuzzy c-means also tries to find a good partition by searching for prototypes vi that minimize the objective function Jm

• k=1,2,…c• m is a weight that affects how partial

members of a cluster affect the clustering result

• FCM also needs to search for membership function ci

that minimize Jm

Page 33: Pattern Recognition Systems

Fuzzy C-Means Theorem

Fuzzy Logic: Intelligence, Control, and Information, J. Yen and R. Langari, Prentice Hall

• A constrainted fuzzy partition {C1, C2, …, Ck} can be a local minimum of the objective function Jm only if the following conditions are satisfied:

• Based on this theorem, FCM updates the prototypes and the membership function iteratively using Equation A and B until a convergence criterion is reached

Page 34: Pattern Recognition Systems

Fuzzy C-Means Algorithm

Fuzzy Logic: Intelligence, Control, and Information, J. Yen and R. Langari, Prentice Hall

Page 35: Pattern Recognition Systems

Fuzzy C-Means - Example

Fuzzy Logic: Intelligence, Control, and Information, J. Yen and R. Langari, Prentice Hall

• Use FCM to partition the data set into two clusters (c=2), suppose we set the parameter m in FCM at 2, and initial prototypes to v1 = (5,5) v2 = (10,10)

Page 36: Pattern Recognition Systems

Fuzzy C-Means - Example

Fuzzy Logic: Intelligence, Control, and Information, J. Yen and R. Langari, Prentice Hall

Page 37: Pattern Recognition Systems

Fuzzy C-Means - Example

Fuzzy Logic: Intelligence, Control, and Information, J. Yen and R. Langari, Prentice Hall

• The initial membership functions of the two clusters are calculated using Equation A

Page 38: Pattern Recognition Systems

Example (Continued)

Fuzzy Logic: Intelligence, Control, and Information, J. Yen and R. Langari, Prentice Hall

• Similarly,

Page 39: Pattern Recognition Systems

Example (Continued)

Fuzzy Logic: Intelligence, Control, and Information, J. Yen and R. Langari, Prentice Hall

• Similarly,

Page 40: Pattern Recognition Systems

Example (Continued)

Fuzzy Logic: Intelligence, Control, and Information, J. Yen and R. Langari, Prentice Hall

• FCM algoruthm then updates the prototypes according to Equation B– For V1

Page 41: Pattern Recognition Systems

Example (Continued)

Fuzzy Logic: Intelligence, Control, and Information, J. Yen and R. Langari, Prentice Hall

• FCM algoruthm then updates the prototypes according to Equation B– For V2

Page 42: Pattern Recognition Systems

Example (Continued)

Fuzzy Logic: Intelligence, Control, and Information, J. Yen and R. Langari, Prentice Hall

• The updated prototype v1 and v2 are move closer to the center of the cluster formed by x1,x2, x3 and x4,x5,x6 , respectively

• Show Matlab example

Page 43: Pattern Recognition Systems

Recognition of Geometric shapes

Manuel J.Fonseca, Joaquim A.Jorge, Using Fuzzy Logic to Recognize Geometric Shapes Interactively

• Used in PDAs

• Interactive CAD systems

Page 44: Pattern Recognition Systems

Recognition of Geometric shapes

Multi-stroke shapesManuel J.Fonseca, Joaquim A.Jorge, Using Fuzzy Logic to Recognize Geometric Shapes Interactively

Page 45: Pattern Recognition Systems

Recognition of Geometric shapes

Multi-stroke shapesManuel J.Fonseca, Joaquim A.Jorge, Using Fuzzy Logic to Recognize Geometric Shapes Interactively

Page 46: Pattern Recognition Systems

Recognition of Geometric shapes

Multi-stroke shapesManuel J.Fonseca, Joaquim A.Jorge, Using Fuzzy Logic to Recognize Geometric Shapes Interactively

Page 47: Pattern Recognition Systems

Recognition of Geometric shapes

Uni-stroke shapesManuel J.Fonseca, Joaquim A.Jorge, Using Fuzzy Logic to Recognize Geometric Shapes Interactively

Page 48: Pattern Recognition Systems

Recognition of Geometric shapes

Uni-stroke shapesManuel J.Fonseca, Joaquim A.Jorge, Using Fuzzy Logic to Recognize Geometric Shapes Interactively

Page 49: Pattern Recognition Systems

Recognition of Geometric shapes

Recognition algorithm:

1. Use global geometric properties of the shapes

2. Use a set of filters to either to identify shapes or to filter out unwanted outcomes

3. Use fuzzy logic to handle uncertainty

Manuel J.Fonseca, Joaquim A.Jorge, Using Fuzzy Logic to Recognize Geometric Shapes Interactively

Page 50: Pattern Recognition Systems

Recognition of Geometric shapes

Feature extraction

Use statistical properties of shape’s features!

Manuel J.Fonseca, Joaquim A.Jorge, Using Fuzzy Logic to Recognize Geometric Shapes Interactively

Page 51: Pattern Recognition Systems

Recognition of Geometric shapes

Circle: Thinness ratio Ach/ P2ch

Ach – area of the convex hullP2

ch – perimeter squared

(line from 10% to 90%, bar from 25% to 75%)

Page 52: Pattern Recognition Systems

Recognition of Geometric shapes

Line: Thinness ratio Her/ Wer

Her – height of enclosing rectangleWer – width of enclosing rectangle

(line from 10% to 90%, bar from 25% to 75%)

Page 53: Pattern Recognition Systems

Recognition of Geometric shapes

Rectangle: first ratio R1 = Ach/ Aer

Aer – area of enclosing rectangleAch – area of convex hull

(line from 10% to 90%, bar from 25% to 75%)

Page 54: Pattern Recognition Systems

Recognition of Geometric shapes

Rectangle: second ratio R2 = Alq/ Aer

Alq – area of largest quadrilateralAer – area of enclosing rectangle

(line from 10% to 90%, bar from 25% to 75%)

Page 55: Pattern Recognition Systems

Recognition of Geometric shapes

Diamond: ratio of Alt/ Alq

Alt – area of largest triangleAlq – area of largest quadrilateral

(line from 10% to 90%, bar from 25% to 75%)

Page 56: Pattern Recognition Systems

Recognition of Geometric shapes

Triangle/Move: first ratio T1= Alt/ Ach

Alt – area of largest triangleAch – area of convex hull

(line from 10% to 90%, bar from 25% to 75%)

Page 57: Pattern Recognition Systems

Recognition of Geometric shapes

Triangle/Move: sec. ratio T2= Plt/Pch

Plt – perimeter of largest trianglePch – perimeter of convex hull

How to distinguish between triangle and move?

Page 58: Pattern Recognition Systems

Recognition of Geometric shapes

Another parameter – HOLLOWNESS-Place a triangle with approx. 60% area of the convex hull in the center of mass of a shape-Count shape points inside the triangle

Manuel J.Fonseca, Joaquim A.Jorge, Using Fuzzy Logic to Recognize Geometric Shapes Interactively

Page 59: Pattern Recognition Systems

Recognition of Geometric shapes

Features used by each shapeManuel J.Fonseca, Joaquim A.Jorge, Using Fuzzy Logic to Recognize Geometric Shapes Interactively

Page 60: Pattern Recognition Systems

Recognition of Geometric shapes

Defining fuzzy sets

a – minimum from a feature distribution

b – 10% from a feature distribution

c – 90% from a feature distribution

d – maximum from a feature distribution

Manuel J.Fonseca, Joaquim A.Jorge, Using Fuzzy Logic to Recognize Geometric Shapes Interactively

Page 61: Pattern Recognition Systems

Recognition of Geometric shapes

There are 4 ambiguous cases for which it is impossible todefine membership functions in the way demonstrated in the previous slide.

Manuel J.Fonseca, Joaquim A.Jorge, Using Fuzzy Logic to Recognize Geometric Shapes Interactively

Page 62: Pattern Recognition Systems

Recognition of Geometric shapes

The membership functions for the ambiguous cases are defined as shown.

Manuel J.Fonseca, Joaquim A.Jorge, Using Fuzzy Logic to Recognize Geometric Shapes Interactively

Page 63: Pattern Recognition Systems

Recognition of Geometric shapes

Rules:

Manuel J.Fonseca, Joaquim A.Jorge, Using Fuzzy Logic to Recognize Geometric Shapes Interactively

Page 64: Pattern Recognition Systems

Recognition of Geometric shapes

Recognition accuracy:

Problems: poor recognition of arrows

Manuel J.Fonseca, Joaquim A.Jorge, Using Fuzzy Logic to Recognize Geometric Shapes Interactively