首页 | 本学科首页   官方微博 | 高级检索  
     检索      

基于改进YOLOv7模型的柑橘表面缺陷在线检测
引用本文:贾雪莹,赵春江,周娟,王庆艳,梁晓婷,何鑫,黄文倩,张驰.基于改进YOLOv7模型的柑橘表面缺陷在线检测[J].农业工程学报,2023,39(23):142-151.
作者姓名:贾雪莹  赵春江  周娟  王庆艳  梁晓婷  何鑫  黄文倩  张驰
作者单位:上海海洋大学信息学院, 上海 201306;北京市农林科学院智能装备技术研究中心, 北京 100097;北京市农林科学院信息技术研究中心, 北京 100097;陕西铁路工程职业技术学院, 渭南 714000
基金项目:国家自然科学基金项目(31871523);北京市农林科学院改革与发展课题
摘    要:柑橘表面缺陷是水果检测分级的重要依据,针对传统柑橘表面缺陷检测方法效率低、精度低等问题,该研究提出一种柑橘表面缺陷的实时检测方法。该方法首先对柑橘图像进行图像增强,然后利用提出的YOLOv7-CACT模型对柑橘表面缺陷进行检测,该模型在YOLOv7模型骨干网络中引入坐标注意力模块(coordinate attention, CA),从而提高模型对缺陷部分的关注度。在网络头部引入CT(contextual transformer,CT)模块,融合静态和动态上下文表征特征,从而增强缺陷部分特征表达能力。通过试验确定CA模块和CT模块的最佳位置。改进后的YOLOv7-CACT模型检测结果平均精度均值(mean average precision,mAP)相较于原始模型增加了4.1个百分点,达到91.1%,满足了实际生产中对柑橘缺陷检测精度的要求。最后将基于YOLOv7-CACT的柑橘检测模型通过TensorRT进行部署,试验结果表明模型的推理时间满足柑橘生产线10个/s的实时分选要求,总体的检测精度达到94.4%,为柑橘表面缺陷在线检测提供了一种精准的实时检测方法。

关 键 词:无损检测  柑橘  表面缺陷  YOLOv7  深度学习  注意力机制  TensorRT
收稿时间:2023/8/12 0:00:00
修稿时间:2023/10/27 0:00:00

Online detection of citrus surface defects using improved YOLOv7 modeling
JIA Xueying,ZHAO Chunjiang,ZHOU Juan,WANG Qingyan,LIANG Xiaoting,HE Xin,HUANG Wenqian,ZHANG Chi.Online detection of citrus surface defects using improved YOLOv7 modeling[J].Transactions of the Chinese Society of Agricultural Engineering,2023,39(23):142-151.
Authors:JIA Xueying  ZHAO Chunjiang  ZHOU Juan  WANG Qingyan  LIANG Xiaoting  HE Xin  HUANG Wenqian  ZHANG Chi
Institution:College of Information Science, Shanghai Ocean University, Shanghai 201306, China;Intelligent Equipment Technology Research Center, Beijing Academy of Agricultural and Forestry Sciences, Beijing 100097, China;Information Technology Research Center, Beijing Academy of Agricultural and Forestry Sciences, Beijing 100097, China;Shaanxi Railway Institute, Weinan 714000, China
Abstract:Citrus surface defects play a pivotal role in the fruit inspection and grading during agricultural production. Surface imperfections are also much easier to spot than inside ones, leading to accelerate the deterioration. However, conventional detection of citrus surface defects cannot fully meet the overall quality assessment in the large-scale production in recent years, due to the low efficiency and accuracy. In this study, an accurate, rapid and real-time detection was proposed to consider the diverse and complex nature of surface imperfections observed in citrus fruits. This speed and precision of detection were also enhanced for the quality of surface defects. Firstly, the images of citrus fruits were captured by industrial cameras. The generated images were enhanced to make the region of interest more outstanding. Then, the YOLOv7-CACT model was improved for the defect region in the enhanced citrus image. The coordinate attention (CA) module was introduced in the backbone network, in order to increase the attention to the defective part. The contextual transformer (CT) module was introduced in the head of the network to fuse the static and dynamic contextual representation features, thus enhancing the feature expression of the defective part. The superior performance was achieved in the modified YOLOv7-CACT model, compared with the baseline version. Especially, the detection accuracy was improved by 4.1% in the mean average precision (mAP). Consequently, the modified model was fully met the accuracy requirements for the identification of citrus surface defects in an offline setting. TensorRT was also employed around YOLOv7-CACT for the deployment of improved model, in order to real-time detect in practical scenarios. The results show that the improved YOLOv7-CACT-RT model was performed the best to detect the surface defects on the surface of citrus fruits in the grading and sorting production line with a transition rate of 10 fruits per second. The deployed YOLOv7-CACT-RT model was loaded into the grading software programmed by C++ language, in order to validate the performance. An accuracy of 94.4% was obtained with the processing time below 100 ms for 18 images of one citrus fruit using independent 198 citruses. The improved model can be directly applied to grade and sort fruit in the production line, according to the external qualities. Meanwhile, this model can also be extended to the real-time surface defects detection of other fruits without specialized knowledge. Our future research will focus on the registration and fusion of RGB and NIR image, in order to improve the detection accuracy of fruit defects.
Keywords:nondestructive determination  citrus  surface defects  YOLOv7  deep learning  attention mechanism  TensorRT
点击此处可从《农业工程学报》浏览原始摘要信息
点击此处可从《农业工程学报》下载免费的PDF全文
设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号