42
This work was supported bu EU projects FP7- ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center for Machine Perception Czech Technical University in Prague A Distributed Mincut/Maxflow Algorithm Combining Path Augmentation and Push- Relabel Alexander Shekhovtsov and Václav Hlaváč [email protected], [email protected]

This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

Embed Size (px)

Citation preview

Page 1: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

This work was supported bu EU projects FP7-ICT-247870NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK

25-27 July, 2011EMMCVPR

Center for Machine Perception

Czech Technical University in Prague

A Distributed Mincut/Maxflow Algorithm Combining Path Augmentation and Push-Relabel

Alexander Shekhovtsov and Václav Hlaváč

[email protected], [email protected]

Page 2: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

2/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Overview

Goals

Main Results

Preliminary results presented on workshop 2010 in Kiev (not entirely correct)

Page 3: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

3/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Mincut in Computer Vision

Test Problems (University of Western Ontario)

Page 4: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

4/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Mincut in Computer Vision

Discrete Energy Minimization via Mincut

Page 5: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

5/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Mincut

Capacitated network

Page 6: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

6/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Mincut

Minimum s-t Cut

Page 7: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

7/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Augmenting Path Approach

Path Augmentation

Page 8: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

8/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Augmenting Path Approach

Residual Network

Page 9: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

9/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Augmenting Path Approach

Costs of all cuts are changed by a constant

Page 10: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

10/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Augmenting Path Approach

Augment next path

Page 11: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

11/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Augmenting Path Approach

Minimum Cut in Residual Network

Page 12: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

12/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Push-Relabel Approach

Extended transformation

excess

excess

Page 13: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

13/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Push-Relabel Approach

Page 14: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

14/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Push-Relabel Approach

Page 15: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

15/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Push-Relabel Approach

Page 16: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

16/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Push-Relabel Approach

Page 17: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

17/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Push-Relabel Approach

Page 18: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

18/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Distributed Algorithms

CPU CPU

Memory

CPU

Mem

CPU

Mem

Quick

Slow

Distributed Sequential

CPU

Mem

Quick

Slow

Disk

Distributed Parallel

Shared Memory Parallel

CPU

Memory

Sequential

Distributed Model – Divide Computation AND Memory

Page 19: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

19/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Existing Distributed Algorithms

Push-Relabel [Goldberg ‘94]

Region Discharge [Delong and Boykov, CVPR‘08]

t

Page 20: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

20/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Existing Distributed Algorithms Adaptive Bottom-up Merging [Liu and J. Sun, CVPR‘10]

t

Page 21: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

21/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Existing Distributed Algorithms Dual Decomposition for Mincut [Strandmark and Kahl, CVPR‘10]

¡ 1

2

2

1 ¡ 3

1 2

2

1

1

¡ 1

2

2

1

1

¡ 3

0 21

2

2

¡ 12

¡ 1

2

1¡ ¸1 1+¸1

1¡ ¸2 0+¸2

v v0 v00M N

¡ 1

2

2

1

1

¡ 3

1

0 21

1

1

0

1

1

2

2

¡ 1

v0 v00

Page 22: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

22/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Existing Distributed Algorithms Dual Decomposition for Mincut [Strandmark and Kahl, CVPR‘10]

Page 23: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

23/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

New Algorithm New Distance Function The Algorithm Parallel Version Complexity Bound Experimental Confirmation

Page 24: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

24/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

New Distance Function

length of the path = number of boundary edges

distance = length of a shortest path to the sink

d¤B(u) = 2

d¤B(v) = 0

tValid Labeling – distance underestimate

Page 25: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

25/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

The Algorithm: Augmenting Path Region Discharge

t

1. Augment paths to the sink

2. Augment paths the boundary with label 0

3. Augment paths the boundary with label 1

...

Relabel the interior vertices

sweep

estimate ofthe shortestway to the sink

Page 26: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

26/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Parallel Version

t

parallel sweep

Conflicts are resolved by canceling one of the flows (similar to asynchronous parallel push-relabel [Goldberg and Tarjan 88])

all regions discharged concurrently

Page 27: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

27/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Complexity Bound

Page 28: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

28/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Experimental Confirmation

S-PRD details: highest label first push-relabel (HI-PR), region-gap heuristic, region-relabel heuristic, global gap heuristicS-ARD details: global gap heuristic

S-PRD: Sequential Push-Relabel Region DischargeS-ARD: Sequential Augmenting path Region Discharge

Test problems: 2D grid with regular connectivity and random costs

Page 29: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

29/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Efficient Implementation Standard Heuristics: global relabel and global gap Boundary Relabel Partial Discharges Boundary Search Trees

Page 30: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

30/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Efficient Implementation Global Relabel Heuristic = compute exact distance, O(m) time

Global Gap Heuristic (sufficient condition of sink unreachability)

t

… cannot reach sink

cannot be in the sink set of a minimum cut

“decided nodes”

Page 31: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

31/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

not possible

Efficient Implementation

Boundary Relabel

0

211

2

1

1

1

12

2

1

1

0

1

21

2

2

1

1

0

31

42

2

33

A valid labeling ofboundary nodes

Group nodes by their label within each region

Compute exact distanceon the auxiliary graph

Add possible links (red)

Improve labeling, knowing only the information on the boundary?

do not know how the vertices linked inside

Result: a (better) valid labeling. In the limit of small regions = global relabel.

Page 32: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

32/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Efficient Implementation

Partial Discharges

1. Augment paths to the sink

2. Augment paths the boundary with label 0

3. Augment paths the boundary with label 1

...

Relabel the interior vertices

execute only this step in sweep 0

Page 33: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

33/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Efficient Implementation

Partial Discharges

1. Augment paths to the sink

2. Augment paths the boundary with label 0

3. Augment paths the boundary with label 1

...

Relabel the interior vertices

execute up to here in sweep 1

Page 34: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

34/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Efficient Implementation

Partial Discharges

1. Augment paths to the sink

2. Augment paths the boundary with label 0

3. Augment paths the boundary with label 1

...

Relabel the interior vertices

execute up to here in sweep 2

Prevents sending the flow in a wrong direction (redundant work)

Boundary Relabel + Partial Discharges effect:

Page 35: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

35/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

00

Efficient Implementation

Boundary Search Trees

0

0

1

t

0

0

1

t

0

0

1

t1 1 11

2 00

Residual region network

Search trees of thesink and boundaryvetices

Labels of the innervertices are determinedby their tree root

Tree with higher root cannot overtake lower

(¡ 1)

Saves computation between sweeps, Integrates region-relabel into augmentation.

Find augmenting paths and encode labeling.

Page 36: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

36/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Results Dependence on Partition Sequential Competition Parallel Competition Local Problem Reduction

Page 37: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

37/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Results: Dependence on Partition

BL06-gargoyle-smlcell complex32x45x32x24partitioned by vertex number

LB07-bunny-med3D 6-connected202x199x157sparse datasliced along dimensions

liver.n6.c103D 6-connected170x170x144sliced along dimensions

Stable over partitions

Page 38: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

38/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Results: Sequential CompetitionBK – Augmenting Path [Boykov-Kolmogorov]HIPR – Highest level Push-Relabel [Goldberg-Tarjan, Cherkassky]S-ARD – Sequential Augmenting Path Region DischargeS-PRD – Sequential Push-Relable Region Discharge ([Delong-Boykov], our impl.)

Page 39: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

39/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Results: Sequential CompetitionBK – Augmenting Path [Boykov-Kolmogorov]HIPR – Highest level Push-Relabel [Goldberg-Tarjan, Cherkassky]S-ARD – Sequential Augmenting Path Region DischargeS-PRD – Sequential Push-Relable Region Discharge ([Delong-Boykov], our impl.)

...

Page 40: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

40/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Results: Parallel Competition (4 CPUs)DD – Dual Decomposition [ Strandmark and Kahl ’10] 2/4 Regions

RPR – Region Push-Relable [Delong and Boykov ‘08] impl. by Sameh Khamis

not applicable

not applicable

reduced graph

best parameters

P-ARD speed-up over BK: 0.8 – 4, robust method, few sweeps (message exchanges)

shared memory

Adaptive Bottom-up Merging [Liu and J. Sun ‘10] achieves near linear speed-up over BK

Page 41: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

41/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Local Problem Reduction How many vertices can be decided optimally by considering

regions separately?

16 regions 64 regions

2D stereo problems are largely decided locally. Other problems are significantly harder.

s

t

BR

weak source

strong source

strong sink

undecided

Page 42: This work was supported bu EU projects FP7-ICT-247870 NIFTi and FP7-ICT-247525 HUMAVIPS and the Czech project 1M0567 CAK 25-27 July, 2011 EMMCVPR Center

42/9

Alexander Shekhovtsov & Vaclav Hlavac, 2011

Conclusion New distributed algorithm Terminates in at most B2+1 sweeps (few in practice)

Sequential Algorithm1) competitive with sequential solvers2) uses few sweeps (= loads/unloads of regions)3) suitable to run in the limited memory model

Parallel Algorithm 1) competitive with shared memory algorithms2) uses few sweeps (= rounds of message exchange)3) suitable for execution on a computer cluster

Implementation can be specialized for regular grids (less memory/faster)

(?) no good worst case complexity bound in terms of elementary operations

Thanks for you comments