Fuzzy Logic Ppt

Preview:

Citation preview

Fuzzy Logic and Fuzzy Set Theorywith examples from Image Processing

By: Rafi Steinberg

4/2/20081

2

Some Fuzzy Background

Lofti Zadeh has coined the term “Fuzzy Set” in 1965 and opened a new field of research and applicationsA Fuzzy Set is a class with different degrees of membership. Almost all real world classes are fuzzy!Examples of fuzzy sets include: {‘Tall people’}, {‘Nice day’}, {‘Round object’} …

If a person’s height is 1.88 meters is he considered ‘tall’?What if we also know that he is an NBA player?

3

Some Related Fields

Fuzzy Logic & Fuzzy Set

Theory

Evidence Theory

Pattern Recognition &

Image Processing

Control Theory

Knowledge Engineering

4

Overview

L. ZadehD. DuboisH. PradeJ.C. BezdekR.R. YagerM. SugenoE.H. MamdaniG.J. KlirJ.J. Buckley

Membership Functions

5

A Crisp Definition of Fuzzy Logic

• Does not exist, however …- Fuzzifies bivalent Aristotelian (Crisp) logicIs “The sky are blue” True or False?

• Modus PonensIF <Antecedent == True> THEN <Do Consequent>IF (X is a prime number) THEN (Send TCP packet)• Generalized Modus PonensIF “a region is green and highly textured” AND “the region is somewhat below a sky region”THEN “the region contains trees with high confidence”

6

Fuzzy Inference (Expert) SystemsInput_1

Fuzzy IF-THEN

Rules

Output

Input_2

Input_3

7

Fuzzy Vs. Probability

Walking in the desert, close to being dehydrated, you find two bottles of water:

The first contains deadly poison with a probability of 0.1

The second has a 0.9 membership value in the Fuzzy Set “Safe drinks”

Which one will you choose to drink from???

8

Membership Functions (MFs)

• What is a MF? • Linguistic Variable• A Normal MF attains ‘1’ and ‘0’ for some input

• How do we construct MFs?– Heuristic– Rank ordering– Mathematical Models– Adaptive (Neural Networks, Genetic Algorithms …)

1 2 1 2, 1, 0A Ax x x x

9

Membership Function Examples

TrapezoidalTriangular

1

, ,1

smf a x cf x a c

e

Sigmoid

2

22; ,x c

gmff x c e

Gaussian

; , , , max min ,1 , ,0x a d x

f x a b c db a d c

; , , max min , , 0

x a c xf x a b c

b a c b

10

Alpha Cuts

AA x X x

AA x X x

Strong Alpha Cut

Alpha Cut0

0.2 0.5 0.8 1

11

Linguistic Hedges

Operate on the Membership Function (Linguistic Variable)1. Expansive (“Less”, ”Very Little”)2. Restrictive (“Very”, “Extremely”)3. Reinforcing/Weakening (“Really”, “Relatively”)

Less x

4Very Little x

2Very x

4Extremely x

A Ax x c

12

Aggregation Operations

1

2121 ,,,

n

aaaaaah nn

0 0, ,1iand a i i n

, min

1 ,

0 ,

1 ,

, max

h

h Harmonic Mean

h Geometric Mean

h Algebraic Mean

h

Generalized Mean:

13

Aggregation Operations (2)• Fixed Norms (Drastic, Product, Min)• Parametric Norms (Yager)

T-norms:

, 1

, , 1

0 ,D

b if a

T a b a if b

otherwise

Drastic Product

, min ,ZT a b a b ,T a b a b

Zadehian

,BSS a b a b a b , 0

, , 0

1 ,D

b if a

S a b a if b

otherwise

S-Norm Duals:

, max ,ZS a b a b

Bounded Sum DrasticZadehian

14

Aggregation Operations (3)

DrasticT-Norm Product Zadehian

min

Generalized Mean

Zadehian max

BoundedSum

Drastic S-Norm

Algebraic (Mean)

Geometric

Harmonic

b (=0.8)a (=0.3)

1

, min 1, 0,w w wu a b a b for w

Yager S-Norm

Yager S-Norm for varying w

15

Crisp Vs. Fuzzy

Fuzzy Sets• Membership values on [0,1]• Law of Excluded Middle and Non-

Contradiction do not necessarily hold:

• Fuzzy Membership Function• Flexibility in choosing the

Intersection (T-Norm), Union (S-Norm) and Negation operations

Crisp Sets• True/False {0,1}• Law of Excluded Middle and Non-

Contradiction hold:

• Crisp Membership Function• Intersection (AND) , Union (OR),

and Negation (NOT) are fixed

A A

A A

A A

A A

16

Image Processing

BinaryGray LevelColor (RGB,HSV etc.)

Can we give a crisp definition to light blue?

17

Fuzziness Vs. Vagueness

Vagueness=Insufficient Specificity

“I will be back sometime”

Fuzzy Vague

“I will be back in a few minutes”

Fuzzy

Fuzziness=Unsharp Boundaries

18

Fuzziness

“As the complexity of a system increases, our ability to make precise and yet significant statements about its behavior diminishes” – L. Zadeh

• A possible definition of fuzziness of an image:

2min ,ij ij

i j

FuzzM N

19

Example: Finding an Image Threshold

Membership Value

Gray Level

1

, ,1

smf a x cf x a c

e

20

Mathematical Morphology

• Operates on predefined geometrical objects in an image• Structured Element (SE) represents the shape of interest• Initially developed for binary images; extended to grayscale using

aggregation operations from Fuzzy Logic

Some Examples: Dilation, Erosion, Open, Close, Hit&Miss, Skeleton

0 1 0

0 1 0

0 1 0

SE

68 12 4 32 60

16 12 4 32 60

16 40 28 56 12

16 40 52 8 12

40 72 76 8 12

imerode

68 12 4 32 60

92 80 28 56 64

16 40 52 80 88

40 100 76 84 12

44 72 100 8 36

im

21

Fuzzy Mathematical Morphology

“Does it fit” “How well does a SE fit”

,

,

, max , ,

, min , ,

Gj k B

Gj k B

D A B a m j n k b j k

E A B a m j n k b j k

For B=0 , max

, min

GB

G B

D A B A

E A B A

max min

min max

G BB

G B B

O A

C A

22

Some Basic Concepts

, ,

# 2 L

L a b c

elements in the Power Set

Universe of Discourse:

Power Set of X= P(X)= {Null , {a} , {b} , {c} ,{a , b},{b , c}, {a , c}, {a,b,c}}

Singletons of the Power Set of X: { {a} , {b} , {c} }An Event=An Element of the Power SetBasic Probability Assignment (BPA)

Focal Element

m(A)=0.2

m(C)=0.5

m(B)=0.3

m(A)=0.2Consonant Body of

Evidence

1

0i

iA P X

m A

m

23

Fuzzy Measures

Additive, Sub Additive, Super Additive MeasuresExamples: {Probability}, {Belief, Plausibility}, {Necessity, Possibility}

0 , 1g g X

, ,if A B A B P X then g A g B (2) Monotonicity:

(1) Boundary Condition:

: 0,1set function g P x

(3) Uniform Convergence

1i iA

increasing sequence of measurable sets we have uniform convergence:

lim limi ii iA A

24

Example: Fuzzy MeasureMembership

in the Set “Our Line”

Symbolic Representation of the Measure

Observed Image

1

0.7

0.5

0.7

0.2

0.3

0.2

0

1 3,x x 1 2,x x

1 2 3, ,x x x

2 3,x x

3x

2x

1x

1 2 3, ,Line x x x

25

The Choquet Integral

• Is defined over a Fuzzy Measure• Consider a gray level input

f(x3) f(x2) f(x1)

1 0.4 0.8

26

Example: Choquet Integral CalculationCorresponding

MeasureSet

Representation

0.2 1 0 0

0.2 1 0 0

0.5 1 0 1

0.5 1 0 1

0.5 1 0 1

0.5 1 0 1

1 1 1 1

1 1 1 1

1 1 1 1

1 1 1 10.64 1 0.4 0.8

10f

9f

7f

8f

5f

6f

3f

4f

1f

2f

/10

1x 2x 3x

27

Sugeno Measures

1

, 1 ,1

AA

A

1,

A B A B A B

for and A B

Sugeno Inverse for λ={-0.99, -0.9, -0.5, 0, 1, 10}

Sugeno Inverse:

Sugeno Measure’s Additional Axiom:

1 1 ii

x Compute λ from the normalization rule:

Optimistic/Pessimistic Aggregation of Evidence

28

Finding the Sugeno MeasureWe need to solve the third order equation:

Solutions: {0, -15, 5/3}Since λ=0 is the trivial additive solution and since λ =-15 is out of range (λ>-1) we choose λ=5/3 and obtain:

21 1 0.3 1 0.2

1 3, 0.47x x

2 3 1 2, , 0.6x x x x

29

Example: Sugeno Integral Calculation

3 1 3 1 2 3, , , , ,h g h a g x h b g x x h c g x x x

0.9 0.2 , 0.5 0.47 , 0 1

max min 0.9,0.2 , min 0.5,0.47 0.47

-> We cannot aggregate with the Sugeno Union since the segmenting alpha cut values are not part of our initial frame of discernment

-> Zadehian Max-Min are ‘good’ default operators

h(q) is the alpha cut that entirely includes the measure of q.

30

Example: Finding Edges

12ˆ min 1, min ,

1ij

mn iji j ijW

max min min

1max max max

ij ij ij ijspatial spatial spatial

ij ij

ij ij ijspatial global spatial

g g g

g g

31

O.K. So Now What?

• We have a fuzzy result, however in many cases we need to make a crisp decision (On/Off)

• Methods of defuzzifying are:– Centroid (Center of Mass)– Maximum– Other methods

A

A

x x dxCentroid

x dx

32

Fuzzy Inference (Expert) SystemsService Time

Fuzzy IF-THEN

Rules

Tip Level

Food Quality

Ambiance

Fuzzify: Apply MF on

input

Generalized Modus Ponens with specified aggregation

operations

Defuzzify: Method of Centroid,

Maximum, ...

33

Automatic Speech Recognition (ASR) via Automatic Reading of Speech Spectrograms

Phoneme Classes:VowelsSemi-vowels/DiphthongsNasalsPlosivesFricativesSilence

Examples of Fuzzy Variables:Distance between formants (Large/Small)Formant location (High/Mid/Low)Formant length (Long/Average/Short)Zero crossings (Many/Few)Formant movement (Descending/Ascending/Fixed)VOT= Voice Onset Time (Long/Short)Phoneme duration (Long/Average/Short)Pitch frequency (High/Low/Undetermined)Blob (F1/F2/F3/F4/None)

“Don’t ask me to carry…"

34

Applying the Segmentation Algorithm

35

Suggested Fuzzy Inference SystemFeature Vector from Spectrogram

Identify Phoneme Class using Fuzzy IF-THEN Rules

Vowels

Find Vowel

Fricatives

Nasals

Output Fuzzy MF for each Phoneme

Assign a Fuzzy Value for each Phoneme, Output Highest N Values to a

Linguistic model

36

Summary• Fuzzy Logic can be useful in solving Human related tasks• Evidence Theory gives tools to handle knowledge• Membership functions and Aggregation methods can be selected according to the problem at hand

Some things we didn’t talk about:• Fuzzy C-Means (FCM) clustering algorithm• Dempster-Schafer theory of combining evidence• Fuzzy Relation Equations (FRE)• Compositions• Fuzzy Entropy

37

References[1] G. J. Klir ,U. S. Clair, B. Yuan“Fuzzy Set Theory: Foundations and Applications “, Prentice Hall PTR 1997, ISBN: 978-0133410587 [2] H.R. Tizhoosh;“Fast fuzzy edge detection” Fuzzy Information Processing Society, Annual Meeting of the North American, pp. 239 – 242, 27-29 June 2002. [3] A.K. Hocaoglu; P.D. Gader; “ An interpretation of discrete Choquet integrals in morphological image processing Fuzzy Systems “, Fuzzy Systems, FUZZ '03. Vol. 2, 25-28, pp. 1291 – 1295, May 2003. [4] E.R. Daugherty, “An introduction to Morphological Image Processing”, SPlE Optical Engineering Press, Bellingham, Wash., 1992.[5] A. Dumitras, G. Moschytz, “Understanding Fuzzy Logic – An interview with Lofti Zadeh”, IEEE Signal Processing Magazine, May 2007 [6] J.M. Yang; J.H. Kim, ”A multisensor decision fusion strategy using fuzzy measure theory ”, Intelligent Control, Proceedings of the 1995 IEEE International Symposium on, pp. 157 – 162, Aug. 1995 [7] R. Steinberg, D. O’Shaugnessy ,”Segmentation of a Speech Spectrogram using Mathematical Morphology ” ,To be presented at ICASSP 2008.[8] J.C. Bezdek, J. Keller, R. Krisnapuram, N.R. Pal, ” Fuzzy Models and Algorithms for Pattern Recognition and Image Processing ” Springer 2005, ISBN: 0-387-245 15-4 [9] W. Siler, J.J. Buckley,“Fuzzy Expert Systems and Fuzzy Reasoning“, John Wiley & Sons, 2005, Online ISBN: 9780471698500[10] http://pami.uwaterloo.ca/tizhoosh/fip.htm[11] "Heavy-tailed distribution." Wikipedia, The Free Encyclopedia. 22 Jan 2008, 17:43 UTC. Wikimedia Foundation, Inc. 3 Feb 2008 http://en.wikipedia.org/w/index.php?title=Heavy-tailed_distribution&oldid=186151469[12] T.J. Ross, “Fuzzy Logic with Engineering Applications”, McGraw-Hill 1997. ISBN: 0070539170

38

Heavy-Tail DistributionsExamples: Alpha Stable (Cauchy, Pareto), Weibull, Student-T, Log-Normal …

Problem – different samples with very low probability occur very frequentlySolution: Smoothing the probability density function; Good or Bad??Another Solution: Use Possibility (Membership function) and Necessity as envelopes

Example: Amazon sells far more books that are ‘very unpopular’ than popular books

Another example: Automatic translation – most words in English have a very low frequency of occurrence. However, we often find such rare words in a sentence.

Bonus Slide

lim Pr , 0x

xe X x

Recommended