A Two-stage Image Segmentation Method Using a Convex Variant of the Mumford-Shah Model
and Thresholding
Raymond H. Chan
Department of Mathematics, The Chinese University of Hong Kong
Joint work with
Xiaohao Cai (Kaiserslautern Technical University) Tieyong Zeng (Hong Kong Baptist University)
CIMI Workshop on Optimization and Statistics in Image Processing
June 24–28, 2013
Aim: One Method to Segment Different Images
anti-mass noisy tubular
3-phase 4-phase blurry non-Gaussian
Multiphase Segmentation for Blurry Image
Noisy and blur image Li et al. (10) Yuan et al. (10) 1
2 3
4
Sandberg et al. (10) Steidl et al. (12) Our result
Outline
1 Mumford-Shah Model
2 Our Two-stage Image Segmentation Method
3 Experimental Results
4 Extensions to Other Noise Models
5 Conclusions
Outline
1 Mumford-Shah Model
2 Our Two-stage Image Segmentation Method
3 Experimental Results
4 Extensions to Other Noise Models
5 Conclusions
Mumford-Shah Model (1989)
Mumford-Shah Energy
E MS (g , Γ)
||
µ 2
R
Ω\Γ |∇g | 2 dx Length(Γ)
λ 2
R
Ω (f − g ) 2 dx + +
Mumford-Shah Model (1989)
Mumford-Shah Energy
E MS (g , Γ)
||
µ 2
R
Ω\Γ |∇g | 2 dx Length(Γ)
λ 2
R
Ω (f − g ) 2 dx + +
Data fidelity:
control g not far away from f .
Regularization:
impose smooth- ness of g on Ω \ Γ.
Regularization:
require boundary
Γ be short.
Mumford-Shah Model (1989)
Mumford-Shah Energy
E MS (g , Γ)
||
µ 2
R
Ω\Γ |∇g | 2 dx Length(Γ)
λ 2
R
Ω (f − g ) 2 dx + +
Nonconvex:
due to the
edge term Γ.
Finding Good Approximation of M-S Model
Mumford-Shah Energy
E MS (g , Γ)
||
µ 2
R
Ω\Γ |∇g | 2 dx Length(Γ)
λ 2
R
Ω (f − g ) 2 dx + +
Find a good
approximation
Finding Good Approximation of M-S Model
Mumford-Shah Energy
E MS (g , Γ)
||
µ 2
R
Ω\Γ |∇g | 2 dx Length(Γ)
λ 2
R
Ω (f − g ) 2 dx + +
Find a good approximation
(1) Ambrosio and Tortorelli (1990)
(2) Gobbino (1998) and Chambolle (1999)
(3) Pock and Cremers, et al. (2009)
Finding Good Approximation of M-S Model
Mumford-Shah Energy
E MS (g , Γ)
||
µ 2
R
Ω\Γ |∇g | 2 dx Length(Γ)
λ 2
R
Ω (f − g ) 2 dx + +
Find a good approximation
(1) Ambrosio and Tortorelli (1990)
(2) Gobbino (1998) and Chambolle (1999) (3) Pock and Cremers, et al. (2009):
A 128 × 128 image on a Tesla C1060 GPU
machine requires 600 seconds.
Simplifying Mumford-Shah Model
Mumford-Shah Energy
E MS (g , Γ)
||
µ 2
R
Ω\Γ |∇g | 2 dx Length(Γ)
λ 2
R
Ω (f − g ) 2 dx + +
Simplify it:
∇g ≡ 0 on Ω \ Γ
Restrict:
Ω \ Γ = ∪ i Ω i
g = c i in Ω i
Simplifying Mumford-Shah Model
Mumford-Shah Energy
E MS (g , Γ)
||
µ 2
R
Ω\Γ |∇g | 2 dx Length(Γ)
λ 2
R
Ω (f − g ) 2 dx + +
Simplify it:
∇g ≡ 0 on Ω \ Γ
Restrict:
Ω \ Γ = ∪ i Ω i
g = c i in Ω i
= 0
Multiphase Chan-Vese Model (02) (g is piecewise constant function):
E MS (g , Γ) = λ 2 P
i
R
Ω
i(f − c i ) 2 dx + |Γ|
Simplifying Mumford-Shah Model
Mumford-Shah Energy
E MS (g , Γ)
||
µ 2
R
Ω\Γ |∇g | 2 dx Length(Γ)
λ 2
R
Ω (f − g ) 2 dx + +
Simplify it:
∇g ≡ 0 on Ω \ Γ
ACWE (01) Ω \ Γ = Ω 1 ∪ Ω 2
g = c i in Ω i
two-phase
= 0
Multiphase Chan-Vese Model (02) (g is piecewise constant function):
E MS (g , Γ) = λ 2 P
i
R
Ω
i(f − c i ) 2 dx + |Γ|
Outline
1 Mumford-Shah Model
2 Our Two-stage Image Segmentation Method
3 Experimental Results
4 Extensions to Other Noise Models
5 Conclusions
Our Motivation
(a): True binary image (b): Given smooth image
Our Motivation
(a): True binary image (c): Binary image from (b)
with threshold = 0.5
Our Motivation
(a): True binary image Difference of (a) and (c)
(nonzero pixel values)
Aim in Segmentation
piecewise constant approximation of f
Aim in Segmentation
piecewise constant approximation of f
threshold
smooth piecewise
constant
Aim in Segmentation
piecewise constant approximation of f
threshold
smooth piecewise
constant
Stage 1 Stage 2
Aim in Segmentation
piecewise constant approximation of f
threshold
smooth piecewise
constant
Stage 1 Stage 2
X. Cai, R. Chan, S. Morigi, and F. Sgallari, Vessel
Segmentation in Medical Imaging Using a Tight-Frame
Based Algorithm, SIAM J. Imaging Sci., (2013)
Stage One: Convex Variant of the M-S Model
Mumford-Shah Energy
E MS (g , Γ)
||
µ 2
R
Ω\Γ |∇g | 2 dx Length(Γ)
λ 2
R
Ω (f − g ) 2 dx + +
Restrict:
g ∈ W 1,2 (Ω)
Stage One: Convex Variant of the M-S Model
Mumford-Shah Energy
E MS (g , Γ)
||
µ 2
R
Ω\Γ |∇g | 2 dx Length(Γ)
λ 2
R
Ω (f − g ) 2 dx + +
Restrict:
g ∈ W 1,2 (Ω)
λ 2
R
Ω (f − g ) 2 dx µ 2 R
Ω |∇g | 2 dx R
Ω |∇g |dx
||
+ +
||
Convex M-S Energy
E(g )
Appro.
Thm. 2
Lemma 1
Stage One: Convex Variant of the M-S Model
Mumford-Shah Energy
E MS (g , Γ)
||
µ 2
R
Ω\Γ |∇g | 2 dx Length(Γ)
λ 2
R
Ω (f − g ) 2 dx + +
Restrict:
g ∈ W 1,2 (Ω)
λ 2
R
Ω (f − g ) 2 dx µ 2 R
Ω |∇g | 2 dx R
Ω |∇g |dx
||
+ +
||
Convex M-S Energy
E(g )
Appro.
Thm. 2
Lemma 1
Stage One: Lemma 1
Lemma 1
If g ∈ W 1,2 (Ω) and Γ is a closed curve with Lebesgue measure m(Γ) = 0, then
Z
Γ
|∇g | 2 dx = 0.
Proof.
Since g ∈ W 1,2 (Ω), we have ∇g ∈ L 2 (Ω). Because of m(Γ) = 0, we get R
Γ |∇g | 2 dx = 0 immediately.
Stage One: Convex Variant of the M-S Model
Mumford-Shah Energy
E MS (g , Γ)
||
µ 2
R
Ω\Γ |∇g | 2 dx Length(Γ)
λ 2
R
Ω (f − g ) 2 dx + +
Restrict:
g ∈ W 1,2 (Ω)
λ 2
R
Ω (f − g ) 2 dx µ 2 R
Ω |∇g | 2 dx R
Ω |∇g |dx
||
+ +
||
Convex M-S Energy
E(g )
Appro.
Thm. 2
Lemma 1
Stage One: Convex Variant of the M-S Model
Mumford-Shah Energy
E MS (g , Γ)
||
µ 2
R
Ω\Γ |∇g | 2 dx Length(Γ)
λ 2
R
Ω (f − g ) 2 dx + +
Restrict:
g ∈ W 1,2 (Ω)
λ 2
R
Ω (f − g ) 2 dx µ 2 R
Ω |∇g | 2 dx R
Ω |∇g |dx
||
+ +
||
Convex M-S Energy
E(g )
Appro.
Thm. 2
Lemma 1
Stage One: Theorem 2
Let Σ = Inside(Γ), g 1 ∈ W 1,2 (Σ \ Γ) and g 2 ∈ W 1,2 (Ω \ Σ), rewrite the Mumford-Shah model as:
E MS ∗ (Σ, g 1 , g 2 ) = λ 2 R
Σ\Γ (f − g 1 ) 2 dx + µ 2 R
Σ\Γ |∇g 1 | 2 dx + λ 2 R
Ω\Σ (f − g 2 ) 2 dx + µ 2 R
Ω\Σ |∇g 2 | 2 dx + Length(Γ).
✬
✫
✩
✪ Σ \ Γ
g 1 Ω \ Σ
g 2
❅ ❅
■ Γ = ∂Σ
Stage One: Theorem 2
To minimize the rewritten Mumford-Shah model:
E
MS∗(Σ, g
1, g
2) =
λ2R
Σ\Γ
(f − g
1)
2dx +
µ2R
Σ\Γ
|∇g
1|
2dx +
λ2R
Ω\Σ
(f − g
2)
2dx +
µ2R
Ω\Σ
|∇g
2|
2dx + Length (Γ) let G (g
1, g
2) = λ(f − g
1)
2+ µ|∇g
1|
2−λ(f − g
2)
2− µ|∇g
2|
2.
Theorem 2
Given g
1and g
2∈ W
1,2(Ω), a global minimizer Σ for E
MS∗(Σ; g
1, g
2) can be found by solving the convex minimization:
0≤u≤1
min ( Z
Ω
|∇u| + 1 2
Z
Ω
G (g
1, g
2)u(x) )
, and setting Σ = {x : u(x) ≥ ρ} for a.e. ρ ∈ [0, 1].
(Proof is similar to Theorem 2 of T. Chan, Esedoglu, and Nikolova (06) )
Stage One: Theorem 2
Conclusion:
• Length(Γ) ←→ R
Ω |∇u|; and equal when u is binary.
• phases of g can be obtained from u by thresholding.
Stage One: Theorem 2
Conclusion:
• Length(Γ) ←→ R
Ω |∇u|; and equal when u is binary.
• phases of g can be obtained from u by thresholding.
Observation: (especially when g is nearly binary)
• jump set of g ≈ jump set of u.
• R
Ω |∇g | ≈ R
Ω |∇u| ←→ Length(Γ).
Stage One: Convex Variant of the M-S Model
Convex M-S Energy
E(g )
||
µ 2
R
Ω |∇g | 2 dx R
Ω |∇g |dx
λ 2
R
Ω (f − g ) 2 dx + +
Stage One
Stage One: Convex Variant of the M-S Model
Convex M-S Energy
E(g )
||
µ 2
R
Ω |∇g | 2 dx R
Ω |∇g |dx
λ 2
R
Ω (f − g ) 2 dx + +
Stage One
λ 2
R
Ω (f − Ag ) 2 dx µ 2 R
Ω |∇g | 2 dx R
Ω |∇g |dx
+ +
extendable to blurred images
Stage One: Unique Minimizer
Our convex variant of the Mumford-Shah model is:
E (g ) = λ 2
Z
Ω
(f − Ag ) 2 dx + µ 2
Z
Ω
|∇g | 2 dx + Z
Ω
|∇g |dx
Its discrete version:
λ
2 kf − Ag k 2 2 + µ
2 k∇g k 2 2 + k∇g k 1 Theorem 3
Let Ω be a bounded connected open subset of R 2 with a Lipschitz boundary. Let Ker(A) T
Ker(∇) = {0} and f ∈ L 2 (Ω), where A
is a bounded linear operator from L 2 (Ω) to itself. Then E (g ) has
a unique minimizer g ∈ W 1,2 (Ω).
Stage Two: Thresholding
Convex M-S Energy
E(g )
||
µ 2
R
Ω |∇g | 2 dx R
Ω |∇g |dx
λ 2
R
Ω (f − Ag ) 2 dx + +
Stage One
Stage Two: Thresholding
Convex M-S Energy
E(g )
||
µ 2
R
Ω |∇g | 2 dx R
Ω |∇g |dx
λ 2
R
Ω (f − Ag ) 2 dx + +
Stage One
⇓
Threshold g to
piecewise constant
Stage Two
Our Two-stage Segmentation Algorithm
Given f Stage One: solve min
gn
λ2
kf − Ag k
22+
µ
2
k∇g k
22+ k∇g k
1o
Stage Two: determine thresholds from g
ρ 1 ≤ · · · ≤ ρ K−1
K segments
Numerical Aspects: Stage One
Given f Stage One: solve min
gn
λ2
kf − Ag k
22+
µ
2
k∇g k
22+ k∇g k
1o
Stage Two: determine thresholds from g
ρ 1 ≤ · · · ≤ ρ K−1 K segments
Split-Bregman (ADMM) (Goldstein and Osher, 09);
Augmented Lagrangian (Tai, et. al., 09);
Chambolle-Pock method (Chambolle and Pock, 10);
etc.
Numerical Aspects: Stage One
Given f Stage One: solve min
gn
λ2
kf − Ag k
22+
µ
2
k∇g k
22+ k∇g k
1o
Stage Two: determine thresholds from g
ρ 1 ≤ · · · ≤ ρ K−1 K segments
Split-Bregman (ADMM) (Goldstein and Osher, 09);
Augmented Lagrangian (Tai, et. al., 09);
Chambolle-Pock method (Chambolle and Pock, 10);
etc.
Numerical Aspects: Stage One
Split-Bregman method for solving our model min g
n λ
2 kf − Ag k 2 2 + µ 2 k∇g k 2 2
| {z }
F (g)
+k∇g k 1 o .
Note that F (g ) is quadratic in g .
Idea is to separate the g ’s in F (g ) and k∇g k 1 . Set ( d x = ∇ x g ,
d y = ∇ y g .
Numerical Aspects: Stage One
Solve:
g min ,d
x,d
yn
F (g ) + k(d x , d y )k 1 o
s.t. d x = ∇ x g , d y = ∇ y g
Split-Bregman iteration:
(g k+1 , d x k+1 , d y k+1 ) = argmin g,d
x,d
yn
F (g ) + k(d x , d y )k 1 + σ
2 kd x − ∇ x g − b x k k 2 2 + σ
2 kd y − ∇ y g − b k y k 2 2 o
,
b x k+1 = b x k + (∇ x g k+1 − d x k+1 ), b k+1 y = b k y + (∇ y g k+1 − d y k+1 ).
Numerical Aspects: Stage One
Given f Stage One: solve min
gn
λ2
kf − Ag k
22+
µ
2
k∇g k
22+ k∇g k
1o
Stage Two: determine thresholds from g
ρ 1 ≤ · · · ≤ ρ K−1 K segments
Solved!
Numerical Aspects: Stage Two
Given f Stage One: solve min
gn
λ2
kf − Ag k
22+
µ
2
k∇g k
22+ k∇g k
1o
Stage Two: determine thresholds from g
ρ 1 ≤ · · · ≤ ρ K−1 K segments
Automatic way to determine thresholds by K-means 1. Linear-stretch g to [0, 1]:
¯
g = (g − g min )/(g max − g min ).
2. Segment the histogram of g ¯ into K clusters, and compute the mean value of each cluster:
m 1 ≤ m 2 ≤ · · · ≤ m K . 3. Define (K − 1) thresholds:
ρ i = (m i + m i+1 )/2, i = 1, . . . , K − 1.
Numerical Aspects: Stage Two
Given f Stage One: solve min
gn
λ2
kf − Ag k
22+
µ
2
k∇g k
22+ k∇g k
1o
Stage Two: determine thresholds from g
ρ 1 ≤ · · · ≤ ρ K−1 K segments
Other Ways
1. Choose by the user: ρ U .
2. Two-phase: ρ M = mean(¯ g ).
Numerical Aspects: Stage Two
Given f Stage One: solve min
gn
λ2
kf − Ag k
22+
µ
2
k∇g k
22+ k∇g k
1o
Stage Two: determine thresholds from g
ρ 1 ≤ · · · ≤ ρ K−1 K segments
1. No need to recompute g when using different thresholds!
2. No need to fix the number of
phases K at the beginning!
Outline
1 Mumford-Shah Model
2 Our Two-stage Image Segmentation Method
3 Experimental Results Two-phase Segmentation Multiphase Segmentation
4 Extensions to Other Noise Models
5 Conclusions
Anti-mass Image: Stage One Solution
Given image Our solution g
Anti-mass Image: Results Comparison
Given image Chan-Vese (01) Our: ρ M = 0.1898
Dong et al. (10) Yuan et al. (10) Our: ρ = 0.2669
Anti-mass Image: Our Result
ρ M = 0.1898 ρ U = 0.2 ρ 1 = 0.2669
Different thresholds give different meaningful
segmentation results. No need to solve the convex
model again when thresholds changed.
Tubular Image: Stage One Solution
Given image Our solution g
Tubular Image: Results Comparison
Chan-Vese (01) Yuan et al. (10) ρ 1 = 0.4019
Dong et al. (10) Cai et al. (13) ρ M = 0.1760
Motion Blurred and Noisy Image
Clean image Given blurred image Chan-Vese (01)
Dong et al. (10) Yuan et al. (10) ρ = 0.5048
Motion Blurred and Noisy Image
✒✑
✓✏
Clean image Given blurred image Chan-Vese (01)
✒✑
✓✏
Dong et al. (10) Yuan et al. (10) ρ = 0.5048
Motion Blurred and Noisy Image
ρ M = 0.7661 ρ U = 0.6 ρ 1 = 0.5048
Robust with respect to the thresholds chosen.
Segmentation Changes with Threshold
(Loading Video...)
Convergence History
Log of difference in iterates versus time
0 0.5 1 1.5 2 2.5 3 3.5 4
−10
−9
−8
−7
−6
−5
−4
−3
−2
−1
time (seconds)
log of difference in iterants
Chan−Vese Dong et al.
Yuan et al.
Ours
0 0.5 1 1.5 2 2.5 3 3.5 4
−10
−9
−8
−7
−6
−5
−4
−3
−2
−1
time (seconds)
log of difference in iterants
Chan−Vese Dong et al.
Yuan et al.
Ours
Anti-mass image Motion blurred and noisy image
Our method is very stable.
CPU Time
Two-phase: iteration numbers and CPU time in second
C-V (01) Dong (10) Yuan (10) Our method Example iter. time iter. time iter. time iter. time Anti-mass 1000 263.73 300 83.82 64 6.01 172 18.38 Tubular 1000 76.62 300 32.17 18 0.37 115 3.03 Motion 1300 28.19 300 10.18 20 0.09 52 1.13
Our method is faster than others except Yuan’s, but our
segmentation results are better.
Three-phase Segmentation
Given image Li et al. (10) Sandberg et al. (10) 1
2 3
Yuan et al. (10) Our solution g Our 3 phases from g
Three-phase Segmentation
❦ ❦
Given image Li et al. (10) Sandberg et al. (10)
✒✑
✓✏
1
2 3
Yuan et al. (10) Our solution g Our 3 phases from g
Four-phase Segmentation: Noisy image
Given noisy image Yuan et al. (10) Li et al. (10) 1
2 3
4
Sandberg et al. (10) Steidl et al. (12) Our 4 phases from g
Four-phase Segmentation: Noisy image
Given noisy image Yuan et al. (10) Li et al. (10)
✐
✐ 1
2 3
4
Sandberg et al. (10) Steidl et al. (12) Our 4 phases from g
Four-phase Segmentation: Noisy and blurry image
Noisy & blurry Yuan et al. (10) Li et al. (10) 1
2 3
4
Sandberg et al. (10) Steidl et al. (12) Our 4 phases from g
Convergence History
Log of difference in iterates versus time
0 0.5 1 1.5 2 2.5 3
−10
−8
−6
−4
−2 0 2 4 6 8 10
time (seconds)
log of difference in iterants
Li et al.
Sandberg et al.
Yuan et al.
Ours
0 1 2 3 4 5 6 7 8 9
−10
−8
−6
−4
−2 0 2 4 6 8 10
time (seconds)
log of difference in iterants
Li et al.
Sandberg et al.
Yuan et al.
Ours