CS3000: Algorithms & Data Jonathan Ullman Lecture 17: More Applications of Network Flow March 25, 2020
Image Segmentation foreground background e me d I II D o.o u x Em Set of pixels n • Separate image into foreground and background • We have some idea of: e g middle • whether pixel i is in the foreground or background pixels more to be likely • whether pair (i,j) are likely to go together foreground
� � � in the graph Assume all values Image Segmentation externally m me 9 q of • Input: • an undirected graph ! = ($, &) ; $ = “pixels”, & = “pairs” likelihood of foreground • likelihoods ( ) , * ) ≥ 0 for every - ∈ $ a • separation penalty / )0 ≥ 0 for every -, 1 ∈ & • Output: • a partition of $ into 2, 3 that maximizes 4 2, 3 = 6 ( ) + 6 * − 6 / )0 0 )∈8 0∈: ),0 ∈< I =>? 8 @AB : foreground background i j Pij
� � � � � � Reduction to MinCut Short for Image Segmentation y • Differences between SEG and MINCUT: D • SEG asks us to maximize, MINCUT asks us to minimize f Min f x x may max 8,: 6 ( ) + 6 * − 6 / )0 min 8,: 6 * ) + 6 ( 0 + 6 / )0 0 )∈8 0∈: ),0 ∈< )∈8 0∈: ),0 ∈< =>? 8 @AB : =>? 8 @AB : A FB bi Pii Fa Fon DE I btv A B ai E Epi bi Ea am
Reduction to MinCut • Differences between SEG and MINCUT: • SEG allows any partition, MINCUT requires H ∈ 2 , I ∈ 3 SE A t C B f d tqg O_0 EE B se Aq Add Solution dummy nodes the graph t to s and
� � � � Reduction to MinCut • Differences between SEG and MINCUT: • SEG has edges between A and B , MINCUT considers edges from A to B min 8,: 6 * ) + 6 ( 0 + 6 / )0 min 6 / )0 8,: )∈8 0∈: ),0 ∈< ),0 ∈< =>? 8 @AB : JKLM 8 >L : B A solution yes Replace undirected no oe go Ily ul edge Cii A and j B i i j mbth i0 0j Mandy.net both with js capacity pi n
� � � � Reduction to MinCut • Differences between SEG and MINCUT: • SEG has terms for each node in A,B, MINCUT only has terms for edges from A to B so MIMI min 8,: 6 * ) + 6 ( 0 + 6 / )0 min 6 / )0 8,: )∈8 0∈: ),0 ∈< ),0 ∈< =>? 8 @AB : JKLM 8 >L : sit in Iz edges from s want 7ft capacity we t and t.IT Etb
� � � Reduction to MinCut • How should the reduction work? • capacity of the cut should correspond to the function we’re trying to minimize min 8,: 6 * ) + 6 ( 0 + 6 / )0 )∈8 0∈: ),0 ∈< JKLM 8 >L : with Replace men max pairs of directed edge undirected edges w Replace Add St nodes dummy b ax e x s x Add dummy edges
Step 1: Transform the Input Input G,{a,b,p} Input G’ for for SEG MINCUT with Replace man Max our pairs of directed edges undirected edges w Replace Add St nodes dummy b ax e s x x Add dummy edges 0 mtn Total Time
Step 2: Receive the Output v x3 u were the original graph u Input G’ for MINCUT Solve 1 Output (A,B) for MINCUT sat A B is a mmmm G at in T Ine mascot Solve on a A 12 nodes graph with n B 2Mt 2n edges and so 0 Cmn t.me
Step 3: Transform the Output Output (A,B) Output (A,B) for for SEG MINCUT Return partition fu v3 A x 3 f w B O O A B 0 Time n
Reduction to MinCut • correctness? of the original nodes A B Every patron A 0953 Bu Et3 at s C to an corresponds the Bust 3 Auss3 For every we sf capacity is ftp.bi ifrsaitif.EIEEJPT • running time? xatg what SEG wants to 0 m.nm.ae Total Time mn Bottleneck is solving at minimum
Image Segmentation Densest Subgraph Mammootty of edges inside • Want to identify communities in a network 070 • “Community”: a set of nodes that have a lot of connections inside and few outside Hr made i
Densest Subgraph tt mside A 2 A of nodes in • Input: • an undirected graph ! = $, & 1 • Output: • a subset of nodes 2 ⊆ $ that maximizes O < 8,8 |8| both endpoints in A set of edges w F ASA one endpoint in A one MB set of edges ECA B w
DS uses an undirected graph ie ieesuscnooseayse iafmmiIT.es Ds I iOS O t Add nodes s dummy SEG Same transformations as objective function the transform Need to MINCUT DS 2 IECA A I E C i j Ci j EE I Al f IEA jtB Is it Eff bite ai cij FA btw A B dummy edges usang
ask yes Em If I can no Reduction to MinCut Is the DS der w questions I can find then than 8 • Different objectives the densest subgraph f • maximize O < 8,8 vs. minimize & 2, 3 8 DO • Suppose O < 8,8 ≥ Q and see what that implies 8 E ⇔ 2 & 2, 2 ≥ Q 2 me oof ⇔ Σ U∈8 deg Y − & 2, 3 ≥ Q 2 ⇔ Σ U∈Z deg Y − Σ U∈: deg Y − & 2, 3 ≥ Q 2 ⇔ 2 & − Σ U∈: deg Y − & 2, 3 ≥ Q 2 ⇔ Σ U∈: deg Y + Q 2 + & 2, 3 ≤ 2 & ⇔ Σ U∈: deg Y + Σ U∈8 Q + Σ \ JKLM 8 >L : 1 ≤ 2 &
ask yes Em If I can no Reduction to MinCut Is the DS der w questions I can find then than 8 • Different objectives the densest subgraph f • maximize O < 8,8 vs. minimize & 2, 3 8 DO • Suppose O < 8,8 ≥ Q and see what that implies 8 Eadegen ⇔ 2 & 2, 2 ≥ Q 2 TEA degcul jfdegh E.de o ⇔ Σ U∈8 deg Y − & 2, 3 ≥ Q 2 ⇔ Σ U∈Z deg Y − Σ U∈: deg Y − & 2, 3 ≥ Q 2 IFudegCu TEodesh ⇔ 2 & − Σ U∈: deg Y − & 2, 3 ≥ Q 2 IE CA B I ⇔ Σ U∈: deg Y + Q 2 + & 2, 3 ≤ 2 & E L Sla e from B A ⇔ Σ U∈: deg Y + Σ U∈8 Q + Σ \ JKLM 8 >L : 1 ≤ 2 & S 3 v C A
t Fa t Ee L Ifs degli s from A to B E 21 El If the value is A has the subgraph then 2 IE Ea Al 38 Tai
Reduction to MinCut 000 Σ U∈: deg Y + Σ U∈8 Q + Σ \ JKLM 8 >L : 1 ≤ 2 & Is I s degg degce if andonly if F This graph has mmeat ELIE subgraph a of dusty 8
Recommend
More recommend