Author Login Chief Editor Login Reviewer Login Editor Login Remote Office

Computer Engineering

   

A lightweight internal contamination cocoon detection method based on improved YOLOv7

  

  • Published:2025-07-08

基于改进YOLOv7的内部污染茧轻量化检测方法

Abstract: In this study, to address the issues of large model size, high computational cost, and slow detection speed in existing internal pollution cocoon detection models, an internal pollution cocoon detection method based on LEF-YOLOv7 (Lightweight and Enhanced Features-YOLOv7) was proposed. Following the principle of the traditional light-based cocoon selection method, it detects targets by leveraging image differences caused by varying transmittance between polluted and reelable cocoons. Firstly, GhostNet was used to reconstruct the feature extraction network to reduce computational costs and memory consumption. Secondly, the feature fusion network is simplified, and a 3*3 convolution with a step size of 2 was employed for downsampling, which further reduces the amount of model computation and memory access. Thirdly, the convolutional attention mechanism was introduced to enhance the feature extraction ability of the model and weaken the background interference. Finally, the DIoU (Distance-IoU) loss function was used to reduce the impact of the prediction box loss calculation on the model performance. Experimental results show that the log-average miss rate(LAMR) of the LEF-YOLOv7 model is 0.01, which is reduced by 0.05 compared with the original model. The mean average precision(mAP) is 99.58%, while floating-point operations(FLOPs) and parameters are reduced by 91.84% and 83.13%. The model size is reduced by about 117.7 MB, and the detection speed reaches 36.69 FPS, which is about 3.3 times faster than the original model, which meets the requirements of lightweighting. This method can reduce the complexity of the model while maintaining good performance, which can provide technical support for internal pollution cocoon detection in production-oriented enterprises.

摘要: 针对内部污染茧检测模型体积大、运算量大、识别速度慢等问题,提出了一种基于YOLOv7改进的内部污染茧检测模型LEF(Lightweight and Enhanced Features)-YOLOv7,该模型遵循传统的光照法选茧原理,根据内部污染茧和上车茧透光性不同产生的图像差异进行目标检测。首先,在YOLOv7中引入Ghost模块,以较低的计算成本增加特征图的数量,从而减少运算量和内存数据搬运;其次,减少特征融合网络中的卷积数和分支,采用步长为2的3*3卷积进行下采样,进一步减少模型运算量和内存访问;再次,引入卷积注意力机制增强模型的特征提取能力,削弱背景干扰;最后,采用DIoU(Distance-IoU)损失函数以降低预测框损失计算对模型性能的影响。实验结果表明,LEF-YOLOv7模型的对数平均漏检率为0.01,较原模型降低了0.05,检测精度为99.58%,同时,运算量与参数量分别降低了91.84%和83.13%,模型体积压缩了约117.7MB,检测速度达36.69FPS,约为原模型的3.3倍,符合轻量化的要求。该方法能够在保持较好性能的同时降低模型的复杂度,可为生产型企业进行内部污染茧检测提供技术支持。