欢迎您访问《智慧农业(中英文)》官方网站! English

Smart Agriculture ›› 2024, Vol. 6 ›› Issue (2): 118-127.doi: 10.12133/j.smartag.SA202401005

• 专刊--农业信息感知与模型 • 上一篇    下一篇

基于改进YOLOv8s的玫瑰鲜切花分级方法

张玉玉, 邴树营, 纪元浩, 严蓓蓓, 许金普()   

  1. 青岛农业大学动漫与传媒学院,山东 青岛 266109,中国
  • 收稿日期:2024-01-07 出版日期:2024-03-30
  • 基金资助:
    山东省自然科学基金面上项目(ZR2022MC152); 山东省重大科技创新工程项目(2021LZGC014-3); 青岛市产业培育计划科技惠民专项(23-1-3-6-zyyd-nsh)
  • 作者简介:

    张玉玉,研究方向为农业工程与信息技术。E-mail:

  • 通信作者:
    许金普,博士,副教授,研究方向为智慧农业、农业信息技术。E-mail:

Grading Method of Fresh Cut Rose Flowers Based on Improved YOLOv8s

ZHANG Yuyu, BING Shuying, JI Yuanhao, YAN Beibei, XU Jinpu()   

  1. College of Animation and Media, Qingdao Agricultural University, Qingdao 266109, China
  • Received:2024-01-07 Online:2024-03-30
  • corresponding author:
    XU Jinpu, E-mail:
  • About author:

    ZHANG Yuyu, E-mail:

  • Supported by:
    Shandong Province Natural Science Foundation General Project(ZR2022MC152); Shandong Province Major Science and Technology Innovation Project(2021LZGC014-3); Qingdao City Industrial Cultivation Plan Science and Technology Benefit People Special Project(23-1-3-6-zyyd-nsh)

摘要:

[目的/意义] 针对当前玫瑰鲜切花分级仍依赖人工进行简单分级,造成效率低、准确率低等问题,提出一种新的模型Flower-YOLOv8s来实现玫瑰鲜切花的分级检测。 [方法] 以单一背景下单支玫瑰花的花头作为检测目标,将鲜切花分为A、B、C、D四个等级,对YOLOv8s(You Only Look Once version 8 small)模型进行了优化改进。首先,构建了一个全新的玫瑰鲜切花分级检测数据集。其次,在YOLOv8s的骨干网络分别添加CBAM(Convolutional Block Attention Module)和SAM(Spatial Attion Module)两个注意力机制模块进行对比实验;选择SAM模块并对其进一步优化,针对模型轻量化需求,再结合深度可分离卷积模块一起添加到C2f结构中,形成Flower-YOLOv8s模型。 [结果和讨论] 从实验结果来看YOLOv8s添加SAM的模型具有更高的检测精度,mAP@0.5达到86.4%。Flower-YOLOv8s相较于基线模型精确率提高了2.1%,达到97.4%,平均精度均值(mAP)提高了0.7%,同时降低了模型参数和计算量,分别降低2.26 M和4.45 MB;最后使用相同的数据集和预处理方法与Fast-RCNN、Faster-RCNN、SSD、YOLOv3、YOLOv5s和YOLOv8s进行对比实验,证明所提出的实验方法综合强于其他经典YOLO模型。 [结论] 提出的基于改进YOLOv8s的玫瑰鲜切花分级方法研究能有效提升玫瑰鲜切花分级检测的精准度,为玫瑰鲜切花分级检测技术提供一定的参考价值。

关键词: YOLOv8s, 玫瑰鲜切花, 分级检测, 深度学习, SAM, 注意力机制

Abstract:

[Objective] The fresh cut rose industry has shown a positive growth trend in recent years, demonstrating sustained development. Considering the current fresh cut roses grading process relies on simple manual grading, which results in low efficiency and accuracy, a new model named Flower-YOLOv8s was proposed for grading detection of fresh cut roses. [Methods] The flower head of a single rose against a uniform background was selected as the primary detection target. Subsequently, fresh cut roses were categorized into four distinct grades: A, B, C, and D. These grades were determined based on factors such as color, size, and freshness, ensuring a comprehensive and objective grading system. A novel dataset contenting 778 images was specifically tailored for rose fresh-cut flower grading and detection was constructed. This dataset served as the foundation for our subsequent experiments and analysis. To further enhance the performance of the YOLOv8s model, two cutting-edge attention convolutional block attention module (CBAM) and spatial attention module (SAM) were introduced separately for comparison experiments. These modules were seamlessly integrated into the backbone network of the YOLOv8s model to enhance its ability to focus on salient features and suppressing irrelevant information. Moreover, selecting and optimizing the SAM module by reducing the number of convolution kernels, incorporating a depth-separable convolution module and reducing the number of input channels to improve the module's efficiency and contribute to reducing the overall computational complexity of the model. The convolution layer (Conv) in the C2f module was replaced by the depth separable convolution (DWConv), and then combined with Optimized-SAM was introduced into the C2f structure, giving birth to the Flower-YOLOv8s model. Precision, recall and F1 score were used as evaluation indicators. [Results and Discussions] Ablation results showed that the Flower-YOLOv8s model proposed in this study, namely YOLOv8s+DWConv+Optimized-SAM, the recall rate was 95.4%, which was 3.8% higher and the average accuracy, 0.2% higher than that of YOLOv8s with DWConv alone. When compared to the baseline model YOLOv8s, the Flower-YOLOv8s model exhibited a remarkable 2.1% increase in accuracy, reaching a peak of 97.4%. Furthermore, mAP was augmented by 0.7%, demonstrating the model's superior performance across various evaluation metrics. The effectiveness of adding Optimized-SAM was proved. From the overall experimental results, the number of parameters of Flower-YOLOv8s was reduced by 2.26 M compared with the baseline model YOLOv8s, and the reasoning time was also reduced from 15.6 to 5.7 ms. Therefore, the Flower-YOLOv8s model was superior to the baseline model in terms of accuracy rate, average accuracy, number of parameters, detection time and model size. The performances of Flower-YOLOv8s network were compared with other target detection algorithms of Fast-RCNN, Faster-RCNN and first-stage target detection models of SSD, YOLOv3, YOLOv5s and YOLOv8s to verify the superiority under the same condition and the same data set. The average precision values of the Flower-YOLOv8s model proposed in this study were 2.6%, 19.4%, 6.5%, 1.7%, 1.9% and 0.7% higher than those of Fast-RCNN, Faster-RCNN, SSD, YOLOv3, YOLOv5s and YOLOv8s, respectively. Compared with YOLOv8s with higher recall rate, Flower-YOLOv8s reduced model size, inference time and parameter number by 4.5 MB, 9.9 ms and 2.26 M, respectively. Notably, the Flower-YOLOv8s model achieved these improvements while simultaneously reducing model parameters and computational complexity. [Conclusions] The Flower-YOLOv8s model not only demonstrated superior detection accuracy but also exhibited a reduction in model parameters and computational complexity. This lightweight yet powerful model is highly suitable for real-time applications, making it a promising candidate for flower grading and detection tasks in the agricultural and horticultural industries.

Key words: YOLOv8s, fresh cut roses, hierarchical detection, deep learning, SAM, attention mechanism