Graphical Models and Learning

Slides:



Advertisements
Similar presentations
MAP Estimation Algorithms in
Advertisements

Primal-dual Algorithm for Convex Markov Random Fields Vladimir Kolmogorov University College London GDR (Optimisation Discrète, Graph Cuts et Analyse d'Images)
Algorithms for MAP estimation in Markov Random Fields Vladimir Kolmogorov University College London Tutorial at GDR (Optimisation Discrète, Graph Cuts.
Lecture 5: Network Flow Algorithms Max-Flow Min-Cut Single-Source Shortest-Path (SSSP) Job Sequencing.
Introduction to Markov Random Fields and Graph Cuts Simon Prince
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
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.
Robust Higher Order Potentials For Enforcing Label Consistency
P 3 & Beyond Solving Energies with Higher Order Cliques Pushmeet Kohli Pawan Kumar Philip H. S. Torr Oxford Brookes University CVPR 2007.
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.
Maximum Flows Lecture 4: Jan 19. Network transmission Given a directed graph G A source node s A sink node t Goal: To send as much information from s.
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.
What Energy Functions Can be Minimized Using Graph Cuts? Shai Bagon Advanced Topics in Computer Vision June 2010.
Relaxations and Moves for MAP Estimation in MRFs M. Pawan Kumar STANFORDSTANFORD Vladimir KolmogorovPhilip TorrDaphne Koller.
Measuring Uncertainty in Graph Cut Solutions Pushmeet Kohli Philip H.S. Torr Department of Computing Oxford Brookes University.
Computer vision: models, learning and inference
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
Multiplicative Bounds for Metric Labeling M. Pawan Kumar École Centrale Paris École des Ponts ParisTech INRIA Saclay, Île-de-France Joint work with Phil.
CS774. Markov Random Field : Theory and Application Lecture 13 Kyomin Jung KAIST Oct
Lecture 5: Network Flow Algorithms Single-Source Shortest-Path (SSSP) (Dijkstra's Algorithm) Max Flow - Min Cut (Ford-Fulkerson) Job Sequencing.
Multiplicative Bounds for Metric Labeling M. Pawan Kumar École Centrale Paris Joint work with Phil Torr, Daphne Koller.
Rounding-based Moves for Metric Labeling M. Pawan Kumar Center for Visual Computing Ecole Centrale Paris.
Discrete Optimization Lecture 5 – Part 2 M. Pawan Kumar Slides available online
Graph Cuts Marc Niethammer. Segmentation by Graph-Cuts A way to compute solutions to the optimization problems we looked at before. Example: Binary Segmentation.
Probabilistic Inference Lecture 3 M. Pawan Kumar Slides available online
Algorithms for MAP estimation in Markov Random Fields Vladimir Kolmogorov University College London.
Discrete Optimization in Computer Vision M. Pawan Kumar Slides will be available online
Probabilistic Inference Lecture 5 M. Pawan Kumar Slides available online
Lecture 19: Solving the Correspondence Problem with Graph Cuts CAP 5415 Fall 2006.
Machine Learning – Lecture 15
Discrete Optimization Lecture 1 M. Pawan Kumar Slides available online
Pushmeet Kohli. E(X) E: {0,1} n → R 0 → fg 1 → bg Image (D) n = number of pixels [Boykov and Jolly ‘ 01] [Blake et al. ‘04] [Rother, Kolmogorov and.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
Outline Standard 2-way minimum graph cut problem. Applications to problems in computer vision Classical algorithms from the theory literature A new algorithm.
Fall 2003Maximum Flow1 w s v u t z 3/33/3 1/91/9 1/11/1 3/33/3 4/74/7 4/64/6 3/53/5 1/11/1 3/53/5 2/22/2 
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
Markov Random Fields in Vision
Rounding-based Moves for Metric Labeling M. Pawan Kumar École Centrale Paris INRIA Saclay, Île-de-France.
TU/e Algorithms (2IL15) – Lecture 8 1 MAXIMUM FLOW (part II)
Polyhedral Optimization Lecture 2 – Part 2 M. Pawan Kumar Slides available online
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
Submodularity Reading Group Minimum Cut, Dinic’s Algorithm
CS4234 Optimiz(s)ation Algorithms
Markov Random Fields with Efficient Approximations
Lectures on Network Flows
Richard Anderson Lecture 23 Network Flow
Lecture 22 Network Flow, Part 2
CSCI 3160 Design and Analysis of Algorithms Tutorial 8
Graph Cut Weizhen Jing
Efficient Graph Cut Optimization for Full CRFs with Quantized Edges
Discrete Inference and Learning
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
CSE Algorithms Max Flow Problems 11/21/02 CSE Max Flow.
Lecture 10 Network flow Max-flow and Min-cut Ford-Fulkerson method
Introduction to Maximum Flows
Haim Kaplan and Uri Zwick
Richard Anderson Lecture 23 Network Flow
Richard Anderson Lecture 23 Network Flow
Richard Anderson Lecture 21 Network Flow
Discrete Optimization Methods Basic overview of graph cuts
Flow Networks and Bipartite Matching
Primal-Dual Algorithm
Algorithms (2IL15) – Lecture 7
EE5900 Advanced Embedded System For Smart Infrastructure
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
Richard Anderson Lecture 22 Network Flow
Lecture 21 Network Flow, Part 1
Lecture 22 Network Flow, Part 2
Presentation transcript:

Graphical Models and Learning Lecture 3: Maximum Flow, Minimum Cut Yuliya Tarabalka yuliya.tarabalka@inria.fr Slides courtesy of Pawan Kumar

Outline Preliminaries Maximum Flow Algorithms Functions and Excess Functions s-t Flow s-t Cut Flows vs. Cuts Maximum Flow Algorithms Energy minimization with max flow/min cut

Context Example: network optimization problems

Maximum flow problem Applications Maximize the flow through a company’s distribution network from factories to customers Maximize the flow of oil through a system of pipelines Maximize the flow of vehicles through a transportation network

Functions on Arcs D = (V, A) s 1 1 10 8 Arc capacities c(a) 4 6 v1 v2 Function f: A  Reals 3 3 2 Excess function Ef(v) Incoming value - Outgoing value v3 v4 5 7 3 3 t

Functions on Arcs D = (V, A) s 1 1 10 8 Arc capacities c(a) 4 6 v1 v2 Function f: A  Reals 3 3 2 Excess function Ef(v) Σain-arcs(v) f(a) - Outgoing value v3 v4 5 7 3 3 t

Functions on Arcs D = (V, A) s 1 1 10 8 Arc capacities c(a) 4 6 v1 v2 Function f: A  Reals 3 3 2 Excess function Ef(v) Σain-arcs(v) f(a) - Σaout-arcs(v) f(a) v3 v4 5 7 3 3 t

Functions on Arcs D = (V, A) s 1 1 10 8 Arc capacities c(a) 4 6 v1 v2 Function f: A  Reals 3 3 2 Excess function Ef(v) f(in-arcs(v)) - f(out-arcs(v)) v3 v4 5 7 3 3 t Ef(v1) -6

Functions on Arcs D = (V, A) s 1 1 10 8 Arc capacities c(a) 4 6 v1 v2 Function f: A  Reals 3 3 2 Excess function Ef(v) f(in-arcs(v)) - f(out-arcs(v)) v3 v4 5 7 3 3 t Ef(v2) 14

Excess Functions of Vertex Subsets Excess function Ef(U) 1 1 10 8 Incoming Value - Outgoing Value 4 6 v1 v2 3 3 2 v3 v4 5 7 3 3 t

Excess Functions of Vertex Subsets Excess function Ef(U) 1 1 10 8 Σain-arcs(U) f(a) - Outgoing Value 4 6 v1 v2 3 3 2 v3 v4 5 7 3 3 t

Excess Functions of Vertex Subsets Excess function Ef(U) 1 1 10 8 Σain-arcs(U) f(a) - Σaout-arcs(U) f(a) 4 6 v1 v2 3 3 2 v3 v4 5 7 3 3 t

Excess Functions of Vertex Subsets Excess function Ef(U) 1 1 10 8 f(in-arcs(U)) - f(out-arcs(U)) 4 6 v1 v2 3 3 2 Ef({v1,v2}) 8 v3 v4 5 7 3 3 t

Excess Functions of Vertex Subsets Excess function Ef(U) 1 1 10 8 f(in-arcs(U)) - f(out-arcs(U)) 4 6 v1 v2 3 3 2 Ef({v1,v2}) -6 + 14 v3 v4 5 Ef(U) = ΣvU Ef(v) 7 3 3 t

Outline Preliminaries Maximum Flow Algorithms Functions and Excess Functions s-t Flow s-t Cut Flows vs. Cuts Maximum Flow Algorithms Energy minimization with max flow/min cut

s-t Flow s Function flow: A  R 1 8 Flow of arc ≤ arc capacity 6 v1 v2 Flow is non-negative 3 2 For all vertex except s,t v3 v4 Incoming flow 5 = Outgoing flow 7 3 t

s-t Flow s Function flow: A  R 1 8 flow(a) ≤ c(a) 6 v1 v2 Flow is non-negative 3 2 For all vertex except s,t v3 v4 Incoming flow 5 = Outgoing flow 7 3 t

s-t Flow s Function flow: A  R 1 8 flow(a) ≤ c(a) 6 v1 v2 flow(a) ≥ 0 3 2 For all vertex except s,t v3 v4 Incoming flow 5 = Outgoing flow 7 3 t

s-t Flow s Function flow: A  R 1 8 flow(a) ≤ c(a) 6 v1 v2 flow(a) ≥ 0 3 2 For all v  V \ {s,t} v3 v4 Incoming flow 5 = Outgoing flow 7 3 t

s-t Flow s Function flow: A  R 1 8 flow(a) ≤ c(a) 6 v1 v2 flow(a) ≥ 0 3 2 For all v  V \ {s,t} v3 v4 Σ(u,v)A flow((u,v)) 5 = Outgoing flow 7 3 t

s-t Flow s Function flow: A  R 1 8 flow(a) ≤ c(a) 6 v1 v2 flow(a) ≥ 0 3 2 For all v  V \ {s,t} v3 v4 Σ(u,v)A flow((u,v)) 5 = Σ(v,u)A flow((v,u)) 7 3 t

s-t Flow s Function flow: A  R 1 8 flow(a) ≤ c(a) 6 v1 v2 flow(a) ≥ 0 3 2 For all v  V \ {s,t} v3 v4 Eflow(v) = 0 5 7 3 t

✗ s-t Flow s Function flow: A  R 1 1 10 8 4 flow(a) ≤ c(a) 6 v1 v2 3 3 2 For all v  V \ {s,t} v3 v4 Eflow(v) = 0 5 7 3 3 ✗ t

✗ s-t Flow s Function flow: A  R -1 1 8 flow(a) ≤ c(a) 6 v1 v2 3 2 For all v  V \ {s,t} v3 v4 Eflow(v) = 0 5 7 -1 3 ✗ t

✓ s-t Flow s Function flow: A  R 1 1 8 flow(a) ≤ c(a) 6 v1 v2 3 2 For all v  V \ {s,t} v3 v4 Eflow(v) = 0 5 7 1 3 ✓ t

Value of s-t Flow s 1 8 6 v1 v2 Outgoing flow of s 3 2 - Incoming flow of s v3 v4 5 7 3 t

Value of s-t Flow s -Eflow(s) Eflow(t) 1 8 6 v1 v2 Σ(s,v)A flow((s,v)) 3 2 - Σ(u,s)A flow((u,s)) v3 v4 5 7 3 t

Value of s-t Flow s -Eflow(s) Eflow(t) 1 1 8 6 v1 v2 Σ(s,v)A flow((s,v)) 1 3 2 - Σ(u,s)A flow((u,s)) v3 v4 Value = 1 5 7 1 3 t

Outline Preliminaries Maximum Flow Algorithms Functions and Excess Functions s-t Flow s-t Cut Flows vs. Cuts Maximum Flow Algorithms Energy minimization with max flow/min cut

Cut D = (V, A) Let U be a subset of V 10 v1 v2 3 2 C is a set of arcs such that (u,v)  A u  U v  V\U v3 v4 5 C is a cut in the digraph D

✓ Cut D = (V, A) U What is C? 10 v1 v2 {(v1,v2),(v1,v4)} ? 3 2 5 V\U

✓ Cut D = (V, A) V\U U What is C? 10 v1 v2 {(v1,v2),(v1,v4),(v3,v2)} ? 5

✓ Cut D = (V, A) U V\U What is C? 10 v1 v2 {(v1,v2),(v1,v4),(v3,v2)} ? 5

Cut D = (V, A) 10 v1 v2 3 2 C = out-arcs(U) v3 v4 5

Capacity of Cut 10 v1 v2 3 2 Sum of capacity of all arcs in C v3 v4 5

Capacity of Cut 10 v1 v2 3 2 Σa  C c(a) v3 v4 5

Capacity of Cut U 10 v1 v2 3 3 2 v3 v4 5 V\U

Capacity of Cut U V\U 10 v1 v2 15 3 2 v3 v4 5

s-t Cut s D = (V, A) 1 8 A source vertex “s” 6 v1 v2 A sink vertex “t” 3 2 C is a cut such that s  U t  V\U v3 v4 5 7 3 C is an s-t cut t

Capacity of s-t Cut s 1 8 6 v1 v2 Σa  C c(a) 3 2 v3 v4 5 7 3 t

Capacity of s-t Cut s 1 8 6 v1 v2 5 3 2 v3 v4 5 7 3 t

Capacity of s-t Cut s 1 8 6 v1 v2 17 3 2 v3 v4 5 7 3 t

Outline Preliminaries Maximum Flow Algorithms Functions and Excess Functions s-t Flow s-t Cut Flows vs. Cuts Maximum Flow Algorithms Energy minimization with max flow/min cut

Flows vs. Cuts An s-t flow function : A  Reals An s-t cut C such that s  U, t  V\U Value of flow ≤ Capacity of C

Flows vs. Cuts Value of flow = -Eflow(s) = -Eflow(s) - ΣvU\{s} Eflow(v) = -Eflow(U) = flow(out-arcs(U)) - flow(in-arcs(U)) ≤ Capacity of C - flow(in-arcs(U))

Flows vs. Cuts Value of flow = -Eflow(s) = -Eflow(s) - ΣvU\{s} Eflow(v) = -Eflow(U) = flow(out-arcs(U)) - flow(in-arcs(U)) ≤ Capacity of C When does equality hold?

Flows vs. Cuts Value of flow = -Eflow(s) = -Eflow(s) - ΣvU\{s} Eflow(v) = -Eflow(U) = flow(out-arcs(U)) - flow(in-arcs(U)) ≤ Capacity of C flow(a) = c(a), a  out-arcs(U) flow(a) = 0, a  in-arcs(U)

Flows vs. Cuts Value of flow = -Eflow(s) = -Eflow(s) - ΣvU\{s} Eflow(v) = -Eflow(U) = flow(out-arcs(U)) - flow(in-arcs(U)) = Capacity of C flow(a) = c(a), a  out-arcs(U) flow(a) = 0, a  in-arcs(U)

Outline Preliminaries Maximum Flow Algorithms Residual Graph Max-Flow Min-Cut Theorem Algorithms Energy minimization with max flow/min cut

Maximum Flow Problem s Find the flow with the maximum value !! 2 4 3 Σ(s,v)A flow((s,v)) 1 2 - Σ(u,s)A flow((u,s)) t First suggestion to solve this problem !!

Passing Flow through s-t Paths Find an s-t path where flow(a) < c(a) for all arcs 2 4 3 v1 v2 1 2 t

Passing Flow through s-t Paths Find an s-t path where flow(a) < c(a) for all arcs 1 2 4 3 v1 v2 Pass maximum allowable flow through the arcs 1 1 2 t

Passing Flow through s-t Paths Find an s-t path where flow(a) < c(a) for all arcs 1 2 4 3 v1 v2 1 1 2 t

Passing Flow through s-t Paths Find an s-t path where flow(a) < c(a) for all arcs 1 2 4 2 3 v1 v2 Pass maximum allowable flow through the arcs 1 1 2 2 t

Passing Flow through s-t Paths Find an s-t path where flow(a) < c(a) for all arcs 1 2 4 2 3 v1 v2 No more paths. Stop. 1 1 2 2 t Will this give us maximum flow? NO !!!

Passing Flow through s-t Paths Find an s-t path where flow(a) < c(a) for all arcs 2 2 4 2 3 v1 v2 Pass maximum allowable flow through the arcs 1 2 2 t

Passing Flow through s-t Paths Find an s-t path where flow(a) < c(a) for all arcs 2 2 4 2 3 v1 v2 No more paths. Stop. 1 2 2 t Another method? Incorrect Answer !!

Outline Preliminaries Maximum Flow Algorithms Residual Graph Max-Flow Min-Cut Theorem Algorithms Energy minimization with max flow/min cut

Residual Graph s s 2 2 4 2 3 v1 v2 v1 v2 1 2 2 t t Arcs where flow(a) < c(a)

Residual Graph s s 2 2 4 2 3 v1 v2 v1 v2 1 2 2 t t Including arcs to s and from t is not necessary Inverse of arcs where flow(a) > 0

Maximum Flow using Residual Graphs 2 4 3 v1 v2 v1 v2 1 2 t t Start with zero flow.

Maximum Flow using Residual Graphs 2 4 3 v1 v2 v1 v2 1 2 t t Find an s-t path in the residual graph.

Maximum Flow using Residual Graphs 2 4 3 v1 v2 v1 v2 1 2 t t Find an s-t path in the residual graph.

Maximum Flow using Residual Graphs 2 4 3 v1 v2 v1 v2 1 2 t t For inverse arcs in path, subtract flow K.

Maximum Flow using Residual Graphs 2 4 3 v1 v2 v1 v2 1 2 t t Choose maximum allowable value of K. For forward arcs in path, add flow K.

Maximum Flow using Residual Graphs 2 2 4 2 3 v1 v2 v1 v2 1 2 2 t t Choose maximum allowable value of K. For forward arcs in path, add flow K.

Maximum Flow using Residual Graphs 2 2 4 2 3 v1 v2 v1 v2 1 2 2 t t Update the residual graph.

Maximum Flow using Residual Graphs 2 2 4 2 3 v1 v2 v1 v2 1 2 2 t t Find an s-t path in the residual graph.

Maximum Flow using Residual Graphs 2 2 4 2 3 v1 v2 v1 v2 1 2 2 t t Find an s-t path in the residual graph.

Maximum Flow using Residual Graphs 2 2 4 2 3 v1 v2 v1 v2 1 2 2 t t Choose maximum allowable value of K. Add K to (s,v2) and (v1,t). Subtract K from (v1,v2).

Maximum Flow using Residual Graphs 2 2 4 1 1 3 v1 v2 v1 v2 1 1 2 2 t t Choose maximum allowable value of K. Add K to (s,v2) and (v1,t). Subtract K from (v1,v2).

Maximum Flow using Residual Graphs 2 2 4 1 1 3 v1 v2 v1 v2 1 1 2 2 t t Update the residual graph.

Maximum Flow using Residual Graphs 2 2 4 1 1 3 v1 v2 v1 v2 1 1 2 2 t t Find an s-t path in the residual graph.

Maximum Flow using Residual Graphs 2 2 4 1 1 3 v1 v2 v1 v2 1 1 2 2 t t No more s-t paths. Stop.

Maximum Flow using Residual Graphs 2 2 4 1 1 3 v1 v2 v1 v2 1 1 2 2 t t Correct Answer.

Maximum Flow using Residual Graphs 1 4 3 v1 v2 v1 v2 2 2 t t Start with zero flow

Maximum Flow using Residual Graphs 1 4 3 v1 v2 v1 v2 2 2 t t Find an s-t path in the residual graph.

Maximum Flow using Residual Graphs 1 4 3 v1 v2 v1 v2 2 2 t t Find an s-t path in the residual graph.

Maximum Flow using Residual Graphs 1 4 3 v1 v2 v1 v2 2 2 t t For inverse arcs in path, subtract flow K.

Maximum Flow using Residual Graphs 1 4 3 v1 v2 v1 v2 2 2 t t Choose maximum allowable value of K. For forward arcs in path, add flow K.

Maximum Flow using Residual Graphs 1 1 4 1 3 v1 v2 v1 v2 2 2 1 t t Choose maximum allowable value of K. For forward arcs in path, add flow K.

Maximum Flow using Residual Graphs 1 1 4 1 3 v1 v2 v1 v2 2 2 1 t t Update the residual graph.

Maximum Flow using Residual Graphs 1 1 4 1 3 v1 v2 v1 v2 2 2 1 t t Find an s-t path in the residual graph.

Maximum Flow using Residual Graphs 1 1 4 1 3 v1 v2 v1 v2 2 2 1 t t Find an s-t path in the residual graph.

Maximum Flow using Residual Graphs 1 1 4 1 3 v1 v2 v1 v2 2 2 1 t t Choose maximum allowable value of K. Add K to (s,v2) and (v1,t). Subtract K from (v1,v2).

Maximum Flow using Residual Graphs 1 1 4 1 3 v1 v2 v1 v2 1 2 2 1 t t Choose maximum allowable value of K. Add K to (s,v2) and (v1,t). Subtract K from (v1,v2).

Maximum Flow using Residual Graphs 1 1 4 1 3 v1 v2 v1 v2 1 2 2 1 t t Update the residual graph.

Maximum Flow using Residual Graphs 1 1 4 1 3 v1 v2 v1 v2 1 2 2 1 t t Find an s-t path in the residual graph.

Maximum Flow using Residual Graphs 1 1 4 1 3 v1 v2 v1 v2 1 2 2 1 t t Find an s-t path in the residual graph.

Maximum Flow using Residual Graphs 1 1 4 1 3 v1 v2 v1 v2 1 2 2 1 t t Choose maximum allowable value of K. Add K to (s,v2) and (v2,t).

Maximum Flow using Residual Graphs 1 1 4 2 3 v1 v2 v1 v2 1 2 2 2 t t Choose maximum allowable value of K. Add K to (s,v2) and (v2,t).

Maximum Flow using Residual Graphs 1 1 4 2 3 v1 v2 v1 v2 1 2 2 2 t t Update residual graph.

Maximum Flow using Residual Graphs 1 1 4 2 3 v1 v2 v1 v2 1 2 2 2 t t No more s-t paths. Stop.

Maximum Flow using Residual Graphs 1 1 4 2 3 v1 v2 v1 v2 1 2 2 2 t t How can I be sure this will always work?

Outline Preliminaries Maximum Flow Algorithms Residual Graph Max-Flow Min-Cut Theorem Algorithms Energy minimization with max flow/min cut

Let the subset of vertices U be reachable from s. Max-Flow Min-Cut s s 1 1 4 2 3 v1 v2 v1 v2 1 2 2 2 t t t is not in U. Let the subset of vertices U be reachable from s.

Max-Flow Min-Cut s s 1 1 4 2 3 v1 v2 v1 v2 1 2 2 2 t t Or else a will be in the residual graph. For all a  out-arcs(U), flow(a) = c(a).

Max-Flow Min-Cut s s 1 1 4 2 3 v1 v2 v1 v2 1 2 2 2 t t Or else inverse of a will be in the residual graph. For all a  in-arcs(U), flow(a) = 0.

Max-Flow Min-Cut s s 1 1 4 2 3 v1 v2 v1 v2 1 2 2 2 t t For all a  out-arcs(U), flow(a) = c(a). For all a  in-arcs(U), flow(a) = 0.

Flows vs. Cuts Value of flow = -Eflow(s) = -Eflow(s) - ΣvU\{s} Eflow(v) = -Eflow(U) = flow(out-arcs(U)) - flow(in-arcs(U)) = Capacity of C flow(a) = c(a), a  out-arcs(U) flow(a) = 0, a  in-arcs(U)

Capacity(C) = Value(flow) Max-Flow Min-Cut s s 1 1 4 2 3 v1 v2 v1 v2 1 2 2 2 t t Minimum Cut Maximum Flow Capacity(C) = Value(flow)

Outline Preliminaries Maximum Flow Algorithms Ford-Fulkerson Algorithm Dinits Algorithm Energy minimization with max flow/min cut

Ford-Fulkerson Algorithm Start with flow = 0 for all arcs. Find an s-t path in the residual graph. Pass maximum allowable flow. REPEAT Subtract from inverse arcs. Add to forward arcs. Until s and t are disjoint in the residual graph.

Ford-Fulkerson Algorithm 1 v1 v2 v1 v2 10k 10k t t Start with zero flow

Ford-Fulkerson Algorithm 1 v1 v2 v1 v2 10k 10k t t Find an s-t path in the residual graph.

Ford-Fulkerson Algorithm 1 v1 v2 v1 v2 10k 10k t t Find an s-t path in the residual graph.

Ford-Fulkerson Algorithm 1 v1 v2 v1 v2 10k 10k t t Pass the maximum allowable flow.

Ford-Fulkerson Algorithm 1 10k 10k 1 1 v1 v2 v1 v2 10k 10k t 1 t Pass the maximum allowable flow.

Ford-Fulkerson Algorithm 1 10k 10k 1 1 v1 v2 v1 v2 10k 10k t 1 t Update the residual graph.

Ford-Fulkerson Algorithm 1 10k 10k 1 1 v1 v2 v1 v2 10k 10k t 1 t Find an s-t path in the residual graph.

Ford-Fulkerson Algorithm 1 10k 10k 1 1 v1 v2 v1 v2 10k 10k t 1 t Find an s-t path in the residual graph.

Ford-Fulkerson Algorithm 1 10k 10k 1 1 v1 v2 v1 v2 10k 10k t 1 t Complexity is exponential in k.

Ford-Fulkerson Algorithm 1 10k 10k 1 1 v1 v2 v1 v2 10k 10k t 1 t For examples, see Uri Zwick, 1993 Irrational arc lengths can lead to infinite iterations.

Ford-Fulkerson Algorithm 1 10k 10k 1 1 v1 v2 v1 v2 10k 10k t 1 t Choose wisely. There are good paths and bad paths.

Outline Preliminaries Maximum Flow Algorithms Ford-Fulkerson Algorithm Dinits Algorithm Energy minimization with max flow/min cut

Dinits Algorithm Start with flow = 0 for all arcs. Find the minimum s-t path in the residual graph. Pass maximum allowable flow. REPEAT Subtract from inverse arcs. Add to forward arcs. Until s and t are disjoint in the residual graph.

Dinits Algorithm s s 10k 10k 1 v1 v2 v1 v2 10k 10k t t Start with zero flow

Find the minimum s-t path in the residual graph. Dinits Algorithm s s 10k 10k 1 v1 v2 v1 v2 10k 10k t t Find the minimum s-t path in the residual graph.

Find the minimum s-t path in the residual graph. Dinits Algorithm s s 10k 10k 1 v1 v2 v1 v2 10k 10k t t Find the minimum s-t path in the residual graph.

Pass the maximum allowable flow. Dinits Algorithm s s 10k 10k 1 v1 v2 v1 v2 10k 10k t t Pass the maximum allowable flow.

Pass the maximum allowable flow. Dinits Algorithm s s 10k 10k 10k 1 v1 v2 v1 v2 10k 10k 10k t t Pass the maximum allowable flow.

Update the residual graph. Dinits Algorithm s s 10k 10k 10k 1 v1 v2 v1 v2 10k 10k 10k t t Update the residual graph.

Find the minimum s-t path in the residual graph. Dinits Algorithm s s 10k 10k 10k 1 v1 v2 v1 v2 10k 10k 10k t t Find the minimum s-t path in the residual graph.

Find the minimum s-t path in the residual graph. Dinits Algorithm s s 10k 10k 10k 1 v1 v2 v1 v2 10k 10k 10k t t Find the minimum s-t path in the residual graph.

Pass the maximum allowable flow. Dinits Algorithm s s 10k 10k 10k 1 v1 v2 v1 v2 10k 10k 10k t t Pass the maximum allowable flow.

Pass the maximum allowable flow. Dinits Algorithm s s 10k 10k 10k 10k 1 v1 v2 v1 v2 10k 10k 10k t 10k t Pass the maximum allowable flow.

Update the residual graph. Dinits Algorithm s s 10k 10k 10k 10k 1 v1 v2 v1 v2 10k 10k 10k t 10k t Update the residual graph.

Dinits Algorithm s s 10k 10k 10k 10k 1 v1 v2 v1 v2 10k 10k 10k t 10k t No more s-t paths. Stop.

Solvers for the Minimum-Cut Problem Augmenting Path and Push-Relabel n: #nodes m: #arcs U: maximum arc length [Slide credit: Andrew Goldberg]

Max-Flow in Computer Vision Specialized algorithms for vision problems Grid graphs Low connectivity (m ~ O(n)) Dual search tree augmenting path algorithm [Boykov and Kolmogorov PAMI 2004] Finds approximate shortest augmenting paths efficiently High worst-case time complexity Empirically outperforms other algorithms on vision problems Efficient code available on the web http://www.adastral.ucl.ac.uk/~vladkolm/software.html

Outline Preliminaries Maximum Flow Algorithms Energy minimization with max flow/min cut Two-Label Energy Functions

Interactive Binary Segmentation Foreground histogram of RGB values FG Background histogram of RGB values BG ‘1’ indicates foreground and ‘0’ indicates background

Interactive Binary Segmentation More likely to be foreground than background

Interactive Binary Segmentation θp(0) proportional to -log(BG(da)) θp(1) proportional to -log(FG(da)) More likely to be background than foreground

Interactive Binary Segmentation More likely to belong to same label

Interactive Binary Segmentation θpq(i,k) proportional to exp(-(da-db)2) if i ≠ k θpq(i,k) = 0 if i = k Less likely to belong to same label

Overview Energy E Digraph D One vertex per random variable + Additional vertices “s” and “t” Compute Minimum Cut vp  U implies xp = 0 Labeling x U and V\U vp  V\U implies xp = 1

Digraph for Unary Potentials B θp(1) xp = 0 θp(0) xp = 1 Xp

Digraph for Unary Potentials B s xp = 0 xp = 1 vp t

Digraph for Unary Potentials B Let A ≥ B s xp = 0 xp = 1 vp Constant A-B A-B B t +

Digraph for Unary Potentials B Let A ≥ B s xp = 0 xp = 1 xp = 1 vp Constant A-B A-B B t +

Digraph for Unary Potentials B Let A ≥ B s xp = 0 xp = 1 xp = 0 vp Constant A-B A-B A-B B t +

Digraph for Unary Potentials B Let A < B s xp = 0 B-A xp = 1 vp Constant B-A A t +

Digraph for Unary Potentials B Let A < B s xp = 0 B-A xp = 1 xp = 1 vp Constant B-A B-A A t +

Digraph for Unary Potentials B Let A < B s xp = 0 B-A xp = 1 xp = 0 vp Constant B-A A t +

Digraph for Pairwise Potentials xp = 0 xp = 1 θpq(1,1) A C B D xq = 0 θpq(0,1) θpq(1,0) xq = 1 θpq(0,0) Xp Xq A B-A D-B C+B-D-A + + +

Digraph for Pairwise Potentials xp = 0 xp = 1 A C B D xq = 0 s xq = 1 Constant vp vq A t B-A D-B C+B-D-A + + +

Digraph for Pairwise Potentials xp = 0 xp = 1 A C B D xq = 0 s B-A xq = 1 vp vq Unary Potential xq = 1 t B-A D-B C+B-D-A + +

Digraph for Pairwise Potentials xp = 0 xp = 1 A C B D xq = 0 s D-B B-A xq = 1 vp vq t Unary Potential xp = 1 D-B C+B-D-A +

Digraph for Pairwise Potentials xp = 0 xp = 1 A C B D xq = 0 s D-B B-A xq = 1 C+B-D-A vp vq t Pairwise Potential xp = 1, xq = 0 C+B-D-A

Digraph for Pairwise Potentials xp = 0 xp = 1 A C B D xq = 0 s D-B B-A xq = 1 C+B-D-A vp vq t C+B-D-A ≥ 0 Submodular Energy General 2-label MAP estimation is NP-hard

Results – Image Segmentation Boykov and Jolly, ICCV 2001

Results – Image Segmentation Boykov and Jolly, ICCV 2001

Results – Image Segmentation Boykov and Jolly, ICCV 2001

Results – Image Synthesis Kwatra et al., SIGGRAPH 2003

Results – Image Synthesis Kwatra et al., SIGGRAPH 2003

Outline Preliminaries Maximum Flow Algorithms Energy minimization with max flow/min cut Multi-Label Energy Functions

St-mincut based Move algorithms E(x) = ∑ θi (xi) + ∑ θij (xi,xj) i,j i x ϵ Labels L = {l1, l2, … , lk} Commonly used for solving non-submodular multi-label problems Extremely efficient and produce good solutions Not Exact: Produce local optima

Move-Making Algorithms Space of All Labelings x

Move Making Algorithms Energy Solution Space

Move Making Algorithms Current Solution Search Neighbourhood Optimal Move Energy Solution Space

Computing the Optimal Move Current Solution Search Neighbourhood Optimal Move xc (t) Key Property Move Space Energy Solution Space Better solutions Finding the optimal move hard Bigger move space

Moves using Graph Cuts Expansion and Swap move algorithms [Boykov Veksler and Zabih, PAMI 2001] Makes a series of changes to the solution (moves) Each move results in a solution with smaller energy Current Solution Search Neighbourhood N Number of Variables Move Space (t) : 2N L Number of Labels Space of Solutions (x) : LN

Moves using Graph Cuts Expansion and Swap move algorithms [Boykov Veksler and Zabih, PAMI 2001] Makes a series of changes to the solution (moves) Each move results in a solution with smaller energy Current Solution Move to new solution How to minimize move functions? Construct a move function Minimize move function to get optimal move

Expansion Algorithm Variables take label lα or retain current label Slide courtesy Pushmeet Kohli

Expansion Algorithm Variables take label lα or retain current label Tree Ground House Status: Expand Sky Expand House Initialize with Tree Expand Ground Sky Slide courtesy Pushmeet Kohli

Expansion Algorithm Initialize labeling x = x0 (say x0p = 0, for all Xp) For α = 1, 2, … , h-1 xα = argminx’ E(x’) s.t. x’p  {xp} U {lα} Repeat until convergence Update x = xα End Boykov, Veksler and Zabih, 2001

θij (la,lb) + θij (lb,lc) ≥ θij (la,lc) Expansion Algorithm Restriction on pairwise potentials? Move energy is submodular if: Unary Potentials: Arbitrary Pairwise potentials: Metric θij (la,lb) + θij (lb,lc) ≥ θij (la,lc) Example: Potts model [Boykov, Veksler, Zabih]

Swap Move Variables labeled α, β can swap their labels Chi square [Boykov, Veksler, Zabih]

Swap Move Variables labeled α, β can swap their labels Swap Sky, House Tree Ground Swap Sky, House House Sky [Boykov, Veksler, Zabih]

Swap Move Move energy is submodular if: Unary Potentials: Arbitrary Variables labeled α, β can swap their labels Move energy is submodular if: Unary Potentials: Arbitrary Pairwise potentials: Semimetric θij (la,lb) ≥ 0 θij (la,lb) = 0 a = b Chi square Example: Potts model [Boykov, Veksler, Zabih]

Minimize over move variables t General Binary Moves x = t x1 + (1-t) x2 New solution First solution Second solution Minimize over move variables t Move Type First Solution Second Solution Guarantee Expansion Old solution All alpha Metric Fusion Any solution 

Solving Continuous Problems using Fusion Move x = t x1 + (1-t) x2 Optical Flow Example Solution from Method 2 x2 Solution from Method 1 F Final Solution x1 x (Lempitsky et al. CVPR08, Woodford et al. CVPR08)

Results – Denoising + Inpainting Label = intensity value of the image

Results – Denoising + Inpainting

Results – Denoising + Inpainting

Results – Denoising + Inpainting

Paper presentation Tarabalka et al., “Spatio-temporal video segmentation with shape growth or shrinkage constraint”, Transactions on Image Processing 2014.