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

基于改进YOLOv7的破壳鸡蛋在线实时检测系统
引用本文:赵祚喜,魏洪飞,黄渊,黄杏彪,米亚龙,罗阳帆.基于改进YOLOv7的破壳鸡蛋在线实时检测系统[J].农业工程学报,2023,39(20):255-265.
作者姓名:赵祚喜  魏洪飞  黄渊  黄杏彪  米亚龙  罗阳帆
作者单位:华南农业大学工程学院,广州 510642;广州广兴牧业设备集团有限公司,广州 510540
基金项目:广东省现代农业产业共性关键技术研发创新团队建设项目:禽蛋收集与包装机器人(2019KJ129);国家重点研发计划项目:“主要饲草饲料生产全程智能化作业装备创制与应用”子课题:“主要饲草饲料全程智能化生产共性关键技术研究与应用”(2022YFD2001901)
摘    要:针对破壳鸡蛋(破口蛋和裂纹蛋)缺陷差异性大,在线检测要求实时,以及人工检测依靠主观经验且检测速度慢、检测精度不高等问题,该研究提出一种基于改进的YOLOv7(You Only Look Once v7)模型的破壳鸡蛋在线实时检测系统。即以YOLOv7网络为基础,将YOLOv7网络的损失函数CIoU(complete-IoU)替换为WIoUv2(wise-IoU),在骨干网络(backbone)中嵌入坐标注意力模块(coordinate attention,CA)和添加可变形卷积DCNv2(deformable convnet)模块,同时将YOLOv7网络中的检测头(IDetect)替换为具有隐式知识学习的解耦检测头(IDetect_Decoupled)模块。在PC端的试验结果表明,改进后的模型在测试集上平均精度均值(mean average precision,mAP)为94.0%,单张图片检测时间为13.1 ms,与模型改进之前相比,其mAP提高了2.9个百分点,检测时间仅延长1.0 ms;改进后模型的参数量为3.64×107,较原始模型降低了2.1%。最后通过格式转换并利用ONNXRuntime深度学习框架把模型部署至设备端,在ONNXRuntime推理框架下进行在线检测验证。试验结果表明:该算法相较原始YOLOv7误检率降低了3.8个百分点,漏检率不变,并且在线检测平均帧率约为54帧/s,满足在线实时性检测需求。该研究可为破壳鸡蛋在线检测研究提供技术参考。

关 键 词:模型  图像处理  深度学习  改进YOLOv7  破壳鸡蛋  实时检测
收稿时间:2023/5/28 0:00:00
修稿时间:2023/10/23 0:00:00

Online real-time detection system for cracked eggs using improved YOLOv7
ZHAO Zuoxi,WEI Hongfei,HUANG Yuan,HUANG Xingbiao,MI Yalong,LUO Yangfan.Online real-time detection system for cracked eggs using improved YOLOv7[J].Transactions of the Chinese Society of Agricultural Engineering,2023,39(20):255-265.
Authors:ZHAO Zuoxi  WEI Hongfei  HUANG Yuan  HUANG Xingbiao  MI Yalong  LUO Yangfan
Institution:College of Engineering, South China Agricultural University, Guangzhou 510642, China;Guangzhou Guangxing Animal Husbandry Equipment Group Co., Ltd., Guangzhou 510540, China
Abstract:An accurate and rapid detection of eggshell damage has been one of the most important steps in the field of egg processing. Eggshells are prone to mechanical impact and damage during laying and processing, leading to the leakage of egg contents. It has also posed serious bacterial infections and food safety risks on the rest of the intact eggs in the processing line, particularly for the cleaning work and production costs. Furthermore, the current manual detection relies mainly on the subjective experience with slow speed and low accuracy. Therefore, it is of great practical significance to rapidly, accurately, and low-costly detect broken shell eggs in egg processing. In this study, an online real-time detection system was proposed for the broken shell eggs using the improved YOLOv7 (you only look once) model. Significant differences were also presented in the defects between broken shell eggs. Specifically, the YOLOv7 network was selected to replace the loss function CIoU (complete-IoU) with WIoUv2 (wise-IoU). The coordinate attention (CA) modules were added into the deformable convolutional DCNv2 (deformable convnet) in the backbone network. At the same time, the detection head (IDetect) module was replaced in the YOLOv7 network with a decoupled detection head (IDetect-Decoupled) with implicit knowledge learning. Among them, the CA module was used to effectively identify and locate targets of interest for optimal model performance, where the deformable convolution was combined to decouple the detection heads. WIoU loss functions were used to learn the local and global information while improving the accuracy and speed of shell-breaking egg detection with the less missed and false detections. The generalization and robustness of the model were further improved using data augmentation. Various operations were performed on the training set, such as random cropping, 50% probability of random horizontal and vertical flipping, 50% probability of random rotation and scaling, random noise, brightness and color adjustments. The dataset was screened to remove the unqualified data after data augmentation. Finally, a final dataset was obtained with 1729 images, including 3782 intact and 1574 cracked eggs. The experimental results on the PC side show that better performance was achieved in the improved model, with an average precision (mAP) of 94.0% on the test set. The single image detection time of 13.1 ms was 2.9 percentage points higher than before, where the detection time was only extended by 1.0 ms. The parameter quantity of the improved model was 3.64×107, indicating a decrease of 2.1 percentage points, compared with the original model. In addition, the improved YOLOv7 model enhanced the mAP of broken shell eggs by 5.4, 3.4, and 4.5 percentage points, compared with the SSD, Faster R-CNN, and YOLOv5 models, respectively. The best detection accuracy was achieved for the broken shell eggs, indicating the high effectiveness of the improved model. Finally, the model was also deployed to the device side through the format conversion. The ONNXRuntime deep learning was utilized to conduct the online detection and verification under its inference framework. The improved model was reduced by 3.8 percentage points on the false detection rate of broken eggs, whereas, the missed detection rate remained unchanged. The average frame rate was about 54 frames/s for online detection. The strong robustness of the improved model fully met the requirements of online real-time detection. This finding can provide the technical reference for the online detection of broken shell eggs.
Keywords:models  image processing  deep learning  improved YOLOv7  broken shell eggs  real time detection
点击此处可从《农业工程学报》浏览原始摘要信息
点击此处可从《农业工程学报》下载免费的PDF全文
设为首页 | 免责声明 | 关于勤云 | 加入收藏

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