《Semi-Supervised Pedestrian Instance Synthesis and Detection with Mutual Reinforcement》笔记

Motivation

该论文的内容是行人实例检测,针对的问题是数据集只有部分数据有标注,其他大部分数据没有标注,即半监督(semi-supervised)学习研究的内容。该论文使用GAN来生成行人实例样本,训练一个行人类别分类器,用该分类器对未标注的图片进行扫描分类,得到未标注图片的伪标注,最后使用有标注的数据和伪标注的数据训练重新训练检测器。

  • Semi-supervised.
    • 适用情景:部分数据有label,大部分数据没有label。
    • 收集和人工标注大量数据需要耗费大量的时间和精力。
  • 用GAN生成行人实例。
  • 行人实例检测。

Method

论文的方法如下图所示
method

方法分为几个部分

  • Base Detector:使用有标注的数据训练的检测器,是2阶段的检测器,有RPN。RPN网络提取region proposals,映射到原图,裁剪出来,作为其他网络的输入。
  • Generator G: 生成器。给定类别y和随机变量z,生成类别为y的样本。
  • Class-conditional discriminator D con D_{\text{con}} Dcon: 用来判读生成的样本和类别y是否匹配。
  • Class- specific discriminator D spe D_{\text{spe}} Dspe: 用来判读样本是真实样本还是生成样本。
  • Post-refinement classifier (PRC): 行人分类器,训练的目的是对未标注的数据进行分类,为未标注的数据赋予伪标注。

Instance synthesis

说明符号的含义

  • ( x , y ) ∼ p l (x, y) \sim p_l (x,y)pl: 已标注数据的分布,x表示裁剪出来的小图
  • x ∼ p u x \sim p_u xpu: 未标注数据的分布
  • ( z , y ) ∼ p s (z, y) \sim p_s (z,y)ps: 输入到G的先验分布

与G对应的训练公式
min ⁡ θ G l adv G + μ l feaMat (1) \min_{\theta_G} \mathcal{l}_{\text{adv}}^G + \mu \mathcal{l}_{\text{feaMat}} \tag{1} θGminladvG+μlfeaMat(1)
其中
l adv G = E ( z , y ) ∼ p s [ log ⁡ ( 1 − D con ( G ( z , y ) , y ) ) ] + E ( z , y ) ∼ p s y = y + [ log ⁡ ( 1 − D spe ( G ( z , y ) ) ) ] (2) \begin{aligned} l_{\text{adv}}^G = & \Bbb{E}_{(z,y) \sim p_s} \left[ \log \left( 1-D_{\text{con}}(G(z,y), y) \right) \right ] \\ & + \Bbb{E}_{\underset{y=y^+}{(z,y) \sim p_s}}\left [ \log \left( 1 - D_{\text{spe}}(G(z, y)) \right ) \right ] \end{aligned} \tag{2} ladvG=E(z,y)ps[log(1Dcon(G(z,y),y))]+Ey=y+(z,y)ps[log(1Dspe(G(z,y)))](2)
公式2第1项(2-1)作用是使得生成的样本和类别y越匹配越好。公式2第2项(2-2)作用是使得生成的样本越真实越好。

G 公式

l feaMat \mathcal{l}_{\text{feaMat}} lfeaMat表示平均特征匹配项
l feaMat = ∥ E ( x , y ) ∼ p l [ 1 { y = y + } f C ( x ) ] − E ( z , y ) ∼ p s [ 1 { y = y + } f C ( G ( z , y ) ) ] ∥ 2 2 (3) \begin{aligned} \mathcal{l}_{\text{feaMat}} = & \Big \lVert \Bbb{E}_{(x,y) \sim p_l} \left [ 1^{\{y=y^+\}} f_C(x) \right] \\ & - \Bbb{E}_{(z,y) \sim p_s} \left [ 1^{\{y=y^+\}} f_C(G(z,y)) \right] \Big \rVert_2^2 \end{aligned} \tag{3} lfeaMat=E(x,y)pl[1{y=y+}fC(x)]E(z,y)ps[1{y=y+}fC(G(z,y))]22(3)
公式3第1项(3-1)表示真实样本特征的平均值,特征是指PRC最后一层隐藏层的特征,公式3第2项(3-2)表示生成样本特征的平均值。公式3的目的是使得生成的行人实例匹配征是样本特征的统计值,使得生成样本更加真实,同时有助于PRC的训练。

Optimizing the PRC

PRC分类网络的训练公式如下
min ⁡ θ C l adv C + λ f l feaMat + λ c l claEva (4) \min_{\theta_C} \mathcal{l}_{\text{adv}}^C + \lambda_f \mathcal{l}_{\text{feaMat}} + \lambda_c \mathcal{l}_{\text{claEva}} \tag{4} θCminladvC+λflfeaMat+λclclaEva(4)

首先,第一项(4-1)是指把伪标注的样本和对应的伪标注输入到 D c o n D_{con} Dcon中,由 D c o n D_{con} Dcon来判断未标注样本和伪标注是否匹配,目的是使得伪标注尽可能准确。
l adv C = E x ∼ p u [ p ( x ∣ θ C ) log ⁡ ( 1 − D con ( x , y ^ ) ] \mathcal{l}_{\text{adv}}^C = \Bbb{E}_{x \sim p_u} \left[ p(x|\theta_C) \log (1 - D_{\text{con}}(x, \hat{y}) \right] ladvC=Expu[p(xθC)log(1Dcon(x,y^)]
其中 p ( x ∣ θ C ) p(x|\theta_C) p(xθC)表示PRC预测出来的置信度, y ^ \hat{y} y^是伪标注,由 p ( x ∣ θ C ) p(x|\theta_C) p(xθC)决定具体的值。

第三项(4-3)是分类损失(分类网络当然要有分类损失),包括3中数据的3个损失项
l claEva = E ( x , y ) ∼ p l [ − y log ⁡ p ( x ∣ θ C ) ] E x ∼ p u [ − p ( x ∣ θ C ) log ⁡ p ( x ∣ θ C ) ] E ( z , y ) ∼ p u y = y + [ − y log ⁡ p ( G ( z , y ) ∣ θ C ) ] (6) \begin{aligned} \mathcal{l}_{\text{claEva}} = & \Bbb{E}_{(x,y) \sim p_l} \left [ -y \log p(x|\theta_C) \right ] \\ & \Bbb{E}_{x \sim p_u} \left [ -p(x|\theta_C) \log p(x|\theta_C) \right ] \\ & \Bbb{E}_{\underset{y=y^+}{(z,y) \sim p_u}} \left [ -y \log p(G(z,y)|\theta_C) \right ] \\ \end{aligned} \tag{6} lclaEva=E(x,y)pl[ylogp(xθC)]Expu[p(xθC)logp(xθC)]Ey=y+(z,y)pu[ylogp(G(z,y)θC)](6)
公式6第二项(6-2)有些奇怪,用 p ( x ∣ θ C ) p(x|\theta_C) p(xθC)代替真实样本y的位置,这样做的目的是使得PRC预测出来的结果分数高的越高,分数低的越低,提高分类器对未标注数据的分类信心。

PRC 公式

Adversarial training

GAN的训练过程还包括最大化的过程。

首先看 D con D_{\text{con}} Dcon
max ⁡ θ D con E ( x , y ) ∼ p l [ log ⁡ D con ( x , y ) ] + 1 2 E ( z , y ) ∼ p s [ log ⁡ ( 1 − D con ( G ( z , y ) , y ) ) ] + 1 2 E x ∼ p u [ log ⁡ ( 1 − D con ( x , y ^ ) ) ] (7) \begin{aligned} \max{\theta_{D_{\text{con}}}} & \Bbb{E}_{(x, y) \sim p_l} \left[ \log D_{\text{con}}(x,y) \right] \\ & + \frac{1}{2} \Bbb{E}_{(z,y) \sim p_s} \left[ \log (1 - D_{\text{con}}(G(z, y), y)) \right] \\ & + \frac{1}{2} \Bbb{E}_{x \sim p_u} \left[ \log (1 - D_{\text{con}}(x, \hat{y})) \right] \end{aligned} \tag{7} maxθDconE(x,y)pl[logDcon(x,y)]+21E(z,y)ps[log(1Dcon(G(z,y),y))]+21Expu[log(1Dcon(x,y^))](7)
因为有3中数据,所以公式7有3项。

对于另外一个 D spe D_{\text{spe}} Dspe,它的作用是判断样本是真的还是假的
max ⁡ θ D spc E ( x , y ) ∼ p l y = y + [ log ⁡ D spc ( x ) ] + E ( z , y ) ∼ p s y = y + [ 1 − D spc ( G ( z , y ) ) ] (8) \begin{aligned} \max_{\theta_{D_{\text{spc}}}} & \Bbb{E}_{\underset{y=y^+}{(x,y) \sim p_l}} \left[ \log D_{\text{spc}}(x) \right] \\ & + \Bbb{E}_{\underset{y=y^+}{(z,y) \sim p_s}} \left[ 1 - D_{\text{spc}}(G(z,y)) \right] \end{aligned} \tag{8} θDspcmaxEy=y+(x,y)pl[logDspc(x)]+Ey=y+(z,y)ps[1Dspc(G(z,y))](8)

adversarial 公式

Enhancement of the base detector

使用预训练的检测器和PRC去扫描未标注的图片,生成伪标注,然后使用已标注数据和伪标注数据重新训练检测器。

检测器训练时正样本的选择:IoU>0.5,其他的为负样本。

检测器训练单个样本的损失函数
l det ( x , y ) = − y log ⁡ p ( x ∣ θ R ) + v r 1 { y = y + } l locReg ( b , b ~ ) (9) \mathcal{l}_\text{det}(x,y) = -y \log p(x|\theta_R) + v_r 1^{\{y=y^+\}} \mathcal{l}_{\text{locReg}}(b, \tilde{b}) \tag{9} ldet(x,y)=ylogp(xθR)+vr1{y=y+}llocReg(b,b~)(9)
分别是分类损失和bbox的回归损失。

总损失函数
min ⁡ θ R E ( x , y ) ∼ p l [ l det ( x , y ) ] + v ∗ E ( x , y ∗ ) ∼ p l ∗ y ∗ = y + [ l det ( x , y ∗ ) ] + v c E x ′ ∈ N ( x ) ( x , y ) ∼ p l , y = y + or ( x , y ∗ ) ∼ p l ∗ , y ∗ = y + [ ∥ p ( x ∣ θ R ) − p ( x ′ ∣ θ R ) ∥ 2 2 ] (11) \begin{aligned} \min_{\theta_R} & \Bbb{E}_{(x,y) \sim p_l} \left[ \mathcal{l}_{\text{det}}(x, y) \right] + v_* \Bbb{E}_{\underset{y* = y^+}{(x, y^*) \sim p_{l^*}}} \left[ \mathcal{l}_{\text{det}} (x, y^*) \right] \\ & + v_c \Bbb{E}_{\underset{\underset{(x, y^*) \sim p_{l^*}, y*=y^+}{(x,y)\sim p_l, y=y^+ \text{or}}}{x' \in \mathcal{N}(x)}} \left[ \lVert p(x|\theta_R) - p(x'|\theta_R) \rVert_2^2 \right] \end{aligned} \tag{11} θRminE(x,y)pl[ldet(x,y)]+vEy=y+(x,y)pl[ldet(x,y)]+vcE(x,y)pl,y=y+(x,y)pl,y=y+orxN(x)[p(xθR)p(xθR)22](11)
其中 y ∗ y^* y表示伪标签, p l ∗ p_{l^*} pl表示对应的分布。公式11前两项分布代表已标注数据和伪标注数据的损失。

伪标注数据有一个缺点,伪标注的bbox可能不准确,可能只包括gt bbox的一部分。论文提出了公式11第3项。选择一个样本x,在x的领域 N ( x ) \mathcal{N}(x) N(x)内随机选择一个样本 x ′ x' x,对 x ′ x' x的预测结果要和 x x x的预测结果一样,这是(11-3)项的意思。这样做可以保证检测器的分类效果,减少网络受到伪标注数据的坏影响。

Experiments

论文在3个行人检测数据集上进行实验。论文只使用数据集上5%的图片的标注,剩余的95%的图片都当作没有标注的数据。这个数据划分就很夸张了,但是论文的实验效果很好,说明了该方法确实可行。

论文首先看看GAN生成行人实例的效果
GAN生成的行人实例
可以看到生成的行人实例已经很接近真实样本了。

接着看看行人检测的效果,指标是log-average miss rate,值越小越好。
行人检测效果

行人检测效果

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值