Fruit Distribution Density Estimation in YOLO-Detected Strawberry Images: A Kernel Density and Nearest Neighbor Analysis Approach
Abstract
:1. Introduction
2. Materials and Methods
2.1. Experimental Data Collection and Processing
2.1.1. Image Collection
2.1.2. Image Processing
- (1)
- (2)
- Dataset Construction: To prevent overfitting of the model due to insufficient dataset size, the original data were augmented using methods such as random flipping, rotation, color perturbation, random affine transformation, and the addition of various types of noise [23], expanding the dataset to 4500 images. Additionally, the LabelImg tool (version 1.8.6) was used for precise manual annotation of the strawberry dataset, and samples were randomly selected to divide the dataset into training, validation, and test sets in a ratio of 8:1:1.
2.2. Strawberry Object Detection Model
2.2.1. Yolov8 Object Detection Model
2.2.2. Improved Yolov8 Strawberry Object Detection Model
- (1)
- Feature Attention Mechanism: SE EIoU Loss Function
- (2)
- EIoU Loss Function
2.3. Strawberry Density Distribution Estimation
2.3.1. Kernel Density Estimation
2.3.2. Target Area Segmentation and Density Evaluation Based on Nearest Neighbor Analysis
3. Results and Discussion
3.1. Strawberry Recognition Experiment and Result Analysis
3.1.1. Model Performance Comparison Experiment
3.1.2. Strawberry Localization Experiment
- (1)
- Point-by-Point Difference Analysis: Euclidean distance, X-direction deviation, Y-direction deviation, and relative error were introduced as evaluation metrics to conduct a point-by-point difference analysis experiment between the predicted coordinates and the reference coordinates of the strawberry center points in each image. Some of the results are shown in Figure 7.
- (2)
- Data Group Statistical Analysis: To ensure the representativeness of the statistical experimental results, the 200 images were processed in groups and named group1, group2, group3, group4, and group5, each containing 40 images. Unlike the previous point-by-point difference analysis, this experiment introduced the mean Euclidean distance, Mean Absolute Error (MAE), Root Mean Square Error (RMSE), and R2 value as evaluation metrics. Statistical analysis was conducted on each group of data to obtain more comprehensive results. The experimental results are shown in Table 2.
3.2. Kernel Density Estimation Experiment
3.3. Target Area Segmentation and Density Evaluation Experiment
4. Conclusions
- (1)
- Performance Improvement of the Improved yolov8n Model: By incorporating the SE attention mechanism and the EIoU loss function, the improved yolov8n model demonstrated outstanding performance in strawberry target detection. Its detection accuracy reached 94.7%, and [email protected]~0.95 improved to 87.3%, showcasing excellent detection capabilities in various complex environments. Particularly in handling the occlusion and overlapping of fruits, the improved model significantly reduced missed detections and false positives, proving its great potential for practical agricultural applications.
- (2)
- Consistency and Stability of Kernel Density Estimation: Based on the fruit center point data extracted by the improved yolov8n model, the kernel density estimation algorithm was successfully applied to evaluate strawberry distribution density. The experimental results indicate that when the bandwidth value is set to 200, the kernel density estimation accurately reflects the actual distribution characteristics of strawberries, with particularly notable performance in identifying high-density areas. Additionally, the kernel density estimation algorithm demonstrated consistency and stability across different data groups, with density estimation results maintaining high levels of mean, variance, skewness, and kurtosis across statistical indicators.
- (3)
- Refined Regional Segmentation and Density Evaluation Using Nearest Neighbor Analysis: This study further employed the nearest neighbor analysis method to finely segment target areas in strawberry images and evaluate the density of each region. When the distance threshold was set to 600 pixels, the correct grouping rate exceeded 94%, indicating that this method has high accuracy in regional segmentation. The significant positive correlation between the number of fruits and density within the regions provides a scientific basis for optimizing planting strategies and harvesting sequences, helping to reduce fruit damage and improve harvesting efficiency.
- (4)
- Practical Significance, Application Prospects, and Future Research: The methods developed in this study provide innovative tools for strawberry cultivation management. By accurately estimating fruit distribution density, these methods can effectively guide the optimization of planting density, thereby improving yield and fruit quality. The detailed distribution information also provides theoretical support for the path planning and operational process optimization of intelligent harvesting systems, indicating broad application prospects. In future research, this study will further explore dynamic models that link fruit distribution density, planting density, and fruit growth status. By establishing these correlation models, we can gain a more comprehensive understanding of the impact of planting density on fruit distribution and growth status, thus optimizing planting strategies and enhancing fruit yield and quality. This research will provide more scientifically grounded decision support for precision agriculture, promoting the development of agricultural production towards intelligence and sustainability.
Author Contributions
Funding
Institutional Review Board Statement
Data Availability Statement
Conflicts of Interest
References
- Basu, A.; Nguyen, A.; Betts, N.M.; Lyons, T.J. Strawberry as a functional food: An evidence-based review. Crit. Rev. Food Sci. Nutr. 2014, 54, 790–806. [Google Scholar] [CrossRef] [PubMed]
- Tulipani, S.; Armeni, T.; Giampieri, F.; Alvarez-Suarez, J.M.; Gonzalez-Paramás, A.M.; Santos-Buelga, C.; Battino, M. Strawberry intake increases blood fluid, erythrocyte and mononuclear cell defenses against oxidative challenge. Food Chem. 2014, 156, 87–93. [Google Scholar] [CrossRef] [PubMed]
- Yuan, B.Z.; Sun, J.; Nishiyama, S. Effect of drip irrigation on strawberry growth and yield inside a plastic greenhouse. Biosyst. Eng. 2004, 87, 237–245. [Google Scholar] [CrossRef]
- Tang, Y.; Ma, X.; Li, M.; Wang, Y. The effect of temperature and light on strawberry production in a solar green-house. Sol. Energy 2020, 195, 318–328. [Google Scholar] [CrossRef]
- Haque, M.A.; Sakimin, S.Z. Planting arrangement and effects of planting density on tropical fruit crops. Horticulturae 2022, 8, 485. [Google Scholar] [CrossRef]
- Zhang, Y.; Hu, Y.; You, Z.; Li, Z.; Kong, M.; Han, M.; Yao, Y. Soil ventilation benefited strawberry growth via microbial communities and nutrient cycling under high-density planting. Front. Microbiol. 2021, 12, 666982. [Google Scholar] [CrossRef]
- Garrett, K.A.; Mundt, C.C. Effects of planting density and the composition of wheat cultivar mixtures on stripe rust: An analysis taking into account limits to the replication of controls. Phytopathology 2000, 90, 1313–1321. [Google Scholar] [CrossRef]
- García-Martínez, H.; Flores-Magdaleno, H.; Ascencio-Hernández, R.; Khalil-Gardezi, A.; Tijerina-Chávez, L.; Mancilla-Villa, O.R.; Vázquez-Peña, M.A. Corn grain yield estimation from vegetation indices, canopy cover, plant density, and a neural network using multispectral and RGB images acquired with unmanned aerial vehicles. Agriculture 2020, 10, 277. [Google Scholar] [CrossRef]
- Yang, T.; Jay, S.; Gao, Y.; Liu, S.; Baret, F. How accurate is straw cereal plant density estimation from spectral measurements at early stages. In Precision Agriculture; Wageningen Academic Publishers: Wageningen, The Netherlands, 2023; pp. 1035–1041. [Google Scholar] [CrossRef]
- Velumani, K.; Lopez-Lozano, R.; Madec, S.; Guo, W.; Gillet, J.; Comar, A.; Baret, F. Estimates of maize plant density from UAV RGB images using faster-RCNN detection model: Impact of the spatial resolution. Plant Phenomics 2021, 2021, 9824843. [Google Scholar] [CrossRef]
- Nathalie, C.; Fabrice, D.; Frank, F. Evaluating field-scale sampling methods for the estimation of mean plant densities of weeds. Weed Res. 2000, 40, 411–430. [Google Scholar]
- Liu, L.; Lu, H.; Li, Y.; Cao, Z. High-throughput rice density estimation from transplantation to tillering stages using deep networks. Plant Phenomics 2020, 2020, 1375957. [Google Scholar] [CrossRef] [PubMed]
- Vong, C.N.; Conway, L.S.; Feng, A.; Zhou, J.; Kitchen, N.R.; Sudduth, K.A. Corn emergence uniformity estimation and mapping using UAV imagery and deep learning. Comput. Electron. Agric. 2022, 198, 107008. [Google Scholar] [CrossRef]
- Peng, J.; Rezaei, E.E.; Zhu, W.; Wang, D.; Li, H.; Yang, B.; Sun, Z. Plant Density Estimation Using UAV Imagery and Deep Learning. Remote Sens. 2022, 14, 5923. [Google Scholar] [CrossRef]
- Cheng, C.; Fu, J.; Su, H.; Ren, L. Recent Advancements in Agriculture Robots: Benefits and Challenges. Machines 2023, 11, 48. [Google Scholar] [CrossRef]
- Zhang, Z.; Igathinathane, C.; Li, J.; Cen, H.; Lu, Y.; Flores, P. Technology progress in mechanical harvest of fresh market apples. Comput. Electron. Agric. 2020, 175, 105606. [Google Scholar] [CrossRef]
- Bu, L.; Chen, C.; Hu, G.; Sugirbay, A.; Sun, H.; Chen, J. Design and evaluation of a robotic apple harvester using optimized picking patterns. Comput. Electron. Agric. 2022, 198, 107092. [Google Scholar] [CrossRef]
- Cui, Z.; Sun, H.M.; Yu, J.T.; Yin, R.N.; Jia, R.S. Fast detection method of green peach for application of picking robot. Appl. Intell. 2022, 52, 1718–1739. [Google Scholar] [CrossRef]
- Zhang, Y.; Yu, J.; Chen, Y.; Yang, W.; Zhang, W.; He, Y. Real-time strawberry detection using deep neural networks on embedded system (rtsd-net): An edge AI application. Comput. Electron. Agric. 2022, 192, 106586. [Google Scholar] [CrossRef]
- Du, X.; Cheng, H.; Ma, Z.; Lu, W.; Wang, M.; Meng, Z.; Hong, F. DSW-YOLO: A detection method for ground-planted strawberry fruits under different occlusion levels. Comput. Electron. Agric. 2023, 214, 108304. [Google Scholar] [CrossRef]
- Qi, Y.; Yang, Z.; Sun, W.; Lou, M.; Lian, J.; Zhao, W.; Ma, Y. A comprehensive overview of image enhancement techniques. Arch. Comput. Methods Eng. 2021, 29, 1–25. [Google Scholar] [CrossRef]
- Zhang, Y.; Zhang, L.; Yu, H.; Guo, Z.; Zhang, R.; Zhou, X. Research on the Strawberry Recognition Algorithm Based on Deep Learning. Appl. Sci. 2023, 13, 11298. [Google Scholar] [CrossRef]
- Mumuni, A.; Mumuni, F. Data augmentation: A comprehensive survey of modern approaches. Array 2022, 16, 100258. [Google Scholar] [CrossRef]
- Shen, Q.; Zhang, L.; Zhang, Y.; Li, Y.; Liu, S.; Xu, Y. Distracted Driving Behavior Detection Algorithm Based on Lightweight StarDL-YOLO. Electronics 2024, 13, 3216. [Google Scholar] [CrossRef]
- Solimani, F.; Cardellicchio, A.; Dimauro, G.; Petrozza, A.; Summerer, S.; Cellini, F.; Renò, V. Optimizing tomato plant phenotyping detection: Boosting YOLOv8 architecture to tackle data complexity. Comput. Electron. Agric. 2024, 218, 108728. [Google Scholar] [CrossRef]
- Li, Z.; Jiang, X.; Shuai, L.; Zhang, B.; Yang, Y.; Mu, J. A real-time detection algorithm for sweet cherry fruit maturity based on YOLOX in the natural environment. Agronomy 2022, 12, 2482. [Google Scholar] [CrossRef]
- Razavi, M.; Yazdi, H.S.; Taherinia, A.H. Crowd analysis using bayesian risk kernel density estimation. Eng. Appl. Artif. Intell. 2019, 82, 282–293. [Google Scholar] [CrossRef]
- Kang, Y.J.; Noh, Y.; Lim, O.K. Kernel density estimation with bounded data. Struct. Multidiscip. Optim. 2018, 57, 95–113. [Google Scholar] [CrossRef]
- Arroyo, J.; Guijarro, M.; Pajares, G. An instance-based learning approach for thresholding in crop images under different outdoor conditions. Comput. Electron. Agric. 2016, 127, 669–679. [Google Scholar] [CrossRef]
- Zhong, C.; Miao, D.; Fränti, P. Minimum spanning tree based split-and-merge: A hierarchical clustering method. Inf. Sci. 2011, 181, 3397–3410. [Google Scholar] [CrossRef]
- Yan, H.; Wang, M.; Xie, J. ANN-DPC: Density peak clustering by finding the adaptive nearest neighbors. Knowl.-Based Syst. 2024, 294, 111748. [Google Scholar] [CrossRef]
- Qin, W.; Yang, X.; Liu, C.; Zheng, W. A deep learning method based on YOLOv5 and SuperPoint-SuperGlue for digestive disease warning and cage location backtracking in stacked cage laying hen systems. Comput. Electron. Agric. 2024, 222, 108999. [Google Scholar] [CrossRef]
Model | Precision/% | Recall/% | [email protected]~0.95 | Inference Time/ms |
---|---|---|---|---|
yolov3-tiny | 93.4 | 87.6 | 78.4 | 73.3 |
yolov5n | 93.8 | 89.8 | 86 | 58.2 |
yolov6n | 93.7 | 89.9 | 86.2 | 50.6 |
yolov7-tiny | 93.6 | 93.0 | 85 | 91.4 |
Improved yolov8n | 94.7 | 90.7 | 87.3 | 62.7 |
Groups | Number of Points | Mean Euclidean Distance | MAE | RMSE | R2 |
---|---|---|---|---|---|
group1 | 453 | 17.0259 | 11.0555 | 14.8874 | 0.9994 |
group2 | 475 | 18.6218 | 12.0533 | 15.1678 | 0.9998 |
group3 | 426 | 18.5869 | 12.0146 | 16.0246 | 0.9977 |
group4 | 502 | 17.1867 | 11.6153 | 15.5884 | 0.9982 |
group5 | 477 | 17.6654 | 11.8876 | 15.8428 | 0.9988 |
Bandwidth | Kernel | Sample Images | |||
---|---|---|---|---|---|
Sample A | Sample B | Sample C | Sample D | ||
100 | gaussian | 1 | 2 | 3 | 4 |
150 | 5 | 6 | 7 | 8 | |
200 | 9 | 10 | 11 | 12 | |
250 | 13 | 14 | 15 | 16 | |
300 | 17 | 18 | 19 | 20 |
Groups | Mean | Variance | Skewness | Kurtosis | Shapiro–Wilk Test |
---|---|---|---|---|---|
group1 | 5.9101 | 0.1639 | 0.1877 | −0.5064 | 0.9838 |
group2 | 5.6987 | 0.1612 | −0.4736 | 0.1347 | 0.9717 |
group3 | 5.8018 | 0.1819 | 0.3350 | −0.0548 | 0.9796 |
group4 | 5.581 | 0.1567 | 0.4015 | 0.1365 | 0.9632 |
group5 | 5.6281 | 0.1624 | −0.2736 | 0.1256 | 0.9784 |
Groups | NCGs | NCPGs | CGR | MR | NMs | R2 |
---|---|---|---|---|---|---|
group1 | 140 | 134 | 95.71 | 4.29 | 6 | 0.964 |
group2 | 213 | 205 | 96.23 | 3.77 | 8 | 0.965 |
group3 | 158 | 150 | 94.94 | 5.06 | 8 | 0.963 |
group4 | 256 | 250 | 97.66 | 2.34 | 6 | 0.964 |
group5 | 178 | 172 | 96.63 | 3.37 | 6 | 0.965 |
Overall | 945 | 911 | 96.40 | 3.60 | 34 | 0.964 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Jiang, L.; Wang, Y.; Wu, C.; Wu, H. Fruit Distribution Density Estimation in YOLO-Detected Strawberry Images: A Kernel Density and Nearest Neighbor Analysis Approach. Agriculture 2024, 14, 1848. https://doi.org/10.3390/agriculture14101848
Jiang L, Wang Y, Wu C, Wu H. Fruit Distribution Density Estimation in YOLO-Detected Strawberry Images: A Kernel Density and Nearest Neighbor Analysis Approach. Agriculture. 2024; 14(10):1848. https://doi.org/10.3390/agriculture14101848
Chicago/Turabian StyleJiang, Lili, Yunfei Wang, Chong Wu, and Haibin Wu. 2024. "Fruit Distribution Density Estimation in YOLO-Detected Strawberry Images: A Kernel Density and Nearest Neighbor Analysis Approach" Agriculture 14, no. 10: 1848. https://doi.org/10.3390/agriculture14101848
APA StyleJiang, L., Wang, Y., Wu, C., & Wu, H. (2024). Fruit Distribution Density Estimation in YOLO-Detected Strawberry Images: A Kernel Density and Nearest Neighbor Analysis Approach. Agriculture, 14(10), 1848. https://doi.org/10.3390/agriculture14101848