Computer Engineering and Applications ›› 2021, Vol. 57 ›› Issue (23): 185-192.DOI: 10.3778/j.issn.1002-8331.2104-0321

• Pattern Recognition and Artificial Intelligence • Previous Articles     Next Articles

Image Object Detection Algorithm Based on Adaptive Focal Loss

XIAO Zhenjiu, KONG Xiangxu, ZONG Jiaxu, YANG Yueying   

  1. College of Software, Liaoning Technology University, Huludao, Liaoning 125105, China
  • Online:2021-12-01 Published:2021-12-02

自适应聚焦损失的图像目标检测算法

肖振久,孔祥旭,宗佳旭,杨玥莹   

  1. 辽宁工程技术大学 软件学院,辽宁 葫芦岛 125105

Abstract:

Modern target detection algorithms still have the imbalance of positive and negative samples caused by the existing target detection architecture and the imbalance of hard and easy samples caused by the training data. The existing methods generally use resampling based on class frequency or reweighting based on class prediction probability. Although the imbalance of classes is alleviated, new super parameters are introduced, which requires a lot of manual adjustment for each training task. For this reason, a new loss function Adaptive Focal Loss is proposed on the basis of the existing Focal Loss, which makes the model focus on the more difficult samples and adjust the super parameters adaptively. Firstly, according to the number of positive and negative samples in each batch of image tags in the training process, the self-adaptive weighting factor is calculated to achieve the dynamic balance of positive and negative samples. Secondly, according to the expected probabilities of all kinds of ground-truth label in different stages of the training process, the adaptive modulation factor is calculated, and the adaptive balanced samples are obtained. In order to verify the effectiveness of the method, the mAP of PASCAL VOC2007 test data set reaches 80.75%, which is 3.45 percentage points higher than the original algorithm. In PASCAL VOC2012 test data set, the mAP is 77.17%, which is 1.87 percentage points higher than the original algorithm. The experimental results show that, compared with the original Focal Loss, the detection accuracy of Adaptive Focal Loss is improved, and it has great practical value.

Key words: object detection, sample imbalance, adaptive focal loss

摘要:

现代目标检测算法仍然存在由现有目标检测架构引起的正负样本不平衡和训练数据引起的难易样本不平衡。现有方法一般采用基于类别频率的重采样或基于类别预测概率的重新加权,虽然减轻了类别的不平衡问题,但是引入了新的超参数,为每个训练任务需要进行大量的手动调整超参数。为此在现有Focal Loss损失函数基础上提出了一个新的损失函数自适应聚焦损失(Adaptive Focal Loss),使模型聚焦于对训练过程贡献更大的困难样本,并且可自适应地调整超参数。根据训练过程中每批图像标签中的正负样本数量计算出自适应的加权因子来实现对正负样本的动态平衡。根据训练过程中不同阶段各类真实标签的期望概率计算出自适应的调制因子来自适应地平衡难易样本。为验证方法的有效性,在PASCAL VOC2007测试数据集中平均精度均值达到80.75%,相比较于原算法提高了3.45个百分点。在PASCAL VOC2012测试数据集中平均精度均值达到77.17%,相比较于原算法提高了1.87个百分点。实验结果表明,把Adaptive Focal Loss作为网络的损失函数,相比于原始的Focal Loss损失函数检测精度有所提升,并具有较大的实用价值。

关键词: 目标检测, 样本不平衡, 自适应聚焦损失