针对脱水蔬菜生产过程中人工质检工作量大、检测效率低、工人质检标准不一致等问题,提出了一种基于改进YOLOv8的异物检测方法YOLOv8n-BCS,以辅助工人提高质检效率并减轻劳动强度.YOLOv8n-BCS模型在主干网络中引入ShuffleNetV2和BoTNet(bottleneck transformer network),在颈部网络结构融入SimAM(simple attention module)注意力机制和轻量化上采样算子CARAFE(content-aware reassembly of features),同时采用SIoU(similarity intersection over union)函数计算回归损失.使用NVIDIA GeForce RTX 3080服务器进行训练测试,实验结果表明:YOLOv8n-BCS模型精确率P为96.8%,召回率R为94.7%,调和平均值F1为95.7%,平均精度均值(mAP)为97.1%,帧率为231 f/s,模型体积为6.1 MB.相比对照模型,YOLOv8n-BCS模型容量减小,检测速度和平均精度均值提升,可为脱水蔬菜智能检测分拣系统优化提供技术参考.
Abstract
Problems such as heavy workload, low manual detection efficiency, and inconsistent quality inspection standards of workers during the production process of dehydrated vegetables exist. To address these issues, a foreign object detection method based on improved YOLOv8, namely YOLOv8n-BCS, was proposed. This method could assist workers in improving quality inspection efficiency and reducing labor intensity. The YOLOv8n-BCS model introduced ShuffleNetV2 and BoTNet (bottleneck transformer network) into the backbone network and incorporated the simple attention module (SimAM) attention mechanism and lightweight upsampling operator content-aware reassembly of features (CARAFE) into the neck structure. The similarity intersection over union (SIoU) function was also used to calculate regression loss. By using an NVIDIA GeForce RTX 3080 server for training and testing, the experimental results show that the YOLOv8n-BCS model has an accuracy P of 96.8%, a recall R of 94.7%, a harmonic mean F1 of 95.7%, a mean average accuracy (mAP) of 97.1%, a frame rate of 231 f/s, and a model volume of 6.1 MB. Compared with the control model, the YOLOv8n-BCS model has reduced capacity, as well as improved detection speed and average accuracy, providing a technical reference for optimizing intelligent detection and sorting systems for dehydrated vegetables.
YOLOv8是YOLO(you only look once)系列中的最新算法,相比于广泛应用的YOLOv3和YOLOv5网络,YOLOv8具有检测精度高、内存占用低和检测速度快等优点.在确保精度的同时,YOLOv8进一步实现了模型的轻量化,其网络模型的权重文件显著减小[16].目前YOLOv8已在工业安全场景[17-18]、虫害监测[19-21]和麦穗检测[22-24]等领域得到改进和应用.
ShuffleNetV2是一种轻量化网络结构,由ShuffleNetV1发展而来,引入主干网络可降低特征层的参数量.ShuffleNetV1使用大量类瓶颈结构,使网络的输入和输出通道数不同,导致训练运算量增大,训练速度降低;ShuffleNetV1包含很多逐点组卷积,会增大设备硬件压力;网络中的部分模块采用多分支结构,即模块中包含多个小算子堆叠不同的卷积层和池化层,导致网络结构碎片化,降低运算效率和检测速度;ShuffleNetV1使用ReLU(rectified linear unit)和shortcut结构,所需内存较大,限制了网络速度.
ShanYang. Current situation and development strategic consideration of the fruits & vegetables processing industry in China[J]. Journal of Chinese Institute of Food Science and Technology, 2010, 10(1): 1-9.
SunXiao-jing, LiuJun, ZouYu-xiao, et al. Research progress in the quality change of dehydrated vegetables in processing[J]. Science and Technology of Food Industry, 2014, 35(20): 388-392.
[7]
BhargavaA, BansalA, GoyalV. Machine learning-based detection and sorting of multiple vegetables and fruits[J]. Food Analytical Methods, 2022, 15(1): 228-242.
[8]
KawamuraS, NatsugaM, TakekuraK, et al. Development of an automatic rice-quality inspection system[J]. Computers and Electronics in Agriculture, 2003, 40(1/3): 115-126.
[9]
ZhaoY S, GongL, HuangY X, et al. Robust tomato recognition for robotic harvesting using feature images fusion[J]. Sensors, 2016, 16(2): 173.
[10]
HayashiS, ShigematsuK, YamamotoS, et al. Evaluation of a strawberry-harvesting robot in a field test[J]. Biosystems Engineering, 2010, 105(2): 160-171.
[11]
PandeyV K, SrivastavaS, DashK K, et al. Machine learning algorithms and fundamentals as emerging safety tools in preservation of fruits and vegetables: a review[J]. Processes, 2023, 11(6): 1720.
[12]
JiW, QianZ J, XuB, et al. A nighttime image enhancement method based on Retinex and guided filter for object recognition of apple harvesting robot[J]. International Journal of Advanced Robotic Systems, 2018, 15(1): 1-12.
[13]
AgarwalM, GuptaS K, BiswasK K. Development of efficient CNN model for tomato crop disease identification[J]. Sustainable Computing: Informatics and Systems, 2020, 28: 100407.
WangHong-jun, XiongJun-tao, LiZou-zou, et al. Potato grading method of weight and shape based on imaging characteristics parameters in machine vision system[J]. Transactions of the Chinese Society of Agricultural Engineering, 2016, 32(8): 272-277.
[16]
BlancP. Unit for sorting and packaging products capable of being hung on a hooking member for the purpose of their conveyance, such as bunches of fruits, in particular table grapes or truss tomatoes: US6957940B2[P]. 2005-10-25.
YeJin-tao, WangYun-xiang, YangJie, et al. Research on maturity and classification of Hami melon based on color space feature extraction[J]. Journal of Shihezi University (Natural Science), 2016, 34(1): 106-111.
WeiKang-li, WangZhen-jie, SunKe, et al. External quality classification of apple chips based on computer vision[J]. Journal of Nanjing Agricultural University, 2017, 40(3): 547-555.
[21]
BaigvandM, BanakarA, MinaeiS, et al. Machine vision system for grading of dried figs[J]. Computers and Electronics in Agriculture, 2015, 119: 158-165.
MaChao-wei, ZhangHao, MaXin-ming, et al. Lightweight wheat disease detection method based on improved YOLOv8[J]. Transactions of the Chinese Society of Agricultural Engineering, 2024, 40(5): 187-195.
HuJie-zhen, YangJing-rong, DengPei-chang, et al. Image recognition and analysis system for metal surface corrosion based on YOLO algorithm[J]. Materials Protection, 2025,58(9):124-133.
[28]
YeR, ShaoG Q, HeY, et al. YOLOv8-RMDA: lightweight YOLOv8 network for early detection of small target diseases in tea[J]. Sensors, 2024, 24(9): 2896.
WangShao-cong, WangHui-qiang, DingXiao-ming, et al. Pest monitoring in strawberry greenhouses using improved YOLO v8n[J]. Transactions of the Chinese Society of Agricultural Engineering, 2025, 41(17): 184-193.
BaiKai, ZhangYu-jie, SuDeng-wen, et al. Peanut leaf disease detection method based on improved YOLO v8n[J]. Transactions of the Chinese Society for Agricultural Machinery, 2025, 56(6): 518-526, 564.
[33]
FangC, YangX. Lightweight YOLOv8 for wheat head detection[J]. IEEE Access, 2024, 12: 66214-66222.
LiuMeng-shu, ZhangChun-qi, ChaoJin-yang, et al. Improved wheat disease detection system based on YOLO v8n[J]. Transactions of the Chinese Society for Agricultural Machinery, 2024, 55(S1): 280-287, 355.
YuanYing-chun, GengJun, XuNan, et al. Wheat ear recognition method using YOLOv8-TRP model[J]. Transactions of the Chinese Society for Agricultural Machinery, 2025, 56(11): 499-508.
[38]
WangC Y, BochkovskiyA, LiaoH M. YOLOv7: trainable bag-of-freebies sets new state-of-the-art for real-time object detectors[C]//2023 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). Vancouver, 2023: 7464-7475.
[39]
GeZ, LiuS T, WangF, et al. YOLOX: exceeding YOLO series in 2021[EB/OL]. 2021: arXiv: 2107.08430.
BaoYu-chen, XuZeng-bo, TianBing-qiang. Improved garment defect detection algorithm based on YOLOv8[J]. Journal of Donghua University (Natural Science), 2024, 50(4): 49-56.
[42]
MaN N, ZhangX Y, ZhengH T, et al. ShuffleNet V2: practical guidelines for efficient CNN architecture design[C]//Computer Vision-ECCV 2018. Cham: Springer, 2018: 122-138.
[43]
SrinivasA, LinT Y, ParmarN, et al. Bottleneck transformers for visual recognition[EB/OL]. (2021-01-21) [2024-03-30].
[44]
WangJ Q, ChenK, XuR, et al. CARAFE: content-aware ReAssembly of FEatures[C]//2019 IEEE/CVF International Conference on Computer Vision (ICCV). Seoul, 2020: 3007-3016.
LiWen-ju, ZhangGan, CuiLiu, et al. Lightweight traffic sign recognition model based on coordinate attention[J]. Journal of Computer Applications, 2023, 43(2): 608-614.
MaHong-xing, DongKai-bing, WangYing-fei, et al. Lightweight plant recognition model based on improved YOLO v5s[J]. Transactions of the Chinese Society for Agricultural Machinery, 2023, 54(8): 267-276.
[49]
YangL X, ZhangR Y, LiL D, et al. SimAM: a simple, parameter-free attention module for convolutional neural networks[C]//International Conference on Machine Learning.Vienna, 2021:11863-11874.
[50]
ZhengZ H, WangP, LiuW, et al. Distance-IoU loss: faster and better learning for bounding box regression[J]. Proceedings of the AAAI Conference on Artificial Intelligence, 2020, 34(7): 12993-13000.
[51]
GevorgyanZ. SIoU loss: more powerful learning for bounding box regression[EB/OL]. (2022-05-25) [2024-03-30].
[52]
KoiralaA, WalshK B, WangZ, et al. Deep learning for real-time fruit detection and orchard fruit load estimation: benchmarking of ‘MangoYOLO’[J]. Precision Agriculture, 2019, 20(6): 1107-1135.
[53]
LiuG X, NouazeJ C, Touko MbouembeP L, et al. YOLO-tomato: a robust algorithm for tomato detection based on YOLOv3[J]. Sensors, 2020, 20(7): 2145.
[54]
LawalO M. YOLOMuskmelon: quest for fruit detection speed and accuracy using deep learning[J]. IEEE Access, 2021, 9: 15221-15227.
[55]
RedmonJ, FarhadiA. YOLOv3: an incremental improvement[EB/OL]. (2018-04-08) [2024-03-30].
[56]
DengS C, MeiF, YangL, et al. Research on the hand-eye calibration method based on monocular robot[J]. Journal of Physics: Conference Series, 2021, 1820(1): 012007.