基于 EM 的 MRF 彩色图像分割

54
基基 EM 基 MRF 基基基基基基 基基基

description

基于 EM 的 MRF 彩色图像分割. 李求旭. 领域系统和势团 Markov Random Fields Markov-Gibbs 等价性 有用的 MRF 模型 多级 GRF 模型和 MML 模型 MAP-MRF 标记 观察模型. 一个简单的例子:图像纹理分割 MRF 参数估计 基于 EM 和 MRF 的彩色图像分割 图像特征的提取 聚类的个数的分析. 领域系统和势团. Sites 和 Labels - PowerPoint PPT Presentation

Transcript of 基于 EM 的 MRF 彩色图像分割

Page 1: 基于 EM 的 MRF 彩色图像分割

基于 EM 的 MRF 彩色图像分割

李求旭

Page 2: 基于 EM 的 MRF 彩色图像分割

领域系统和势团Markov Random FieldsMarkov-Gibbs 等价性有用的 MRF 模型多级 GRF 模型和 MML 模型MAP-MRF 标记观察模型

Page 3: 基于 EM 的 MRF 彩色图像分割

• 一个简单的例子:图像纹理分割• MRF 参数估计• 基于 EM 和 MRF 的彩色图像分割• 图像特征的提取• 聚类的个数的分析

Page 4: 基于 EM 的 MRF 彩色图像分割

领域系统和势团

• Sites 和 Labels• A labeling of the sites in S in terms of the l

abels in L: f = { }• Sites S= {1,…m}

1,... mf f

Page 5: 基于 EM 的 MRF 彩色图像分割

The labeling problem is to assign a label from the label set L to each of the sites in S.

1 1{ ,..., } ...

When all the sites have the same label set

Examples: L={edge , non-edge};

m m

m

f f f L L

f L

Page 6: 基于 EM 的 MRF 彩色图像分割

• 领域系统被定义为:

'

2'

{ | }

i

2. '

a regular lattice S,

{ ' | [ ( , )] , '}

i

i

i i

i i i

N N i S

N

i N i N

For

N i S dist pixel pixel r i i

满足以下两个条件:1.

Page 7: 基于 EM 的 MRF 彩色图像分割

Cliques

• A clique   c for (S, N) is defined as a subset of sites in S . 在 c 中所有的 sites 都是相邻的。

• 对于( S , N )所有势团的集合是:

1

2

3

{ | }

{( , ) | , }

{( , , ) | , , .}

... ... ...

i

C i i S

C i i i N i S

C i i i i i i S are neighbors to each other

1 2 3...... C C C C

Page 8: 基于 EM 的 MRF 彩色图像分割

Markov Random Fields

1 m

i

1

F={F ,...,F }

m

Li

i

f

f

i

1 2 2 m m

假设随机场 是定义在位置集

S={1, 2, . . . , m}上随机变量的集合,其中为图像的像素总数;F 表示事件:F

在标记集 中的取值为

(F=f , F =f , . . . , F =f )表示联合事件

Page 9: 基于 EM 的 MRF 彩色图像分割

1 2 m

F=f

f={f ,f ,...,f } F

出于简单起见,一个联合事件被简写成:这里 是随机场 的一个confi gurati on

(构型),相应于这个随机场的一个实现。

Page 10: 基于 EM 的 MRF 彩色图像分割

Definition

i

i

i S-{i} i

S-{i}

i '

N

markov random fields

1.p(f) > 0 , f F (positivity)

2.p(f |f )=p(f |f ) (markovianity)

i

f

f { | ' }.

N

N i

F S

f i N

称随机场 为在位置集 上关于领域系统的 当且仅当满足以下两个条件:

其中S-{i }表示在位置集上除像素点以外的所有点。 表示在位置S-{i }处的标记集合,

Page 11: 基于 EM 的 MRF 彩色图像分割

Markov-Gibbs 等价性 ( 证明省略 )

• An MRF is characterized by its local property (the Markovianity)

• GRF is characterized by its global property (the Gibbs distribution).

• The Hammersley-Clifford theorem establishes the equivalence of these two types of properties

Page 12: 基于 EM 的 MRF 彩色图像分割

• The theorem states that F is an MRF on S with respect to N if and only if F is a GRF on S with respect to N

Page 13: 基于 EM 的 MRF 彩色图像分割

Gibbs Random Field----definition

• F is said to be a Gibbs Random Field on S with respect to N if and only if its configurations obey a Gibbs distribution:

1( )1

1( )

( )U f

T

U fT

f F

P f Z e

where

Z e

Page 14: 基于 EM 的 MRF 彩色图像分割

1 2 3

1 2 3{ } { , } { , , }

( )

( )

( ) ( , ) ( , , ) ... ...

cc C

i i i i i ii C i i C i i i C

U f

V f

V f V f f V f f f

Page 15: 基于 EM 的 MRF 彩色图像分割

有用的 MRF 模型• Auto-Models

• auto-logistic model ( Ising model )• auto-binomial model

• auto-normal model ( Gaussian MRF )• multi-level logistic (MLL) model (potts mod

el)

• Hierarchical GRF Model

Page 16: 基于 EM 的 MRF 彩色图像分割

MLL 模型和多级 GRF 模型• There are M (>2) discrete labels in the label set ,

L={1,2,…,M}.

For cliques containing more than one site (#c > 1)

( ) cc

c

if all siteson c havethe samelabelV f

otherwise

Page 17: 基于 EM 的 MRF 彩色图像分割

在多级两层 Gibbs 模型中:• The higher level Gibbs distribution uses an isotro

pic random field ( MLL )• A lower level Gibbs distribution describes the filli

ng-in in each region • 在纹理分割中:blob-like regions are modeled by a high level MRF

which is an isotropic MLL these regions are filled in by patterns generated ac

cording to MRFs at the lower level

Page 18: 基于 EM 的 MRF 彩色图像分割

MAP-MRF 标记• 1. 贝叶斯估计: 估计 的贝叶斯风险被定义为:

2. d: 观察的数据 C( , f) 是费用函数 p(f | d)is the posterior distribution

* *( ) ( , ) ( | )f F

R f C f f P f d df

*f

*f

Page 19: 基于 EM 的 MRF 彩色图像分割

• 费用函数:

• 根据( 1 ),贝叶斯风险为:

* * 2

*

(1) ( , ) || ||

0 || * ||(2) ( , )

1

C f f f f

if f fC f f

otherwise

* 2

*

*

( ) || * || ( | )

( *)0, min var :

( | )

f F

f F

R f f f P f d df

R fLetting we obtain the imal iance estimate

f

f fP f d df

Page 20: 基于 EM 的 MRF 彩色图像分割

• 根据( 2 )贝叶斯风险为:

• where k is the volume of the space containing all points f for which

* *

*

:|| || :|| ||

*

( ) ( | ) 1 ( | )

0,

( ) 1 ( | )

f f f f f f

R f P f d df P f d df

when the above is approximated by

R f P f d

*|| ||f f

Page 21: 基于 EM 的 MRF 彩色图像分割

• 因此:最小化风险就相当于最大化后验概率 p(f|d).这就是我们所知的最大后验概率估计。

*

f F

*

f F

arg max ( | )

( | ) ( | ) ( )

arg max ( ) ( | )

f p f d

p f d p d f p f

then f p f p d f

Page 22: 基于 EM 的 MRF 彩色图像分割

1. ( ) exp( ( ))

2. ( | ) exp( ( | ))

( ) ( | )

( | ) exp( { ( ) ( | )})

( ) ( | )

p f U f

p d f U d f

p f p d f

so p f d U f U d f

U f U d f

根据高斯模型i . i . d假设的似然函数

3. p(f | d) exp(-U(f | d))

4. p(f | d)

因此,最大化p(f | d)相当于最小化

Page 23: 基于 EM 的 MRF 彩色图像分割

MAP-MRF approach for solving computer vision problems :

Pose a vision problem as one of labeling in categories LP1-LP4 and choose an appropriate MRF representation f.

Derive the posterior energy to define the MAP solution to a problem.

Find the MAP solution.

Page 24: 基于 EM 的 MRF 彩色图像分割

The process of deriving the posterior energy

C

1. Define a neighborhood system N on S and the

set of cliques C for N .

2. Define the prior clique potentials V (f) to give

U(f) .

3. Derive the likelihood energy U(d|f).

4. Add U(f) and U(d|f) to yield the the posterior

energy U(f|d).

Page 25: 基于 EM 的 MRF 彩色图像分割

观察模型

1 2 man observation d = {d ,d ,...,d }. d

MRF f

d= (B(f))

B

一个观察 被考虑

为一个 实现 的变换和退化版本

其中 是模糊效应, 是一个变换(线性或者非线性的, 确定性的或者概率的)。 是传感器噪音。 是一个加 法或者乘积操作。

Page 26: 基于 EM 的 MRF 彩色图像分割

i i i

2i

In practice, a simple observation model of no blurring,

linear transformation and independent additive Gaussian

noise is often assumed

d = (f )+

where (.) is a linear function

(0, )

(

iN

p d

2

2i

2

1| ) exp( ( | ))

2

( (f ) ) U(d|f) =

2

m

ii

i

i S i

f U d f

dwhere

Page 27: 基于 EM 的 MRF 彩色图像分割

一个简单的例子:图像纹理分割• Texture segmentation is to segment an

image into regions according to the textures of the regions

• Texture segmentation, as other labeling problems, is usually performed in an optimization sense, such as MAP

Page 28: 基于 EM 的 MRF 彩色图像分割

( )

i

I

I I

( )

( )

L

i

( ) { | }

S= ( ) and ( ) ( ) ,

( | ) ( | ) ( | )

{ , ,...}.

I

i

I L

Ic c

c C I L c S

I I I

Ic

L

S f i S I f

then S f S f S f I J

U d f V d f V d f

type I

V

( )

( ) ( ) (J)

( ) ( )

标签集 ={1, . . . , M}, f表示一个分割,其中f 是

像素纹理类型的指示器。

假设 纹理被建模为一个MLL,具有参数:

单点势团( )c( )

( )c i

( | )

otherwise( | )

if all d , , are the same

After U(f) is also defined for the region process, the posterior

energy can be obtained as

U(f|d)=U(f)+U(d|f)

I

II

c I

d f

V d fi c

( )

多点势团

Page 29: 基于 EM 的 MRF 彩色图像分割

MRF 参数估计• EM 算法:一种迭代的标记 - 估计算法

Page 30: 基于 EM 的 MRF 彩色图像分割

基于 EM 和 MRF 的彩色图像分割

• 对图像中的每个像素,计算一个 d 维的特征向量 X, X 可以包含各种不同的颜色表示,以及一序列滤波器的输出。

• 我们将图像模型表示如下:图像中的每个像素均是由 g 个图像分割中的某一个的密度函数计算得到的。因此为产生一个像素,首先选择一个图像分割区域,然后通过该区域的密度函数生成所需的像素

Page 31: 基于 EM 的 MRF 彩色图像分割

1

1 1

1/ 2 1/ 2

p ( | )

( ,..., , ,..., )

:

( , ) :

1 1( | ) exp{ ( ) ( )}

(2 ) det( ) 2

g

l l ll

g g

l

l l

Tl l l ld

l

p X

X X X

l

l

生成一个像素向量的概率可表示为:

(X| )=

选择第l个分割的概率(混合权重)

每个分割(块)的参数

用高斯函数来建模与第l个区域对应的密

度p

Page 32: 基于 EM 的 MRF 彩色图像分割

• 我们希望确定以下参数:• 1. 每一个分割(块)的参数• 2. 混合权重• 3. 各个像素来源于模型中的哪个分量(从

而实现图像分割)

Page 33: 基于 EM 的 MRF 彩色图像分割

• 一个两难问题的提出:• 1 . 如果我们已经知道了各个像素分别来

源于哪个分量,那么确定参数将会变得容易

2. 如果知道了参数, 那么对于每个像素,就能够确定最可能产生那个像素的分量(这样就确定了图像分割)

3. 但问题是两者都不知道。

Page 34: 基于 EM 的 MRF 彩色图像分割

• 图像的似然函数为:

1j

( | )g

l l j llobervations

p X ( )

Page 35: 基于 EM 的 MRF 彩色图像分割

• The expectation-maximization (EM) algorithm is a general technique for finding maximum likelihood (ML) estimates with incomplete data

• In EM, the complete data is considered to consist of the two parts : { , }, which only is observed while

is missing(or unobervable,hidden).com obs mis obs

mis

d d d of d

d

Page 36: 基于 EM 的 MRF 彩色图像分割

*

EM

arg max ln(p( | ))

obs

obs

d

d

对于不完全数据 , 算法尝试解决以下的最大

似然估计问题:

Page 37: 基于 EM 的 MRF 彩色图像分割

Related to parameter estimation in MRF models

the observed part is the given data obsd d

mi s

,the unobservabl e l abel i ng f = d

完整数据的似然函数表示为:l n P(f , d| )

Page 38: 基于 EM 的 MRF 彩色图像分割

• EM 算法的主要思想是 1. 通过用期望值来替代丢失的(隐藏的)数据,为丢失的数据获取工作变量的集合 2. 接着将计算出的不完备数据的期望值代入到完备数据的似然函数中,用这个函数计算相对要简单一些 3. 然后最大化这个函数获得参数的值。

• 这时不完备数据的期望值可能已经改变了。• 通过交替执行期望阶段和最大化阶段,迭

代直致收敛

Page 39: 基于 EM 的 MRF 彩色图像分割

EM 算法的形式化描述• 1. 使用不完备的数据以及参数的当前值来

计算完备数据的期望值( E 步)• 2. 使用 E 步计算出的完备数据的期望值,

最大化完备数据关于参数的对数似然函数( M 步)。

• 1 , 2 步交替直到收敛。

Page 40: 基于 EM 的 MRF 彩色图像分割

• 可以证明,不完备数据的对数似然函数在每个阶段都是增长的,也就说参数序列收敛到不完备数据对数似然函数的某个局部最大值。

• However, we cannot work directly with this complete-data log likelihood because it is a random function of the missing variables f. The idea of the EM algorithm is to use the expectation of the complete-data log likelihood which will formalize EM

Page 41: 基于 EM 的 MRF 彩色图像分割

• The M-step performs maximum likelihood estimation as if there were no missing data as it had been filled in by the expectations

Page 42: 基于 EM 的 MRF 彩色图像分割

Label process

• The label process w is modeled as a MRF

with respect to a second order neighborhood system

{ , }

1 1( ) exp( ( )) exp( ( ))

-1 if ( , )

+1 otherwise

potential is also know as the potts model

markov

1( ) exp( ( , ))

c c

s wc s r

s rs r C

p w U f V fZ Z

f fV f f

this

p f f fZ

我们选取的 先验如下:

Page 43: 基于 EM 的 MRF 彩色图像分割

Image process

• 多元高斯密度分布是一种典型的适合大多数分类问题的模型。其中,对于某个给定的类 m ,特征向量 d 是连续取值的。

Page 44: 基于 EM 的 MRF 彩色图像分割

1

1

( | )

m {1,2,..., }

1 1( , ) exp( ( ) ( ))

2(2 ) det( )

1 1exp( ( ) ( ))

2(2 ) det( )s s s

s

s s

m m

Tm m m m mn

m

Ts f f s fn

s S f

p d f

M L

N d d

d d

s ss S

服从一个正态分布N( , ),

每个像素类 用均值向量和协方差矩阵 表示:

其中n是特征空间的维数

P(D| f )= P(d| f )

Page 45: 基于 EM 的 MRF 彩色图像分割

Posterior energy

{ , }

1

( | ) exp( ( , ))

exp( ( ( , ) ( , )))

1( , ) ln( (2 ) det( )) ( ) ( )

2s s s s

s s s s rs S s r C

n Ts s s f s f f s f

p f D U f D

V f d f f

V f d d d

其中, 是控制先验的权重参数,随着 的增长,区域变得更加同质。

Page 46: 基于 EM 的 MRF 彩色图像分割

• So the energy function

1

{ , }

*

1( | ) ( , ) (ln( (2 ) det( )) ( ) ( ))

2

arg min (U(f|D))

f

s s s s

n Ts r f s f f s f

s r C s S

U f D f f d d

f

Page 47: 基于 EM 的 MRF 彩色图像分割

EM 算法• 假设存在 r 个像素,丢失(隐藏)的数据形成一个 r×

L 的数组表示的指示变量 Z.• 在每一行,除了一个像素,其他的值均为 0 ,这个

值表示每个像素的特征向量来源于哪个块(分割)Z m

1 0.

( ) 1*P( ) 0*P( )

=P( )lm

l m

E Z l m l m

如果第个像素来自第 个块, 的l行 列元素为 ,否则为

第个像素来自第 块 第个像素不来自第 个块

第l个像素来自第m个块

Page 48: 基于 EM 的 MRF 彩色图像分割

( ) ( )( ) (t) ( )

( ) ( )

1

1.

arg min{ ( | )}

f

3.

( | )( | ) , ( p (m)= )

( | )

4.

t tt tm m l l

l mLt t

k k l lk

U f D

p dp m d

p d

*

l m

初始化类标签为随意值和取得一个参数集合

2. f

计算后验概率分布:

Z 注:

更新参数:见下页:

Page 49: 基于 EM 的 MRF 彩色图像分割

( 1) ( )m

1

( )

( 1) 1

( )

1

( ) ( 1) ( 1)

( 1) 1

( )

1

1( | )

( | )

( | )

( | ){( )( ) }

( | )

5. 2 5

rt t

ll

rt

l lt l

m rt

ll

rt t t T

l l m l mt lm r

tl

l

p m dr

d p m d

p m d

p m d d d

p m d

重复 步骤,直到一定的迭代次数

Page 50: 基于 EM 的 MRF 彩色图像分割
Page 51: 基于 EM 的 MRF 彩色图像分割

图像特征的提取• The brightness and texture features are ex

tracted from the L* component and the color features are extracted from the a* and b* components.

Page 52: 基于 EM 的 MRF 彩色图像分割

• two brightness features: brightness gradient and local energy content of the L* component; three color features: color gradient, local energy content of the a* and b* components;

• three texture features: phase divergence, homogeneity and homogeneous intensity; and two position features ( x,y ) coordinates of the pixels

Page 53: 基于 EM 的 MRF 彩色图像分割

聚类的个数的分析• 基于直方图的聚类个数分析

Page 54: 基于 EM 的 MRF 彩色图像分割

• thanks