CS3000: Algorithms & Data Jonathan Ullman Lecture 17: More - - PowerPoint PPT Presentation

cs3000 algorithms data jonathan ullman
SMART_READER_LITE
LIVE PREVIEW

CS3000: Algorithms & Data Jonathan Ullman Lecture 17: More - - PowerPoint PPT Presentation

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


slide-1
SLIDE 1

CS3000: Algorithms & Data Jonathan Ullman

Lecture 17: More Applications of Network Flow March 25, 2020

slide-2
SLIDE 2

Image Segmentation

  • Separate image into foreground and background
  • We have some idea of:
  • whether pixel i is in the foreground or background
  • whether pair (i,j) are likely to go together

background

foreground

e me

d

I

  • .o

II

D

u

Set of pixels

n xEm e g middle

pixelsmore

likely

to be

foreground

slide-3
SLIDE 3

Image Segmentation

  • Input:
  • an undirected graph ! = ($, &); $ = “pixels”, & = “pairs”
  • likelihoods (), *) ≥ 0 for every - ∈ $
  • separation penalty /)0 ≥ 0 for every -, 1 ∈ &
  • Output:
  • a partition of $ into 2, 3 that maximizes

4 2, 3 = 6 ()

  • )∈8

+ 6 *

  • 0∈:

− 6 /)0

  • ),0 ∈<

=>? 8 @AB :

Assume all values

in the graph

q of

me

9

m

externally

a

likelihood of foreground

foreground

I

background

i

j

Pij

slide-4
SLIDE 4

Reduction to MinCut

  • Differences between SEG and MINCUT:
  • SEG asks us to maximize, MINCUT asks us to minimize

max

8,: 6 ()

  • )∈8

+ 6 *

  • 0∈:

− 6 /)0

  • ),0 ∈<

=>? 8 @AB :

min

8,: 6 *)

  • )∈8

+ 6 (0

  • 0∈:

+ 6 /)0

  • ),0 ∈<

=>? 8 @AB :

y

Short for

Image Segmentation

D

Min

f

x

may

f x

Fon

Fa

FB bi

Pii

A DE

btv A B

am

Ea

ai E

bi

Epi

I

slide-5
SLIDE 5

Reduction to MinCut

  • Differences between SEG and MINCUT:
  • SEG allows any partition, MINCUT requires H ∈ 2, I ∈ 3

SE A

f

t C B EE B

O_0 se Aq

d tqg

Solution Add

dummy nodes

s and

t to

the graph

slide-6
SLIDE 6

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 /)0

  • ),0 ∈<

JKLM 8 >L :

min

8,: 6 *)

  • )∈8

+ 6 (0

  • 0∈:

+ 6 /)0

  • ),0 ∈<

=>? 8 @AB :

A

B

solution

yes

Replace undirected

  • e

go

no

edge Cii

ul

Ily

i

j

and j

i B

A

both

with

capacity pi

i0

0j Mandy.net

js

n

mbth

slide-7
SLIDE 7

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

min

8,:

6 /)0

  • ),0 ∈<

JKLM 8 >L :

min

8,: 6 *)

  • )∈8

+ 6 (0

  • 0∈:

+ 6 /)0

  • ),0 ∈<

=>? 8 @AB :

MIMI

so

sit in

edges from

s

Iz

and t

7ft

capacity we

want

t.IT Etb

slide-8
SLIDE 8

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 *)

  • )∈8

+ 6 (0

  • 0∈:

+ 6 /)0

  • ),0 ∈<

JKLM 8 >L :

Replace

max

with

men

Replace

undirected edges

w

pairs of directededge

Add

dummy

nodes

St

b ax

Add

dummy edges

s

x

x e

slide-9
SLIDE 9

Step 1: Transform the Input

Input G,{a,b,p} for SEG Input G’ for MINCUT

  • ur

Replace

Max

with

man

Replace

undirected edges

w

pairs of directededges

Add

dummy

nodes

St

b ax

Add

dummy edges

s

x

x e

Total Time

mtn

slide-10
SLIDE 10

Step 2: Receive the Output

Solve

Input G’ for MINCUT Output (A,B) for MINCUT

u

u

v x3

were the original graph

1

A B

is

a mmmm

sat at

in

G

T

Ine

Solve

mascot

  • n

a

A graph with

n

12 nodes

B

and

2Mt 2n edges

so 0Cmn

t.me

slide-11
SLIDE 11

Step 3: Transform the Output

Output (A,B) for SEG Output (A,B) for MINCUT

Return partition

A

fu v3

B

f w

x 3

O

O

A

B

Time

n

slide-12
SLIDE 12

Reduction to MinCut

  • correctness?
  • running time?

Every patron

A B

  • f the original nodes

corresponds

to

an

s C

at

A 0953 Bu Et3

For every

sf

we

Auss3

Bust 3

the

capacity is ftp.bi

ifrsaitif.EIEEJPT

xatg what

SEG wants to

Total Time

mn

m.nm.ae

Bottleneck is solving

minimum

at

slide-13
SLIDE 13

Image Segmentation

  • Want to identify communities in a network
  • “Community”: a set of nodes that have a lot of

connections inside and few outside

Mammootty

Densest

Subgraph

  • f

edges inside

070

made

Hr

i

slide-14
SLIDE 14

Densest Subgraph

  • Input:
  • an undirected graph ! = $, &
  • Output:
  • a subset of nodes 2 ⊆ $ that maximizes O < 8,8

|8|

2

tt

msideA

  • f nodes in

A

1

F ASA

set of edges

w

both endpoints in A

ECA B

set of edges

w

  • ne endpoint in A one MB
slide-15
SLIDE 15

DS

uses an undirectedgraph

Ds

ieesuscnooseayseiafmmiIT.es

ie

I

iOS O

Add

dummy

nodes

s

t

Same transformations

as

SEG

Need to transform

the

  • bjective function

DS

MINCUT

2 IECA A I

E

C i j

Ci j

EE

IAl

f

IEA

jtB

Is

it

FA

ai

Effbite

cij

btw A B

usang

dummy edges

slide-16
SLIDE 16

Reduction to MinCut

  • Different objectives
  • maximize O < 8,8

8

  • vs. minimize & 2, 3
  • Suppose O < 8,8

8

≥ Q and see what that implies

⇔ 2 & 2, 2 ≥ Q 2 ⇔ Σ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∈8Q + Σ\ JKLM 8 >L : 1 ≤ 2 &

If I can

ask yes

no

questions Is the DS der w

f

Em

than 8

then

I can find

the

densest

subgraph

DO

E

me

  • of
slide-17
SLIDE 17

Reduction to MinCut

  • Different objectives
  • maximize O < 8,8

8

  • vs. minimize & 2, 3
  • Suppose O < 8,8

8

≥ Q and see what that implies

⇔ 2 & 2, 2 ≥ Q 2 ⇔ Σ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∈8Q + Σ\ JKLM 8 >L : 1 ≤ 2 &

If I can

ask yes

no

questions Is the DS der w

f

Em

than 8

then

I can find

the

densest

subgraph

DO

Eadegen

TEAdegcul jfdegh E.de

  • IFudegCu TEodesh

IECA B I

E

L

Sla

efrom

A B

3

S

v C A

slide-18
SLIDE 18

Ifs degli

t Fa

s

t Ee

L fromA to B

If

the value

is

E 21 El

then

the

subgraph

A has

2 IEEa Al

Tai

38

slide-19
SLIDE 19

Reduction to MinCut

ΣU∈: deg Y + ΣU∈8 Q + Σ\ JKLM 8 >L : 1 ≤ 2 &

000

Is

degg

I s

degce

Thisgraph has mmeat ELIE

if andonly if F

a

subgraph

  • f dusty

8