Optimal solution of binary problems Much material taken from :  Olga Veksler, University of Western Ontario

Slides:



Advertisements
Similar presentations
Lecture 5: Network Flow Algorithms Max-Flow Min-Cut Single-Source Shortest-Path (SSSP) Job Sequencing.
Advertisements

Graph Cut Algorithms for Computer Vision & Medical Imaging Ramin Zabih Computer Science & Radiology Cornell University Joint work with Y. Boykov, V. Kolmogorov,
Introduction to Markov Random Fields and Graph Cuts Simon Prince
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
Learning with Inference for Discrete Graphical Models Nikos Komodakis Pawan Kumar Nikos Paragios Ramin Zabih (presenter)
Optimal solution of binary problems Much material taken from :  Olga Veksler, University of Western Ontario
Graph-Based Image Segmentation
Foreground/Background Image Segmentation. What is our goal? To label each pixel in an image as belonging to either the foreground of the scene or the.
Piyush Kumar (Lecture 6: MaxFlow MinCut Applications)
1 s-t Graph Cuts for Binary Energy Minimization  Now that we have an energy function, the big question is how do we minimize it? n Exhaustive search is.
Learning with Inference for Discrete Graphical Models Nikos Komodakis Pawan Kumar Nikos Paragios Ramin Zabih (presenter)
1 Can this be generalized?  NP-hard for Potts model [K/BVZ 01]  Two main approaches 1. Exact solution [Ishikawa 03] Large graph, convex V (arbitrary.
Last Time Pinhole camera model, projection
Modelling with Max Flow 1. 2 The Max Flow Problem.
Totally Unimodular Matrices Lecture 11: Feb 23 Simplex Algorithm Elliposid Algorithm.
2010/5/171 Overview of graph cuts. 2010/5/172 Outline Introduction S-t Graph cuts Extension to multi-label problems Compare simulated annealing and alpha-
Stereo & Iterative Graph-Cuts Alex Rav-Acha Vision Course Hebrew University.
The max flow problem
MRF Labeling With Graph Cut CMPUT 615 Nilanjan Ray.
The plan for today Camera matrix
Lecture 10: Stereo and Graph Cuts
Job Scheduling Lecture 19: March 19. Job Scheduling: Unrelated Multiple Machines There are n jobs, each job has: a processing time p(i,j) (the time to.
Stereo Computation using Iterative Graph-Cuts
Comp 775: Graph Cuts and Continuous Maximal Flows Marc Niethammer, Stephen Pizer Department of Computer Science University of North Carolina, Chapel Hill.
Graph-Cut Algorithm with Application to Computer Vision Presented by Yongsub Lim Applied Algorithm Laboratory.
Max-flow/min-cut theorem Theorem: For each network with one source and one sink, the maximum flow from the source to the destination is equal to the minimal.
A Selective Overview of Graph Cut Energy Minimization Algorithms Ramin Zabih Computer Science Department Cornell University Joint work with Yuri Boykov,
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
Graph Cut & Energy Minimization
Advanced Algorithms Piyush Kumar (Lecture 4: MaxFlow MinCut Applications) Welcome to COT5405.
Graph Cut 韋弘 2010/2/22. Outline Background Graph cut Ford–Fulkerson algorithm Application Extended reading.
CS774. Markov Random Field : Theory and Application Lecture 13 Kyomin Jung KAIST Oct
10/11/10 A. Smith; based on slides by E. Demaine, C. Leiserson, S. Raskhodnikova, K. Wayne Adam Smith Algorithm Design and Analysis L ECTURE 22 Network.
Interactive Graph Cuts for Optimal Boundary & Region Segmentation of Objects in N-D Images (Fri) Young Ki Baik, Computer Vision Lab.
Digital Image Processing Lecture 18: Segmentation: Thresholding & Region-Based Prof. Charlene Tsai.
Graph Cuts Marc Niethammer. Segmentation by Graph-Cuts A way to compute solutions to the optimization problems we looked at before. Example: Binary Segmentation.
CS 4487/6587 Algorithms for Image Analysis
1 Markov Random Fields with Efficient Approximations Yuri Boykov, Olga Veksler, Ramin Zabih Computer Science Department CORNELL UNIVERSITY.
1/24 Introduction to Graphs. 2/24 Graph Definition Graph : consists of vertices and edges. Each edge must start and end at a vertex. Graph G = (V, E)
Lecture 19: Solving the Correspondence Problem with Graph Cuts CAP 5415 Fall 2006.
Maximum Flow Problem (Thanks to Jim Orlin & MIT OCW)
Presenter : Kuang-Jui Hsu Date : 2011/3/24(Thur.).
15.082J & 6.855J & ESD.78J October 7, 2010 Introduction to Maximum Flows.
15.082J and 6.855J March 4, 2003 Introduction to Maximum Flows.
Graphcut Textures Image and Video Synthesis Using Graph Cuts
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 25.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
Exercise 6.1 Find the number of different shortest paths from point A to point B in a city with perfectly horizontal streets and vertical avenues as shown.
A global approach Finding correspondence between a pair of epipolar lines for all pixels simultaneously Local method: no guarantee we will have one to.
Chapter 13 Backtracking Introduction The 3-coloring problem
Markov Random Fields in Vision
Approximation Algorithms Duality My T. UF.
Some links between min-cuts, optimal spanning forests and watersheds Cédric Allène, Jean-Yves Audibert, Michel Couprie, Jean Cousty & Renaud Keriven ENPC.
Hebrew University Image Processing Exercise Class 8 Panoramas – Stitching and Blending Min-Cut Stitching Many slides from Alexei Efros.
Energy minimization Another global approach to improve quality of correspondences Assumption: disparities vary (mostly) smoothly Minimize energy function:
Lap Chi Lau we will only use slides 4 to 19
Topics in Algorithms Lap Chi Lau.
Computer Vision Lecture 13: Image Segmentation III
Richard Anderson Lecture 26 NP-Completeness
CS4234 Optimiz(s)ation Algorithms
Markov Random Fields with Efficient Approximations
Richard Anderson Lecture 23 Network Flow
Computer Vision Lecture 12: Image Segmentation II
Graph Cut Weizhen Jing
Haim Kaplan and Uri Zwick
Lecture 31: Graph-Based Image Segmentation
Problem Solving 4.
Primal-Dual Algorithm
EE5900 Advanced Embedded System For Smart Infrastructure
Maximum Flow Problems in 2005.
Presentation transcript:

Optimal solution of binary problems Much material taken from :  Olga Veksler, University of Western Ontario

2 Announcements  Project proposal due March 31 – to RDZ –One or two paragraphs  Project will be due the last week of classes, or perhaps a bit later  Ashish will lecture on Friday

3 Motivating example  Suppose we want to find a bright object against a dark background –But some of the pixel values are slightly wrong

4 Optimization viewpoint  Find best (least expensive) binary image –Costs: C1 (labeling) and C2 (boundary)  C1: Labeling a dark pixel as foreground –Or, a bright pixel as background  If we only had labeling costs, the cheapest solution is the thresholded output  C2: The length of the boundary between foreground and background –Penalizes isolated pixels or ragged boundaries

5 MAP-MRF energy function LikelihoodPrior  Generalization of C2 is –Think of V as the cost for two adjacent pixels to have these particular labels –For binary images, the natural cost is uniform  Bayesian energy function:

6 Generalizations  Many vision problems have this form  The optimization techniques are specific to these energy function, but not to images –See: [Kleinberg & Tardos JACM 02]  Historically solved by gradient descent or related methods (e.g. annealing) –Optimization method and energy function are not independent choices! –Use the most specific method you can And, be prepared to tweak your problem

7 Binary labeling problems  Consider the case of two labels only –Surprisingly important Lots of nice applications Same basic ideas used for more labels  There is a fast exact solution! –Turn a problem you don’t know how to solve into a problem you do (reduction) Due to Hammer (1965) originally Job scheduling problems: Stone (1977) Images: Greig, Porteus & Seheult (1989)

8 Binary Labeling: Motivation  Suppose we receive a noisy fax: –Some black pixels in the original image were flipped to white pixels, and some white pixels were flipped to black n We want to try to clean up (or restore) the original image: original image restored image n This problem is called image restoration (denoising)

9 Binary Labeling Problem : Motivation  Fax image is binary: each pixel is either –black (stored as 0) –or white (stored as 1) n What we know: 1)In the restored image, each pixels should also be either black (0) or white (1) 2)Data Constraint: if a pixel is black in the original image, it is more likely to be black in the restored image; and a white pixel in the original image is more likely to be white in the restored image 3)Prior Constraint: in the restored image, white pixels should form coherent groups, as should black pixels original image restored image

10 Binary Labeling Problem  We can formulate our restoration problem as a labeling problem: –Labels: black (0) and white (1) –Set of sites: all image pixels I will say set of “sites” or set of pixels interchangeably original image set of sites P, and one possible labeling Assign a label to each site (either the black or the white label) s.t. –If a pixel is black (white) in the original image, it is more likely to get the black (white) label –Black labeled pixels tend to group together, and white labeled pixels tend to group together

11 Binary Labeling Problem: Constraints  Our Constraints: 1.If a pixel is black (white) in the original image, it is more likely to get the black (white) label 2.Black labeled pixels tend to group together, and white labeled pixels tend to group together original image good labeling bad labeling (constraint 1) bad labeling (constraint 2)

12 Binary Labeling Problem: Data Constraints  How can we find a a good labeling (i.e., satisfying our constraints)? original image a good labeling L n Formulate and minimize an energy function on labelings L: Let L p be the label assigned to pixel p – L p = 0 or L p = 1 Let I(p) be the intensity of pixel p in the original image Data constraint is modeled by the Data Penalty D P (L P ) –D P (0) < D P (1) if I(p) = 0 –D P (0) > D P (1) if I(p) = 1

13 Binary Labeling Problem: Data Constraints  In our example, we can make –if I(p) = black then D P (black) = 0 D P (white) = 4 –if I(p) = white then D P (black) = 4 D P (white) = 0 original image a good labeling L n To figure out how well image as a whole satisfies the data constraint, sum up data terms over all image pixels:

14 Binary Labeling Problem: Prior Constraints  To model our prior constraints, simply count the number “discontinuities” in a labeling L: –There is a discontinuity between pixels p and q if labels p and q have different labels –The more pixels with equal labels group together in coherent groups, the less discontinuities there are 31 discontinuities some discontinuities are marked 8 discontinuities all discontinuities are marked

15 Binary Labeling: Data Constraints  How to count the number of discontinuities in a labeling L? –Let N be the set of all adjacent pixels –Thus our N consists of edges between immediately adjacent pixels 31 discontinuities Let I (b) be the identity function I (b) =1 when its argument b is true I (b) =0 when its argument b is false To count all discontinuities in a labeling L, N consists of all edges

16 Binary Labeling Problem: Energy Formulation  Our final energy, which takes into consideration the data and the prior constraints is: data term prior term Data term says that in a good labeling L pixels should be labeled as close as possible to their colors in the original (noisy) image Prior term says that in a good labeling L pixels should be labeled as to form spatially coherent blocks (as few discontinuities as possible)

17 Binary Labeling Problem: Energy Formulation  Note that data term and prior term want different things: data term prior term Best labeling as far as the data term is concerned is the original image: Best labeling considering only the prior term is completely black or completely white:

18 Binary Labeling Problem: Energy Formulation  serves as a balancing parameter between the data term and the prior term: –The larger the, the less discontinuities in the optimal labeling L –The smaller the, the more the optimal labeling L looks like the original image data term prior term =0 =huge number

19 s-t Graph Cuts for Binary Energy Minimization  Now that we have an energy function, the big question is how do we minimize it? n Exhaustive search is exponential: if n is the number of pixels, there are 2 n possible labelings L data term prior term

20 Maximum flow problem  Max flow problem: –Each edge is a “pipe” –Find the largest flow F of “water” that can be sent from the “source” to the “sink” along the pipes –Source output = sink input = flow value –Edge weights give the pipe’s capacity “source” A graph with two terminals S T “sink” a flow F

21 Minimum cut problem  Min cut problem: –Find the cheapest way to cut the edges so that the “source” is separated from the “sink” –Cut edges going from source side to sink side –Edge weights now represent cutting “costs” a cut C “source” A graph with two terminals S T “sink”

22 Max flow/Min cut theorem  Max Flow = Min Cut: –Proof sketch: value of a flow is value over any cut –Maximum flow saturates the edges along the minimum cut Ford and Fulkerson, 1962 Problem reduction!  Ford and Fulkerson gave first polynomial time algorithm for globally optimal solution “source” A graph with two terminals S T “sink”