GrainNet: efficient detection and counting of wheat grains based on an improved YOLOv7 modeling

Abstract Background Seed testing plays a crucial role in improving crop yields.In actual seed testing processes, factors such as grain sticking and complex imaging environments can significantly affect the accuracy of wheat grain counting, directly impacting the effectiveness of seed testing. Howeve...

Full description

Saved in:
Bibliographic Details
Main Authors: Xin Wang, Changchun Li, Chenyi Zhao, Yinghua Jiao, Hengmao Xiang, Xifang Wu, Huabin Chai
Format: Article
Language:English
Published: BMC 2025-03-01
Series:Plant Methods
Subjects:
Online Access:https://doi.org/10.1186/s13007-025-01363-y
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1850208110667366400
author Xin Wang
Changchun Li
Chenyi Zhao
Yinghua Jiao
Hengmao Xiang
Xifang Wu
Huabin Chai
author_facet Xin Wang
Changchun Li
Chenyi Zhao
Yinghua Jiao
Hengmao Xiang
Xifang Wu
Huabin Chai
author_sort Xin Wang
collection DOAJ
description Abstract Background Seed testing plays a crucial role in improving crop yields.In actual seed testing processes, factors such as grain sticking and complex imaging environments can significantly affect the accuracy of wheat grain counting, directly impacting the effectiveness of seed testing. However, most existing methods primarily focus on simple counting tasks and lack general applicability. Results To enable fast and accurate counting of wheat grains under severe adhesion and complex scenarios, this study collected images of wheat grains from different varieties, backgrounds, densities, imaging heights, adhesion levels, and other natural conditions using various imaging devices and constructed a comprehensive wheat grain dataset through data enhancement techniques. We propose a wheat grain detection and counting model called GrainNet, which significantly improves the counting performance and detection speed across diverse conditions and adhesion levels by incorporating lightweight and efficient feature fusion modules. Specifically, the model incorporates an Efficient Multi-scale Attention (EMA) mechanism, effectively mitigating the interference of background noise on detection results. Additionally, the ASF-Gather and Distribute (ASF-GD) module optimizes the feature extraction component of the original YOLOv7 network, improving the model’s robustness and accuracy in complex scenarios. Ablation experiments validate the effectiveness of the proposed methods.Compared with classic models such as Faster R-CNN, YOLOv5, YOLOv7, and YOLOv8, the GrainNet model achieves better detection performance and computational efficiency in various scenarios and adhesion levels. The mean Average Precision reached 93.15%, the F1 score was 0.946, and the detection speed was 29.10 frames per second (FPS). A comparative analysis with manual counting results revealed that the GrainNet model achieved the highest coefficient of determination and Mean Absolute Error values for wheat grain counting tasks, which were 0.93 and 5.97, respectively, with a counting accuracy of 94.47%. Conclusions Overall, the GrainNet model presented in this study enables accurate and rapid recognition and quantification of wheat grains, which can provide a reference for effective seed examination of wheat grains in real scenarios. Related content can be accessed through the following link: https://github.com/1371530728/grainnet.git .
format Article
id doaj-art-5344bc247bb64d69b32d846f6bdd7b04
institution OA Journals
issn 1746-4811
language English
publishDate 2025-03-01
publisher BMC
record_format Article
series Plant Methods
spelling doaj-art-5344bc247bb64d69b32d846f6bdd7b042025-08-20T02:10:19ZengBMCPlant Methods1746-48112025-03-0121112210.1186/s13007-025-01363-yGrainNet: efficient detection and counting of wheat grains based on an improved YOLOv7 modelingXin Wang0Changchun Li1Chenyi Zhao2Yinghua Jiao3Hengmao Xiang4Xifang Wu5Huabin Chai6School of Surveying and Land Information Engineering, Henan Polytechnic UniversitySchool of Surveying and Land Information Engineering, Henan Polytechnic UniversitySchool of Surveying and Land Information Engineering, Henan Polytechnic UniversityShandong Provincial Institute of Land Surveying and MappingShandong Provincial Institute of Land Surveying and MappingSchool of Surveying and Land Information Engineering, Henan Polytechnic UniversitySchool of Surveying and Land Information Engineering, Henan Polytechnic UniversityAbstract Background Seed testing plays a crucial role in improving crop yields.In actual seed testing processes, factors such as grain sticking and complex imaging environments can significantly affect the accuracy of wheat grain counting, directly impacting the effectiveness of seed testing. However, most existing methods primarily focus on simple counting tasks and lack general applicability. Results To enable fast and accurate counting of wheat grains under severe adhesion and complex scenarios, this study collected images of wheat grains from different varieties, backgrounds, densities, imaging heights, adhesion levels, and other natural conditions using various imaging devices and constructed a comprehensive wheat grain dataset through data enhancement techniques. We propose a wheat grain detection and counting model called GrainNet, which significantly improves the counting performance and detection speed across diverse conditions and adhesion levels by incorporating lightweight and efficient feature fusion modules. Specifically, the model incorporates an Efficient Multi-scale Attention (EMA) mechanism, effectively mitigating the interference of background noise on detection results. Additionally, the ASF-Gather and Distribute (ASF-GD) module optimizes the feature extraction component of the original YOLOv7 network, improving the model’s robustness and accuracy in complex scenarios. Ablation experiments validate the effectiveness of the proposed methods.Compared with classic models such as Faster R-CNN, YOLOv5, YOLOv7, and YOLOv8, the GrainNet model achieves better detection performance and computational efficiency in various scenarios and adhesion levels. The mean Average Precision reached 93.15%, the F1 score was 0.946, and the detection speed was 29.10 frames per second (FPS). A comparative analysis with manual counting results revealed that the GrainNet model achieved the highest coefficient of determination and Mean Absolute Error values for wheat grain counting tasks, which were 0.93 and 5.97, respectively, with a counting accuracy of 94.47%. Conclusions Overall, the GrainNet model presented in this study enables accurate and rapid recognition and quantification of wheat grains, which can provide a reference for effective seed examination of wheat grains in real scenarios. Related content can be accessed through the following link: https://github.com/1371530728/grainnet.git .https://doi.org/10.1186/s13007-025-01363-yWheat seedDeep learningCountYOLOv7Target recognition
spellingShingle Xin Wang
Changchun Li
Chenyi Zhao
Yinghua Jiao
Hengmao Xiang
Xifang Wu
Huabin Chai
GrainNet: efficient detection and counting of wheat grains based on an improved YOLOv7 modeling
Plant Methods
Wheat seed
Deep learning
Count
YOLOv7
Target recognition
title GrainNet: efficient detection and counting of wheat grains based on an improved YOLOv7 modeling
title_full GrainNet: efficient detection and counting of wheat grains based on an improved YOLOv7 modeling
title_fullStr GrainNet: efficient detection and counting of wheat grains based on an improved YOLOv7 modeling
title_full_unstemmed GrainNet: efficient detection and counting of wheat grains based on an improved YOLOv7 modeling
title_short GrainNet: efficient detection and counting of wheat grains based on an improved YOLOv7 modeling
title_sort grainnet efficient detection and counting of wheat grains based on an improved yolov7 modeling
topic Wheat seed
Deep learning
Count
YOLOv7
Target recognition
url https://doi.org/10.1186/s13007-025-01363-y
work_keys_str_mv AT xinwang grainnetefficientdetectionandcountingofwheatgrainsbasedonanimprovedyolov7modeling
AT changchunli grainnetefficientdetectionandcountingofwheatgrainsbasedonanimprovedyolov7modeling
AT chenyizhao grainnetefficientdetectionandcountingofwheatgrainsbasedonanimprovedyolov7modeling
AT yinghuajiao grainnetefficientdetectionandcountingofwheatgrainsbasedonanimprovedyolov7modeling
AT hengmaoxiang grainnetefficientdetectionandcountingofwheatgrainsbasedonanimprovedyolov7modeling
AT xifangwu grainnetefficientdetectionandcountingofwheatgrainsbasedonanimprovedyolov7modeling
AT huabinchai grainnetefficientdetectionandcountingofwheatgrainsbasedonanimprovedyolov7modeling