graph cuts based segmentation methods: daniel heilper, cs department, haifa university

67
Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Post on 20-Dec-2015

223 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Graph Cuts based segmentation

methods:

Daniel Heilper, CS Department, Haifa University

Page 2: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Topics:

Segmentation as Graph cuts problems. MIN-CUT and Normalized CUT approaches Examples of Cost/Energy functions Performance issues – feasibility and

approximations Relations to Clustering and other methods

Page 3: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Motivation:

Human perception takes into account several perceptual aspects and “blends” them together: Proximity:

Page 4: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Human perception Proximity: Closure:

Page 5: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Human perception Similarity Continuation

Page 6: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Early segmentation methods Boundary based methods - based on local information and cannot

guarantee continuous closed edge contours (Derivatives kernels, Harris, Canny)

Region based methods + statistics inside the region. - often generates irregular boundaries and small

Holes.

Page 7: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Boundary based methods Original text Canny:

Page 8: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Boundary based methods Derivatives:

Page 9: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Region based methods

Page 10: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Global optimization approaches based on energy functions

Construct a heuristic energy function which take into account both the local information and the global information.

Page 11: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Graph Representation: The set of points in an arbitrary feature

space are represented as a weighted undirected

graph G = (V,E,w) where the nodes of the graph are the points in the feature space, and an edge is formed between every pair of nodes. The weight on each edge, Wij is a function of the similarity between nodes i and j.

Page 12: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Graph Representation:

Page 13: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Energy cost functions: Energy Function is heuristic for quantization

of a combination of Data Features on an N-D Image.

Simple Examples: Distance metric – Image is sent as a binary image, graph is represented as points in the plane

Page 14: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Energy functions for Graph Cuts In some cases, energy minimization is

NP-Hard, or has high polynomial order which make the method impractical

Choosing a good energy function is not “Pure” science

Page 15: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Energy functions for Graph Cuts The most Natural Energy form is:

V - Boundary Penalty caused by choosing labels for 2 pixels

D – Regional Penalty for assigning a pixel to some label.

Page 16: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University
Page 17: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

First approach: Max-Flow Min-Cut

Refresher: Flow Networks:

Page 18: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Network flow graphs Given A flow Networks where: is a directed graph is a source (not necessary belongs to G) is a sink (not necessary belongs to G) a non-negative capacity function on the

edges (if we can assume )

),( EVG

ctsGN ,,,

Vs

Vt

REc :

( , ) 0c u v ( , )u v E

Page 19: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Network flow graphs Function is a valid flow function if holds: Capacity constraints: , counter symmetry: for each ,

flow conservation: , where , are the edge set that leave V. Similarly are the sedge set that enters V

, ,f u v c u v Ev,u

,v u V u,vfv,uf

)()(

)()(vNevNe

efef )(vN

)(vN

tsVv ,\

Page 20: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Network flow graphs The value of the flow function is

Vv

v,sf

)()(

)()(sNesNe

efef

Page 21: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Network flow graphs

Page 22: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Network flow graphs

Page 23: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Network flow graphs Max-Flow – Min-Cut Theorem: The maximum amount of flow is equal to

the capacity of a minimum cut

Page 24: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Interactive Segmentation application using Graph Cuts:

Motivation: for some applications: Fully automatic segmentation does not give sufficient results.

for example, in medical diagnostics, Doctors handlings a medical scan images where soft tissues, blood vessels, and bones are “blended” together , are very difficult to segment.

Page 25: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Above: CAT scan of Pancreas.

Page 26: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Interactive Segmentation application using Graph Cuts In a nutshell:

User marks some pixels as seeds of “Background” and “Object”, and runs the application several times until a satisfactory result achieved.

Interactive inputs: “seeds” pixels the ratio between regional importance VS boundary

importance Energy function (Intensities, distances, textures, etc..)

Page 27: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Seeds in the flow graph

Page 28: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Interactive Segmentation application using Graph Cuts First run, application fully solves max-flow task Each time the application outputs an insufficient

result, the user adds more “seeds”, (changes the ratio ) and rerun the application.

The segmentation is improved until satisfactory by user.

Only the first run is computationally heavy, while the consecutive runs are fast, and can be seen as an addition to capacities, and hence finding additional “augmenting paths” in the flow function

Page 29: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Past Interactive tools for segmentation: intelligent scissors live wire “shortest path” between certain pixels using

some energy function Difficulties:

the user inputs have to be very accurately positioned at the desired boundary

can not be easily generalized to 3D data.

Page 30: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Energy function: General form of the energy function:

Where

Page 31: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Energy function:

R(A) stands for the sum of the regional penalties of a given labeling

Similarly B(A) is the sum of the boundry penalties of the labeling

Page 32: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University
Page 33: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

3D - Data Video sequence is treated as a 3D volume

image:

Page 34: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University
Page 35: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Second Method: Normalized Cut: The normalized cut criterion measures both

the total dissimilarity between the different groups as well as the total similarity within the groups.

The key point is that image partitioning is to be done from the big picture downward, rather like a painter first marking out the major areas and then filling in the details.

Page 36: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Normalized Cut Unfortunately, minimizing normalized cut

exactly is NP-complete, even for the special case of graphs on grids(Papadimitriou). However, an approximate discrete solution can be found efficiently

Page 37: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

MINCut problem Why minimum cut isn’t always favorable? the minimum cut criteria favors cutting

small sets of isolated nodes in the graph. (for example when cost function is inverse to the distance between nodes)

Page 38: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

A case where minimum cut gives a bad partition

.

Page 39: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Definition: Normalized cut

where assoc(A,V) is the total connection from nodes in A to all nodes in the graph

Page 40: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Normalized cut It is easy to see that single nodded cuts

produce MINCut value of at least 1, so minimum normal cut is not likely to be single nodded.

Page 41: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Definition: Normalized Association:

In the same spirit, we can define a measure for total normalized association within groups for a given partition:

Page 42: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

NAssoc vs NCut A direct conclusion:

NCut(A,B) = 2 – Nassoc(A,B)

Ncut is normalized measure of disassociation

minimizing Ncut is equivalent to maximizing association

Page 43: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Computing the Optimal Partition An approximate discrete solution can be

found efficiently by converting the problem into a generalized eigenvector problem

Page 44: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

NCut as Eigenvector system Matrix representation W is the cost Matrix D is the sum of the costs from node i:

The Partition is a binary matrix size |P|XK where |P| is the number of pixels and K is the number of labels

Page 45: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

NCut as Eigenvector system

The Segmentation matrix y:

Each column is a label vector

NCut can be written as:

Page 46: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Recursive two-way Ncut grouping algorithm

1. Given an image or image sequence, set up a weighted graph G=(V, E) and set the weight on the edge connection two nodes to be a measure of the similarity between the two nodes.

2. Solve for eigenvectors with the smallest eigenvalues

Page 47: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Recursive two-way Ncut grouping algorithm

3. Use the eigenvector with the second smallest eigenvalue to bipartition the graph

4. Decide if the current partition should be subdivided and recursively repartition the segmented parts if necessary.

Page 48: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Experiments on energy functions:

where X(i) is the spatial location of node i, and F(i) is a feature vector based on intensity, color, or texture information

If can separate the regional weight from the boundary weight using log operation

Page 49: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

(a) A synthetic image showing a noisy ªstepº image. Intensity varies from 0 to 1, and Gaussian noise with sigma = 0.2 is added.

(b) eigenvector with the second smallest eigenvalue (c) resulting partition.

Page 50: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Performance and optimality Solving an eigenvector system takes at

least (|P|^3) time Using iterative power method we can find

the second lowest eigenvector in a O(|P|*|n|) where |P| is #pixels, and |n| is #iterative steps

The NCut at the end of the algorithm has proven constant proximity to the MIN NCut

Page 51: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Finding the Minimum Normalized Cut VS interactive MINCut finding:

Min NCut Pros: Avoids segmenting isolated small sections (VS

“blind” calculation of MINCut) This NP-Hard can be well approximated

Min NCut cons: Difficult to control and analyse

Page 52: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Finding the Minimum Normalized Cut VS interactive MINCut finding

interactive MINCut Pros: Allows a fast correction of the result in an

interactively manner, and converges Easy to control

Page 53: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Energy Minimization Techniques for Graph Cuts Goal: giving a faster algorithm to the MIN-

Cut problem or a general K-Labeling partition of an Image

Some energy functions makes the MinCut problem to be NP-Hard

Other functions reach optimal solution in impractical polynomial time

Page 54: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Known algorithms for energy minimization: Simmulated Anealing – converges well but for

small temperature delta’s is exponential in time, and for large deltas it converges to local minimum which may be far from the minimum

Combinatorial Max flow – Min cut algorithms. Combinatorial algorithms solves the problem in at least O(|P|^3) time (Tarjan & Goldberg).

dynamic programming – restricted to 1-D energy function

Page 55: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

linear time algorithm for finding the Max-Flow-Min-Cut/

Updating the labeling function: two types of large moves: α-expansion and

α-β-swap

Page 56: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

α-Exapnsion

Take a subset of pixels which are not labeled to have that label

Works for a metric energy function:

Page 57: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

α-β swap Changing a label α of some pixels to label β Works for semimetric Energy functions:

Page 58: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

α-Exapnsion

Page 59: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

α-Exapnsion and {α, β}–Swap

Page 60: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

α-Exapnsion and {α, β}–Swap these moves allow large number of pixels

to change their labels simultaneously Note that a move which assigns a given

label α to a single pixel is both an α-β swap and an α-expansion. (α-β swap can be seen as a private case of α-Exapnsion)

Page 61: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

{ α} Expansion 1. Start with an arbitrary labeling f 2. Set success := 0 3. For each label α belongs L

3.1. Find ˆ f = argminE(f0) among f0 within one α-expansion of f

3.2. If E(f*) < E(f), set f := f* and success := 1

4. If success = 1 goto 2 5. Return f

Page 62: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

{α, β} – Swap algorithm 1. Start with an arbitrary labeling f 2. Set success := 0 3. For each pair of labels {α, β} belongs to L

3.1. Find f* = argminE(f’) among f’ within one α-β swap of f

3.2. If E(f*) < E(f), set f := f* and success := 1

4. If success = 1 goto 2 5. Return f

Page 63: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Algorithms summary A cycle is successful if a strictly better

labeling is found at any iteration. The algorithms stop after the first

unsuccessful cycle since no further improvement is possible.

α-Exapnsion much faster than α-β swap : |L| VS o(|L|^2) iterations (L is the labeling)

Page 64: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University
Page 65: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University
Page 66: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

Benchmark results

(Results of running the algorithms on the previous image)

Page 67: Graph Cuts based segmentation methods: Daniel Heilper, CS Department, Haifa University

References:

[1] J. Shi and J.Malik, “Normalized Cuts and Image Segmentation,” Proc. CVPR 1997.

[2] Boykov, Y., Jolly, M., " Interactive graph cuts for optimal boundary and regionsegmentation of objects in N-D images." In: International Conference on Computer Vision, Vancouver , BC. (2001) 105–112

[3] Boykov, Y., Veksler, O., Zabih, R.: Fast approximate energy minimization via graph cuts. IEEE Trans. Pattern Anal. Mach. Intell. 23 (2001) 1222–1239

[4] Goro Obinata, Ashish Dutta: Vision Systems: Segmentation and Pattern Recognition, I-Tech Education and Publishing, Vienna, Austria