园艺学报 ›› 2024, Vol. 51 ›› Issue (2): 396-410.doi: 10.16420/j.issn.0513-353x.2023-0859
孙宇朝1,2, 李守豪1,2, 夏秀波1,3,*(), 杨玮2,*(
), 李民赞2, 张焕春1,3
收稿日期:
2023-10-30
修回日期:
2023-12-29
出版日期:
2024-02-25
发布日期:
2024-02-27
通讯作者:
基金资助:
SUN Yuchao1,2, LI Shouhao1,2, XIA Xiubo1,3,*(), YANG Wei2,*(
), LI Minzan2, ZHANG Huanchun1,3
Received:
2023-10-30
Revised:
2023-12-29
Published:
2024-02-25
Online:
2024-02-27
摘要:
以粉果番茄为试验材料,基于深度学习方法开展了番茄果实成熟度和外观品质的检测研究。试验中共采集番茄图片数据2 036张,通过处理扩增至5 316张,然后将数据进行标注和文件转换,构建了试验用数据集;通过在YOLOv5s模型中加入CA注意力机制、替换Stem block结构、结合识别需求优化检测层尺度、替换K-means++聚类算法来实现SC-YOLOv5s识别精度提升,提高模型的特征表达能力;通过在SC-YOLOv5s模型中加入Fire module结构进行轻量化卷积、降低Bottleneck模块的参数量来实现SC-YOLOv5s-lite轻量化设计,提升模型在硬件上的检测速度;将SC-YOLOv5s-lite模型在训练集上进行训练优化、消融试验和性能对比,结果表明,SC-YOLOv5s-lite模型内存大小为7.73 M,其准确率为89.04%,召回率83.35%,平均精度91.34%,检测时间为143 ms,相比于YOLOv5s,模型参数量降低了45.57%,模型大小压缩了44.86%,平均精度提升3.98%,检测时间减少20.99%,优势明显,更适合于硬件上部署。
孙宇朝, 李守豪, 夏秀波, 杨玮, 李民赞, 张焕春. 利用改进YOLOv5s模型检测番茄果实成熟度及外观品质[J]. 园艺学报, 2024, 51(2): 396-410.
SUN Yuchao, LI Shouhao, XIA Xiubo, YANG Wei, LI Minzan, ZHANG Huanchun. Detecting Tomato Fruit Ripeness and Appearance Quality Based on Improved YOLOv5s[J]. Acta Horticulturae Sinica, 2024, 51(2): 396-410.
成熟度分类 Maturity classification | 外观品质分级 Appearance quality grading | 主要特点 Main features |
---|---|---|
成熟果 Ripe fruit | 优等 Superior | 商品果,果实周正,无瑕疵。着色率 ≥ 80% Commodity fruit,and the fruit is round and flawless. Coloring rate ≥ 80% |
二等 Second-class | 非商品果,但可食用,有瑕疵,裂纹,轻微日灼。着色率 ≥70% Non commercial fruit,but edible,with defects,cracks,and slight sunburn. Coloring rate ≥ 70% | |
劣等 Inferior | 非商品果,有明显的腐烂,挤压伤,裂果,表面有虫。着色率 ≥ 70% Non commercial fruits,with obvious decay,crushing damage,cracking,and insect infestation on the surface. Coloring rate ≥ 70% | |
半熟果 Semi-ripe fruit | 不分等级 Not graded | 白粉色,或者着色率 < 70% White and pink,or coloring rate < 70% |
未熟果 Unripe fruit | 不分等级 Not graded | 白果、绿果 White and green fruits |
表1 番茄果实不同成熟度与外观品质分级标准
Table 1 Classification standards for different maturity and appearance quality of tomato fruits
成熟度分类 Maturity classification | 外观品质分级 Appearance quality grading | 主要特点 Main features |
---|---|---|
成熟果 Ripe fruit | 优等 Superior | 商品果,果实周正,无瑕疵。着色率 ≥ 80% Commodity fruit,and the fruit is round and flawless. Coloring rate ≥ 80% |
二等 Second-class | 非商品果,但可食用,有瑕疵,裂纹,轻微日灼。着色率 ≥70% Non commercial fruit,but edible,with defects,cracks,and slight sunburn. Coloring rate ≥ 70% | |
劣等 Inferior | 非商品果,有明显的腐烂,挤压伤,裂果,表面有虫。着色率 ≥ 70% Non commercial fruits,with obvious decay,crushing damage,cracking,and insect infestation on the surface. Coloring rate ≥ 70% | |
半熟果 Semi-ripe fruit | 不分等级 Not graded | 白粉色,或者着色率 < 70% White and pink,or coloring rate < 70% |
未熟果 Unripe fruit | 不分等级 Not graded | 白果、绿果 White and green fruits |
图1 番茄果实不同成熟度及外观品质分级样本 a:优等成熟果;b:二等成熟果;c:劣等成熟果;d:半熟果;e、f:未熟果。
Fig. 1 Tomato samples with different maturity and appearance quality grading of tomato fruits a:Ripe superior fruit;b:Ripe second-class fruit;c:Ripe inferior fruit;d:Semi-ripe fruit;e,f:Unripe fruit.
配置名称 Configuration name | 详细信息 Detailed information |
---|---|
CPU | Intel(R)Core i7-12700H |
GPU | NVIDIA GEFORCE RTX 3060 |
显存Video storage | 16GB |
操作系统Operating system | Windows11 |
深度学习框架 Deep learning framework | Pytorch1.9.0 |
开发语言Development language | Python3.9 |
开发IDE Develop IDE | Pycharm |
虚拟环境 Virtual environment | Anaconda |
表2 试验平台硬件及软件信息
Table 2 Hardware and software information of the test platform
配置名称 Configuration name | 详细信息 Detailed information |
---|---|
CPU | Intel(R)Core i7-12700H |
GPU | NVIDIA GEFORCE RTX 3060 |
显存Video storage | 16GB |
操作系统Operating system | Windows11 |
深度学习框架 Deep learning framework | Pytorch1.9.0 |
开发语言Development language | Python3.9 |
开发IDE Develop IDE | Pycharm |
虚拟环境 Virtual environment | Anaconda |
模型 Model | 精度提升策略 Precision improvement strategy | 参数量 Parameter quantity | 模型大小/M Model memory | 平均精度/% mAP | 检测时间/ms Detection time | |||
---|---|---|---|---|---|---|---|---|
CA注意力 机制 CA attention mechanism | Stem Block 结构 Stem Block structure | 优化检测层尺度 Optimize detection layer scale | 替换K-means++聚类 Replace K-means++ clustering | |||||
YOLOv5s | — | — | — | — | 7 103 997 | 14.02 | 81.19 | 181 |
YOLOv5s | √ | — | — | — | 7 115 587 | 14.13 | 82.12 | 185 |
YOLOv5s | √ | √ | — | — | 7 098 934 | 14.17 | 83.23 | 193 |
YOLOv5s | √ | √ | √ | — | 5 287 521 | 10.65 | 83.34 | 188 |
SC-YOLOv5s | √ | √ | √ | √ | 5 287 521 | 10.62 | 83.97 | 188 |
表3 SC-YOLOv5s消融试验
Table 3 SC-YOLOv5s ablation test
模型 Model | 精度提升策略 Precision improvement strategy | 参数量 Parameter quantity | 模型大小/M Model memory | 平均精度/% mAP | 检测时间/ms Detection time | |||
---|---|---|---|---|---|---|---|---|
CA注意力 机制 CA attention mechanism | Stem Block 结构 Stem Block structure | 优化检测层尺度 Optimize detection layer scale | 替换K-means++聚类 Replace K-means++ clustering | |||||
YOLOv5s | — | — | — | — | 7 103 997 | 14.02 | 81.19 | 181 |
YOLOv5s | √ | — | — | — | 7 115 587 | 14.13 | 82.12 | 185 |
YOLOv5s | √ | √ | — | — | 7 098 934 | 14.17 | 83.23 | 193 |
YOLOv5s | √ | √ | √ | — | 5 287 521 | 10.65 | 83.34 | 188 |
SC-YOLOv5s | √ | √ | √ | √ | 5 287 521 | 10.62 | 83.97 | 188 |
模型 Model | 轻量化策略 Lightweight strategy | 参数量 Parameter quantity | 模型大小/M Model memory | 平均精度/% mAP | 检测时间/ms Detection time | |
---|---|---|---|---|---|---|
Fire module结构替换3 × 3卷积层 Fire module structure replace 3 × 3 convolutional layers | 减少Bottleneck模块数量 Reduce the number of bottleneck modules | |||||
YOLOv5s | — | — | 7 103 997 | 14.02 | 81.19 | 181 |
SC-YOLOv5s | — | — | 5 287 521 | 10.62 | 83.97 | 188 |
SC-YOLOv5s | √ | — | 3 901 521 | 7.84 | 83.33 | 148 |
SC-YOLOv5s-lite | √ | √ | 3 866 032 | 7.73 | 84.42 | 143 |
表4 SC-YOLOv5s-lite消融试验
Table 4 SC-YOLOv5s lite ablation test
模型 Model | 轻量化策略 Lightweight strategy | 参数量 Parameter quantity | 模型大小/M Model memory | 平均精度/% mAP | 检测时间/ms Detection time | |
---|---|---|---|---|---|---|
Fire module结构替换3 × 3卷积层 Fire module structure replace 3 × 3 convolutional layers | 减少Bottleneck模块数量 Reduce the number of bottleneck modules | |||||
YOLOv5s | — | — | 7 103 997 | 14.02 | 81.19 | 181 |
SC-YOLOv5s | — | — | 5 287 521 | 10.62 | 83.97 | 188 |
SC-YOLOv5s | √ | — | 3 901 521 | 7.84 | 83.33 | 148 |
SC-YOLOv5s-lite | √ | √ | 3 866 032 | 7.73 | 84.42 | 143 |
模型 Model | 参数量 Parameter quantity | 模型大小/M Model memory | 平均精度/% mAP | 检测时间/ms Detection time |
---|---|---|---|---|
YOLOv5n | 2 754 122 | 3.87 | 79.31 | 131 |
YOLOv5s | 7 103 997 | 14.12 | 81.23 | 181 |
YOLOv5-lite | 4 368 521 | 10.98 | 80.86 | 162 |
SC-YOLOv5s-lite | 3 866 032 | 7.73 | 84.42 | 143 |
表5 不同网络模型性能参数对比
Table 5 Comparison of performance parameters of different network models
模型 Model | 参数量 Parameter quantity | 模型大小/M Model memory | 平均精度/% mAP | 检测时间/ms Detection time |
---|---|---|---|---|
YOLOv5n | 2 754 122 | 3.87 | 79.31 | 131 |
YOLOv5s | 7 103 997 | 14.12 | 81.23 | 181 |
YOLOv5-lite | 4 368 521 | 10.98 | 80.86 | 162 |
SC-YOLOv5s-lite | 3 866 032 | 7.73 | 84.42 | 143 |
成熟度类别 Maturity classification | 外观品质分级 Appearance quality grading | 召回率/% Recall | 精确率/% AP | F1值/% F1-score | 准确率/% Accuracy | 平均精度/% mAP | |
---|---|---|---|---|---|---|---|
mAP @0.5 | mAP@0.5 ~ 0.95 | ||||||
成熟果Ripe fruit | 优等果Superior fruit | 89.52 | 94.88 | 92.12 | |||
二等果Second-class fruit | 64.39 | 85.72 | 73.53 | ||||
劣等果Inferior fruit | 93.13 | 95.07 | 94.09 | ||||
半熟果Semi-ripe fruit | — | 81.48 | 88.93 | 85.04 | |||
未熟果Unripe fruit | — | 88.24 | 92.08 | 90.12 | |||
整体 Total | — | 83.35 | — | 86.98 | 89.04 | 91.34 | 84.42 |
表6 SC-YOLOv5s-lite算法下不同成熟度和外观品质果实量化结果
Table 6 Quantitative results of fruits with different maturity and appearance quality using the SC-YOLOv5s lite algorithm
成熟度类别 Maturity classification | 外观品质分级 Appearance quality grading | 召回率/% Recall | 精确率/% AP | F1值/% F1-score | 准确率/% Accuracy | 平均精度/% mAP | |
---|---|---|---|---|---|---|---|
mAP @0.5 | mAP@0.5 ~ 0.95 | ||||||
成熟果Ripe fruit | 优等果Superior fruit | 89.52 | 94.88 | 92.12 | |||
二等果Second-class fruit | 64.39 | 85.72 | 73.53 | ||||
劣等果Inferior fruit | 93.13 | 95.07 | 94.09 | ||||
半熟果Semi-ripe fruit | — | 81.48 | 88.93 | 85.04 | |||
未熟果Unripe fruit | — | 88.24 | 92.08 | 90.12 | |||
整体 Total | — | 83.35 | — | 86.98 | 89.04 | 91.34 | 84.42 |
图9 番茄果实成熟度和外观品质检测效果图 a ~ c:成熟优等果;d ~ f:成熟二等果;g ~ i:成熟劣等果;j ~ l:半熟果;m ~ o:未熟果。
Fig. 9 Effect diagram of tomato fruit detection with different maturity and appearance quality a-c:Mature and high-quality fruit;d-f:Mature and second class fruit;g-i:Mature and inferior fruit;j-l:Semi-ripe fruit;m-o:Unripe fruit.
图10 复杂环境下SC-YOLOv5s-lite预测验效果图 a、b:枝叶遮挡环境;c、d:不同光照明暗度;e、f:果实叠加环境;g、h:多类因素混搭环境。
Fig. 10 SC-YOLOv5s lite prediction validation effect in complex environments a,b:The environment obstructed by branches and leaves;c,d:The darkness of different lighting conditions;e,f:The overlapping environment of fruits;g,h:A mixed environment of multiple factors.
[1] |
|
陈乔松, 陈鹏昌, 李佩, 张亚玲, 邓欣, 孙开伟, 王进. 2023. 基于多尺度特征选择与融合的目标检测方法. 重庆邮电大学学报(自然科学版), 35 (2):227-234.
|
|
[2] |
|
杜名扬, 张天柱. 2022. 农业数字化风景下的靓点无人农场. 蔬菜,(9):1-9.
|
|
[3] |
|
冯帆. 2022. 智慧农业背景下物联网技术在现代农业中的应用. 农家参谋,(21):25-27.
|
|
[4] |
|
冯俊惠, 李志伟, 戎有丽, 孙志立. 2021. 基于改进Hough圆变换算法的成熟番茄果实识别. 中国农机化学报, 42 (4):190-196.
doi: 10.13733/j.jcam.issn.2095-5553.2021.04.27 |
|
[5] |
|
高彦钊, 陶常勇. 2023. 信号处理与深度学习硬件加速的一致性计算结构. 国防科技大学学报, 45 (2):112-120.
|
|
[6] |
|
贺杰, 马婷娟, 张永良, 张亚娟. 2022. 指向深度学习的高职混合式学习评价模型及指标体系构建. 职业技术教育, 43 (26):64-70.
|
|
[7] |
|
黄波. 2022. 乡村振兴背景下的人才流失问题对策与分析. 农村实用技术,(4):46-48.
|
|
[8] |
|
黄彤镔, 黄河清, 李震, 吕石磊, 薛秀云, 代秋芳, 温威. 2022. 基于YOLOv5改进模型的柑橘果实识别方法. 华中农业大学学报, 41 (4):170-177.
|
|
[9] |
|
[10] |
doi: 10.13733/j.jcam.issn.20955553.2023.04.022 |
李岩舟, 何艳洲, 覃锋, 钱万强, 吴媚, 乔曦. 2023. 基于卷积神经网络的互花米草识别研究. 中国农机化学报, 44 (4):159-166.
|
|
[11] |
|
刘芳, 刘玉坤, 林森, 郭文忠, 徐凡, 张白. 2020. 基于改进型YOLO的复杂环境下番茄果实快速识别方法. 农业机械学报, 51 (6):229-237.
|
|
[12] |
|
刘铮, 魏传成. 2021. 推进乡村全面振兴的重点、难点及对策. 经济纵横,(10):122-128.
|
|
[13] |
doi: 10.15302/J-SSCAE-2022.01.005 |
罗锡文, 廖娟, 臧英, 区颖刚, 汪沛. 2022. 我国农业生产的发展方向:从机械化到智慧化. 中国工程科学, 24 (1):46-54.
doi: 10.15302/J-SSCAE-2022.01.005 |
|
[14] |
|
马金林, 张裕, 马自萍, 毛凯绩. 2022. 轻量化神经网络卷积设计研究进展. 计算机科学与探索, 16 (3):512-528.
doi: 10.3778/j.issn.1673-9418.2107056 |
|
[15] |
|
宋玲, 曹勉, 胡小春, 贾沛沅, 陈燕, 陈宁江. 2023. 基于YOLOX的复杂背景下木薯叶病害检测方法. 农业机械学报, 54 (3):301-307.
|
|
[16] |
|
孙丰刚, 王云露, 兰鹏, 张旭东, 陈修德, 王志军. 2022. 基于改进YOLOv5s和迁移学习的苹果果实病害识别方法. 农业工程学报, 38 (11):171-179.
|
|
[17] |
|
王海群, 张成君, 张怡. 2023. 基于YOLOv4的轻量级火焰检测算法. 山东科技大学学报(自然科学版), 42 (1):91-99.
|
|
[18] |
|
[19] |
|
王亮, 张超. 2023. 一种基于YOLOv5的轻量型行人检测方法. 工业控制计算机, 36 (4):84-86,89.
|
|
[20] |
|
吴敌, 李明辉, 马文凯, 李睿童, 李艳. 2023. 基于改进YOLOv5的钢材表面缺陷检测. 陕西科技大学学报, 41 (2):162-169.
|
|
[21] |
|
郗厚印, 张栋, 周涛, 杨云霄. 2021. 采摘机器人识别抓取重叠番茄果实的方法研究. 农机化研究, 43 (12):17-23,50.
|
|
[22] |
|
熊俊涛, 郑镇辉, 梁嘉恩, 钟灼, 刘柏林, 孙宝霞. 2020. 基于改进YOLO v3网络的夜间环境柑橘识别方法. 农业机械学报, 51 (4):199-206.
|
|
[23] |
|
阳茜汕, 卓德兵, 涂婉莹, 刘杜洋. 2023. 基于离线数据增强与YOLOv5的混凝土裂缝检测研究. 山西建筑, 49 (8):63-66.
|
|
[24] |
|
岳有军, 孙碧玉, 王红君, 赵辉. 2021. 基于级联卷积神经网络的番茄果实目标检测. 科学技术与工程, 21 (6):2387-2391.
|
|
[25] |
|
查文文, 潘伟豪, 陈成鹏, 陈威, 辜丽川, 焦俊. 2023. 基于边缘计算与改进YOLOv5的群养生猪姿态识别及跟踪研究. 东北农业大学学报, 54 (3):83-96.
|
|
[26] |
|
张淮峰, 何祥健, 吴强. 2006. 通用目标检测算法研究进展与评述. 云南民族大学学报(自然科学版), 15 (4):261-267.
|
|
[27] |
|
张会丰, 邢雨彤, 张淼, 李文旭, 李聪. 2022. 不同深度学习模型的骨骺定位准确率比较. 中国法医学杂志, 37 (3):267-271.
|
|
[28] |
|
张磊, 刘琪芳, 聂红玫, 王晨, 牛帆. 2022. 基于改进YOLOV4网络模型的番茄果实检测. 中国农机化学报, 43 (12):162-169.
|
|
[29] |
|
周升和, 邵武长, 王强. 2023. 基于深度学习的小目标检测算法综述数字技术与应用, 41 (2):156-158.
|
|
[30] |
|
朱德利, 文瑞, 熊俊逸. 2023. 融合坐标注意力机制的轻量级玉米花丝检测. 农业工程学报, 39 (3):145-153.
|
|
[31] |
|
祖林禄. 2023. 数据驱动的日光温室番茄果实生长预测模型研究[博士论文]. 泰安: 山东农业大学.
|
[1] | 韩荧, 段颖, 牛一杰, 李衍素, 贺超兴, 孙敏涛, 王君, 李强, 陈双臣, 闫妍. 腐殖酸生物降解地膜提高番茄品质的转录代谢机制研究[J]. 园艺学报, 2024, 51(8): 1758-1772. |
[2] | 龚小雅, 李贤, 周新刚, 吴凤芝. 分蘖洋葱伴生番茄诱导的根际微生物对根结线虫病的影响[J]. 园艺学报, 2024, 51(8): 1913-1926. |
[3] | 刘成龙, 范旭东, 任 芳, 张尊平, 胡国君, 董雅凤. 苹果病毒检测技术[J]. 园艺学报, 2024, 51(7): 1580-1594. |
[4] | 孟思达, 韩磊磊, 相恒佐, 朱美玉, 冯 珍, 叶云珠, 孙美华, 李艳冰, 赵利萍, 谭昌华, 齐明芳, 李天来. 番茄心室数的调控机制研究进展[J]. 园艺学报, 2024, 51(7): 1649-1664. |
[5] | 马星云, 范冰丽, 唐光彩, 贾芝琪, 李营, 薛东齐, 张世文. DXR调控番茄叶绿体发育、花色与果实着色机制初探[J]. 园艺学报, 2024, 51(6): 1241-1255. |
[6] | 张文静, 徐大勇, 吴倩琳, 杨佛, 信丙越, 曾昕, 李峰. 拮抗番茄灰霉病的贝莱斯芽孢杆菌XDY66基因组分析[J]. 园艺学报, 2024, 51(6): 1413-1425. |
[7] | 王永珍, 张剑国, 刘彩虹, 李思蓓, 吕甜甜. 番茄新品种‘圆红212’[J]. 园艺学报, 2024, 51(6): 1435-1436. |
[8] | 刘泽营, 孙帅, 刘志强, 崔霞, 李仁. 番茄尖果脐突变体的生理特性及其候选基因分析[J]. 园艺学报, 2024, 51(5): 982-992. |
[9] | 李品, 甘宁, 陈家伟, 项思翔, 沈静漪, 欧阳波, 卢永恩. 番茄自然群体磷利用效率分析及耐低磷种质筛选[J]. 园艺学报, 2024, 51(5): 993-1004. |
[10] | 杨婷, 席德慧, 夏明, 李佳楠. α-苦瓜素基因提高番茄对烟草花叶病毒抗性的机理研究[J]. 园艺学报, 2024, 51(5): 1126-1136. |
[11] | 胡志峰, 邵景成, 张莉. 番茄新品种‘陇番15号’[J]. 园艺学报, 2024, 51(4): 917-918. |
[12] | 刘根忠, 李方曼, 葛平飞, 陶金宝, 张星雨, 叶志彪, 张余洋. 番茄抗坏血酸含量相关QTL定位及候选基因鉴定[J]. 园艺学报, 2024, 51(2): 219-228. |
[13] | 董舒超, 洪骏, 凌嘉怡, 谢紫欣, 张胜军, 赵丽萍, 宋刘霞, 王银磊, 赵统敏. 番茄抗旱性的全基因组关联分析[J]. 园艺学报, 2024, 51(2): 229-238. |
[14] | 徐琴, 王嘉颖, 张曼楠, 萧志浩, 郑涵楷, 卢永恩, 王涛涛, 张余洋, 张俊红, 叶志彪, 叶杰. 番茄苗期耐盐相关遗传位点鉴定及分子标记开发[J]. 园艺学报, 2024, 51(2): 239-252. |
[15] | 杨亮, 刘欢, 马燕勤, 李菊, 王海娥, 周玉洁, 龙海成, 苗明军, 李志, 常伟. 利用CRISPR/Cas9技术创制高番茄红素番茄新材料[J]. 园艺学报, 2024, 51(2): 253-265. |
阅读次数 | ||||||
全文 |
|
|||||
摘要 |
|
|||||
版权所有 © 2012 《园艺学报》编辑部 京ICP备10030308号-2 国际联网备案号 11010802023439
编辑部地址: 北京市海淀区中关村南大街12号中国农业科学院蔬菜花卉研究所 邮编: 100081
电话: 010-82109523 E-Mail: yuanyixuebao@126.com
技术支持:北京玛格泰克科技发展有限公司