一、算法概述

OTSU 算法是一种用于图像分割的自动阈值选择算法,广泛应用于图像处理领域,特别是在二值化过程中。它是由日本学者大津展之(Nobuyuki Otsu)在1979年提出,因此得名“OTSU算法”。

二、算法原理

OTSU算法的核心思想是通过遍历所有可能的阈值,将图像分割为前景(目标)和背景两部分,使得这两部分之间的类内方差(intra-class variance)最小,或者说使得这两部分之间的类间方差(inter-class variance)最大,也称为最大类间方差算法。

2.1 研究任务

该算法主要用于进行图像分割,针对于图像的灰度直方图,计算灰度级别从 0 到 255 的频率分布,然后希望选择一个最佳的灰度级别(分割阈值)。将图像的各个像素分为两个部分,灰度值小于等于阈值的为一个部分(背景),灰度值大于阈值的为另外一个部分(前景)。

  • 图像二值化
    图像分割最常见的就是将图像中的物体分割为两个部分,最直观的反映就是二值化。根据 OTSU 算法划分出的前景和背景两个部分,可以将背景的像素点设置为 0 (黑色),前景的像素点设置为 255 (白色),便可实现自适应的图像二值化分割。

2.2 算法推导

基本定义

假定图像尺寸为 W × H W\times H W×H,给定一个分割阈值 T T T,图像的所有像素点可以分为背景和前景(目标)两个部分。现定义以下个各参数表示,

含义符号含义符号含义符号
划分为背景的像素点个数 N 0 N_0 N0划分为前景的像素点个数 N 1 N_1 N1
整个图像的像素点个数 N N N
背景像素点数占整张图像比例 ω 0 \omega_0 ω0前景像素点数占整张图像比例 ω 1 \omega_1 ω1
背景像素灰度均值 μ 0 \mu_0 μ0前景像素灰度均值 μ 1 \mu_1 μ1整个图像像素灰度均值 μ \mu μ
背景像素点方差 σ 0 2 \sigma_0^2 σ02前景像素点方差 σ 1 2 \sigma_1^2 σ12
类内方差 σ W 2 \sigma_W^2 σW2类间方差 σ B 2 \sigma_B^2 σB2
整张图像的灰度级 L L L i i i 个灰度级的像素个数 n i n_i ni分割灰度值阈值 T T T
图像背景像素点类 C 0 C_0 C0图像前景像素点类 C 1 C_1 C1

定义以上参数后,可以直接得到参数关系:
ω 0 = N 0 N (1) \omega_0 = \frac{N_0}{N}\tag{1} ω0=NN0(1)
ω 1 = N 1 N (2) \omega_1=\frac{N_1}{N}\tag{2} ω1=NN1(2)
N = W ∗ H = N 0 + N 1 (3) N = W*H=N_0+N_1\tag{3} N=WH=N0+N1(3)
进一步,由公式 ( 1 ) ∼ ( 3 ) (1)\sim(3) (1)(3) 推得,
ω 0 + ω 1 = 1 (4) \omega_0 + \omega_1 = 1\tag{4} ω0+ω1=1(4)
μ = μ 0 ∗ N 0 + μ 1 ∗ N 1 N = μ 0 ∗ ω 0 + μ 1 ∗ ω 1 (5) \begin{aligned} \mu &= \frac{\mu_0*N_0+\mu_1*N_1}{N}\newline &=\mu_0*\omega_0 + \mu_1*\omega_1 \end{aligned}\tag{5} μ=Nμ0N0+μ1N1=μ0ω0+μ1ω1(5)

类内方差与类间方差

  • 类内方差(Within-class variance)
    σ W 2 = ω 0 σ 0 2 + ω 1 σ 1 2 (6) \sigma_W^2 = \omega_0\sigma_0^2 + \omega_1\sigma_1^2\tag{6} σW2=ω0σ02+ω1σ12(6)

类内方差是背景与前景两类像素方差的加权和,权重分别为对应像素点占比。

  • 类间方差(Between-class variance)
    σ B 2 = ω 0 ( μ 0 − μ ) 2 + ω 1 ( μ 1 − μ ) 2 = ω 0 ω 1 ( μ 0 − μ 1 ) 2 (7) \begin{aligned} \sigma_B^2 &= \omega_0(\mu_0-\mu)^2+\omega_1(\mu_1-\mu)^2\newline &=\omega_0\omega_1(\mu_0-\mu_1)^2 \end{aligned}\tag{7} σB2=ω0(μ0μ)2+ω1(μ1μ)2=ω0ω1(μ0μ1)2(7)

类间方差推导过程
σ B 2 = ω 0 ( μ 0 − μ ) 2 + ω 1 ( μ 1 − μ ) 2 = ω 0 ( μ 0 − ( ω 0 μ 0 + ω 1 μ 1 ) ) 2 + ω 1 ( μ 1 − ( ω 0 μ 0 + ω 1 μ 1 ) ) 2 = ω 0 ( ( 1 − ω 0 ) μ 0 − ω 1 μ 1 ) 2 + ω 1 ( ( 1 − ω 1 ) μ 1 − ω 0 μ 0 ) 2 = ω 0 ( ω 1 μ 0 − ω 1 μ 1 ) 2 + ω 1 ( ω 0 μ 1 − ω 0 μ 0 ) 2 = ω 0 ω 1 2 ( μ 0 − μ 1 ) 2 + ω 1 ω 0 2 ( μ 0 − μ 1 ) 2 = ( ω 0 + ω 1 ) ω 0 ω 1 ( μ 0 − μ 1 ) 2 = ω 0 ω 1 ( μ 0 − μ 1 ) 2 (8) \begin{aligned} \sigma_B^2 &= \omega_0(\mu_0-\mu)^2+\omega_1(\mu_1-\mu)^2\newline &=\omega_0(\mu_0-(\omega_0\mu_0+\omega_1\mu_1))^2+ \omega_1(\mu_1-(\omega_0\mu_0+\omega_1\mu_1))^2\newline &=\omega_0((1-\omega_0)\mu_0-\omega_1\mu_1)^2+\omega_1((1-\omega_1)\mu_1-\omega_0\mu_0)^2\newline &=\omega_0(\omega_1\mu_0-\omega_1\mu_1)^2+\omega_1(\omega_0\mu_1-\omega_0\mu_0)^2\newline &=\omega_0\omega_1^2(\mu_0-\mu_1)^2+\omega_1\omega_0^2(\mu_0-\mu_1)^2\newline &=(\omega_0+\omega_1)\omega_0\omega_1(\mu_0-\mu_1)^2\newline &=\omega_0\omega_1(\mu_0-\mu_1)^2 \end{aligned}\tag{8} σB2=ω0(μ0μ)2+ω1(μ1μ)2=ω0(μ0(ω0μ0+ω1μ1))2+ω1(μ1(ω0μ0+ω1μ1))2=ω0((1ω0)μ0ω1μ1)2+ω1((1ω1)μ1ω0μ0)2=ω0(ω1μ0ω1μ1)2+ω1(ω0μ1ω0μ0)2=ω0ω12(μ0μ1)2+ω1ω02(μ0μ1)2=(ω0+ω1)ω0ω1(μ0μ1)2=ω0ω1(μ0μ1)2(8)

详细解释

该图像有 L L L 个灰度级,则对应的灰度值范围为 [ 0 , 1 , 2 , ⋯   , L − 1 ] [0,1,2,\cdots, L-1] [0,1,2,,L1],最大的灰度级即 L = 255 L = 255 L=255。对应第 i i i 个灰度级的像素个数为 n i n_i ni,则我们可以对【基本定义】中的参数进一步细化,
N = W ∗ H = n 1 + n 2 + ⋯ + n L − 1 = ∑ i = 0 L − 1 n i (9) \begin{aligned} N = W*H &=n_1+n_2+\cdots+n_{L-1}\newline &=\sum_{i=0}^{L-1}n_i \end{aligned}\tag{9} N=WH=n1+n2++nL1=i=0L1ni(9)
对所有像素点绘制灰度直方图,会得到每个灰度值在图像中出现的频率,具体表示灰度值为 i i i 的像素在图像中出现的频率为 f i f_i fi,如果我们以频率估计概率,将其视为灰度值概率,可以得到
p i = f i = n i N       ( i = 0 , 1 , ⋯   , L − 1 ) (10) p_i = f_i = \frac{n_i}{N}\ \ \ \ \ (i = 0, 1, \cdots, L-1)\tag{10} pi=fi=Nni     (i=0,1,,L1)(10)
∑ i = 0 L − 1 p i = 1 (11) \sum_{i=0}^{L-1}p_i = 1\tag{11} i=0L1pi=1(11)
在灰度值阈值 T T T 划分下,所有像素点分为两类记为 C 0 , C 1 C_0, C_1 C0,C1,其中 C 0 C_0 C0 类表示图像背景,对应的灰度级别为 [ 0 , 1 , ⋯   , T − 1 ] [0,1,\cdots, T-1] [0,1,,T1] C 1 C_1 C1 类表示图像前景,对应的灰度级别为 [ T , T + 1 , ⋯   , L − 1 ] [T, T+1, \cdots, L-1] [T,T+1,,L1]
对应于基本定义中像素点占比,从概率的角度应该计算每个类别的所有概率点,即
ω 0 ( T ) = P r ( C 0 ) = ∑ i = 0 T − 1 p i ω 1 ( T ) = P r ( C 1 ) = ∑ i = T L − 1 p i = 1 − ω 0 ( T ) (12) \begin{aligned} \omega_0(T) &= P_r(C_0) = \sum^{T-1}_{i=0}p_i\newline \omega_1(T) &= P_r(C_1) = \sum^{L-1}_{i=T}p_i=1-\omega_0(T) \end{aligned}\tag{12} ω0(T)ω1(T)=Pr(C0)=i=0T1pi=Pr(C1)=i=TL1pi=1ω0(T)(12)
由离散型概率分布,可以计算出图像整体灰度值,并且其与灰度值阈值的选取无关,为了下文统一标识,在这里记作 μ ( L ) \mu(L) μ(L) 表示前 L L L 级的平均灰度值。
μ ( L ) = ∑ i = 0 L − 1 i ∗ p i (13) \mu(L) = \sum^{L-1}_{i=0}i*p_i\tag{13} μ(L)=i=0L1ipi(13)
前面 ω 0 ( T ) , ω 1 ( T ) \omega_0(T),\omega_1(T) ω0(T),ω1(T) 是我们获取得到的各类别的概率点,可以估计为各类别像素点占比。现在需要计算的是,各类别对应的平均灰度值,
μ 0 = ∑ i = 0 T − 1 i ∗ P r ( i ∣ C 0 ) = ∑ i = 0 T − 1 i ∗ p i ω 0 ( T ) = 1 ω 0 ( T ) ∑ i = 0 T − 1 i ∗ p i = μ ( T ) ω 0 ( T ) (14) \begin{aligned} \mu_0&=\sum_{i=0}^{T-1}i*P_r(i|C_0)=\sum_{i=0}^{T-1}i*\frac{p_i}{\omega_0(T)}\newline &=\frac{1}{\omega_0(T)}\sum^{T-1}_{i=0}i*p_i\newline &=\frac{\mu(T)}{\omega_0(T)} \end{aligned}\tag{14} μ0=i=0T1iPr(iC0)=i=0T1iω0(T)pi=ω0(T)1i=0T1ipi=ω0(T)μ(T)(14)
μ 1 = ∑ i = T L − 1 i ∗ P r ( i ∣ C 0 ) = ∑ i = T L − 1 i ∗ p i ω 1 ( T ) = 1 ω 1 ( T ) ∑ i = T L − 1 i ∗ p i = μ ( L ) − μ ( T ) ω 1 ( T ) (15) \begin{aligned} \mu_1&=\sum_{i=T}^{L-1}i*P_r(i|C_0)=\sum_{i=T}^{L-1}i*\frac{p_i}{\omega_1(T)}\newline &=\frac{1}{\omega_1(T)}\sum^{L-1}_{i=T}i*p_i\newline &=\frac{\mu(L)-\mu(T)}{\omega_1(T)} \end{aligned}\tag{15} μ1=i=TL1iPr(iC0)=i=TL1iω1(T)pi=ω1(T)1i=TL1ipi=ω1(T)μ(L)μ(T)(15)
根据式 ( 14 ) , ( 15 ) (14),(15) (14),(15) 进一步得到,
μ 0 ω 0 ( T ) = μ ( T ) μ 1 ω 1 ( T ) = μ ( L ) − μ ( T ) (16) \begin{aligned} \mu_0\omega_0(T) &= \mu(T)\newline \mu_1\omega_1(T) &= \mu(L) - \mu(T) \end{aligned}\tag{16} μ0ω0(T)μ1ω1(T)=μ(T)=μ(L)μ(T)(16)
由上述关系,直接相加两个等式可以得到与【基本定义】一致的关系式,
μ ( L ) = μ 0 ω 0 ( T ) + μ 1 ω 1 ( T ) (17) \mu(L)=\mu_0\omega_0(T)+\mu_1\omega_1(T)\tag{17} μ(L)=μ0ω0(T)+μ1ω1(T)(17)
进一步,可以计算图像整体以及各类比的各像素灰度值方差,
σ 2 = ∑ i = 0 L − 1 ( i − μ ( L ) ) 2 p i σ 0 2 = ∑ i = 0 T − 1 ( i − μ 0 ) 2 P r ( i ∣ C 0 ) = ∑ i = 0 T − 1 ( i − μ 0 ) 2 p i ω 0 ( T ) σ 1 2 = ∑ i = T L − 1 ( i − μ 1 ) 2 P r ( i ∣ C 1 ) = ∑ i = T L − 1 ( i − μ 1 ) 2 p i ω 1 ( T ) (18) \begin{aligned} \sigma^2 &= \sum_{i=0}^{L-1}(i-\mu(L))^2p_i\newline \sigma_0^2 &= \sum^{T-1}_{i=0}(i-\mu_0)^2P_r(i|C_0)=\sum^{T-1}_{i=0}\frac{(i-\mu_0)^2p_i}{\omega_0(T)}\newline \sigma_1^2 &= \sum^{L-1}_{i=T}(i-\mu_1)^2P_r(i|C_1)=\sum_{i=T}^{L-1}\frac{(i-\mu_1)^2p_i}{\omega_1(T)} \end{aligned}\tag{18} σ2σ02σ12=i=0L1(iμ(L))2pi=i=0T1(iμ0)2Pr(iC0)=i=0T1ω0(T)(iμ0)2pi=i=TL1(iμ1)2Pr(iC1)=i=TL1ω1(T)(iμ1)2pi(18)
计算类内方差,
σ W 2 = ω 0 ( T ) σ 0 2 + ω 1 ( T ) σ 1 2 = ω 0 ( T ) ∗ 1 ω 0 ( T ) ∑ i = 0 T − 1 ( i − μ 0 ) 2 p i + ω 1 ( T ) ∗ 1 ω 1 ( T ) ∑ i = T L − 1 ( i − μ 1 ) 2 p i = ∑ i = 0 T − 1 ( i − μ 0 ) 2 p i + ∑ i = T L − 1 ( i − μ 1 ) 2 p i (19) \begin{aligned} \sigma_W^2 &= \omega_0(T)\sigma_0^2 + \omega_1(T)\sigma_1^2\newline &=\omega_0(T)*\frac{1}{\omega_0(T)}\sum_{i=0}^{T-1}(i-\mu_0)^2p_i+\omega_1(T)*\frac{1}{\omega_1(T)}\sum_{i=T}^{L-1}(i-\mu_1)^2p_i\newline &=\sum_{i=0}^{T-1}(i-\mu_0)^2p_i+\sum_{i=T}^{L-1}(i-\mu_1)^2p_i \end{aligned}\tag{19} σW2=ω0(T)σ02+ω1(T)σ12=ω0(T)ω0(T)1i=0T1(iμ0)2pi+ω1(T)ω1(T)1i=TL1(iμ1)2pi=i=0T1(iμ0)2pi+i=TL1(iμ1)2pi(19)
计算类间方差,
σ B 2 = ω 0 ( T ) ω 1 ( T ) ( μ 0 − μ 1 ) 2 = ω 0 ( T ) ω 1 ( T ) ( μ ( T ) ω 0 ( T ) − μ ( L ) − μ ( T ) ω 1 ( T ) ) 2 = ω 0 ( T ) ω 1 ( T ) ( μ ( T ) ω 1 ( T ) − μ ( L ) ω 0 ( T ) + μ ( T ) ω 0 ( T ) ω 0 ( T ) ω 1 ( T ) ) 2 = ( μ ( T ) − μ ( T ) ω 0 ( T ) − μ ( L ) ω 0 ( T ) + μ ( T ) ω 0 ( T ) ) 2 ω 0 ( T ) ω 1 ( T ) = ( μ ( T ) − μ ( L ) ω 0 ( T ) ) 2 ω 0 ( T ) ω 1 ( T ) (20) \begin{aligned} \sigma_B^2 &= \omega_0(T)\omega_1(T)(\mu_0-\mu_1)^2\newline &=\omega_0(T)\omega_1(T)(\frac{\mu(T)}{\omega_0(T)}-\frac{\mu(L)-\mu(T)}{\omega_1(T)})^2\newline &=\omega_0(T)\omega_1(T)(\frac{\mu(T)\omega_1(T)-\mu(L)\omega_0(T)+\mu(T)\omega_0(T)}{\omega_0(T)\omega_1(T)})^2\newline &=\frac{(\mu(T)-\mu(T)\omega_0(T)-\mu(L)\omega_0(T)+\mu(T)\omega_0(T))^2}{\omega_0(T)\omega_1(T)}\newline &=\frac{(\mu(T)-\mu(L)\omega_0(T))^2}{\omega_0(T)\omega_1(T)}\newline \end{aligned}\tag{20} σB2=ω0(T)ω1(T)(μ0μ1)2=ω0(T)ω1(T)(ω0(T)μ(T)ω1(T)μ(L)μ(T))2=ω0(T)ω1(T)(ω0(T)ω1(T)μ(T)ω1(T)μ(L)ω0(T)+μ(T)ω0(T))2=ω0(T)ω1(T)(μ(T)μ(T)ω0(T)μ(L)ω0(T)+μ(T)ω0(T))2=ω0(T)ω1(T)(μ(T)μ(L)ω0(T))2(20)

类内方差与类间方差和为定值

σ W 2 + σ B 2 = σ 2 (21) \sigma_W^2 + \sigma_B^2=\sigma^2\tag{21} σW2+σB2=σ2(21)

详细推导
σ W 2 + σ B 2 = ( ω 0 ( T ) σ 0 2 + ω 1 ( T ) σ 1 2 ) + ( ω 0 ( T ) ( μ 0 − μ ) 2 ) + ω 1 ( T ) ( μ 1 − μ ) 2 ) = ( ω 0 ( T ) σ 0 2 + ω 0 ( T ) ( μ 0 − μ ) 2 ) + ( ω 1 ( T ) σ 1 2 + ω 1 ( T ) ( μ 1 − μ ) 2 ) (22) \begin{aligned} \sigma_W^2+\sigma_B^2 &= (\omega_0(T)\sigma_0^2+\omega_1(T)\sigma_1^2)+(\omega_0(T)(\mu_0-\mu)^2)+\omega_1(T)(\mu_1-\mu)^2)\newline &=(\omega_0(T)\sigma_0^2+\omega_0(T)(\mu_0-\mu)^2)+(\omega_1(T)\sigma_1^2+\omega_1(T)(\mu_1-\mu)^2) \end{aligned}\tag{22} σW2+σB2=(ω0(T)σ02+ω1(T)σ12)+(ω0(T)(μ0μ)2)+ω1(T)(μ1μ)2)=(ω0(T)σ02+ω0(T)(μ0μ)2)+(ω1(T)σ12+ω1(T)(μ1μ)2)(22)
其中 ω 0 ( T ) σ 0 2 \omega_0(T)\sigma_0^2 ω0(T)σ02 推导如下
ω 0 ( T ) σ 0 2 = ω 0 ( T ) [ 1 ω 0 ( T ) ∑ i = 0 T − 1 ( i − μ 0 ) 2 p i ] = ω 0 ( T ) [ 1 ω 0 ( T ) ∑ i = 0 T − 1 ( ( i − μ ( L ) ) + ( μ ( L ) − μ 0 ) ) 2 p i ] = ω 0 ( T ) [ 1 ω 0 ( T ) ∑ i = 0 T − 1 ( ( i − μ ( L ) ) 2 + 2 ( i − μ ( L ) ) ( μ ( L ) − μ 0 ) + ( μ ( L ) − μ 0 ) 2 ) p i ] = ( ∑ i = 0 T − 1 ( i − μ ( L ) ) 2 ∗ p i ) + ( ∑ i = 0 T − 1 2 ( i − μ ( L ) ) ( μ ( L ) − μ 0 ) ∗ p i ) + ( ( μ ( L ) − μ 0 ) 2 ∑ i = 0 T − 1 p i ) = ( ∑ i = 0 T − 1 ( i − μ ( L ) ) 2 ∗ p i ) + ( 2 ( μ ( L ) − μ 0 ) ∑ i = 0 T − 1 ( i − μ ( L ) ) p i ) + ( ω 0 ( T ) ( μ ( L ) − μ 0 ) 2 ) = ( ∑ i = 0 T − 1 ( i − μ ( L ) ) 2 ∗ p i ) + ( 2 ( μ ( L ) − μ 0 ) [ ∑ i = 0 T − 1 i p i − ∑ i = 0 T − 1 μ ( L ) p i ] ) + ( ω 0 ( T ) ( μ ( L ) − μ 0 ) 2 ) = ( ∑ i = 0 T − 1 ( i − μ ( L ) ) 2 ∗ p i ) + 2 ( μ ( L ) − μ 0 ) ( ω 0 ( T ) μ 0 − μ ( L ) ω 0 ( T ) ) + ( ω 0 ( T ) ( μ ( L ) − μ 0 ) 2 ) = ( ∑ i = 0 T − 1 ( i − μ ( L ) ) 2 ∗ p i ) − 2 ω 0 ( T ) ( μ 0 − μ ( L ) ) 2 + ( ω 0 ( T ) ( μ ( L ) − μ 0 ) 2 ) = ( ∑ i = 0 T − 1 ( i − μ ( L ) ) 2 ∗ p i ) − ω 0 ( μ 0 − μ ( L ) ) 2 (23) \begin{aligned} \omega_0(T) \sigma_0^2 &= \omega_0(T) \left[ \frac{1}{\omega_0(T)} \sum_{i=0}^{T-1} (i - \mu_0)^2 p_i \right]\newline &=\omega_0(T) \left[ \frac{1}{\omega_0(T)} \sum_{i=0}^{T-1} \left( (i - \mu(L)) + (\mu(L) - \mu_0) \right)^2 p_i \right]\newline &= \omega_0(T) \left[ \frac{1}{\omega_0(T)} \sum_{i=0}^{T-1} \left( (i - \mu(L))^2 + 2(i - \mu(L))(\mu(L) - \mu_0) + (\mu(L) - \mu_0)^2 \right) p_i \right] \newline &= \left( \sum_{i=0}^{T-1} (i - \mu(L))^2 * p_i \right) + \left( \sum_{i=0}^{T-1} 2(i - \mu(L))(\mu(L) - \mu_0) * p_i \right) + \left( (\mu(L) - \mu_0)^2 \sum_{i=0}^{T-1} p_i \right) \newline &= \left( \sum_{i=0}^{T-1} (i - \mu(L))^2 * p_i \right) + \left( 2(\mu(L) - \mu_0) \sum_{i=0}^{T-1} (i - \mu(L))p_i \right) + \left( \omega_0(T) (\mu(L) - \mu_0)^2 \right) \newline &= \left( \sum_{i=0}^{T-1} (i - \mu(L))^2 * p_i \right) + \left( 2(\mu(L) - \mu_0) \left[ \sum_{i=0}^{T-1} i p_i - \sum_{i=0}^{T-1} \mu(L) p_i \right] \right) + \left( \omega_0(T) (\mu(L) - \mu_0)^2 \right) \newline &= \left( \sum_{i=0}^{T-1} (i - \mu(L))^2 * p_i \right) + 2(\mu(L) - \mu_0) (\omega_0(T) \mu_0 - \mu(L) \omega_0(T)) + \left( \omega_0(T)(\mu(L) - \mu_0)^2 \right) \newline &= \left( \sum_{i=0}^{T-1} (i - \mu(L))^2 * p_i \right) - 2 \omega_0(T) (\mu_0 - \mu(L))^2 + \left( \omega_0(T)(\mu(L) - \mu_0)^2\right) \newline &= \left( \sum_{i=0}^{T-1} (i - \mu(L))^2 * p_i \right) - \omega_0 (\mu_0 - \mu(L))^2 \end{aligned}\tag{23} ω0(T)σ02=ω0(T)[ω0(T)1i=0T1(iμ0)2pi]=ω0(T)[ω0(T)1i=0T1((iμ(L))+(μ(L)μ0))2pi]=ω0(T)[ω0(T)1i=0T1((iμ(L))2+2(iμ(L))(μ(L)μ0)+(μ(L)μ0)2)pi]=(i=0T1(iμ(L))2pi)+(i=0T12(iμ(L))(μ(L)μ0)pi)+((μ(L)μ0)2i=0T1pi)=(i=0T1(iμ(L))2pi)+(2(μ(L)μ0)i=0T1(iμ(L))pi)+(ω0(T)(μ(L)μ0)2)=(i=0T1(iμ(L))2pi)+(2(μ(L)μ0)[i=0T1ipii=0T1μ(L)pi])+(ω0(T)(μ(L)μ0)2)=(i=0T1(iμ(L))2pi)+2(μ(L)μ0)(ω0(T)μ0μ(L)ω0(T))+(ω0(T)(μ(L)μ0)2)=(i=0T1(iμ(L))2pi)2ω0(T)(μ0μ(L))2+(ω0(T)(μ(L)μ0)2)=(i=0T1(iμ(L))2pi)ω0(μ0μ(L))2(23)
其中 ∑ i = 0 T − 1 i p i = ω 0 ( T ) μ 0 \sum_{i=0}^{T-1}ip_i=\omega_0(T)\mu_0 i=0T1ipi=ω0(T)μ0 可以由式 ( 14 ) (14) (14) 推导得到。
同理推导出
ω 1 ( T ) σ 1 2 = ( ∑ i = T L − 1 ( i − μ ( L ) ) 2 ∗ p i ) − ω 1 ( μ 1 − μ ) 2 (24) \omega_1(T)\sigma_1^2=\left(\sum_{i=T}^{L-1}(i-\mu(L))^2*p_i\right)-\omega_1(\mu_1-\mu)^2\tag{24} ω1(T)σ12=(i=TL1(iμ(L))2pi)ω1(μ1μ)2(24)
进一步整理得到,
σ W 2 + σ B 2 = ∑ i = 0 T − 1 ( i − μ ( L ) ) 2 ∗ p i + ∑ i = T L − 1 ( i − μ ( L ) ) 2 ∗ p i = ∑ i = 0 L − 1 ( i − μ ( L ) ) 2 ∗ p i = σ 2 (25) \begin{aligned} \sigma_W^2+\sigma_B^2&=\sum_{i=0}^{T-1} (i - \mu(L))^2 * p_i+\sum_{i=T}^{L-1}(i-\mu(L))^2*p_i\newline &=\sum_{i=0}^{L-1}(i-\mu(L))^2*p_i\newline &=\sigma^2 \end{aligned}\tag{25} σW2+σB2=i=0T1(iμ(L))2pi+i=TL1(iμ(L))2pi=i=0L1(iμ(L))2pi=σ2(25)

三、图像处理应用

  • 【TODO】

四、其他领域应用

4.1 噪声标签学习

  • 【TODO】

4.2 其他领域

  • 【TODO】

参考文献

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐