基于改进YOLOv7-tiny的多光谱苹果表层缺陷检测
Multispectral Apple Surface Defect Detection Based on Improved YOLOv7-tiny
化春键 1孙明春 1蒋毅 1俞建峰 1陈莹2
作者信息
- 1. 江南大学机械工程学院,江苏 无锡 214122;江苏省食品先进制造装备技术重点实验室,江苏 无锡 214122
- 2. 江南大学物联网工程学院,江苏 无锡 214122
- 折叠
摘要
针对苹果表层存在多种缺陷类型、对不同缺陷的检测方法不同的问题,提出一种基于改进YOLOv7-tiny的缺陷检测模型,结合相机采集的RGB+NIR多光谱图像对苹果表层多种缺陷进行了检测和分类.首先,为了提取更多有效的特征信息,提高对缺陷的定位能力,在主干网络中使用坐标注意力(CA)机制聚合坐标信息,同时在主干网络后添加上下文转换器(CoT)模块以增加全局感受野;其次,为了增强高效聚合网络的特征融合能力,将其与加权双向特征金字塔结合,调整结构中各分支的占比;最后,为了解决难易样本不均衡的问题,将损失函数更换为Focal-EIoU损失.改进后网络的平均精度均值(mAP)@0.5提升了1.2百分点,达到93.2%,识别速度为89.3 frame/s.研究结果表明,本文研究内容为苹果表层的缺陷检测提供了更加高效的方法,同时为苹果的分级提供了更加精确的依据.
Abstract
A defect detection model based on improved YOLOv7-tiny is proposed herein to address the problem of different detection methods for different defects on apple surface.Combined with RGB+NIR multispectral images collected by a camera,various defects on the apple surface are detected and classified.First,to extract more effective feature information and improve the ability to locate defects,coordinate attention(CA)is used to aggregate coordinate information in the backbone network,and a contextual transformer(CoT)module is added behind the backbone network to increase the global receptive field.Second,it is combined with the weighted bidirectional feature pyramid to adjust the proportion of each branch in the structure to enhance the feature fusion ability of efficient layer aggregation networks.Finally,the loss function is replaced by Focal-EIoU loss to solve the problem of unbalanced samples.The mean average precision(mAP)@0.5 of the improved network increases by 1.2 percentage points to 93.2%,and the recognition speed is 89.3 frames/s.The research content of this paper provides a more efficient method for apple surface defect detection and a more accurate basis for apple grading.
关键词
缺陷检测/苹果表层/多光谱图像/深度学习/YOLOv7-tiny/注意力机制Key words
defect detection/apple surface/multi-spectral image/deep learning/YOLOv7-tiny/attention mechanism引用本文复制引用
出版年
2024