Computer vision: models, learning and inference

Slides:



Advertisements
Similar presentations
Bayesian Belief Propagation
Advertisements

Linear Time Methods for Propagating Beliefs Min Convolution, Distance Transforms and Box Sums Daniel Huttenlocher Computer Science Department December,
CSE 473/573 Computer Vision and Image Processing (CVIP) Ifeoma Nwogu Lecture 27 – Overview of probability concepts 1.
Exact Inference. Inference Basic task for inference: – Compute a posterior distribution for some query variables given some observed evidence – Sum out.
Graphical Models BRML Chapter 4 1. the zoo of graphical models Markov networks Belief networks Chain graphs (Belief and Markov ) Factor graphs =>they.
Introduction to Markov Random Fields and Graph Cuts Simon Prince
Exact Inference in Bayes Nets
Computer vision: models, learning and inference Chapter 8 Regression.
Computer vision: models, learning and inference Chapter 18 Models for style and identity.
Learning HMM parameters
Junction Trees And Belief Propagation. Junction Trees: Motivation What if we want to compute all marginals, not just one? Doing variable elimination for.
ICCV 2007 tutorial Part III Message-passing algorithms for energy minimization Vladimir Kolmogorov University College London.
Dynamic Bayesian Networks (DBNs)
Loopy Belief Propagation a summary. What is inference? Given: –Observabled variables Y –Hidden variables X –Some model of P(X,Y) We want to make some.
Introduction to Belief Propagation and its Generalizations. Max Welling Donald Bren School of Information and Computer and Science University of California.
Computer vision: models, learning and inference
Belief Propagation by Jakob Metzler. Outline Motivation Pearl’s BP Algorithm Turbo Codes Generalized Belief Propagation Free Energies.
Graphical models: approximate inference and learning CA6b, lecture 5.
Hidden Markov Models Bonnie Dorr Christof Monz CMSC 723: Introduction to Computational Linguistics Lecture 5 October 6, 2004.
Hidden Markov Models M. Vijay Venkatesh. Outline Introduction Graphical Model Parameterization Inference Summary.
GS 540 week 6. HMM basics Given a sequence, and state parameters: – Each possible path through the states has a certain probability of emitting the sequence.
… Hidden Markov Models Markov assumption: Transition model:
1 Graphical Models in Data Assimilation Problems Alexander Ihler UC Irvine Collaborators: Sergey Kirshner Andrew Robertson Padhraic Smyth.
Hidden Markov Model 11/28/07. Bayes Rule The posterior distribution Select k with the largest posterior distribution. Minimizes the average misclassification.
Hidden Markov Models I Biology 162 Computational Genetics Todd Vision 14 Sep 2004.
Part 4 b Forward-Backward Algorithm & Viterbi Algorithm CSE717, SPRING 2008 CUBS, Univ at Buffalo.
Conditional Random Fields
Belief Propagation, Junction Trees, and Factor Graphs
Graphical Models Lei Tang. Review of Graphical Models Directed Graph (DAG, Bayesian Network, Belief Network) Typically used to represent causal relationship.
Understanding Belief Propagation and its Applications Dan Yuan June 2004.
Belief Propagation Kai Ju Liu March 9, Statistical Problems Medicine Finance Internet Computer vision.
Stereo Computation using Iterative Graph-Cuts
Computer vision: models, learning and inference
Computer vision: models, learning and inference Chapter 10 Graphical Models.
Computer vision: models, learning and inference
Learning HMM parameters Sushmita Roy BMI/CS 576 Oct 21 st, 2014.
Computer vision: models, learning and inference Chapter 3 Common probability distributions.
Visual Recognition Tutorial1 Markov models Hidden Markov models Forward/Backward algorithm Viterbi algorithm Baum-Welch estimation algorithm Hidden.
. Class 5: Hidden Markov Models. Sequence Models u So far we examined several probabilistic model sequence models u These model, however, assumed that.
Computer vision: models, learning and inference
Extracting Places and Activities from GPS Traces Using Hierarchical Conditional Random Fields Yong-Joong Kim Dept. of Computer Science Yonsei.
Ch 8. Graphical Models Pattern Recognition and Machine Learning, C. M. Bishop, Summarized by B.-H. Kim Biointelligence Laboratory, Seoul National.
12/07/2008UAI 2008 Cumulative Distribution Networks and the Derivative-Sum-Product Algorithm Jim C. Huang and Brendan J. Frey Probabilistic and Statistical.
Computer vision: models, learning and inference Chapter 19 Temporal models.
Computer vision: models, learning and inference Chapter 19 Temporal models.
Belief Propagation. What is Belief Propagation (BP)? BP is a specific instance of a general class of methods that exist for approximate inference in Bayes.
CS Statistical Machine learning Lecture 24
Probabilistic Graphical Models seminar 15/16 ( ) Haim Kaplan Tel Aviv University.
Lecture 2: Statistical learning primer for biologists
Pattern Recognition and Machine Learning-Chapter 13: Sequential Data
Exact Inference in Bayes Nets. Notation U: set of nodes in a graph X i : random variable associated with node i π i : parents of node i Joint probability:
Christopher M. Bishop, Pattern Recognition and Machine Learning 1.
Computer vision: models, learning and inference Chapter 2 Introduction to probability.
Pattern Recognition and Machine Learning
CS Statistical Machine learning Lecture 25 Yuan (Alan) Qi Purdue CS Nov
Today Graphical Models Representing conditional dependence graphically
Hidden Markov Model Parameter Estimation BMI/CS 576 Colin Dewey Fall 2015.
Bayesian Belief Propagation for Image Understanding David Rosenberg.
Markov Random Fields in Vision
Visual Recognition Tutorial1 Markov models Hidden Markov models Forward/Backward algorithm Viterbi algorithm Baum-Welch estimation algorithm Hidden.
Hidden Markov Models Achim Tresch MPI for Plant Breedging Research & University of Cologne.
Hidden Markov Models BMI/CS 576
Today.
Computer vision: models, learning and inference
Computer vision: models, learning and inference
Computer vision: models, learning and inference
CSCI 5822 Probabilistic Models of Human and Machine Learning
Markov Random Fields Presented by: Vladan Radosavljevic.
Expectation-Maximization & Belief Propagation
Readings: K&F: 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7 Markov networks, Factor graphs, and an unified view Start approximate inference If we are lucky… Graphical.
Presentation transcript:

Computer vision: models, learning and inference Chapter 11 Models for Chains and Trees

Structure Chain and tree models MAP inference in chain models MAP inference in tree models Maximum marginals in chain models Maximum marginals in tree models Models with loops Applications Computer vision: models, learning and inference. ©2011 Simon J.D. Prince 2

Chain and tree models Given a set of measurements and world states , infer the world states from the measurements. Problem: if N is large, then the model relating the two will have a very large number of parameters. Solution: build sparse models where we only describe subsets of the relations between variables. Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Chain and tree models Chain model: only model connections between a world variable and its 1 predeeding and 1 subsequent variables Tree model: connections between world variables are organized as a tree (no loops). Disregard directionality of connections for directed model Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Assumptions We’ll assume that World states are discrete Observed data variables for each world state The nth data variable is conditionally independent of all of other data variables and world states, given associated world state Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Gesture Tracking See also: Thad Starner’s work Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Directed model for chains (Hidden Markov model) Compatibility of measurement and world state Compatibility of world state and previous world state Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Undirected model for chains Compatibility of measurement and world state Compatibility of world state and previous world state Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Equivalence of chain models Directed: Undirected: Equivalence: Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Chain model for sign language application Observations are normally distributed but depend on sign k World state is categorically distributed, parameters depend on previous world state Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Structure Chain and tree models MAP inference in chain models MAP inference in tree models Maximum marginals in chain models Maximum marginals in tree models Models with loops Applications Computer vision: models, learning and inference. ©2011 Simon J.D. Prince 11

MAP inference in chain model Directed model: MAP inference: Substituting in : Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

MAP inference in chain model Takes the general form: Unary term: Pairwise term: Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Dynamic programming Maximizes functions of the form: Set up as cost for traversing graph – each path from left to right is one possible configuration of world states Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Dynamic programming Algorithm: Work through graph computing minimum possible cost to reach each node When we get to last column, find minimum Trace back to see how we got there Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Worked example Unary cost Pairwise costs: Zero cost to stay at same label Cost of 2 to change label by 1 Infinite cost for changing by more than one (not shown) Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Worked example Minimum cost to reach first node is just unary cost Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Worked example Minimum cost is minimum of two possible routes to get here Route 1: 2.0+0.0+1.1 = 3.1 Route 2: 0.8+2.0+1.1 = 3.9 Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Worked example Minimum cost is minimum of two possible routes to get here Route 1: 2.0+0.0+1.1 = 3.1 -- this is the minimum – note this down Route 2: 0.8+2.0+1.1 = 3.9 Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Worked example General rule: Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Worked example Work through the graph, computing the minimum cost to reach each node Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Worked example Keep going until we reach the end of the graph Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Worked example Find the minimum possible cost to reach the final column Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Worked example Trace back the route that we arrived here by – this is the minimum configuration Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Structure Chain and tree models MAP inference in chain models MAP inference in tree models Maximum marginals in chain models Maximum marginals in tree models Models with loops Applications Computer vision: models, learning and inference. ©2011 Simon J.D. Prince 25

MAP inference for trees Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

MAP inference for trees Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Worked example Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Worked example Variables 1-4 proceed as for the chain example. Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Worked example At variable n=5 must consider all pairs of paths from into the current node. Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Worked example Variable 6 proceeds as normal. Then we trace back through the variables, splitting at the junction. Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Structure Chain and tree models MAP inference in chain models MAP inference in tree models Maximum marginals in chain models Maximum marginals in tree models Models with loops Applications Computer vision: models, learning and inference. ©2011 Simon J.D. Prince 32

Marginal posterior inference Start by computing the marginal distribution over the Nth variable Then we`ll consider how to compute the other marginal distributions Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Computing one marginal distribution Compute the posterior using Bayes` rule: We compute this expression by writing the joint probability : Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Computing one marginal distribution Problem: Computing all NK states and marginalizing explicitly is intractable. Solution: Re-order terms and move summations to the right Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Computing one marginal distribution Define function of variable w1 (two rightmost terms) Then compute function of variables w2 in terms of previous function Leads to the recursive relation Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Computing one marginal distribution We work our way through the sequence using this recursion. At the end we normalize the result to compute the posterior Total number of summations is (N-1)K as opposed to KN for brute force approach. Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Forward-backward algorithm We could compute the other N-1 marginal posterior distributions using a similar set of computations However, this is inefficient as much of the computation is duplicated The forward-backward algorithm computes all of the marginal posteriors at once ... and take products Solution: Compute all first term using a recursion Compute all second terms using a recursion Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Forward recursion Conditional probability rule Using conditional independence relations This is the same recursion as before Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Backward recursion Conditional probability rule Using conditional independence relations This is another recursion of the form Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Forward backward algorithm Compute the marginal posterior distribution as product of two terms Forward terms: Backward terms: Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Belief propagation Forward backward algorithm is a special case of a more general technique called belief propagation Intermediate functions in forward and backward recursions are considered as messages conveying beliefs about the variables. We’ll examine the Sum-Product algorithm. The sum-product algorithm operates on factor graphs. Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Sum product algorithm Forward backward algorithm is a special case of a more general technique called belief propagation Intermediate functions in forward and backward recursions are considered as messages conveying beliefs about the variables. We’ll examine the Sum-Product algorithm. The sum-product algorithm operates on factor graphs. Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Factor graphs One node for each variable One node for each function relating variables Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Sum product algorithm Forward pass Distribute evidence through the graph Backward pass Collates the evidence Both phases involve passing messages between nodes: The forward phase can proceed in any order as long as the outgoing messages are not sent until all incoming ones received Backward phase proceeds in reverse order to forward Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Sum product algorithm Three kinds of message Messages from unobserved variables to functions Messages from observed variables to functions Messages from functions to variables Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Sum product algorithm Message type 1: Messages from unobserved variables z to function g Take product of incoming messages Interpretation: combining beliefs Message type 2: Messages from observed variables z to function g Interpretation: conveys certain belief that observed values are true Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Sum product algorithm Message type 3: Messages from a function g to variable z Takes beliefs from all incoming variables except recipient and uses function g to a belief about recipient Computing marginal distributions: After forward and backward passes, we compute the marginal dists as the product of all incoming messages Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Sum product: forward pass Message from x1 to g1: By rule 2: Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Sum product: forward pass Message from g1 to w1: By rule 3: Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Sum product: forward pass Message from w1 to g1,2: By rule 1: (product of all incoming messages) Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Sum product: forward pass Message from g1,2 from w2: By rule 3: Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Sum product: forward pass Messages from x2 to g2 and g2 to w2: Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Sum product: forward pass Message from w2 to g2,3: The same recursion as in the forward backward algorithm Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Sum product: forward pass Message from w2 to g2,3: Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Sum product: backward pass Message from wN to gN,N-1: Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Sum product: backward pass Message from gN,N-1 to wN-1: Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Sum product: backward pass Message from gn,n-1 to wn-1: The same recursion as in the forward backward algorithm Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Sum product: collating evidence Marginal distribution is products of all messages at node Proof: Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Structure Chain and tree models MAP inference in chain models MAP inference in tree models Maximum marginals in chain models Maximum marginals in tree models Models with loops Applications Computer vision: models, learning and inference. ©2011 Simon J.D. Prince 60

Marginal posterior inference for trees Apply sum-product algorithm to the tree-structured graph. Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Structure Chain and tree models MAP inference in chain models MAP inference in tree models Maximum marginals in chain models Maximum marginals in tree models Models with loops Applications Computer vision: models, learning and inference. ©2011 Simon J.D. Prince 62

Tree structured graphs This graph contains loops But the associated factor graph has structure of a tree Can still use Belief Propagation Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Learning in chains and trees Supervised learning (where we know world states wn) is relatively easy. Unsupervised learning (where we do not know world states wn) is more challenging. Use the EM algorithm: E-step – compute posterior marginals over states M-step – update model parameters For the chain model (hidden Markov model) this is known as the Baum-Welch algorithm. Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Grid-based graphs Often in vision, we have one observation associated with each pixel in the image grid. Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Why not dynamic programming? When we trace back from the final node, the paths are not guaranteed to converge. Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Why not dynamic programming? Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Why not dynamic programming? But: Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Approaches to inference for grid-based models Prune the graph. Remove edges until an edge remains Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Approaches to inference for grid-based models 2. Combine variables. Merge variables to form compound variable with more states until what remains is a tree. Not practical for large grids Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Approaches to inference for grid-based models 3. Loopy belief propagation. Just apply belief propagation. It is not guaranteed to converge, but in practice it works well. 4. Sampling approaches Draw samples from the posterior (easier for directed models) Other approaches Tree-reweighted message passing Graph cuts Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Structure Chain and tree models MAP inference in chain models MAP inference in tree models Maximum marginals in chain models Maximum marginals in tree models Models with loops Applications Computer vision: models, learning and inference. ©2011 Simon J.D. Prince 72

Gesture Tracking Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Stereo vision Two image taken from slightly different positions Matching point in image 2 is on same scanline as image 1 Horizontal offset is called disparity Disparity is inversely related to depth Goal – infer disparities wm,n at pixel m,n from images x(1) and x(2) Use likelihood: Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Stereo vision Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Stereo vision 1. Independent pixels Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Stereo vision 2. Scanlines as chain model (hidden Markov model) Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Stereo vision 3. Pixels organized as tree (from Veksler 2005) Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Pictorial Structures Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Pictorial Structures Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Segmentation Computer vision: models, learning and inference. ©2011 Simon J.D. Prince

Conclusion For the special case of chains and trees we can perform MAP inference and compute marginal posteriors efficiently. Unfortunately, many vision problems are defined on pixel grid – this requires special methods Computer vision: models, learning and inference. ©2011 Simon J.D. Prince