基于改进YOLOv8n的轻量化马铃薯表面缺陷检测方法

    Research on a Lightweight Potato Surface Defect Detection Method Based on Improved YOLOv8n.

    • 摘要: 马铃薯表面缺陷是农产品分级的重要依据。为提升马铃薯表面缺陷检测精度并实现模型在移动端的快速识别,该研究提出了一种基于改进YOLOv8n的马铃薯表面缺陷检测方法DATW-YOLOv8。算法使用Dilation-wise Residual模块替换C2f中的Bottleneck模块,并引入Dilated Reparam Block模块对C2f进行二次改进,加强细节特征提取,提高缺陷特征的提取精度;随后,引入轻量级自适应下采样(ADOWN)卷积模块,实现图像数据的有效降维,提升模型处理效率;此外,改造检测头为任务对齐动态检测头(task align dynamic detection head, TADDH),提高缺陷边界预测精度,精准聚焦缺陷关键区;最终,使用Wise-EIoU作为边界框回归损失函数,增强模型对困难样本的关注度,提升缺陷边界回归精度及模型鲁棒性。试验结果表明,改进DATW-YOLOv8模型在准确率、召回率和平均精度方面分别达到95.8%、88.1%和94.3%,参数量和权重分别为1.5 M和3.6 MB。与原YOLOv8n模型相比,参数量和权重分别减少了50.0和42.9个百分点,同时准确率、召回率和平均精度分别提高了2.8个百分点、1.6个百分点和1.4个百分点。该方法能满足实际生产中针对缺陷马铃薯进行精准、实时检测的要求,为马铃薯表面缺陷在线检测及模型在移动端的部署提供了技术参考。

       

      Abstract: The current potato grading methods mainly rely on manual grading, which suffers from low efficiency, high subjectivity, high cost, and insufficient detection accuracy. These limitations make it difficult to meet the demands of large-scale production and high-precision detection. Additionally, potato surface defect detection faces several challenges. First, the variety of defects, such as disease spots, pest damage, and mechanical injuries, along with their diverse morphologies, makes it difficult to achieve effective recognition using simple image processing methods. Second, the complex environmental factors in agricultural settings, such as changes in lighting and soil coverage, further increase the detection difficulty. Moreover, most existing deep learning models have large parameter sizes and high computational complexity, making them unsuitable for real-time operation on resource-constrained devices.To address these issues, this paper proposes a potato surface defect detection method, DATW-YOLOv8, based on an improved YOLOv8n model. The algorithm replaces the Bottleneck module in C2f with the Dilation-wise Residual (DWR) module and introduces the Dilated Reparam Block (DRB) to optimize the extraction of detailed features, thereby improving the accuracy of defect feature detection. Additionally, a lightweight adaptive downsampling (ADOWN) convolution module is integrated to achieve efficient dimensionality reduction and enhance the model's processing efficiency. The detection head is upgraded to a Task Align Dynamic Detection Head (TADDH) to improve the accuracy of defect boundary prediction and focus precisely on key defect regions. Finally, Wise-EIoU is adopted as the bounding box regression loss function to increase the model’s attention to difficult samples, thereby enhancing boundary regression accuracy and model robustness.Experimental results show that the improved DATW-YOLOv8 model achieves detection accuracy, recall, and mean average precision (mAP) of 95.8%, 88.1%, and 94.3%, respectively. The parameter size and weight size are 1.5M and 3.6MB, which are 50.0% and 42.9% smaller than those of the original YOLOv8n model. Additionally, the accuracy, recall, and mAP are improved by 2.8%, 1.6%, and 1.4%, respectively. When using different downsampling methods for defect detection, ADOWN exhibits significant advantages in terms of detection accuracy and mAP compared to YOLOv7 E-ELAN, SPDConv, WaveletPool, and Light-weight Context Guided DownSample, with mAP improvements of 0.8%, 1.3%, 1.4%, and 1.7%, respectively, while reducing parameter counts by 11.8%, 60.5%, 6.3%, and 48.3%, respectively. Additionally, Wise-EIoU achieves the lowest loss value, the fastest convergence, and the smallest fluctuation among various bounding box loss functions.In comparison with YOLOv5Lite-g, YOLOv8n, YOLOv10n, and Mobilenetv2-SSD, DATW-YOLOv8 outperforms these models in terms of accuracy, recall, and mAP@0.5, while maintaining a lower model weight than other network models. Compared with YOLOv7tiny, the model weight of DATW-YOLOv8 is only one-third of that of YOLOv7tiny, further demonstrating its superior performance across multiple evaluation metrics. Furthermore, the improved DATW-YOLOv8 model was deployed on a potato surface defect online detection and sorting test bench to conduct online detection experiments on different potato varieties and conveyor speeds. The results indicate that the maximum sorting accuracy reaches 95.8%, effectively meeting the real-time detection requirements for potato surface defects and demonstrating its potential for practical production applications. Overall, this method provides a valuable technical reference for online potato surface defect detection and model deployment on mobile devices.

       

    /

    返回文章
    返回