| 注册
首页|期刊导航|农业工程学报|自然环境下基于改进YOLOv7的梨花识别方法

自然环境下基于改进YOLOv7的梨花识别方法

张秀花 魏华杰 孔德刚 刘尚坤 黄征 王洪森

农业工程学报2025,Vol.41Issue(2):224-232,9.
农业工程学报2025,Vol.41Issue(2):224-232,9.DOI:10.11975/j.issn.1002-6819.202408209

自然环境下基于改进YOLOv7的梨花识别方法

Recognizing pear blossom in the natural environment using improved YOLOv7

张秀花 1魏华杰 1孔德刚 1刘尚坤 1黄征 1王洪森1

作者信息

  • 1. 河北农业大学机电工程学院,保定 071001||河北省智慧农业装备技术创新中心,保定 071001
  • 折叠

摘要

Abstract

This study aims to improve the accuracy of object detection on the pear blossoms under complex conditions,particularly for the easily obscured,complex backgrounds,varying lighting,and target distances in natural environments.An improved recognition algorithm was proposed for the pear blossom using the YOLOv7 model.Firstly,a P2 small-object layer was added to increase the capability of feature extraction and multi-scale fusion of the model,so that the improved model was selected to better capture the obscured targets.Secondly,a CBAM(convolutional block attention module)attention mechanism was introduced at the end of the output detection layer.CBAM was used to improve the context understanding of the improved model and the performance of YOLOv7 in various scenarios(different lighting conditions,and complex backgrounds).Lastly,the CIoU(complete intersection over union)loss function was optimized to the NWD(normalized weighted distance)loss function.NWD shared the accurate bounding box regression and then performed better for targets with different shapes.The detection accuracy of the model was improved for the complex background targets and distant targets.Additionally,a dataset was created to photograph the pear blossoms from different angles,backgrounds,lighting conditions,and distances during the peak blooming period.The data collection was achieved in a total of 3,240 photos of Ya pear blossoms,1,582 photos of Golden Pear blossoms,and 2,184 photos of New pear No.7 blossoms.Ya pear images were used to create a complex environment dataset for pear blossoms,due to the large number of Ya pear samples and their rich background elements.Images of the three pear varieties were used to create a dataset for different varieties.The improved YOLOv7 model was trained and tested using the complex environment dataset.The images with Ya pear blossoms were randomly selected under different lighting conditions,occlusions,backgrounds,and distances.A comparison was also made on the original and improved YOLOv7 model.The results showed that the improved YOLOv7 model shared better detection performance and higher confidence levels.Ablation experiments were conducted to validate the effectiveness of the three improvements.These improvements significantly enhanced the original YOLOv7 model,thus increasing the detection accuracy of pear blossom targets.The detection heatmaps of the improved and original models showed that the heatmap values of the improved YOLOv7 model were closer to the actual pear blossom regions.The focus was also observed to extract the pear blossom edge features.The improved YOLOv7 model was trained and tested using different datasets of pear blossom,indicating excellent adaptability and robustness.Comparative experiments with mainstream algorithms were conducted to evaluate the performance of the improved YOLOv7 model.The precision,recall,mAP,and F1-score of the improved YOLOv7 model increased by 2.1,1.2,1.9,and 0.6 percentage points,respectively,reaching 99.4%,99.6%,96.4%,and 89.8%,compared with the original.Furthermore,the improved YOLOv7 model also showed better performance in all evaluation metrics,compared with the Faster R-CNN,SSD,YOLOv3,YOLOv4,YOLOv5,YOLOv8,YOLOv9,and YOLOv10 models.A series of experiments were conducted to evaluate the applicability and performance of the improved model.The mAP of the improved YOLOv7 was 3.9 and 3.7 percentage points higher than that of YOLOv7,when training close and distant datasets,respectively;When training the forward and backward light datasets,the mAP of improved YOLOv7 was 4.4 and 1.6 percentage points higher than that of YOLOv7,respectively;The mAP of the improved YOLOv7 increased by 1.8,1.4,and 1.5 percentage points,respectively,in the ground,sky,and pear blossom backgrounds,compared with the YOLOv7 model.The high accuracy of detection was achieved to recognize the pear blossom in complex environments with varying backgrounds,distances,occlusions,and lighting conditions.The findings can also provide the data support to accurately identify the pear blossoms under the natural environment in pear orchards.

关键词

梨花/图像识别/YOLOv7/自然环境/小目标层/CBAM/损失函数

Key words

pear blossom/image recognition/YOLOv7/natural environment/small-object layer/CBAM/loss function.

分类

农业科技

引用本文复制引用

张秀花,魏华杰,孔德刚,刘尚坤,黄征,王洪森..自然环境下基于改进YOLOv7的梨花识别方法[J].农业工程学报,2025,41(2):224-232,9.

基金项目

河北省现代农业产业技术体系建设专项资金项目(HBCT2024170207) (HBCT2024170207)

农业工程学报

OA北大核心

1002-6819

访问量0
|
下载量0
段落导航相关论文