visión de alto nivel - inaoeesucar/clases-van/van6-bayesiana.pdf · 13 probabilistic graphical...

87
1 Visión de Alto Nivel Visión de Alto Nivel Dr. Luis Enrique Sucar INAOE [email protected] ccc.inaoep.mx/~esucar Dr. Luis Enrique Sucar INAOE [email protected] ccc.inaoep.mx/~esucar Sesión 5 Visión Bayesiana Sesión 5 Visión Bayesiana

Upload: others

Post on 10-Mar-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

1

Visión de Alto NivelVisión de Alto NivelDr. Luis Enrique Sucar

INAOE

[email protected]/~esucar

Dr. Luis Enrique Sucar

INAOE

[email protected]/~esucar

Sesión 5Visión Bayesiana

Sesión 5Visión Bayesiana

Page 2: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

2

What do you see?What do you see?

What we see depends on our previous knowledge (model) of the world and the information (data) form

the images Bayesian perception

Page 3: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

3

Bayesian visual perceptionBayesian visual perception• The perception problem is characterized by

two main aspects:– The properties of the world that is

observed (prior knowledge)– The image data used by the observer

(data)• The Bayesian approach combines these two

aspects which are characterized as probability distributions

• The perception problem is characterized by two main aspects:– The properties of the world that is

observed (prior knowledge)– The image data used by the observer

(data)• The Bayesian approach combines these two

aspects which are characterized as probability distributions

Page 4: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

4

RepresentationRepresentation

• Scene properties – S• Model of the world – prior probability

distribution – P(S)• Model of the image – probability distribution

of the image given de scene (likelihood) –P(I|S)

• Scene properties – S• Model of the world – prior probability

distribution – P(S)• Model of the image – probability distribution

of the image given de scene (likelihood) –P(I|S)

Page 5: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

5

RecognitionRecognition

• The scene (object) is characterized by the posterior probability distribution – P(S|I)

• By Bayes theorem:P(S|I) = P(S) P(I|S) / P(I)

• The denominator can be consider as a normalizing constant:

P(S|I) = k P(S) P(I|S)

• The scene (object) is characterized by the posterior probability distribution – P(S|I)

• By Bayes theorem:P(S|I) = P(S) P(I|S) / P(I)

• The denominator can be consider as a normalizing constant:

P(S|I) = k P(S) P(I|S)

Page 6: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

6

ExampleExample

Page 7: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

7

ExampleExample

• Prior distribution of objects – P(O)– Cube 0.2– Cylinder 0.3– Sphere 0.1– Prism 0.4

• Prior distribution of objects – P(O)– Cube 0.2– Cylinder 0.3– Sphere 0.1– Prism 0.4

Page 8: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

8

ExampleExample

• Likelihood function P(Silhouette|Object) – P(S|O)

Prism Cube Cylinder Sphere

Square 1.0 0.6 0.0 0.4Circle 0.0 0.4 1.0 0.0Trapezoid 0.0 0.0 0.0 0.6

• Likelihood function P(Silhouette|Object) – P(S|O)

Prism Cube Cylinder Sphere

Square 1.0 0.6 0.0 0.4Circle 0.0 0.4 1.0 0.0Trapezoid 0.0 0.0 0.0 0.6

Page 9: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

9

ExampleExample

• Posterior distribution P(Object|Silhouette) – P(O|S)• Bayes rule:

P(O|S) = k P(O) P(S|O)• For example, given S=square

P(Cube | square)= k 0.2 * 1 = k 0.2 = 0.37P(Cylinder | square)= k 0.3 * 0.6 = k 0.18 = 0.33P(Sphere | square)= k 0.1 * 0 = 0P(Prism | square)= k 0.4 * 0.4 = k 0.16 = 0.30

• Posterior distribution P(Object|Silhouette) – P(O|S)• Bayes rule:

P(O|S) = k P(O) P(S|O)• For example, given S=square

P(Cube | square)= k 0.2 * 1 = k 0.2 = 0.37P(Cylinder | square)= k 0.3 * 0.6 = k 0.18 = 0.33P(Sphere | square)= k 0.1 * 0 = 0P(Prism | square)= k 0.4 * 0.4 = k 0.16 = 0.30

Page 10: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

10

Graphical ModelGraphical Model

• We can represent the dependence relation in this simple example graphically, with 2 variables and an arc

• We can represent the dependence relation in this simple example graphically, with 2 variables and an arc

O

S

P(O)

P(S|O)

Page 11: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

11

Graphical ModelsGraphical Models

• This graphical representation of probabilistic models can be extended to more complex ones.

• There are several types of probabilistic graphical models (PGMs) that can be applied to different problems in perception

• This graphical representation of probabilistic models can be extended to more complex ones.

• There are several types of probabilistic graphical models (PGMs) that can be applied to different problems in perception

Page 12: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

12

Probabilistic Graphical ModelsProbabilistic Graphical Models• A graphical model is specified by two aspects:

– A Graph, G(V,E), that defines the structure of the model

– A set of local functions, f(Yi), that defines the parameters (probabilities), where Yi is a subset of X

• The joint probability is defined by the product of the local functions:

• A graphical model is specified by two aspects:– A Graph, G(V,E), that defines the structure of

the model– A set of local functions, f(Yi), that defines the

parameters (probabilities), where Yi is a subset of X

• The joint probability is defined by the product of the local functions:

)f(Y )X , ,X ,P(Xn

1i

iN21 ∏=

=…

Page 13: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

13

Probabilistic Graphical ModelsProbabilistic Graphical Models

• This representation in terms of a graph and a set of local functions (called potentials) is the basis for inference and learning in PGMs– Inference: obtain the marginal or conditional

probabilities of any subset of variables Z given any other subset Y

– Learning: given a set of data values for X (that can be incomplete) estimate the structure (graph) and parameters (local function) of the model

• This representation in terms of a graph and a set of local functions (called potentials) is the basis for inference and learning in PGMs– Inference: obtain the marginal or conditional

probabilities of any subset of variables Z given any other subset Y

– Learning: given a set of data values for X (that can be incomplete) estimate the structure (graph) and parameters (local function) of the model

Page 14: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

14

Types of PGMsTypes of PGMs

• We will consider the following models and their applications in vision:– Bayesian classifiers– Bayesian networks– Hidden Markov models– Dynamic Bayesian networks– Markov Random Fields

• We will consider the following models and their applications in vision:– Bayesian classifiers– Bayesian networks– Hidden Markov models– Dynamic Bayesian networks– Markov Random Fields

Page 15: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

15

Bayesian ClassifierBayesian Classifier

• A Bayesian classifier is used to obtain the probability of certain variable (the class or hypothesis, H) given a set of variables known as the attributes or evidence (E = E1, …, EN)

• It is usually assumed that the attributes are independent given the class – Naive Bayesian Classifier – so its PGM is represented as a “star” with the class as the root and the attributes as the leafs

• A Bayesian classifier is used to obtain the probability of certain variable (the class or hypothesis, H) given a set of variables known as the attributes or evidence (E = E1, …, EN)

• It is usually assumed that the attributes are independent given the class – Naive Bayesian Classifier – so its PGM is represented as a “star” with the class as the root and the attributes as the leafs

Page 16: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

16

Naive Bayesian ClassifierNaive Bayesian Classifier

C

A2A1 An…

Page 17: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

17

Bayesian ClassifierBayesian Classifier

• The posterior probability of each hypothesis (H) based on the Evidence (E) is:

P(H | E) = P(H) P(E | H) / P(E)

• The posterior probability of each hypothesis (H) based on the Evidence (E) is:

P(H | EE) = P(H) P(EE | H) / P(EE)

Page 18: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

18

Naive Bayesian classifier Inference

Naive Bayesian classifier Inference

• Consider each attribute independent given the hypothesis:

P(E1, E2, ...EN | H) = P(E1 | H) P(E2 | H) ... P(EN | H)

• So the posterior probability is given by:P(H | E1, E2, ...EN) =

[P(H) P(E1 | H) P(E2 | H) ... P(EN | H)] / P(E)= k P(H) P(E1 | H) P(E2 | H) ... P(EN | H)

• Consider each attribute independent given the hypothesis:

P(E1, E2, ...EN | H) = P(E1 | H) P(E2 | H) ... P(EN | H)

• So the posterior probability is given by:P(H | E1, E2, ...EN) =

[P(H) P(E1 | H) P(E2 | H) ... P(EN | H)] / P(EE)= k P(H) P(E1 | H) P(E2 | H) ... P(EN | H)

Page 19: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

19

Naive Bayesian classifier Learning

Naive Bayesian classifier Learning

• Structure: – the structure is given by the naive Bayes assumption

• Parameters: – we need to estimate the prior probability of each

classP(Ci)

– and the individual conditional probabilities of each attribute given the class

P(Ak | Ci)

• Structure: – the structure is given by the naive Bayes assumption

• Parameters: – we need to estimate the prior probability of each

classP(Ci)

– and the individual conditional probabilities of each attribute given the class

P(Ak | Ci)

Page 20: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

20

ExampleExample

• Skin classification based on color– Hypothesis: skin, no-skin– Attributes: red, green, blue (256 values

each)

• Probability function:P(S|R,G,B) = k P(S) P(R| S) P(G| S) P(B| S)

• Skin classification based on color– Hypothesis: skin, no-skin– Attributes: red, green, blue (256 values

each)

• Probability function:P(S|R,G,B) = k P(S) P(R| S) P(G| S) P(B| S)

Page 21: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

21

Naive Bayes

S

GR B

Page 22: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

22

Skin detectionSkin detection

Detection of skinpixels based oncolor informationand a Bayesianclassifier

Page 23: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

23

Bayesian NetworksBayesian Networks

• Bayesian networks (BN) are a graphical representation of dependencies between a set of random variables. A Bayesian net is a Directed Acyclic Graph (DAG) in which:– Node: Propositional variable. – Arcs: Probabilistic dependencies.

• An arc between two variables represents a direct dependency, usually interpreted as a causalrelation.

• Bayesian networks (BN) are a graphical representation of dependencies between a set of random variables. A Bayesian net is a Directed Acyclic Graph (DAG) in which:– Node: Propositional variable. – Arcs: Probabilistic dependencies.

• An arc between two variables represents a direct dependency, usually interpreted as a causalrelation.

Page 24: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

24

An example of a BN

Drunk

Thirsty Headache

Wine

Page 25: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

25

ParametersParameters

Conditional probabilities of each node given its parents.

• Root nodes: vector of prior probabilities

• Other nodes: matrix of conditional probabilities

Conditional probabilities of each node given its parents.

• Root nodes: vector of prior probabilities

• Other nodes: matrix of conditional probabilities

Page 26: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

26

P(W)0.8 0.2

Drunk

Thirsty Headache

WineP(D|W)0.9 0.70.1 0.3

P(H|D)0.7 0.40.3 0.6

P(T|D)0.9 0.50.1 0.5

Page 27: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

27

InferenceInference

• Inference in a Bayesian Network consists on estimating the posterior probability of some variables (unknowns) given the values of some other variables (evidence)

• There are several algorithms for probability propagation in BN

• All the methods are based on Bayes theorem

• Inference in a Bayesian Network consists on estimating the posterior probability of some variables (unknowns) given the values of some other variables (evidence)

• There are several algorithms for probability propagation in BN

• All the methods are based on Bayes theorem

Page 28: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

28

Inference

C Causal:C H

Evidential:E H

Mixed:C,E H

P(H|C)

H

E

P(E|H)

Page 29: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

29

BN in VisionBN in Vision

General ModelExample

General ModelExample

Page 30: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

30

A “general” BN model for VisionA “general” BN model for Vision

Part

Feature Feature

ObjectObject Object

Feature

Part Part Part

FeatureFeature

Feature

Page 31: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

31

Example - endoscopyExample - endoscopy

• Endoscopy is a tool for direct observation of the human digestive system

• Recognize “objects” in endoscopy images of the colon for semi-automatic navigation

• Main feature – dark regions• Main objects – “lumen” & “diverticula”

• Endoscopy is a tool for direct observation of the human digestive system

• Recognize “objects” in endoscopy images of the colon for semi-automatic navigation

• Main feature – dark regions• Main objects – “lumen” & “diverticula”

Page 32: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

32

Colon ImageColon Image

Page 33: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

33

Segmentation – dark regionSegmentation – dark region

Page 34: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

34

Features – pqhistogram

Features – pqhistogram

Page 35: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

35

BN for endoscopy (partial)BN for endoscopy (partial)

Page 36: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

36

Semi-automatic EndoscopeSemi-automatic Endoscope

Page 37: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

37

Endoscopy navegation systemEndoscopy navegation system

Page 38: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

38

Endoscopy navegation systemEndoscopy navegation system

Page 39: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

39

Dynamic Bayesian networks (DBN)Dynamic Bayesian networks (DBN)

• BN for modeling temporal processes• A “static BN” is repeated at each time

(discrete time)• Dependencies (arcs) between temporal slices

(Markov assumption)• Dependencies and parameters between time

slices are repeated (Stationary assumption)• Hidden Markov models (HMMs) are a special

case of DBN

• BN for modeling temporal processes• A “static BN” is repeated at each time

(discrete time)• Dependencies (arcs) between temporal slices

(Markov assumption)• Dependencies and parameters between time

slices are repeated (Stationary assumption)• Hidden Markov models (HMMs) are a special

case of DBN

Page 40: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

40

Example of a DBN

St St+1 St+2 St+3

Xt Xt+1 Xt+2 Xt+3

E E E E

T T+1 T+2 T+3

Page 41: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

41

Hidden Markov Models (HMM)Hidden Markov Models (HMM)

• A stochastic process in which the states are not directly observable

• It consists of:– A finite set of states– A probability distribution for transitions between

states– A probability distribution for observations given

the state

• A stochastic process in which the states are not directly observable

• It consists of:– A finite set of states– A probability distribution for transitions between

states– A probability distribution for observations given

the state

Page 42: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

42

HMM – Graphical ModelHMM – Graphical Model

P(S1) P(St+1|St)

EE E E

T T + 1 T + 2 T + 3

St St+3St+2St+1

P(E|St)

Page 43: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

43

HMMSHMMS

• Representation– Usually one model (HMM) is used to represent

each dynamic object• Learning

– The structure is set by the designer and the parameters are learned from data

• Recognition– The data is fed to all the models and the one with

the highest probability is selected

• Representation– Usually one model (HMM) is used to represent

each dynamic object• Learning

– The structure is set by the designer and the parameters are learned from data

• Recognition– The data is fed to all the models and the one with

the highest probability is selected

Page 44: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

44

Example HMMs: Gesture RecognitionExample HMMs: Gesture Recognition

• Motion features only• HMMs

• Recognize 5 dynamic gestures with the right hand• The gestures are for commanding a mobile robot• Recognition based on HMM

• Motion features only• HMMs

• Recognize 5 dynamic gestures with the right hand• The gestures are for commanding a mobile robot• Recognition based on HMM

Page 45: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

45

Come

attention

go-right

go-left

stop

Come

attention

go-right

go-left

stop

Page 46: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

46

Feature ExtractionFeature Extraction

• Skin detection• Face and hand segmentation• Hand tracking• Motion features

• Skin detection• Face and hand segmentation• Hand tracking• Motion features

Page 47: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

47

SegmentationSegmentationRadial scan forskin pixel detection

Segmentation by groupingskin pixels in the scan lines

Page 48: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

48

TrackingTrackingLocate face and hand based on antropometric measures

Track the hand by using the radial scansegmentation in region of interest

Page 49: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

49

FeaturesFeatures• From each image we obtain the features:

– change in X (∆X)– change in Y (∆Y)– change in area (∆A)– change in size ratio (∆R)

• Each one is codified in 3 values: (+, 0, -)

• From each image we obtain the features:– change in X (∆X)– change in Y (∆Y)– change in area (∆A)– change in size ratio (∆R)

• Each one is codified in 3 values: (+, 0, -)

X2,Y2

A2X1,Y,1

A1

Page 50: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

50

RecognitionRecognition• Recognition based on HMM• One HMM for each gesture• The probability of each model given the observations is estimated

(forward algorithm) and the one with highest probability is selected

• Recognition based on HMM• One HMM for each gesture• The probability of each model given the observations is estimated

(forward algorithm) and the one with highest probability is selectedP1P2

P4

P3

P5

Page 51: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

51

ResultsResults

• Training with 128 sequences per gesture• Testing with 80 sequences for each gesture• Correct recognition:

– come 75.3 %– attention 70.7%– stop 65.8 %– go-right 100 %– go-left 100 %– Average: 82%

• Training with 128 sequences per gesture• Testing with 80 sequences for each gesture• Correct recognition:

– come 75.3 %– attention 70.7%– stop 65.8 %– go-right 100 %– go-left 100 %– Average: 82%

Page 52: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

52

Example DBNs: Gesture recognitionExample DBNs: Gesture recognition

• Recognize 5 dynamic gestures with the right hand (same as for HMM)

• Recognition based on dynamic Bayesian networks

• Include more features:– Motion– Posture

• Recognize 5 dynamic gestures with the right hand (same as for HMM)

• Recognition based on dynamic Bayesian networks

• Include more features:– Motion– Posture

Page 53: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

53

Motion Features(0,0) x

Image t

.. x'

∆a = 0

∆x = +

∆y = –

form = +

Image t+1

y'

y

Page 54: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

54

Posture features

Above

Right

Torso

Posture features are simple spatial relations between the user’s right hand and other body parts:– Right– Above– Torso

Each one can take one of 2 values: (yes, no)

Posture features are simple spatial relations between the user’s right hand and other body parts:– Right– Above– Torso

Each one can take one of 2 values: (yes, no)

Page 55: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

55

Dynamic naive Bayesian Classifierwith posture information

Dynamic naive Bayesian ClassifierDynamic naive Bayesian Classifierwithwith postureposture informationinformation

St

∆x, ∆y ∆a form above right torso

t

Page 56: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

56

ExperimentsExperiments

• 150 samples of each gesture taken from one user

• Laboratory environment with different lighting conditions

• Distance from the user to the camera varied between 3.0 m and 5.0 m

• The number of training samples varied between 5% to 100% of the training set

• 150 samples of each gesture taken from one user

• Laboratory environment with different lighting conditions

• Distance from the user to the camera varied between 3.0 m and 5.0 m

• The number of training samples varied between 5% to 100% of the training set

Page 57: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

57

Confusion matrix: DNBCs without posture information

Confusion matrix: DNBCs without posture information

come attention go-right go-left stop

come 98 % 2 %

attention 3 % 87 % 10 %

go-right 100 %

go-left 100 %

stop 4 % 39 % 1 % 56 %

TheThe average average recognitionrecognition raterate isis 87.75 %87.75 %

Page 58: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

58

Confusion matrix: BCs with posture informationConfusion matrix: BCs with posture informationcome attention go-right go-left stop

come 100 %

attention 100 %

go-right 100 %

go-left 100 %

stop 11 % 6 % 83 %

TheThe average average recognitionrecognition raterate isis 96.75 %96.75 %

Page 59: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

59

come attention go-right go-left stop

come 100 %

attention 100 %

go-right 100 %

go-left 100 %

stop 8 % 92 %

Confusion matrix: HMMs with posture informationConfusion matrix: HMMs with posture information

TheThe average average recognitionrecognition raterate isis 98.47 %98.47 %

Page 60: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

60

Accuracy vs Training SizeAccuracy vs Training Size

Average recognition results of five repetitions of the experimenAverage recognition results of five repetitions of the experimentt

Page 61: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

61

Markov Random FieldsMarkov Random Fields• A set of random variables indexed by nodes in a graph.

y1 y3 y5

y6y4y2

x1

x2

x3

x4

x5

x6

– Observations: labels generated by base classifier– Prior knowledge: associations between labels

Page 62: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

62

Markov Random FieldMarkov Random Field

Label’s association Confidence of the AIA method

Page 63: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

63

Markov Random FieldMarkov Random Field

• Representation– The fields through a graph a set of objects (nodes) and

their relations (arcs)• Learning

– Usually the structure (vicinity) and parameters (potentials) are specified by the designer, although they could be learned from data

• Recognition– Based on the observed data, recognition consists on

obtaining the most probable values for all the objects(configuration) via an optimization process

• Representation– The fields through a graph a set of objects (nodes) and

their relations (arcs)• Learning

– Usually the structure (vicinity) and parameters (potentials) are specified by the designer, although they could be learned from data

• Recognition– Based on the observed data, recognition consists on

obtaining the most probable values for all the objects(configuration) via an optimization process

Page 64: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

64

ExampleExample

• Use of a MRF to improve automatic image annotation by incorporating:– Semantic associations– Spatial relations

• Use of a MRF to improve automatic image annotation by incorporating:– Semantic associations– Spatial relations

Page 65: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

65

Semantic association between labelsSemantic association between labels

Page 66: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

66

Use of external corpusUse of external corpus• Association:

• Association between two labels is given by the number of documents in which both labels occur within an external corpus of documents

• Association:

• Association between two labels is given by the number of documents in which both labels occur within an external corpus of documents

Occurrence frequency

Page 67: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

67

Label’s associationLabel’s association

• External corpus: IAPR-TC12-2006– 20,000 manually annotated images– Title, description, – location, date, notes

• External corpus: IAPR-TC12-2006– 20,000 manually annotated images– Title, description, – location, date, notes

<TITLE>National Palace in Asuncion</TITLE>

<DESCRIPTION>a white building with lots ofcolumns and arches, a neat lawn and neatlycut trees and bushes in the foreground; the flagof Paraguay is waving at the top of the building; there is a flower bed on the left;</DESCRIPTION>

<NOTES>The National Palace was build in Versaillan style from 1960 to 1992;</NOTES>

<LOCATION>Asunción, Paraguay</LOCATION>

<DATE>March 2002</DATE>

Page 68: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

68

Label’s associationLabel’s association• External corpus: IAPR-TC12-2006• External corpus: IAPR-TC12-2006

Page 69: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

69

Label’s associationLabel’s association• External corpus: IAPR-TC12-2006• External corpus: IAPR-TC12-2006

Page 70: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

70

Label’s associationLabel’s association• External corpus: IAPR-TC12-2006• External corpus: IAPR-TC12-2006

Page 71: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

71

Label’s associationLabel’s associationOccurrence frequency

Laplacian Smoothing

Interpolation smoothing

Page 72: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

72

Experiments: Corel data setExperiments: Corel data set

Page 73: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

73

ExperimentsExperiments• Annotation method: knn

• Comparison of KNN against semi-supervised methods dML1, dML10, gML1, gML10, gMAP1, gMAP1MRF

• Comparing error (e) at the top x-labels

Page 74: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

74

Experimental resultsExperimental resultsk-NN versus others

Error at the 5-labelsError at the first label

Page 75: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

75

Experimental resultsExperimental results

14.7%10.3%

18.9%7.5%

COREL-A ncuts segmentation COREL-A grid segmentation

Page 76: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

76

Incorporating Spatial RelationsIncorporating Spatial Relations

Page 77: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

77

Considering spatial relationsConsidering spatial relations

trees 0.7

grass 0.3 sea 0.8

sky 0.2

sky 0.9

sea 0.1

sky disjoint to trees 0.4

sky adjacent to sea 0.5

sky below trees 0.0

sky below sea 0.0sea adjacent to sea 0.5 sea below sea 0.5

sea below trees 0.4sea disjoint to trees 0.4

sea 0.6

sky 0.4

Sky below sea?

Sky below trees?

77

Page 78: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

78

Spatial RelationsSpatial Relations

• Types of relations:– Topological– Order– Metric

• We use:

• Types of relations:– Topological– Order– Metric

• We use:

Page 79: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

79

PotentialsPotentials

• Energy potentials are inversely proportional to the probability of each relation:

• Energy potentials are inversely proportional to the probability of each relation:

Page 80: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

80

Estimating potentialsEstimating potentials

• The probability of each relation is obtained by combining a subjective estimate (Ek) with data from labeled images (Relk):

• The probability of each relation is obtained by combining a subjective estimate (Ek) with data from labeled images (Relk):

Page 81: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

81

MethodologyMethodology

Page 82: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

82

ExperimentsExperiments• Data set:

– Corel A database– 205 landscape images, segmented with normalized

cuts– 137 training images and 68 test images– 22 possible labels

• Data set:– Corel A database– 205 landscape images, segmented with normalized

cuts– 137 training images and 68 test images– 22 possible labels

Page 83: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

83

ExperimentsExperimentsExpertknowledge

Laplaciansmoothing

Nosmoothing

TopologicalrelationsVerticalrelationsHorizontalrelationsAllrelations

• We used kNN as base classifier for region annotation• We used kNN as base classifier for region annotation

Page 84: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

84

ParametersParameters

The best configuration is based onMAP using simulated annealing:

Page 85: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

85

ResultsResults

Markov Random Fields and Spatial Information to Improve Automatic Image Annotation

Page 86: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

86

Improving segmentationImproving segmentation

Original segmentation

Segmentationimprovements afterkNN

Correctsegmentation

(manual)

Segmentationimprovements afterusing spatialrelations and MRF

Page 87: Visión de Alto Nivel - INAOEesucar/Clases-van/van6-bayesiana.pdf · 13 Probabilistic Graphical ModelsProbabilistic Graphical Models • This representation in terms of a graph and

87

ReferenciasReferencias

• Ullman: Cap. 22, 23• C. Hernández--Gracidas, L.E. Sucar, "Markov

Random Fields and Spatial Information to ImproveAutomatic Image Annotation", Advances in Imageand Video Technology, Lecture Notes in ComputerScience 4872, Springer-Verlag, pp. 879--892, 2007.

• H. J. Escalante, M. Montes, and L. E. Sucar, "Word cooccurrence and Markov Random Fields forImproving Automatic Image Annotation", BritishMachine Vision Conference, Vol. II, pp. 600--609, 2007.

• Ullman: Cap. 22, 23• C. Hernández--Gracidas, L.E. Sucar, "Markov

Random Fields and Spatial Information to ImproveAutomatic Image Annotation", Advances in Imageand Video Technology, Lecture Notes in ComputerScience 4872, Springer-Verlag, pp. 879--892, 2007.

• H. J. Escalante, M. Montes, and L. E. Sucar, "Word cooccurrence and Markov Random Fields forImproving Automatic Image Annotation", BritishMachine Vision Conference, Vol. II, pp. 600--609, 2007.