MRFs and Segmentation with Graph Cuts Computer Vision CS 543 / ECE 549 University of Illinois Derek Hoiem 03/27/12.

Slides:



Advertisements
Similar presentations
Mean-Field Theory and Its Applications In Computer Vision1 1.
Advertisements

Bayesian Belief Propagation
O BJ C UT M. Pawan Kumar Philip Torr Andrew Zisserman UNIVERSITY OF OXFORD.
SOFT SCISSORS: AN INTERACTIVE TOOL FOR REALTIME HIGH QUALITY MATTING International Conference on Computer Graphics and Interactive Techniques ACM SIGGRAPH.
Cutting Images: Graphs and Boundary Finding Computational Photography Derek Hoiem, University of Illinois 09/15/11 “The Double Secret”, Magritte.
Introduction to Markov Random Fields and Graph Cuts Simon Prince
I Images as graphs Fully-connected graph – node for every pixel – link between every pair of pixels, p,q – similarity w ij for each link j w ij c Source:
GrabCut Interactive Image (and Stereo) Segmentation Carsten Rother Vladimir Kolmogorov Andrew Blake Antonio Criminisi Geoffrey Cross [based on Siggraph.
Hidden Variables, the EM Algorithm, and Mixtures of Gaussians Computer Vision CS 143, Brown James Hays 02/22/11 Many slides from Derek Hoiem.
GrabCut Interactive Foreground Extraction using Iterated Graph Cuts Carsten Rother Vladimir Kolmogorov Andrew Blake Microsoft Research Cambridge-UK.
GrabCut Interactive Foreground Extraction using Iterated Graph Cuts Carsten Rother Vladimir Kolmogorov Andrew Blake Microsoft Research Cambridge-UK.
Graph-Based Image Segmentation
Stephen J. Guy 1. Photomontage Photomontage GrabCut – Interactive Foreground Extraction 1.
Hidden Variables, the EM Algorithm, and Mixtures of Gaussians Computer Vision CS 543 / ECE 549 University of Illinois Derek Hoiem 03/15/12.
Graph-based image segmentation Václav Hlaváč Czech Technical University in Prague Faculty of Electrical Engineering Department of Cybernetics Prague, Czech.
GrabCut Interactive Image (and Stereo) Segmentation Joon Jae Lee Keimyung University Welcome. I will present Grabcut – an Interactive tool for foreground.
CS 691 Computational Photography Instructor: Gianfranco Doretto Cutting Images.
Markov Nets Dhruv Batra, Recitation 10/30/2008.
Markov Random Fields (MRF)
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.
Learning to Detect A Salient Object Reporter: 鄭綱 (3/2)
1 Graphical Models in Data Assimilation Problems Alexander Ihler UC Irvine Collaborators: Sergey Kirshner Andrew Robertson Padhraic Smyth.
Robust Higher Order Potentials For Enforcing Label Consistency
Stereo & Iterative Graph-Cuts Alex Rav-Acha Vision Course Hebrew University.
Announcements Readings for today:
Stereo Computation using Iterative Graph-Cuts
What Energy Functions Can be Minimized Using Graph Cuts? Shai Bagon Advanced Topics in Computer Vision June 2010.
An Iterative Optimization Approach for Unified Image Segmentation and Matting Hello everyone, my name is Jue Wang, I’m glad to be here to present our paper.
Image Segmentation Today’s Readings Forsyth & Ponce, Chapter 14
Measuring Uncertainty in Graph Cut Solutions Pushmeet Kohli Philip H.S. Torr Department of Computing Oxford Brookes University.
Computer vision: models, learning and inference
Perceptual Organization: Segmentation and Optical Flow.
Automatic User Interaction Correction via Multi-label Graph-cuts Antonio Hernández-Vela, Carlos Primo and Sergio Escalera Workshop on Human Interaction.
Graph-based Segmentation
Image Segmentation Rob Atlas Nick Bridle Evan Radkoff.
MRFs and Segmentation with Graph Cuts Computer Vision CS 543 / ECE 549 University of Illinois Derek Hoiem 03/31/15.
Cutting Images: Graphs and Boundary Finding Computational Photography Derek Hoiem, University of Illinois 09/14/10 “The Double Secret”, Magritte.
Graph Cut & Energy Minimization
MRFs and Segmentation with Graph Cuts Computer Vision CS 543 / ECE 549 University of Illinois Derek Hoiem 02/24/10.
Segmentation: MRFs and Graph Cuts Computer Vision CS 143, Brown James Hays 10/07/11 Many slides from Kristin Grauman and Derek Hoiem.
Interactive Graph Cuts for Optimal Boundary & Region Segmentation of Objects in N-D Images (Fri) Young Ki Baik, Computer Vision Lab.
Object Stereo- Joint Stereo Matching and Object Segmentation Computer Vision and Pattern Recognition (CVPR), 2011 IEEE Conference on Michael Bleyer Vienna.
Graph Cuts Marc Niethammer. Segmentation by Graph-Cuts A way to compute solutions to the optimization problems we looked at before. Example: Binary Segmentation.
Lecture 19: Solving the Correspondence Problem with Graph Cuts CAP 5415 Fall 2006.
Associative Hierarchical CRFs for Object Class Image Segmentation
O BJ C UT M. Pawan Kumar Philip Torr Andrew Zisserman UNIVERSITY OF OXFORD.
Gaussian Mixture Models and Expectation-Maximization Algorithm.
Machine Learning – Lecture 15
Markov Random Fields & Conditional Random Fields
CS654: Digital Image Analysis Lecture 28: Advanced topics in Image Segmentation Image courtesy: IEEE, IJCV.
Object Recognition by Integrating Multiple Image Segmentations Caroline Pantofaru, Cordelia Schmid, Martial Hebert ECCV 2008 E.
A global approach Finding correspondence between a pair of epipolar lines for all pixels simultaneously Local method: no guarantee we will have one to.
Computational Photography lecture 8 – segmentation CS (future 572) Spring 2016 Prof. Alex Berg (Credits to many other folks on individual slides)
Hidden Variables, the EM Algorithm, and Mixtures of Gaussians Computer Vision CS 543 / ECE 549 University of Illinois Derek Hoiem 02/22/11.
Markov Random Fields in Vision
Cutting Images: Graphs and Boundary Finding Computational Photography Derek Hoiem, University of Illinois 09/20/12 “The Double Secret”, Magritte.
Image segmentation.
Cutting Images: Graphs and Boundary Finding
GrabCut Interactive Foreground Extraction using Iterated Graph Cuts Carsten Rother Vladimir Kolmogorov Andrew Blake Microsoft Research Cambridge-UK.
Classification of unlabeled data:
Markov Random Fields with Efficient Approximations
Nonparametric Semantic Segmentation
Markov Random Fields and Segmentation with Graph Cuts
Integration and Graphical Models
Automatic User Interaction Correction via Multi-label Graph-cuts
Lecture 31: Graph-Based Image Segmentation
“grabcut”- Interactive Foreground Extraction using Iterated Graph Cuts
Segmentation (continued)
“Traditional” image segmentation
Presentation transcript:

MRFs and Segmentation with Graph Cuts Computer Vision CS 543 / ECE 549 University of Illinois Derek Hoiem 03/27/12

HW 3 Mean 92 Median 98 Common mistakes – Mission Possible: don’t need camera rotation matrix – Epipolar geometry: general problems with RANSAC and/or estimating F

Final projects Make appointments to see Ruiqi or me NVbVFtYXRmTldWcjFhWWpZLWc&hl=en_US#gid=0 No late penalty for not meeting us this week, but must get proposal submitted by Thursday – If you’re not sure, make your best guess; can change later

Today’s class Review of EM MRFs Segmentation with Graph Cuts i j w ij

EM Algorithm: Recap 1.E-step: compute 2.M-step: solve Determines hidden variable assignments and parameters that maximize likelihood of observed data Improves likelihood at each step (reaches local maximum) Derivation is tricky but implementation is easy

EM: Mixture of Gaussians 1.Initialize parameters 2.Compute likelihood of hidden variables for current parameters 3.Estimate new parameters for each component, weighted by likelihood Given by normal distribution

Gaussian Mixture Models: Practical Tips Design decisions – Number of components Select by hand based on knowledge of problem Select using cross-validation or sample data Usually, not too sensitive and safer to use more components – Variance “Spherical covariance”: dimensions within each component are independent with equal variance (1 parameter but usually too restrictive) “Diagonal covariance”: dimensions within each component are not independent with difference variances (N parameters for N-D data) “Full covariance”: no assumptions (N*(N+1)/2 parameters); for high N might be expensive to do EM, to evaluate, and may overfit Typically use “Full” if lots of data, few dimensions; Use “Diagonal” otherwise Can get stuck in local minima – Use multiple restarts – Choose solution with greatest data likelihood

EM Demo GMM with images demos

What’s wrong with this prediction? P(foreground | image)

Solution P(foreground | image) Encode dependencies between pixels Labels to be predictedIndividual predictions Pairwise predictions Normalizing constant called “partition function”

Writing Likelihood as an “Energy” Cost of assignment y i Cost of pairwise assignment y i, y j -log(.)

Notes on energy-based formulation Primarily used when you only care about the most likely solution (not the confidences) Can think of it as a general cost function Can have larger “cliques” than 2 – Clique is the set of variables that go into a potential function

Markov Random Fields Node y i : pixel label Edge: constrained pairs Cost to assign a label to each pixel Cost to assign a pair of labels to connected pixels

Markov Random Fields Example: “label smoothing” grid Unary potential K 1 K 0 Pairwise Potential 0: -logP(y i = 0 | data) 1: -logP(y i = 1 | data) K>0

Solving MRFs with graph cuts Source (Label 0) Sink (Label 1) Cost to assign to 1 Cost to assign to 0 Cost to split nodes

Solving MRFs with graph cuts Source (Label 0) Sink (Label 1) Cost to assign to 1 Cost to assign to 0 Cost to split nodes

GrabCut segmentation User provides rough indication of foreground region. Goal: Automatically provide a pixel-level segmentation.

Grab cuts and graph cuts Grab cuts and graph cuts User Input Result Magic Wand (198?) Intelligent Scissors Mortensen and Barrett (1995) GrabCut Regions Boundary Regions & Boundary Source: Rother

Colour Model Colour Model Gaussian Mixture Model (typically 5-8 components) Foreground & Background Background G R Source: Rother

Graph cuts Boykov and Jolly (2001) Image Min Cut Min Cut Cut: separating source and sink; Energy: collection of edges Min Cut: Global minimal enegry in polynomial time Foreground (source) Background (sink) Source: Rother

Colour Model Colour Model Gaussian Mixture Model (typically 5-8 components) Foreground & Background Background Foreground Background G R G R Iterated graph cut Source: Rother

GrabCut segmentation 1.Define graph – usually 4-connected or 8-connected Divide diagonal potentials by sqrt(2) 2.Define unary potentials – Color histogram or mixture of Gaussians for background and foreground 3.Define pairwise potentials 4.Apply graph cuts 5.Return to 2, using current labels to compute foreground, background models

What is easy or hard about these cases for graphcut- based segmentation?

Easier examples GrabCut – Interactive Foreground Extraction 10

More difficult Examples Camouflage & Low Contrast Harder Case Fine structure Initial Rectangle Initial Result GrabCut – Interactive Foreground Extraction 11

Notes look at GraphCut.m in provided code (skip README) – if you have trouble using package get help from Ruiqi Use poly2mask to convert the polygon to a foreground mask

Lazy Snapping (Li et al. SG 2004)

Using graph cuts for recognition TextonBoost (Shotton et al IJCV)

Using graph cuts for recognition TextonBoost (Shotton et al IJCV) Unary Potentials Alpha Expansion Graph Cuts

Graph cuts with multiple labels

Limitations of graph cuts Associative: edge potentials penalize different labels If not associative, can sometimes clip potentials Graph cut algorithm applies to only 2-label problems – Multi-label extensions are not globally optimal (but still usually provide very good solutions) Must satisfy

Graph cuts: Pros and Cons Pros – Very fast inference – Can incorporate data likelihoods and priors – Applies to a wide range of problems (stereo, image labeling, recognition) Cons – Not always applicable (associative only) – Need unary terms (not used for bottom-up segmentation, for example) Use whenever applicable

More about MRFs/CRFs Other common uses – Graph structure on regions – Encoding relations between multiple scene elements Inference methods – Loopy BP or BP-TRW Exact for tree-shaped structures Approximate solutions for general graphs More widely applicable and can produce marginals but often slower

Further reading and resources Graph cuts – – Classic paper: What Energy Functions can be Minimized via Graph Cuts? (Kolmogorov and Zabih, ECCV '02/PAMI '04)What Energy Functions can be Minimized via Graph Cuts? Belief propagation Yedidia, J.S.; Freeman, W.T.; Weiss, Y., "Understanding Belief Propagation and Its Generalizations”, Technical Report, 2001:

Next section: Object Recognition Face recognition Image categorization and general classification methods Object detection – Statistical templates – Parts-based methods Tracking objects