53
Discrete Optimization Methods in Computer Vision CSE 6389 Slides by: Boykov Modified and Presented by: Mostafa Parchami Basic overview of graph cuts [Yuri Boykov, Olga Veksler, Ramin Zabih, Fast Approximation Energy Minimization via Graph Cuts, PAMI’01]

Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Discrete Optimization Methods

in Computer Vision

CSE 6389

Slides by: Boykov

Modified and Presented by: Mostafa Parchami

Basic overview of graph cuts

[Yuri Boykov, Olga Veksler, Ramin Zabih, Fast

Approximation Energy Minimization via

Graph Cuts, PAMI’01]

Page 2: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Disclaimer

Can not possibly cover all discrete optimization methods widely used in computer vision in the last 30 years

Mainly concentrate on

• Discrete energy minimization methods that can be applied to Markov Random Fields with binary or n-labels

– applicable to a wide spectrum of problems in vision

• Methods motivated by LP relaxations

– good bounds on the solutions

Page 3: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Discrete Optimization Methods

in Computer Vision

Basic overview of graph cuts

• binary labeling

– a few basic examples

– energy optimization

• submodularity (discrete view)

• continuous functionals (geometric view)

• posterior MRF energy (statistical view)

• extensions to multi-label problems

– interactions: convex, robust, metric

– move-based optimization

Page 4: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Markov Random Fields in Computer Vision

edgesji

ji

i

i datayydataydataEnergy,

21 ),;,(),;(),;( y

Node yi: pixel label

Edge: constrained

pairs

Cost to assign a label to

each pixel Cost to assign a pair of labels to

connected pixels

Page 5: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Solving MRF with Graph Cuts

edgesji

ji

i

i datayydataydataEnergy,

21 ),;,(),;(),;( y

Source (Label 0)

Sink (Label 1)

Cost to assign to 0

Cost to assign to 1

Cost to split nodes

Page 6: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Solving MRF with Graph Cuts Cont.

edgesji

ji

i

i datayydataydataEnergy,

21 ),;,(),;(),;( y

Source (Label 0)

Sink (Label 1)

Cost to assign to 0

Cost to assign to 1

Cost to split nodes

Page 7: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Shortest paths approach

(live wire, intelligent scissors)

2D Graph cut shortest path on a graph

Example: find the shortest

closed contour in a given domain of a graph

Compute the shortest path p ->p for a point p.

p

Graph Cuts approach

Compute the minimum cut that

separates red region from blue region

Repeat for all points on the gray line. Then choose the

optimal contour.

Page 8: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Graph cuts for optimal boundary detection (B&J, ICCV’01)

n-links

s

t a cut hard constraint

hard constraint

Minimum cost cut can be computed in polynomial time

(max-flow/min-cut algorithms)

22exp

pq

pq

Iw

pqI

Page 9: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Standard minimum s-t cuts algorithms

Augmenting paths [Ford & Fulkerson, 1962]

Push-relabel [Goldberg-Tarjan, 1986]

Tree recycling (dynamic trees) [B&K, 2004]

Flow recycling (dynamic cuts) [Kohli & Torr, 2005]

Cut recycling (active cuts) [Juan & Boykov, 2006]

Hierarchical methods

- in search space [Lombaert et al., CVPR 2005]

- in edge weights (capacity scaling) [Juan et al., ICCV07]

adapted to N-D grids used in computer vision

Page 10: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Optimal boundary in 2D

“max-flow = min-cut”

Page 11: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Optimal boundary in 3D

3D bone segmentation (real time screen capture)

Page 12: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Graph cuts applied to multi-view

reconstruction

CVPR’05 slides from Vogiatzis, Torr, Cippola

visual hull (silhouettes)

surface of good photoconsistency

Page 13: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Adding regional properties (B&J, ICCV’01)

pqw

n-links

s

t a cut )(tDp

)(sDp

NOTE: hard constrains are not required, in general.

regional bias example

suppose are given “expected” intensities

of object and background

ts II and 22 2/||||exp)( s

pp IIsD

22 2/||||exp)( t

pp IItD

Page 14: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

NOTE: hard constrains are not required, in general. EM-style optimization of piece-vise constant Mumford-Shah model

Adding regional properties (B&J, ICCV’01)

pqw

n-links

s

t a cut )(tDp

)(sDp

“expected” intensities of object and background

can be re-estimated

ts II and 22 2/||||exp)( s

pp IIsD

22 2/||||exp)( t

pp IItD

Page 15: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Adding regional properties (B&J, ICCV’01)

a cut )|Pr(ln)( pppp LILD

given object and background intensity histograms

)(sDp

)(tDp s

t

I)|Pr( sI p

)|Pr( tI p

pI

More generally, regional bias can be based on any intensity models of object and background

Page 16: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Adding regional properties (B&J, ICCV’01)

Page 17: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Iterative learning of regional color-models

GMMRF cuts (Blake et al., ECCV04)

Grab-cut (Rother et al., SIGGRAPH 04)

parametric regional model – Gaussian Mixture (GM) designed to guarantee convergence

Page 18: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

At least three ways to look at

energy of graph cuts

I: Binary submodular energy

II: Approximating continuous surface functionals

III: Posterior energy (MAP-MRF)

Page 19: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Simple example of energy

Npq

qppq

p

pp LLwLDLE )()()(

},{ tsLp

t-links n-links

Boundary term Regional term

binary object

segmentation

pqw

n-links

s

t a cut )(tDp

)(sDp

Page 20: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Graph cuts for minimization of

submodular binary energies I

Characterization of binary energies that can be globally minimized by s-t graph cuts [Boros&Hummer, 2002, K&Z 2004]

Non-submodular cases can be addressed with some optimality guarantees, e.g. QPBO algorithm • (see Boros&Hummer, 2002, Tavares et al. 06, Rother et al. 07)

Npq

qp

p

pp LLELELE ),()()(

},{ tsLp

E(L) can be minimized by s-t graph cuts

),(),(),(),( stEtsEttEssE

t-links n-links

Boundary term Regional term

Submodularity (“convexity”)

Page 21: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Graph cuts for minimization of

continuous surface functionals II

[K&B, ICCV 2005]

[B&K, ICCV 2003]

Characterization of energies of binary cuts C as

functionals of continuous surfaces

)(

)(,)()(CC

x

C

dpxfdsdsgCE vN

Geometric length any convex,

symmetric metric g e.g. Riemannian

Flux

any vector field v

Regional bias

any scalar function f

Page 22: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

One extension

using parametric max-flow methods

optimization of ratio functionals

In 2D can use DP [Cox et al’96, Jermyn&Ishikawa’01]

In 3D, [Kolmogorov, Boykov, Rother, ICCV’07]

C

C

x

dsg

ds

CE)(

,

)(

vN

)(

)(

)(

)(

C

C

dpxf

dsg

CE

Page 23: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Graph cuts for minimization of

posterior energy III

Greig at al. [IJRSS, 1989]

• Posterior energy (MRF, Ising model)

),()|Pr(ln)(

Npq

qppq

p

pp LLVLDLE

},{ tsLp

Example: binary image restoration

Spatial prior (regularization)

Likelihood (data term)

Page 24: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Graph cuts algorithms can minimize

multi-label energies as well

Page 25: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Problem Definition: Stereo Matching

Triangulate on two images of the same scene point to recover depth.

• Camera calibration

• Finding all correspondence

• Computing depth or surfaces baseline

depth

left Right

Page 26: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Multi-scan-line stereo

with s-t graph cuts (Roy&Cox’98)

s

t cut

L(p)

p

“cut”

x

y

labels

x

y Dis

parity

labels

Page 27: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

s-t graph-cuts for

multi-label energy minimization

Ishikawa 1998, 2000, 2003

Generalization of construction by Roy&Cox 1998

V(dL)

dL=Lp-Lq

V(dL)

dL=Lp-Lq

Linear interactions “Convex” interactions

Npq

qp

p

pp LLVLDLE ),()()( 1RLp

Page 28: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Pixel interactions V:

“convex” vs. “discontinuity-preserving”

V(dL)

dL=Lp-Lq

Potts model

Robust or “discontinuity preserving” Interactions V

V(dL)

dL=Lp-Lq

“Convex” Interactions V

V(dL)

dL=Lp-Lq

V(dL)

dL=Lp-Lq

“linear” model

(weak membrane models, see a book by Blake and Zisserman, 87)

Page 29: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Pixel interactions:

“convex” vs. “discontinuity-preserving”

“linear” V

truncated

“linear” V

Page 30: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Fast Approximate Energy Minimization

Simple Way to Optimize - ICM 1. Choose a pixel 2. Fix the disparities at the rest of the pixels 3. Set the pixel to the optimal disparity 4. Iterate

Advantages

• Energy always guaranteed to decrease

• Easy to code

Disadvantages

• Convergence

• Scalability

Make Bigger Moves!

Page 31: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Fast Approx. Energy Minimization Cont.

The problem with ICM is that you can only

modify one pixel at a time

Get stuck in local minima easily

We need a way of moving multiple pixels at

once

Boykov, Veksler and Zabih introduced two

types of moves:

• alpha-beta swap

• alpha-expansion

Page 32: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Moving Policies

ICM – One pixel moves (From BKZ-PAMI 01)

Page 33: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Moving Policies

alpha-beta swap

Fix all nodes that aren't labelled alpha or beta

With remaining nodes, find optimal swap

• Some alpha nodes change to beta

• Vice Versa

• Some stay the same

(From BKZ-PAMI 01)

Page 34: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Moving Policies

(From BKZ-PAMI 01)

alpha-expansion

Any node can change to alpha

Page 35: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

a-expansion & a-b swap overview

Page 36: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

alpha-beta graphs

Page 37: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

alpha-beta swap properties

Page 38: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

alpha-beta swap: proof

Page 39: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

a-expansion

NP-hard problem (3 or more labels)

• two labels can be solved via s-t cuts (Greig at. al., 1989)

a-expansion approximation algorithm

(Boykov, Veksler, Zabih 1998, 2001)

• guaranteed approximation quality (Veksler, thesis 2001)

– within a factor of 2 from the global minima (Potts model)

• applies to a wide class of energies with robust interactions

– Potts model (BVZ 1989)

– “metric” interactions (BVZ 2001)

– can be extended to arbitrary interactions with weaker guarantees

• truncation (Kolmogorov et al. 2005)

• QPBO (Boros and Hummer, 2002)

Other “move” algorithms (e.g. a-b swap, jump-moves)

Page 40: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

a-expansion algorithm

1. Start with any initial solution 2. For each label “a” in any (e.g. random) order

1. Compute optimal a-expansion move (s-t graph cuts) 2. Decline the move if there is no energy decrease

3. Stop when no expansion move would decrease energy

Page 41: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

other labels a

a-expansion move

Basic idea: break multi-way cut computation into a sequence of binary s-t cuts

Page 42: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

a-expansion moves

initial solution

-expansion

-expansion

-expansion

-expansion

-expansion

-expansion

-expansion

In each a-expansion a given label “a” grabs space from other labels

For each move we choose expansion that gives the largest decrease in the energy: binary optimization problem

Page 43: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Expansion move

The difference between the optimal solution and the

solution from the expansion move is bounded

Page 44: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Metric interactions

V(a,b)=0 iff a=b

V(a,b) = V(b,a) >= 0

V(a,c) <= V(a,b)+V(b,c) Triangular inequality

Implies that every expansion move (a binary problem) is submodular

V is called a metric if it obeys all 3

• Can use Expansion Moves

V is called a semi-metric if it obeys the last two

• Can only use Swap-Moves

Subject of recent research.

Page 45: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

alpha expansion algorithm

Page 46: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

alpha expansion algorithm

Page 47: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

2-D alpha expansion

Page 48: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

a-expansions:

examples of metric interactions

Potts V

“noisy diamond” “noisy shaded diamond”

Truncated “linear” V

Page 49: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Multi-way graph cuts

Multi-object Extraction

Page 50: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Multi-way graph cuts

Stereo/Motion with slanted surfaces

(Birchfield &Tomasi 1999)

Labels = parameterized surfaces EM based: E step = compute surface boundaries M step = re-estimate surface parameters

Page 51: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Multi-way graph cuts

stereo vision

original pair of “stereo” images

depth map

ground truth BVZ 1998 KZ 2002

Page 52: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

Multi-way graph cuts

Graph-cut textures (Kwatra, Schodl, Essa, Bobick 2003)

similar to “image-quilting” (Efros & Freeman, 2001)

B

A B

G

D C

F

H I J

E

Page 53: Discrete Optimization Methods in Computer Vision CSE 6389ranger.uta.edu/~heng/CSE6389_15_slides/YuriBoykov.pdf · 2015. 4. 24. · Discrete Optimization Methods in Computer Vision

normalized correlation,

start for annealing, 24.7% err

simulated annealing,

19 hours, 20.3% err a-expansions (BVZ 89,01)

90 seconds, 5.8% err

0

20000

40000

60000

80000

100000

1 10 100 1000 10000 100000

Time in seconds

Smoo

thne

ss E

nerg

y

Annealing Our method

a-expansions vs. simulated annealing