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

    Lightweight online detection method for potato surface defects based on the improved YOLOv8n model

    • 摘要: 马铃薯表面缺陷是农产品分级的重要依据。为提升马铃薯表面缺陷检测精度并实现模型在移动端的快速识别,该研究提出了一种基于改进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: Grading has been one of the most important procedures in potato harvesting. However, manual grading has suffered from low efficiency, high subjectivity, high cost, and insufficient accuracy. High precision of detection is then required to fully meet the demands of large-scale production in recent years. Alternatively, several challenges still remain in the detection of potato surface defects. Firstly, simple image processing cannot concurrently recognize the variety of defects, such as disease spots, pest damage, and mechanical injuries, together with their diverse morphologies. Secondly, the high resolution of detection can further be confined to the complex environmental factors in agricultural settings, such as lighting and soil coverage. Moreover, the real-time operation has also failed to be realized on resource-constrained devices using most existing models with large parameter sizes and high computation. In this study, a lightweight algorithm (DATW-YOLOv8) was proposed to detect potato surface defects using an improved YOLOv8n model. The bottleneck module in the C2f was replaced with the Dilation-wise Residual (DWR) module. Dilated Reparam Block (DRB) was then introduced to optimize the extraction of the features for the high accuracy of detection. Additionally, a lightweight adaptive downsampling (ADOWN) convolution module was integrated to reduce the dimensionality for high processing efficiency. The detection head was upgraded to a Task Align Dynamic Detection Head (TADDH). As such, the high accuracy of defection was obtained to predict the boundary. The real-time detection was then realized to focus precisely on the key regions of surface defects. Finally, the Wise-EIoU was adopted as the bounding box regression loss function, in order to increase the attention to the difficult samples, thereby enhancing the boundary regression accuracy and model robustness. Experimental results show that the improved DATW-YOLOv8 model was achieved in the detection accuracy, recall, and mean average precision (mAP) of 95.8%, 88.1%, and 94.3%, respectively. The parameter size and weight size were 1.5 M and 3.6 MB, respectively, which were 50.0% and 42.9% smaller than those of the original YOLOv8n model. Additionally, the accuracy, recall, and mAP were improved by 2.8, 1.6, and 1.4, respectively. The better performance of defect detection was achieved in the ADOWN downsampling, compared with the YOLOv7 E-ELAN, SPDConv, WaveletPool, and Light-weight Context Guided DownSample, with the mAP improvements of 0.8, 1.3, 1.4, and 1.7 percentage points, respectively, while reducing parameter counts by 11.8, 60.5, 6.3, and 48.3 percentage points, respectively. The Wise-EIoU was also achieved in the lowest loss value, the fastest convergence, and the smallest fluctuation among various bounding box loss functions. The DATW-YOLOv8 also outperformed the YOLOv5Lite-g, YOLOv8n, YOLOv10n, and Mobilenetv2-SSD, in terms of the accuracy, recall, and mAP@0.5, particularly with the lower model weight. Specifically, the model weight of DATW-YOLOv8 was only one-third of that of YOLOv7tiny. The superior performance was then confirmed after multiple evaluations. Furthermore, the improved DATW-YOLOv8 model was deployed on an online detection of potato surface defects. A sorting test of online detection was conducted on the different potato varieties and conveyor speeds. The maximum sorting accuracy reached 95.8%, fully meeting the real-time detection requirements of potato surface defects in practical production. Overall, this finding can also provide a valuable technical reference for online detection of potato surface defects and model deployment on mobile devices.

       

    /

    返回文章
    返回