06_Learning_And_Inference

Computer vision models Two types of model Worked example 1: Regression Worked example 2: Classification Which type should we choose? Applications
展开查看详情

1.Computer vision: models, learning and inference Chapter 6 Learning and Inference in Vision

2.Structure 2 2 Computer vision: models, learning and inference. ©2011 Simon J.D. Prince Computer vision models Two types of model Worked example 1: Regression Worked example 2: Classification Which type should we choose? Applications

3.Computer vision models Observe measured data , x Draw inferences from it about state of world , w Examples: Observe adjacent frames in video sequence Infer camera motion Observe image of face Infer identity Observe images from two displaced cameras Infer 3d structure of scene 3 Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

4.Regression vs. Classification Observe measured data, x Draw inferences from it about world, w When the world state w is continuous we’ll call this regression When the world state w is discrete we call this classification 4 Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

5.Ambiguity of visual world Unfortunately visual measurements may be compatible with more than one world state w Measurement process is noisy Inherent ambiguity in visual data Conclusion: the best we can do is compute a probability distribution Pr( w | x ) over possible states of world 5 Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

6.Refined goal of computer vision Take observations x Return probability distribution Pr( w | x ) over possible worlds compatible with data (not always tractable – might have to settle for an approximation to this distribution, samples from it, or the best (MAP) solution for w ) 6 Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

7.Components of solution We need A model that mathematically relates the visual data x to the world state w . Model specifies family of relationships, particular relationship depends on parameters q A learning algorithm : fits parameters q from paired training examples x i , w i An inference algorithm : uses model to return Pr( w | x ) given new observed data x . 7 Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

8.Types of Model The model mathematically relates the visual data x to the world state w . Two main categories of model Model contingency of the world on the data Pr( w | x ) Model contingency of data on world Pr( x | w ) 8 Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

9.Generative vs. Discriminative Model contingency of the world on the data Pr( w | x ) (DISCRIMINATIVE MODEL) 2 . Model contingency of data on world Pr( x | w ) (GENERATIVE MODELS) Generative as probability model over data and so when we draw samples from model, we GENERATE new data 9 Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

10.Type 1: Model Pr( w | x ) - Discriminative How to model Pr( w | x )? Choose an appropriate form for Pr( w ) Make parameters a function of x Function takes parameters q that define its shape Learning algorithm : learn parameters q from training data x , w Inference algorithm : just evaluate Pr( w | x ) 10 Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

11.Type 2: Pr( x | w ) - Generative How to model Pr( x | w )? Choose an appropriate form for Pr( x ) Make parameters a function of w Function takes parameters q that define its shape Learning algorithm : learn parameters q from training data x , w Inference algorithm : Define prior Pr( w ) and then compute Pr( w | x ) using Bayes ’ rule 11 Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

12.Summary Two ifferent types of model depend on the quantity of interest: Pr( w|x ) Discriminative Pr( w|x ) Generative Inference in discriminative models easy as we directly model posterior Pr( w | x ). Generative models require more complex inference process using Bayes ’ rule 12 Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

13.Structure 13 13 Computer vision: models, learning and inference. ©2011 Simon J.D. Prince Computer vision models Two types of model Worked example 1: Regression Worked example 2: Classification Which type should we choose? Applications

14.Worked example 1: Regression Consider simple case where we make a univariate continuous measurement x use this to predict a univariate continuous state w (regression as world state is continuous) 14 Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

15.Regression application 1: Pose from Silhouette 15 Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

16.Regression application 2: Head pose estimation 16 Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

17.Worked example 1: Regression Consider simple case where we make a univariate continuous measurement x use this to predict a univariate continuous state w (regression as world state is continuous) 17 Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

18.Type 1: Model Pr( w | x ) - Discriminative How to model Pr( w | x )? Choose an appropriate form for Pr( w ) Make parameters a function of x Function takes parameters q that define its shape Learning algorithm : learn parameters q from training data x , w Inference algorithm : just evaluate Pr( w | x ) 18 Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

19.Type 1: Model Pr( w | x ) - Discriminative How to model Pr( w | x )? Choose an appropriate form for Pr( w ) Make parameters a function of x Function takes parameters q that define its shape 19 Computer vision: models, learning and inference. ©2011 Simon J.D. Prince Choose normal distribution over w Make mean m linear function of x (variance constant) Parameters are f 0 , f 1 , s 2 . This model is called linear regression.

20.Parameters are y-offset, slope and variance 20 Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

21.Learning algorithm: learn q from training data x , y . E.g. MAP 21 Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

22.Inference algorithm: just evaluate Pr( w | x ) for new data x 22 Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

23.Type 2: Pr( x | w ) - Generative How to model Pr( x | w )? Choose an appropriate form for Pr( x ) Make parameters a function of w Function takes parameters q that define its shape Learning algorithm : learn parameters q from training data x , w Inference algorithm : Define prior Pr( w ) and then compute Pr( w | x ) using Bayes ’ rule 23 Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

24.Type 2: Pr( x | w ) - Generative How to model Pr( x | w )? Choose an appropriate form for Pr( x ) Make parameters a function of w Function takes parameters q that define its shape Choose normal distribution over x Make mean m linear function of w (variance constant) Parameter are f 0 , f 1 , s 2 . 24 Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

25.Learning algorithm: learn q from training data x , w . e.g. MAP 25 Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

26. Pr( x|w ) x Pr(w) = Pr( x,w ) Can get back to joint probability Pr( x,y ) 26 Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

27.Inference algorithm : compute Pr( w | x ) using Bayes rule 27 Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

28.Structure 28 28 Computer vision: models, learning and inference. ©2011 Simon J.D. Prince Computer vision models Three types of model Worked example 1: Regression Worked example 2: Classification Which type should we choose? Applications

29.Worked example 2: Classification Consider simple case where we make a univariate continuous measurement x use this to predict a discrete binary world w (classification as world state is discrete) 29 Computer vision: models, learning and inference. ©2011 Simon J.D. Prince