-
RCNN(Region Convolutional Neural Network)是第1个将卷积神经网络(CNN)引入到目标领域的算法,在该算法中主要思想是通过对大量的候选区域(Region Proposals)进行计算,并利用SVM分类器以及回归器获得目标的精准位置,这样的方法虽然相较于其他方法有加大的提升,但是计算量十分巨大。因此该团队提出了Fast-RCNN模型3个方面的改进:(1)将整张图片归一化处理送入网络,解决RCNN中候选区域大量的冗余计算问题;(2)在整幅图上提取候选区域,并且该候选区域的前几层特征不需要重复计算,这大大减少了训练时间;(3)把类别判断和位置精调统一用深度网络实现,降低了网络训练过程的存储空间[11]。而Faster-RCNN则是该团队的又一力作,在推理速度以及精度方面均有较大提升,因此本文采用该网络模型作为深度学习船舶图像识别方法的基础网络,下面对该网络进行详细的介绍。
-
Faster-RCNN的网络结构可以分为4个部分,如图1所示。第一部分,卷积层(Conv layers),即特征提取网络,在原网络中采用VGG16进行特征提取,用于后续RPN层的输入[12]。第二部分,区域候选网络(Region Proposal Network,RPN),该网络结构有两个任务:(1)判断所有的anchor内是否有目标;(2)修正anchor得到较为准确的候选区域。第三部分对感兴趣区域的池化(ROI Pooling),用于对RPN网络输出的候选区域进行收集,并结合特征提取网络的输出(feature map)送入全连接层进行分类处理。第四部分分类与回归(Classification and Regression),利用商议结构的输出计算出具体类别。
RPN结构作为Faster-RCNN网络中最为重要的结构,损失计算同样包括分类损失以及边界损失2个部分,如公式1~公式3所示。
$$ L\left(\left\{{p}_{i}\right\},\left\{{t}_{i}\right\}\right)={L}_{{\rm{cls}}}+\lambda {L}_{{\rm{reg}}} $$ (1) $$ {L}_{{\rm{cls}}}=\dfrac{1}{{N}_{{\rm{cls}}}}\displaystyle \sum\limits _{i}{L}_{{\rm{cls}}}\left({p}_{i}^{*},{p}_{i}^{*}\right) $$ (2) $$ {L}_{{\rm{reg}}}=\dfrac{1}{{N}_{{\rm{reg}}}}\displaystyle \sum\limits _{i}{p}_{i}^{*}{L}_{{\rm{reg}}}({t}_{i},{t}_{i}^{*}) $$ (3) 式中:
$ {p}_{i} $ ——第i个anchor预测为真实标签的概率;$ {p}_{i}^{\mathrm{*}} $ ——正样本时为1,负样本为0;$ {t}_{i} $ ——预测第i个anchor的边界框回归参数;$ {t}_{i}^{\mathrm{*}} $ ——第i个anchor对应的GT box;${N}_{{\rm{cls}}}$ ——1个mini-batch中所有样本数量,即256↑;${N}_{{\rm{reg}}}$ ——anchor位置的个数,约2 400↑。 -
原始Faster-RCNN网络中采用VGG16作为特征提取网络(backbone),但是由于其特殊的网络结构导致了大量冗余的网络参数,同时在训练过程中导致出现过拟合现象,虽然该网络在2只3次卷积后会通过最大池化下采样对网络复杂度,但是随着网络层数的加深,多次的池化操作会使得特征图的分辨率降低,从而导致网络对于小目标的检测能力降低。因此在本文中采用ResNet、ResNeXt以及MobileNetV2网络对VGG16进行替换。
ResNet的核心思想为残差结构,即通过残差网络增加一个恒等映射,跳过本层或多层运算,同时后向传播过程中,下一层网络梯参数度直接传递给上一层,有效改善了深层网络梯度消失的问题[13]。ResNet共包含5个stage,其中stage 0由1个卷积层组成,主要负责对输入的预处理,而后续4个stage主要由多个bottleneck组成,负责输入的特征提取,最后通过softmax层进行展平处理。
ResNeXt网络结合了VGG、ResNet和Inception3个经典网络的优秀特性,该网络的bottleneck是从ResNet网络中衍生而来,如图2所示。这样的结构能够有效解决由于网络层数增加而引起的退化问题,并且由于cardinality基数的使用可以在降低超参数复杂度的同时保证网络的准确度[14]。
MobileNet的核心思想为深度可分离卷积,该网络折中了网络精度以及网络运行速度方面的性能。深度可分离卷积相较于标准卷积将所有卷积核作用到所有channel中有所不同,它针对每一个输入的channel都有不同的卷积核,卷积核尺寸为1×1。这样的卷积方式与标准卷积由相同的感受野,但是大大地减少了模型的计算量和参数量[15]。如图3所示,在MobileNetV2中使用了倒残差结构,并且使用了ReLU6作为激活函数避免低维特征信息的损失。
-
Lin等[16]在密集目标检测(Dense Object Detection)任务中发现一个主要问题是前景和背景类之间的不平衡,为了解决该问题作者提出了一种新的损失函数——焦点损失函数(Focal Loss Function),它是对交叉熵损失(Entropy Loss)的一种修正,目的是在模型能够很好地分类的例子中减少损失的权重。在船舶识别任务中,我们在Faster-RCNN网络最后的分类阶段使用了该损失函数。焦点损失的计算方式如式4所示。
$$ {p}_{{\rm{t}}}=\left\{\begin{array}{c}p\\ 1-p\end{array}\right.\begin{array}{c}{\rm{if}}\;y=1\\ {\rm{otherwise}}\end{array} $$ (4) $$ {L}_{{\rm{f}}}=-{\left(1-{p}_{{\rm{t}}}\right)}^{\gamma }\mathrm{l}\mathrm{o}\mathrm{g}\left({p}_{{\rm{t}}}\right) $$ (5) 式中:
pt——与ground truth即类别y的接近程度;
Lf——focal loss焦点损失;
p ——预测概率大小。
-
对于海上船舶检测任务,目前大部分算法的数据集是卫星拍摄海面的SAR图像,由于本次任务采用光学摄像头拍摄船舶照片并且进行检测,因此这些数据集并不适用于本次船舶检测任务。针对上述问题,本文自制了一款包含约5 000张的光学摄像头拍摄的船舶图像,这些图像的来源包括:(1)海上风电平台拍摄的船舶图像;(2)通过爬虫技术获取的网络图像。利用labelImg软件完成对图像中船舶位置的标记,训练集、验证集及测试集按照7∶2∶1的比例进行划分[18]。本文数据集部分典型示例如图5所示。
-
为了使得模型能够取得更好的效果,在训练过程中采用了多种方式进行数据增强。这些数据增强方式包括:(1)以0.5的概率进行水平方向的翻转;(2)随机裁剪一个400×400的区域,并在训练期间将其调整为800×800。这样的方式是为了让小目标能够占据图像的较大区域[19]。
-
本文首先采用Pytorch框架搭建网络,利用GPU平台对训练过程进行加速。在训练过程中,首先采用迁移学习的方式分别载入MobileNetV2、ResNet50以及ResNetXt101网络在ImageNet数据集上预训练权重,训练过程分为2个部分:前5个epoch的训练中,首先冻结前置特征提取网络权重(backbone),训练RPN以及最终预测网络部分;而在后续的epoch训练过程中,解冻前置特征提取网络权重(backbone),接着训练整个网络权重。同时在训练过程中,学习率采用SGD优化策略,anchor尺寸设置为(32, 64, 128, 256, 512),当训练过程的损失趋于稳定后保存对于模型并进行测试。
-
根据模型训练过程保存的最优模型在验证集上进行测试,采用查准率(Precision)、查全率(Recall)以及平均准确率(Average Precision,AP)指标对各个模型进行评价,其中查询率表示模型检测的正样本数量占真实正样本的比例,而查准率表示模型检测全目标中真实正样本的比例,而平均准确率表示P-R曲线的面积。针对不同特征提取网络、分类损失函数的Faster-RCNN网络的精度如表1所示。
backbone class loss mAP/% Precision/% Recall/% VGG16(传统结构) entropy loss 79.44 74.23 74.04 ResNet50 entropy loss 81.38 76.42 76.35 focal loss 82.15 78.38 78.12 MobileNetV2 entropy loss 80.92 75.79 75.63 focal loss 81.26 76.37 76.28 ResNeXt101 entropy loss 83.69 79.20 79.08 focal loss 84.83 79.89 79.63 Table 1. Influence of various parameter changes on network performance
-
采用训练好的模型,对数据集中部分数据进行验证与测试,网络对于该任务的识别效果如图6所示,其中图6(a)为船舶正面识别效果,图6(b)为侧面识别效果,该模型能够对图像中的船舶进行识别并将标注位置以及概率。
根据船舶AIS系统数据处理方法以及相关软件要求,通过对船舶AIS数据进行处理后得到船舶的轨迹如图7所示,可显示目标的历史轨迹点和线,间隔时间可调,每个历史轨迹点都有时间和位置信息。
Research and Improvement of Offshore Ship Fusion Recognition Algorithm
doi: 10.16516/j.gedi.issn2095-8676.2023.04.013
- Received Date: 2022-08-08
- Rev Recd Date: 2022-11-17
- Available Online: 2023-07-11
- Publish Date: 2023-07-10
-
Key words:
- Faster-RCNN /
- wind power platform /
- offshore ship /
- automatic identification system /
- identification
Abstract:
Citation: | WANG Xiaohu. Research and Improvement of Offshore Ship Fusion Recognition Algorithm[J]. SOUTHERN ENERGY CONSTRUCTION, 2023, 10(4): 131-137. doi: 10.16516/j.gedi.issn2095-8676.2023.04.013 |