A Self-distillation Object Segmentation Method Based on Transformer Feature Pyramid
-
摘要: 为在不增加网络参数规模的情况下提升目标分割性能,该文提出一种基于Transformer特征金字塔的自蒸馏目标分割方法,提升了Transformer分割模型的实用性。首先,以Swin Transformer为主干网构建了像素级的目标分割模型;然后,设计了适合Transformer的蒸馏辅助分支,该分支由密集连接空间空洞金字塔(DenseASPP)、相邻特征融合模块(AFFM)和得分模块构建而成,通过自蒸馏方式指导主干网络学习蒸馏知识;最后,利用自上而下的学习策略指导模型学习,以保证自蒸馏学习的一致性。实验表明,在4个公开数据集上所提方法均能有效提升目标分割精度,在伪装目标检测(COD)数据集上比次优的Transformer知识蒸馏(TKD)方法的Fβ值提高了约2.29%。
-
关键词:
- 自蒸馏 /
- Transformer /
- 目标分割 /
- 特征金字塔
Abstract:Objective Neural networks that demonstrate superior performance often necessitate complex architectures and substantial computational resources, thereby limiting their practical applications. Enhancing model performance without increasing network parameters has emerged as a significant area of research. Self-distillation has been recognized as an effective approach for simplifying models while simultaneously improving performance. Presently, research on self-distillation predominantly centers on models with Convolutional Neural Network (CNN) architectures, with less emphasis on Transformer-based models. It has been observed that due to their structural differences, different network models frequently extract varied semantic information for the same spatial locations. Consequently, self-distillation methods tailored to specific network architectures may not be directly applicable to other structures; those designed for CNNs are particularly challenging to adapt for Transformers. To address this gap, a self-distillation method for object segmentation is proposed, leveraging a Transformer feature pyramid to improve model performance without increasing network parameters. Methods First, a pixel-wise object segmentation model is developed utilizing the Swin Transformer as the backbone network. In this model, the Swin Transformer produces four layers of features. Each layer of mapped features is subjected to Convolution-Batch normalization-ReLU (CBR) processing to ensure that the backbone features maintain a uniform channel size. Subsequently, all backbone features are concatenated along the channel dimension, after which convolution operations are performed to yield pixel-wise feature representations. In the next phase, an auxiliary branch is designed that integrates Densely connected Atrous Spatial Pyramid Pooling (DenseASPP), Adjacent Feature Fusion Modules (AFFM), and a scoring module, facilitating self-distillation to guide the main network. The specific architecture is depicted. The self-distillation learning framework consists of four sub-branches, labeled FZ1 to FZ4, alongside a main branch labeled FZ0. Each auxiliary sub-branch is connected to different layers of the backbone network to extract layer-specific features and produce a Knowledge Representation Header (KRH) that serves as the segmentation result. The main branch is linked to the fully connected layer to extract fused features and optimize the mixed features from various layers of the backbone network. Finally, a top-down learning strategy is employed to guide the model’s training, ensuring consistency in self-distillation. The KRH0 derived from the main branch FZ0 integrates the knowledge KRH1-KRH4 obtained from each sub-branch FZ1–FZ4, steering the overall optimization direction for self-distillation learning. Consequently, the main branch and sub-branches can be regarded as teacher and student entities, respectively, forming four distillation pairs, with FZ0 directing FZ1–FZ4. This top-down distillation strategy leverages the main branch to instruct the sub-branches to learn independently, thereby enabling the sub-branches to acquire more discriminative features from the main branch while maintaining consistency in the optimization direction between the sub-branches and the main branch. Results and Discussions The results quantitatively demonstrate the segmentation performance of the proposed method. The data indicates that the proposed method consistently achieves superior segmentation results across all four datasets. On average, the metric Fβ of the proposed method exceeds that of the suboptimal method, Transformer Knowledge Distillation (TKD), by 1.18%. Additionally, the mean Intersection over Union (mIoU) metric of the proposed method is 0.86% higher than that of the suboptimal method, Target-Aware Transformer (TAT). These results demonstrate that the proposed method effectively addresses the challenge of camouflage target segmentation. Notably, on the Camouflage Object Detection (COD) dataset, the proposed method improves Fβ by about 2.29% compared to TKD, while achieving an enhancement of 1.72% in mIoU relative to TAT. Among CNN methods, Poolnet+ (POOL+) attained the highest average Fβ, yet it falls short of the proposed method by 5.05%. This difference can be attributed to the Transformer’s capability to overcome the limitations of the restricted receptive field inherent in CNNs, thereby extracting a greater amount of semantic information from images. The results also show that the self-distillation method is similarly effective within the Transformer framework, significantly enhancing the segmentation performance of the Transformer model. The proposed method outperforms other self-distillation strategies, achieving the best segmentation results across all four datasets. When compared to the baseline model, the average metrics for Fβ and mIoU exhibit increases of 2.42% and 3.54%, respectively. Conclusions The proposed self-distillation algorithm enhances object segmentation performance and demonstrates the efficacy of self-distillation within the Transformer architecture. -
Key words:
- Self-distillation /
- Transformer /
- Object segmentation /
- Feature pyramid
-
1. 引言
目标分割根据图像内容区分出目标与背景,是一项重要的计算机视觉任务[1]。早期的目标分割算法主要采用手工设计特征,但是手工特征难以同时表达图像语义和细节信息。近年来,深度神经网络被用来解决目标分割问题,取得了一系列研究成果。基于卷积神经网络(Convolutional Neural Network, CNN)的目标分割方法凭借强大的非线性建模能力,取得了较好的分割结果[2]。针对复杂场景中的目标分割,注意力机制被广泛应用来改善分割模型对小目标、弱目标的关注,提升分割性能[3,4]。作为典型的注意力机制实现模型,Transformer可以在编码、解码等不同阶段实现自注意力[5]。和CNN相比,Transformer结构可以解决CNN感受野有限的问题,有助于更准确提取语义信息,提高模型对图像内容的理解[6]。然而,性能优越的神经网络通常需要复杂的网络结构和大量的计算资源,制约了实际的推广应用[7]。如何在不增加网络参数的情况下提升模型性能成为一个重要的研究方向。
在相关的工作中,知识蒸馏[8]已被证明是一种简化模型、提升性能的行之有效的方法。早期的知识蒸馏通常预先训练复杂的教师模型,利用教师模型指导轻量化的学生模型学习,提升学生模型性能。自蒸馏方法[9]不需要预先训练复杂的教师模型,仅利用学生模型自身知识来指导训练,有效降低了模型参数量和计算复杂度。当前,自蒸馏研究集中在以CNN为主干的模型上,较少关注以Transformer为主干的模型。Lin等人[10]研究发现由于结构的差异,不同网络模型对同一空间位置提取的语义信息通常是不同的,因此基于特定网络模型的自蒸馏方法难以直接适应其他的网络结构。Liu等人[11]也指出基于CNN的自蒸馏方法难以应用于Transformer。
为将自蒸馏方法应用于Transformer模型,本文以在不增加网络参数规模的情况下提升模型性能,提出一种基于Transformer特征金字塔的自蒸馏目标分割方法。首先提出适合于自蒸馏处理的目标分割网络架构,利用密集连接空间空洞金字塔(Densely connected Atrous Spatial Pyramid Pooling, DenseASPP)[12]、相邻特征融合模块(Adjacent Feature Fusion Modules, AFFM)[13]、得分模块(scoring module)[7]构造自蒸馏辅助分支实现自蒸馏结构,最后在4个数据集上的实验验证了方法的有效性。其中,DenseASPP利用空洞卷积(atrous convolution)层生成多尺度特征,可同时获取大感受野和密集的小感受野特征;AFFM通过有效融合各种特征获得更好的表征图像,得分模块则生成像素级的特征表示。模型学习采用自上而下的蒸馏策略[14]。主要贡献如下:
(1)构造了适合于自蒸馏处理的Transformer目标分割模型,能高效提取精细化特征,改进分割性能。
(2)设计了适合Transformer的自蒸馏辅助分支结构,验证了自蒸馏可与Transformer结构有效结合。
(3)在4个数据集上的实验证明了所提自蒸馏方法在目标分割任务上的有效性。
2. 相关工作
2.1 目标分割
近年来,基于深度神经网络框架的方法已逐渐成为目标分割的主流方法。卷积网络[15]、密集反卷积网络[2]、图网络[16]等都取得了较好的分割结果。Transformer采用了注意力机制,能够更好地提取图像的语义信息、分割目标。Li等人[5]系统总结了基于Transformer的视觉分割方法。Wang等人[17]利用自监督的Transformer来提升目标分割的性能。随着大数据集的出现,Kirillov等人[18]提出了分割一切模型(Segment Anything Model, SAM),该模型在无需额外调整的情况下,在多个任务中表现出色。然而,SAM在分割隐藏和伪装目标时也会遇到困难[19]。
上述方法通过复杂的网络结构设计,增强了网络对全局信息的学习及对目标的区分能力,较好地提升网络性能,但网络复杂度增强的同时,也增加了计算复杂度,制约了分割模型的实际应用。
2.2 知识蒸馏
知识蒸馏是新兴的高效小规模网络获取方法。它的主要思想是利用性能优越的教师模型指导小规模的学生模型学习,以提高学生模型的性能。根据学习方式的不同,知识蒸馏可以分为离线蒸馏、在线蒸馏和自蒸馏[13]。离线蒸馏和在线蒸馏都需要一个额外设计的教师模型辅助,而自蒸馏学习则不需要额外的教师模型,学生模型学习自身输出的知识。自蒸馏学习过程中,学生模型将深层信息当作“知识”传播给浅层指导模型训练。Yang等人[20]通过相互对比学习进行自蒸馏学习。Chen等人[7]将数据增强当作自蒸馏方法,利用频域信息丢弃的方法进行蒸馏计算。Chen等人[21]基于自蒸馏是一种正则化方法的观点,将同一标签的不同样本间预测分布作为知识。
上述工作中自蒸馏学习都是基于CNN结构,而基于特定网络模型的自蒸馏方法难以直接适应其他网络结构,因此这些蒸馏模型难以直接适用于基于Transformer的目标分割模型上。
3. 自蒸馏方法
本节描述所提的基于Transformer的自蒸馏目标分割框架,其中3.1节介绍基于Transformer的分割主干网络,3.2节介绍所提的自蒸馏学习框架,3.3节介绍自蒸馏学习的计算过程。
3.1 基于Transformer的分割网络
受文献[7]的启发,将Transformer作为主干网络,并设计了轻量化的特征融合和预测结构,构造了一个简单有效的Transformer目标分割网络,结构如图1所示。
在Transformer结构的实现中,采用Swin Transformer[6]作为编码器。Swin Transformer是一个结构化Transformer架构,利用可变化的非重叠窗口来计算自注意力,可以获得更大的感受野。在所建议的模型中,基于Swin Transformer构造4级特征编码模块,分别产生通道数为128, 256, 512和1 024的多层映射特征ti(i为1~4表示特征层数)。每层映射特征经过由卷积-批量归一化-线性整流单元(Convolution-Batch norm-ReLu, CBR)构造的解码器获取通道大小相同的主干特征。最后将所有主干特征在通道维并联,再利用卷积操作输出像素级特征表示。模型最终的显著度映射为
s=conv(concat[CBR(ti)4i=1]) (1) 其中,conv为卷积操作,concat为连接操作,CBR为解码器,i为特征层数。
3.2 自蒸馏学习架构
自蒸馏学习架构由主干网络上添加辅助分支构建而成。辅助分支提取主干网络知识,对其处理后反向传播到主干网络,以指导主干网络训练。具体的架构如图1所示。所提自蒸馏学习架构包含4个子分支(FZ1~FZ4)和1个主分支(FZ0)。每个辅助分支连接到主干网络的不同层中,以提取不同层次的特征并输出知识表示头(Knowledge Representation Head, KRH)作为分割结果。主分支连接到全连接层,用于提取融合特征,优化主干网络中不同层的混合特征。每个分支主要由DenseASPP[12], AFFM[13],得分模块[7]构成。
DenseASPP结构如图2所示,主要用来扩大感受野,并获取多尺寸的文本信息。空洞卷积可以在不改变特征分辨率的情况下,增加感受野。在1维的情况,y[i]表示输出信号,x[i]表示输入信号,则空洞卷积计算为
y[i]=K∑k=1x[i+d⋅k]⋅w[k] (2) 其中,d是膨胀率,w[k]表示滤波器的第k个参数,K是滤波器大小。当d为1时,该公式就退化为标准的卷积操作。当膨胀率越大时,空洞卷积可以获得更大的感受野。
DenseASPP将空洞卷积以级联的方式组织起来,且每层的膨胀速率逐层增加。膨胀率小的层放在下层,膨胀率大的层放在上层。每个Atrous层的输出与其输入下层的所有输出连接起来,作为一个特征图输入到下一层。DenseASPP的最终输出是由多速率、多尺度的空洞卷积生成的特征图。该结构可以同时组成一个更密集和更大的特征金字塔,并且只使用少数空洞的卷积层。DenseASPP中的每个空洞层计算公式为
yl=HK,dl(concat[yl−1,yl−2,⋯,y0]) (3) 其中,dl表示第l层的膨胀率,yl–1表示之前层生成的输出。DenseASPP将所有膨胀的层堆叠在一起,以密集方式连接它们,具有特征金字塔更密集、感受野更大2个优势。
AFFM[13]通过结合相邻的浅层和深层信息,能较好的抑制特征中的背景噪声,并且能捕获更多的语义信息,结构如图3所示。其中,浅层特征由前面的DenseASPP层传播下来,深层特征由下一阶段的模块传递而来。AFFM首先利用像素级乘法提取浅层和深层特征间的共同部分,然后利用像素级加法将共同特征连接到浅层特征上。该操作可以将深层的语义特征传递到浅层特征,使浅层分支生成更具语义表征能力的特征,并高效地抑制背景噪声。
最后,得分模块[7]连接到AFFM输出,以获得像素级的逻辑输出,其结构如图4所示。给定一幅图像I={xi|i=1,2,⋯,W×H},其中W, H为图像的宽和高。得分模块可以输出像素级的逻辑特征图P={pi∈RC|i=1,2,⋯,W×H},pi表示像素xi的逻辑向量,对应于C个类别的逻辑值。本文将像素级的概率分布作为待学习的知识。然后,将逻辑向量输入softmax函数,输出像素级的知识表示(即图1中的KRH)。像素xi属于第k类的知识表示计算为
qki=exp(pki/T)C∑k=1exp(pki/T) (4) 其中,pki表示逻辑向量pi的第k个逻辑值;T表示温度参数,通常被用于平滑输出概率。
3.3 自蒸馏学习的计算
自蒸馏可以被看做一个动态优化过程,采用自上而下的策略[14]来提高优化过程的鲁棒性。如图5所示,主分支FZ0得到的KRH0融合了各子分支(FZ1~FZ4)得到的知识KRH1~KRH4,引导着自蒸馏学习的总体优化方向。因此,主分支和子分支也可以分别看作是老师和学生,以此构建4组蒸馏对,分别由FZ0指导FZ1~FZ4。自上而下的蒸馏策略利用主分支分别指导子分支学习,可以使子分支学习主分支中更具识别性的特征,并且保证了子分支和主分支优化方向的一致性。
设D={(Xi,Yi)|1≤i≤N}是有N个训练样本的标注数据集,其中X={Xi|1≤i≤N}是训练图像集,Xi∈RH×W×3是第i个训练图像,图像高为H,宽为W;Y={Yi|1≤i≤N}是标注数据集,Yi是Xi对应的像素级标注数据。用WM={Wm|m=1,2,⋯,L}表示L层神经网络可学习的权重矩阵。训练目标是学习映射函数f(Wm;X):X→Y。深度神经网络的参数Wm通过优化式(5)目标函数来获取
Wm=argminLcWm(f(Wm;X);D) (5) 其中,Lc是所有训练样本的总损失。
自蒸馏学习的损失函数Lc由主干网络的像素级交叉熵(Cross Entropy, CE)Lce、辅助分支的分类损失Ls和辅助分支的蒸馏损失Ld组成,具体表示为
Lc=Lce+Ls+Ld (6) 主干网络的像素级交叉熵计算为
Lce(WM;D)=−1N×IN∑i=1I∑j=1yjilgf(Wm;xji) (7) 其中,I=W×H是第i张图像的像素数量。xji是推断网络对训练样本中第i张图像中第j个像素的预测值,yji是对应的标注值。
辅助分支的分类损失Ls计算为
Ls(WM,WB;D)=−1N×I⋅b5∑b=b1N∑i=1I∑j=1yjilgfb(Wm;xji) (8) 其中,fb为辅助分支的参数映射函数。WB={Wb|b=1,2,⋯,5}表示自蒸馏框架中辅助分支的权重矩阵,Wb是第b个辅助分支的权重矩阵,bn∈ϕ={1,2,⋯,L−1}是辅助分支连接到网络主干的位置索引。
辅助分支的蒸馏损失Ld计算为
Ld(WM,WB;D)=1N×I∑p,q∈ϕN∑i=1I∑j=1KL(fp(Wm,Wbp;xji)‖ (9) 其中,bp和bq是辅助分支的索引,KL(·)是Kullback-Leibler散度函数。
4. 实验验证与结果分析
4.1 数据集和实验设置
为验证所提方法的有效性,在伪装目标检测(Camouflage Object Detection, COD)[22]、大连理工大学-欧姆龙(Dalian University of Technology-ORMON, DUT-O)[23]、杂乱的显著目标(Salient Object in Clutter, SOC)[24]和显著目标区域(Salient object region labeling, THUR)[15]等4个具有挑战的数据集上进行实验。这4个数据集分别包括6 066, 4 447, 4 800, 5 168张自然图片和对应的像素级标注图片,分别包含有显著性或伪装目标。其中COD为自然伪装数据集,DUT-O, THUR为显著性目标数据集,SOC大多为无目标的纯背景图片。DUT-O, THUR数据集按照0.6, 0.4的比例划分训练、测试集,COD, SOC按照数据集原划分进行实验。所有图片在实验时均被调整为大小288 \times 288。
在配有NVIDIA Titan-
3090 GPU的工作站进行实验。用Stochastic Gradient Descent训练模型,动量和权重衰减分别设为0.9和0.000 5,主干网络最大学习率为0.005,分支最大学习率为0.05。使用Fβ-measure(Fβ)[13]、平均交并比(mean Intersection over Union, mIoU)[13]来评价目标分割的性能。其中,Fβ值是准确率和召回率的加权平均值。准确率(precision)侧重于衡量算法检测目标区域的准确程度,召回率(recall)侧重于衡量算法检测目标区域的完整程度。mIoU是每一类标注的真实值与模型分割图之间的交集和并集比。Fβ, mIoU值越大,表示网络性能越好。
4.2 与经典分割算法的性能对比
与期望最大化注意力网络(Expectation-Maximization Attention Networks, EMANet)[25]、十字交叉注意力网络(Criss-Cross Attention Network, CCNet)[26]、简单门控网络(a Simple Gated Network, GateNet)[27]、级联部分解码器(Cascaded partial decoder, CPD)[28]、深度子区域网络(Deep Subregion Network, DSR)[29]、极低采样网络(Extremely-Downsampled Network, EDN)[30]、池化网络(Poolnet+, POOL+)[31]、目标感知Transformer (Target-Aware Transformer, TAT)[10]和Transformer知识蒸馏(Transformer Knowledge Distillation, TKD)[11]等9种目标分割模型进行对比。EMANet, CCNet, GateNet, CPD, DSR, EDN, POOL+是以卷积神经网络为主干的分割模型;TAT和TKD教师模型是以Transformer为主干的分割模型,实验时未采用它们的蒸馏结构,只利用它们教师模型分割目标。
图6定性地展示了各种对比算法的分割效果。从上到下,图像对应于COD, DUT-O, THUR, SOC数据集中图像及分割图。从图6中可以看出:(1)所提方法有较好的分割显著性目标。对于第2行的显著性目标,所提方法不仅可以准确地分割出目标的轮廓,同时保留了一些目标边缘的细节。(2)所提方法能较好的抑制噪声。第3行,本文认为标注图像是不够准确的,通过人眼可以看出所提方法的分割结果更切合实际。而其他方法受光照等噪声影响分割结果不如所提方法。
表1定量展示了分割结果,通过结果看出:(1)所提方法在4个数据集上都取得了最好的分割结果。平均结果中,所提方法Fβ值比次优方法(TKD)提高了1.18%,mIoU值比次优方法(TAT)提高了1.24%。(2)所提方法能较好的解决伪装目标分割问题。在COD数据集上,所提方法Fβ值比次优方法(TKD)提高了2.29%,mIoU值比次优方法(TAT)提高了1.72%。(3)基于卷积神经网络方法中,POOL+取得了最佳的平均Fβ值,但与所提方法相比落后5.05%。这是因为Transformer突破了卷积神经网络感受野有限的限制,可以更充分提取图像语义信息。
表 1 不同分割方法的分割结果(%)方法 COD DUT-O THUR SOC 平均值 Fβ mIoU Fβ mIoU Fβ mIoU Fβ mIoU Fβ mIoU EMANet 63.07 26.42 78.38 59.86 82.60 62.70 86.83 71.63 74.02 51.61 CCNet 64.44 41.27 79.70 63.15 84.80 70.10 87.27 77.79 74.90 56.91 GateNet 65.81 46.11 82.22 70.04 87.59 78.60 88.20 79.71 78.40 64.33 CPD 60.42 42.94 83.38 72.33 87.90 79.38 83.59 71.42 76.53 62.46 DSR 54.68 36.25 80.63 66.83 84.04 72.25 82.44 73.04 69.69 55.24 EDN 65.27 46.04 84.23 75.38 88.71 83.31 74.89 63.94 78.71 68.40 POOL+ 61.55 45.39 82.95 70.84 85.25 74.74 87.92 79.39 79.42 67.59 TAT 67.95 47.05 84.28 71.65 88.65 78.34 89.45 80.36 82.58 69.35 TKD 68.46 46.83 83.96 71.27 88.86 78.35 89.35 80.06 82.66 69.13 所提方法 70.03 47.86 85.34 71.87 89.54 79.78 89.64 81.34 83.64 70.21 4.3 与经典自蒸馏方法的性能对比
为证明所提自蒸馏方法的有效性,与其他自蒸馏方法进行比较。实验中主干网络和数据处理方法保持一致,只更换了蒸馏方式。参考Chen等人[7]方法,将自注意力蒸馏(Self-Attention distillation, SA)[32]、成为自己的老师(Be Your Own Teacher, BYOT)[14]、深度监督知识协同(Deeply-supervised Knowledge Synergy, DKS)[33]、动态分层模仿(Dynamic Hierarchical Mimicking, DHM)[34]算法应用到目标分割,并与所提方法比较。结果如表2所示,BL表示不加蒸馏方法的基准模型。
表 2 不同自蒸馏方法的分割结果(%)方法 COD DUT-0 THUR SOC 平均值 Fβ mIoU Fβ mIoU Fβ mIoU Fβ mIoU Fβ mIoU BL 67.34 46.09 83.03 68.25 88.24 77.54 88.03 79.34 81.66 67.81 BL+DKS 68.45 47.26 84.78 70.37 88.62 78.52 89.26 80.54 82.78 69.17 BL+BYOT 68.38 46.32 85.03 70.34 88.57 77.83 88.36 80.37 82.58 68.72 BL+DHM 67.52 45.67 84.23 69.53 89.32 76.97 88.75 81.13 82.45 68.33 BL+SA 69.21 46.23 84.16 69.30 89.24 78.24 88.69 80.24 82.83 68.50 所提方法 70.03 47.86 85.34 71.87 89.54 79.78 89.64 81.34 83.64 70.21 从表2可以看出:(1)几乎所有的自蒸馏方法都能提高所提主干网络性能。这说明自蒸馏方法对于Transformer结构也是适用的,利用自蒸馏方法可以有效提升Transformer模型的分割性能。(2)所提方法优于其他自蒸馏方法。所提方法在4个数据集中都取得了最好的分割结果。与基准模型相比,Fβ, mIoU平均值分别提高了2.42%和3.54%,充分证明所提自蒸馏算法的有效性。
4.4 分割效率对比
采用模型参数大小和分割速度评价各种方法分割效率。模型参数大小单位为MB,分割速度单位为fps (frame per second)。与EMANet[25], CCNet[26], GateNet[27], CPD[28], DSR[29], POOL+[31]和TAT[10]等7种方法进行对比。TAT只利用其教师模型。实验结果如表3所示。参数量越小,表明模型规模越小,部署应用场景更为广阔;分割速度越大,说明模型分割效率越高。
表 3 不同目标分割方法效率EMANet CCNet GateNet CPD DSR POOL+ TAT 所提方法 参数(MB) 34.80 52.10 128.63 47.85 75.29 70.50 140.21 132.25 速度(fps) 37.59 35.34 33.03 32.60 8.80 21.53 18.54 36.15 通过表3可以看出:所提方法的模型参数多于其他基于卷积神经网络的方法,这是由于所提方法采用了Transformer结构,然而所提方法的分割速度仅次于EMANet方法,这表明所提方法虽然参数多,但是分割速度仍优于大多数经典的目标分割方法。和TAT同样采样Transformer结构的方法相比,所提方法的分割速度依然有所提升。这表明所提方法在保持一定规模的网络结构条件下,对模型效率和模型性能同时得到了提升。
4.5 消融实验
为证明提出的各模块和学习策略的有效性,在COD数据集上进行了消融实验。结果如表4所示。结果表明,提出的各模块和学习策略都是有效的,能够提高模型的分割能力,融合各模块能进一步提高分割结果。(1)对比实验2, 3, 4, 6发现,使用自上而下学习策略时,融合DenseASPP和AFFM比不使用模块时的Fβ, mIoU分别高出2.5%和1.58%;单独使用DenseASPP比不使用模块时的Fβ, mIoU分别高出1.5%和0.83%;单独使用AFFM比不使用该模块时的Fβ, mIoU分别高出0.81%和0.56%。从Fβ值看出,DenseASPP, AFFM对模型提高的贡献度分别约为63%和37%。(2)分别对比实验1和2、实验5和6,证明自上而下的学习策略能够有效提升模型分割性能。
表 4 消融实验结果序号 自蒸馏模块 学习策略 结果(%) DenseASPP AFFM 自上而下 Fβ mIoU 1 × × × 67.34 46.09 2 × × √ 67.53 46.28 3 √ × √ 69.03 47.11 4 × √ √ 68.34 46.84 5 √ √ × 69.23 46.96 6 √ √ √ 70.03 47.86 5. 结束语
本文提出了基于Transformer特征金字塔的自蒸馏目标分割方法。本方法基于Swin Transformer的主干网络实现目标分割,并利用DenseASPP等辅助分支实现对Transformer结构的蒸馏学习,在不增加模型参数的情况下提升分割模型性能。在4个数据集上的实验证明,所提方法能有效提升目标分割性能。未来针对Transformer构建更加简单的蒸馏学习架构是进一步研究方向。
-
表 1 不同分割方法的分割结果(%)
方法 COD DUT-O THUR SOC 平均值 Fβ mIoU Fβ mIoU Fβ mIoU Fβ mIoU Fβ mIoU EMANet 63.07 26.42 78.38 59.86 82.60 62.70 86.83 71.63 74.02 51.61 CCNet 64.44 41.27 79.70 63.15 84.80 70.10 87.27 77.79 74.90 56.91 GateNet 65.81 46.11 82.22 70.04 87.59 78.60 88.20 79.71 78.40 64.33 CPD 60.42 42.94 83.38 72.33 87.90 79.38 83.59 71.42 76.53 62.46 DSR 54.68 36.25 80.63 66.83 84.04 72.25 82.44 73.04 69.69 55.24 EDN 65.27 46.04 84.23 75.38 88.71 83.31 74.89 63.94 78.71 68.40 POOL+ 61.55 45.39 82.95 70.84 85.25 74.74 87.92 79.39 79.42 67.59 TAT 67.95 47.05 84.28 71.65 88.65 78.34 89.45 80.36 82.58 69.35 TKD 68.46 46.83 83.96 71.27 88.86 78.35 89.35 80.06 82.66 69.13 所提方法 70.03 47.86 85.34 71.87 89.54 79.78 89.64 81.34 83.64 70.21 表 2 不同自蒸馏方法的分割结果(%)
方法 COD DUT-0 THUR SOC 平均值 Fβ mIoU Fβ mIoU Fβ mIoU Fβ mIoU Fβ mIoU BL 67.34 46.09 83.03 68.25 88.24 77.54 88.03 79.34 81.66 67.81 BL+DKS 68.45 47.26 84.78 70.37 88.62 78.52 89.26 80.54 82.78 69.17 BL+BYOT 68.38 46.32 85.03 70.34 88.57 77.83 88.36 80.37 82.58 68.72 BL+DHM 67.52 45.67 84.23 69.53 89.32 76.97 88.75 81.13 82.45 68.33 BL+SA 69.21 46.23 84.16 69.30 89.24 78.24 88.69 80.24 82.83 68.50 所提方法 70.03 47.86 85.34 71.87 89.54 79.78 89.64 81.34 83.64 70.21 表 3 不同目标分割方法效率
EMANet CCNet GateNet CPD DSR POOL+ TAT 所提方法 参数(MB) 34.80 52.10 128.63 47.85 75.29 70.50 140.21 132.25 速度(fps) 37.59 35.34 33.03 32.60 8.80 21.53 18.54 36.15 表 4 消融实验结果
序号 自蒸馏模块 学习策略 结果(%) DenseASPP AFFM 自上而下 Fβ mIoU 1 × × × 67.34 46.09 2 × × √ 67.53 46.28 3 √ × √ 69.03 47.11 4 × √ √ 68.34 46.84 5 √ √ × 69.23 46.96 6 √ √ √ 70.03 47.86 -
[1] 吕岳, 周浙泉, 吕淑静. 基于双层解耦策略和注意力机制的遮挡目标分割[J]. 电子与信息学报, 2023, 45(1): 335–343. doi: 10.11999/JEIT211288.LÜ Yue, ZHOU Zhequan and LÜ Shujing. Occluded object segmentation based on bilayer decoupling strategy and attention mechanism[J]. Journal of Electronics & Information Technology, 2023, 45(1): 335–343. doi: 10.11999/JEIT211288. [2] ZHENG Yunfei, ZHANG Xiongwei, WANG Feng, et al. Detection of people with camouflage pattern via dense deconvolution network[J]. IEEE Signal Processing Letters, 2019, 26(1): 29–33. doi: 10.1109/LSP.2018.2825959. [3] 任莎莎, 刘琼. 小目标特征增强图像分割算法[J]. 电子学报, 2022, 50(8): 1894–1904. doi: 10.12263/DZXB.20211123.REN Shasha and LIU Qiong. A tiny target feature enhancement algorithm for semantic segmentation[J]. Acta Electronica Sinica, 2022, 50(8): 1894–1904. doi: 10.12263/DZXB.20211123. [4] 梁新宇, 权冀川, 杨辉, 等. 多尺度特征提取和多层次注意力机制的迷彩伪装目标分割算法[J]. 计算机辅助设计与图形学学报, 2022, 34(5): 683–692. doi: 10.3724/SP.J.1089.2022.19000.LIANG Xinyu, QUAN Jichuan, YANG Hui, et al. Camouflage target segmentation algorithm using multi-scale feature extraction and multi-level attention mechanism[J]. Journal of Computer-Aided Design & Computer Graphics, 2022, 34(5): 683–692. doi: 10.3724/SP.J.1089.2022.19000. [5] LI Xiangtai, DING Henghui, YUAN Haobo, et al. Transformer-based visual segmentation: A survey[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2024, 46(12): 10138–10163. doi: 10.1109/TPAMI.2024.3434373. [6] LIU Ze, LIN Yutong, CAO Yue, et al. Swin transformer: Hierarchical vision transformer using shifted windows[C]. 2021 IEEE/CVF International Conference on Computer Vision, Montreal, Canada, 2021: 9992–10002. doi: 10.1109/ICCV48922.2021.00986. [7] CHEN Lei, CAO Tieyong, ZHENG Yunfei, et al. A self‐distillation object segmentation method via frequency domain knowledge augmentation[J]. IET Computer Vision, 2023, 17(3): 341–351. doi: 10.1049/cvi2.12170. [8] 邵仁荣, 刘宇昂, 张伟, 等. 深度学习中知识蒸馏研究综述[J]. 计算机学报, 2022, 45(8): 1638–1673. doi: 10.11897/SP.J.1016.2022.01638.SHAO Renrong, LIU Yuang, ZHANG Wei, et al. A survey of knowledge distillation in deep learning[J]. Chinese Journal of Computer, 2022, 45(8): 1638–1673. doi: 10.11897/SP.J.1016.2022.01638. [9] WU Di, CHEN Pengfei, YU Xuehui, et al. Spatial self-distillation for object detection with inaccurate bounding boxes[C]. 2023 IEEE/CVF International Conference on Computer Vision, Paris, France, 2023: 6832–6842. doi: 10.1109/ICCV51070.2023.00631. [10] LIN Sihao, XIE Hongwei, WANG Bing, et al. Knowledge distillation via the target-aware transformer[C]. 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition, New Orleans, USA, 2022: 10905–10914. doi: 10.1109/CVPR52688.2022.01064. [11] LIU Ruiping, YANG Kailun, ROITBERG A, et al. TransKD: Transformer knowledge distillation for efficient semantic segmentation[J]. IEEE Transactions on Intelligent Transportation Systems, 2024, 25(12): 20933–20949. doi: 10.1109/TITS.2024.3455416. [12] YANG Maoke, YU Kun, ZHANG Chi, et al. DenseASPP for semantic segmentation in street scenes[C]. 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition, Salt Lake City, USA, 2018: 3684–3692. doi: 10.1109/CVPR.2018.00388. [13] ZHENG Yunfei, SUN Meng, WANG Xiaobing, et al. Self-distillation object segmentation via pyramid knowledge representation and transfer[J]. Multimedia Systems, 2023, 29(5): 2615–2631. doi: 10.1007/s00530-023-01121-x. [14] ZHANG Linfeng, SONG Jiebo, GAO Anni, et al. Be your own teacher: Improve the performance of convolutional neural networks via self‐distillation[C]. 2019 IEEE/CVF International Conference on Computer Vision, Seoul, Korea (South), 2019: 3712–3721. doi: 10.1109/ICCV.2019.00381. [15] CHENG Mingming, MITRA N J, HUANG Xiaolei, et al. SalientShape: Group saliency in image collections[J]. The Visual Computer, 2014, 30(4): 443–453. doi: 10.1007/s00371-013-0867-4. [16] ZHAI Qiang, LI Xin, YANG Fan, et al. Mutual graph learning for camouflaged object detection[C]. 2021 IEEE/CVF Conference on Computer Vision and Pattern Recognition, Nashville, USA 2021: 12992–13002. doi: 10.1109/CVPR46437.2021.01280. [17] WANG Yangtao, SHEN Xi, YUAN Yuan, et al. TokenCut: Segmenting objects in images and videos with self-supervised transformer and normalized cut[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2023, 45(12): 15790–15801. doi: 10.1109/TPAMI.2023.3305122. [18] KIRILLOV A, MINTUN E, RAVI N, et al. Segment anything[C]. 2023 IEEE/CVF International Conference on Computer Vision (ICCV), Paris, France, 2023: 3992–4003. doi: 10.1109/ICCV51070.2023.00371. [19] JI Wei, LI Jingjing, BI Qi, et al. Segment anything is not always perfect: An investigation of SAM on different real-world applications[J]. Machine Intelligence Research, 2024, 21(4): 617–630. doi: 10.1007/s11633-023-1385-0. [20] YANG Chuanguang, AN Zhulin, ZHOU Helong, et al. Online knowledge distillation via mutual contrastive learning for visual recognition[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2023, 45(8): 10212–10227. doi: 10.1109/TPAMI.2023.3257878. [21] CHEN Lei, CAO Tieyong, ZHENG Yunfei, et al. A non-negative feedback self-distillation method for salient object detection[J]. PeerJ Computer Science, 2023, 9: e1435. doi: 10.7717/peerj-cs.1435. [22] FAN Dengping, JI Gepeng, SUN Guolei, et al. Camouflaged object detection[C]. Proceedings of 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition, Seattle, USA, 2020: 2774–2784. doi: 10.1109/CVPR42600.2020.00285. [23] YANG Chuan, ZHANG Lihe, LU Huchuan, et al. Saliency detection via graph based manifold ranking[C]. 2013 IEEE Conference on Computer Vision and Pattern Recognition, Portland, USA, 2013: 3166–3173. doi: 10.1109/CVPR.2013.407. [24] FAN Dengping, CHENG Mingming, LIU Jiangjiang, et al. Salient objects in clutter: Bringing salient object detection to the foreground[C]. The 15th European Conference on Computer Vision, Munich, Germany, 2018: 186–202. doi: 10.1007/978-3-030-01267-0_12. [25] LI Xia, ZHONG Zhisheng, WU Jianlong, et al. Expectation‐maximization attention networks for semantic segmentation[C]. 2019 IEEE/CVF International Conference on Computer Vision, Seoul, Korea (South), 2019: 9166–9175. doi: 10.1109/ICCV.2019.00926. [26] HUANG Zilong, WANG Xinggang, HUANG Lichao, et al. CCNeT: Criss-cross attention for semantic segmentation[C]. Proceedings of 2019 IEEE/CVF International Conference on Computer Vision, Seoul, Korea (South), 2019: 603–612. doi: 10.1109/ICCV.2019.00069. [27] ZHAO Xiaoqi, PANG Youwei, ZHANG Lihe, et al. Suppress and balance: A simple gated network for salient object detection[C]. The 16th European Conference on Computer Vision, Glasgow, UK, 2020: 35–51. doi: 10.1007/978-3-030-58536-5_3. [28] WU Zhe, SU Li and HUANG Qingming. Cascaded partial decoder for fast and accurate salient object detection[C]. 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition, Long Beach, USA, 2019: 3902–3911. doi: 10.1109/CVPR.2019.00403. [29] WANG Liansheng, CHEN Rongzhen, ZHU Lei, et al. Deep sub-region network for salient object detection[J]. IEEE Transactions on Circuits and Systems for Video Technology, 2021, 31(2): 728–741. doi: 10.1109/TCSVT.2020.2988768. [30] WU Yuhuan, LIU Yun, ZHANG Le, et al. EDN: Salient object detection via extremely-downsampled network[J]. IEEE Transactions on Image Processing, 2022, 31: 3125–3136. doi: 10.1109/TIP.2022.3164550. [31] LIU Jiangjiang, HOU Qibin, LIU Zhiang, et al. PoolNet+: Exploring the potential of pooling for salient object detection[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2023, 45(1): 887–904. doi: 10.1109/TPAMI.2021.3140168. [32] HOU Yuenan, MA Zheng, LIU Chunxiao, et al. Learning lightweight lane detection CNNs by self‐attention distillation[C]. 2019 IEEE/CVF International Conference on Computer Vision, Seoul, Korea (South), 2019: 1013–1021. doi: 10.1109/ICCV.2019.00110. [33] SUN Dawei, YAO Anbang, ZHOU Aojun, et al. Deeply‐supervised knowledge synergy[C]. 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition, Long Beach, USA, 2019: 6990–6999. doi: 10.1109/CVPR.2019.00716. [34] LI Duo and CHEN Qifeng. Dynamic hierarchical mimicking towards consistent optimization objectives[C]. 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition, Seattle, USA, 2020: 7639–7648. doi: 10.1109/CVPR42600.2020.00766. -