Next Article in Journal
Semantic Segmentation Model-Based Boundary Line Recognition Method for Wheat Harvesting
Previous Article in Journal
Potential Impacts of Diversification of Food Retail Working Hours on Consumer Behaviour and the Benefits for Local Producers in Latvia
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Fruit Distribution Density Estimation in YOLO-Detected Strawberry Images: A Kernel Density and Nearest Neighbor Analysis Approach

1
Shandong Institute of Pomology, Taian 271018, China
2
School of Agricultural Engineering, Jiangsu University, Zhenjiang 212013, China
*
Author to whom correspondence should be addressed.
Agriculture 2024, 14(10), 1848; https://doi.org/10.3390/agriculture14101848
Submission received: 6 September 2024 / Revised: 6 October 2024 / Accepted: 18 October 2024 / Published: 19 October 2024
(This article belongs to the Section Digital Agriculture)

Abstract

:
Precise information on strawberry fruit distribution is of significant importance for optimizing planting density and formulating harvesting strategies. This study applied a combined analysis of kernel density estimation and nearest neighbor techniques to estimate fruit distribution density from YOLOdetected strawberry images. Initially, an improved yolov8n strawberry object detection model was employed to obtain the coordinates of the fruit centers in the images. The results indicated that the improved model achieved an accuracy of 94.7% with an [email protected]~0.95 of 87.3%. The relative error between the predicted and annotated coordinates ranged from 0.002 to 0.02, demonstrating high consistency between the model predictions and the annotated results. Subsequently, based on the strawberry center coordinates, the kernel density estimation algorithm was used to estimate the distribution density in the strawberry images. The results showed that with a bandwidth of 200, the kernel density estimation accurately reflected the actual strawberry density distribution, ensuring that all center points in high-density regions were consistently identified and delineated. Finally, to refine the strawberry distribution information, a comprehensive method based on nearest neighbor analysis was adopted, achieving target area segmentation and regional density estimation in the strawberry images. Experimental results demonstrated that when the distance threshold ϵ was set to 600 pixels, the correct grouping rate exceeded 94%, and the regional density estimation results indicated a significant positive correlation between the number of fruits and regional density. This study provides scientific evidence for optimizing strawberry planting density and formulating harvesting sequences, contributing to improved yield, harvesting efficiency, and reduced fruit damage. In future research, this study will further explore dynamic models that link fruit distribution density, planting density, and fruit growth status.

1. Introduction

Strawberries are an important economic crop, often referred to as the “queen of berries” due to their high nutritional value. Ripe strawberries are rich in vitamin C and antioxidants, which have significant benefits for cardiovascular health and the regulation of blood glucose levels [1,2]. In modern agriculture, strawberry cultivation is increasingly transitioning from open-field farming to greenhouse cultivation [3,4] to address climate change and enhance production efficiency. Greenhouse environments offer more controllable growing conditions for strawberry cultivation, including light, temperature, moisture, and carbon dioxide concentration, thereby significantly improving both the yield and quality of strawberries.
However, a key challenge in greenhouse strawberry cultivation is optimizing planting density. Planting density directly affects photosynthesis, ventilation, and nutrient absorption, thereby influencing the growth, yield, and quality of strawberries [5,6]. Although high-density planting can increase yield per unit area, it may lead to a decline in fruit quality, an increased risk of diseases, and higher management costs. Conversely, low-density planting may result in wasted land resources and reduced overall yield [7]. Therefore, balancing planting density has become a significant challenge in strawberry cultivation research. In recent years, researchers have adopted various methods to assess planting density to optimize crop management. Traditional density assessment methods typically involve manual counting, which, although highly accurate, is time-consuming and labor-intensive. With the introduction of image processing technology, especially RGB image-based analysis, the efficiency and accuracy of planting density estimation have significantly improved. For instance, multispectral analysis, RGB vegetation indices, and digital estimation methods have been widely used to assess canopy coverage and plant density, with neural network models being employed for high-precision estimation of maize planting density and yield [8,9]. Additionally, researchers have recently utilized high-resolution RGB images and UAV technology to assess early crop planting density by analyzing the ground sampling distance of different images [10]. Moreover, by comparing random selection, systematic selection, and prediction map-based methods, researchers have enhanced the accuracy of planting density estimation across different weed species and years [11]. With the advancement of deep learning models, the combination of visual technology and deep model-based density estimation has become a trend in the study of various crops, such as maize, soybean, and wheat. By capturing images of the planting area, identifying plant targets, and counting them, efficient and accurate density estimation can be achieved [12,13,14].
Simultaneously, optimizing planting density can adjust the distribution density of strawberry fruits, making the fruit distribution more uniform. This not only helps improve harvesting efficiency but also reduces fruit damage during mechanized harvesting. Mechanized harvesting is becoming increasingly prevalent in modern agriculture, with various harvesting robots being developed for the intelligent picking of fruits such as strawberries and apples [15,16]. These robots typically integrate advanced vision systems, flexible end-effectors, and precise robotic arms to recognize, locate, and separate the fruits [17]. Currently, mechanized harvesting equipment commonly employs binocular cameras and deep learning perception modules, enabling precise identification and localization of target fruits to achieve intelligent harvesting [18]. For instance, Zhan et al. developed a novel deep neural network, RTSD-Net, which, after acceleration using the TensorRT method on the embedded system Jetson Nano, achieved a detection speed of 25.20 FPS, sufficient to meet the real-time requirements of computer-vision-driven strawberry detection and harvesting operations [19]. Additionally, Du proposed the DSW-YOLO model, which optimizes the yolov7 network architecture to effectively address issues such as stem and leaf occlusion and fruit overlap in strawberry detection tasks, significantly improving the detection accuracy and speed of ripe strawberries in complex environments [20].
In this context, analyzing and estimating strawberry planting density based on visual system analysis holds significant importance. The distribution density of fruits is a crucial indicator for measuring the spatial utilization efficiency of plants and the growth status of fruits. Therefore, this study considers the distribution density of strawberry fruits as a core indicator for evaluating planting density. By analyzing the spatial distribution of fruits within the planting area, the rationality of the planting density can be assessed. Additionally, by effectively evaluating the spatial distribution of fruits, the harvesting paths and operational processes can be optimized, thereby enhancing overall harvesting efficiency and reducing fruit damage during mechanical operations.
To address the issue of fruit distribution density estimation in strawberry images, this study proposes a method that combines kernel density estimation with a nearest neighbor algorithm for the precise estimation of fruit distribution density in yolo-detected strawberry images. First, we employ an improved yolov8n strawberry object detection model to obtain the coordinates of the fruit centers in the images. Then, based on the strawberry fruit center coordinate data, a comprehensive analysis was conducted using kernel density estimation and nearest neighbor analysis to acquire refined fruit distribution information, thereby providing data support for optimizing planting density. This study offers crucial data support for the optimization of strawberry planting density and the formulation of harvesting strategies, demonstrating significant potential for practical applications.

2. Materials and Methods

2.1. Experimental Data Collection and Processing

2.1.1. Image Collection

The strawberry image samples used in the experiment were collected from the fruit and vegetable research base of the Tai’an Institute of Pomology in Shandong Province. The base employs greenhouse cultivation for strawberries, with artificial planting fields arranged in rows oriented north to south, as shown in Figure 1. During the strawberry ripening season, high-definition imaging equipment was used to collect strawberry images. The camera lens was positioned perpendicular to the ground, capturing images from multiple angles along the central plane of the planting rows. A total of 1868 images were collected, encompassing various conditions such as overlap, density, and occlusion. The original images were in JPG format, with a resolution of 4000 × 6000 pixels. During the collection process, multiple planting rows were randomly selected to ensure the diversity and representativeness of the samples.

2.1.2. Image Processing

Strawberry image processing involves image quality enhancement and dataset construction to ensure that the strawberry images are suitable for subsequent yolo strawberry object detection model training and strawberry density distribution estimation.
(1)
Image Quality Enhancement: This study employed various image enhancement algorithms to optimize the quality of strawberry images [21], including adaptive histogram equalization [22], adaptive bilateral filtering, and adaptive mean filtering. The enhancement effects are shown in Figure 2.
(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.
Figure 2. Image enhancement result.
Figure 2. Image enhancement result.
Agriculture 14 01848 g002

2.2. Strawberry Object Detection Model

2.2.1. Yolov8 Object Detection Model

Yolov8 is a state-of-the-art (SOTA) model developed by Ultralytics, which inherits the advantages of the yolo series while introducing new features and improvements [24]. Compared to the previous generation yolov5, the main changes include the use of the C2f module instead of the C3 module in the backbone network, the removal of convolution operations during the upsampling process, and the adoption of a decoupled head structure (DeCouple-Head), which separates classification and detection tasks, thereby further reducing the model’s complexity. In this study, to ensure the real-time performance of the algorithm and keep the model size manageable, the yolov8n version was selected. yolov8n has significant advantages in terms of the number of parameters and computational complexity, allowing for fast detection while maintaining high detection accuracy.

2.2.2. Improved Yolov8 Strawberry Object Detection Model

In the actual strawberry cultivation environment, issues such as occlusion and overlap between strawberry fruits often lead to missed detections during the yolov8n object detection process. To enhance the detection performance of the model without significantly increasing its complexity and computational load, this study introduces improvements to the yolov8 model. The primary improvements include the incorporation of the Squeeze-and-Excitation (SE) attention mechanism module and the replacement of the loss function with the latest version. Figure 3 shows the structure of the improved yolov8 model.
(1)
Feature Attention Mechanism: SE EIoU Loss Function
The Squeeze-and-Excitation (SE) attention mechanism is an innovative network structure, as shown in Figure 4. It adaptively recalibrates the feature channel weights based on global information, thereby enhancing the model’s feature representation capabilities. By introducing the SE module into the C2f module, the fused features undergo adaptive weight adjustment, further strengthening the representation of important features and suppressing irrelevant or redundant features. This improves the model’s ability to capture the salient features of strawberry targets and enhances recognition accuracy. Additionally, the SE module, through the processes of squeeze and excitation based on global information [25], increases the model’s focus on strawberry targets. In scenarios involving complex backgrounds and the occlusion or overlap of fruits, the SE module effectively reduces missed detections by recalibrating the feature channels, thereby enhancing detection performance and robustness. Moreover, the SE module is designed to be simple and efficient, without increasing the model’s computational complexity and memory consumption, thus maintaining the efficiency of the yolov8n model.
(2)
EIoU Loss Function
In strawberry object detection, the issues of occlusion and overlap among fruits may render the traditional IoU loss function insufficient for accurately locating target boundaries. In this study, the EIoU (Efficient Intersection over Union) loss function is chosen to replace the original loss function, as shown in Equation (1).
L E I o U   = L I o U   + α L d   + β L c   + γ L a
where LEIoU is the original IoU loss, and α, β, γ are weight coefficients. The EIoU loss function improves the original IoU loss by adding distance loss Ld, center loss Lc, and aspect ratio loss La. The distance loss Ld reduces the distance between the center points of the predicted and ground truth boxes, the center loss Lc adjusts the shape difference between the predicted and ground truth boxes, and the aspect ratio loss La corrects the width-to-height ratio of the predicted and ground truth boxes.
In the strawberry object detection task, introducing the EIoU loss function presents significant advantages over the traditional IoU loss function. First, EIoU enhances the model’s localization accuracy and regression performance by additionally considering the distance, center, and aspect ratio information of the target box [26]. Second, EIoU effectively reduces the contribution of high-quality samples to the loss value, dynamically assigns gradient gains to boundary boxes, and decreases the harmful gradients from low-quality anchor boxes in the later stages of training, focusing on anchor boxes of moderate quality, thereby improving the model’s localization capability.
By introducing the EIoU loss function, the model can more accurately capture strawberry targets in complex backgrounds and occlusion scenarios, reducing missed detections and false positives and significantly enhancing detection performance and robustness. Therefore, using EIoU as a replacement for the original boundary loss function optimizes the model and can effectively improve the practical application of the yolov8n model in strawberry object detection.

2.3. Strawberry Density Distribution Estimation

2.3.1. Kernel Density Estimation

Upon constructing the Strawberry Target Detection Model, the model is utilized to pinpoint the center of each strawberry, thereby obtaining the central coordinates of every strawberry fruit. To comprehensively assess the distribution density of strawberries across the entire area, the kernel density estimation (KDE) method [27] is employed for analysis. The density evaluation process is illustrated in Figure 5.
Using the Strawberry Target Detection Model (STDM), the central coordinate data of the strawberry fruits are obtained. The kernel density estimation (KDE) method is then applied to calculate the distribution density of strawberry fruits across the entire area based on the central coordinate data. KDE is a non-parametric method that estimates the probability density function of the data by smoothing the data points through a kernel function. The calculation formula is defined as follows:
f ( x , y ) = 1 n h x h y i = 1 n K ( x x i h x , y y i h y )
where f(x,y) is the estimated density function, n is the number of sample points, K is the kernel function, and hx and hy are the smoothing parameters.
The KDE method selects an appropriate kernel function and smoothing parameter to effectively smooth the data, thereby accurately reflecting the spatial distribution characteristics of strawberries in the target area [28]. Meanwhile, the average kernel density of the target area is calculated as the overall distribution density of the strawberry image. The formula for the average kernel density is defined as follows:
f ¯   = 1 A   A   f ( x , y ) d x d y
where ∣A∣ represents the area of the strawberry image.

2.3.2. Target Area Segmentation and Density Evaluation Based on Nearest Neighbor Analysis

After completing the density evaluation of the entire area, a comprehensive method based on the nearest neighbor analysis [29] is employed in this study to accurately segment the distribution density of strawberries within the entire region. This approach enables the segmentation and density evaluation of target areas in strawberry images, providing detailed information on strawberry distribution. The specific analysis process is illustrated in Figure 6.
This study calculates the Euclidean distance matrix based on the center point data of strawberries and sets a distance threshold ϵ to construct an adjacency list. Meanwhile, Prim’s algorithm is employed to construct a Minimum Spanning Tree (MST) [30] based on the adjacency list, ensuring overall connectivity and minimal total distance. The distance matrix formula is defined as follows:
D i j   = ( x i   x j   ) 2 + ( y i   y j   ) 2  
where Dij represents the Euclidean distance between the ith and jth points, and (xi, yi) and (xj, yj) denote the coordinates of the ith and jth points, respectively.
Finally, the Breadth-First Search (BFS) algorithm [31] is used to identify connected components and perform elliptical fitting and labeling. All points within the same region are labeled using elliptical fitting, and the weighted average kernel density formula is employed to estimate the density of points within the same region. The formulas are defined as follows:
ρ = 1   n   i = 1 n f i   × w i
w i = log ( n + 1 )
where ρ represents the weighted kernel density average within the same region, n denotes the number of points within the same region, and wi is the logarithmic density factor, which ensures that regions with a higher number of points have greater weight in the density estimation.
In summary, this method combines distance matrix computation, minimum spanning tree construction, connected component identification, and elliptical fitting techniques to achieve precise segmentation and density evaluation of target areas in strawberry images. The detailed strawberry distribution information obtained through this method is of great significance for optimizing planting layouts and harvesting strategies, enhancing yield and quality, and reducing fruit damage.

3. Results and Discussion

3.1. Strawberry Recognition Experiment and Result Analysis

3.1.1. Model Performance Comparison Experiment

To verify the superiority of the improved yolov8n model in the strawberry image recognition task, precision, recall, [email protected]~0.95 [32], and CPU-based inference time were introduced as evaluation metrics. Quantitative comparison experiments were conducted across different models, including yolov3-tiny, yolov5n, yolov6n, and yolov7-tiny. The experimental results are shown in Table 1.
As shown by the experimental data in Table 1, the improved yolov8n model excels across all metrics. It achieves a precision of 94.7% and an [email protected]~0.95 of 87.3, both of which are the highest among all models, surpassing the lowest precision model, yolov3-tiny, by 1.3 percentage points and 8.9 percentage points, respectively. The recall rate of the improved yolov8n model is 90.7%, higher than most of the compared models and second only to yolov7-tiny’s 93.0%. The inference time for the improved yolov8n model is 62.7 ms, slightly longer than that of yolov5n and yolov6n. However, it offers significant advantages in precision and overall performance, with its inference time being within a reasonable range, making it suitable for practical application scenarios. In summary, the improved yolov8n model demonstrates excellent performance in specific metrics within the strawberry image recognition task, particularly in precision and mAP, showcasing its advantages in these areas compared to other models.

3.1.2. Strawberry Localization Experiment

A strawberry image localization experiment was conducted in which 200 strawberry images were randomly selected as test samples. The target detection model was used to obtain the predicted coordinates of the center point of the strawberries in each image. To verify the accuracy of the model’s predictions, the center point of the strawberries in each image was manually labeled to obtain precise reference coordinates.
(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.
The experimental results indicate that the Euclidean distance between the predicted coordinates and the reference coordinates is primarily concentrated between 10 and 30 pixels. The deviation values in both the X and Y directions are fewer than 50 pixels, and the relative error ranges from 0.002 to 0.02. This suggests that the proportional error between the predicted and reference values is small, demonstrating a high degree of consistency between the model’s predictions and the reference results.
(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.
The experimental results show that the mean Euclidean distance for each data group ranges between 17 and 18.6 pixels, the Mean Absolute Error (MAE) ranges between 11 and 12 pixels, the Root Mean Square Error (RMSE) ranges between 14.8 and 16.0 pixels, and the coefficient of determination (R2) is close to 1. These results indicate that while there is some error in the model’s spatial position predictions, the overall differences are not significant. Although the errors in group2 and group3 are slightly higher, the overall error remains small, demonstrating a high degree of consistency between the model’s predictions and the actual values. This model can achieve accurate predictions of strawberry center points.

3.2. Kernel Density Estimation Experiment

Based on the dataset divided from the strawberry localization experiment, a strawberry distribution density estimation experiment was conducted to verify the reliability of the density estimation method proposed in this study. First, a trial analysis of the key parameter, bandwidth, in the kernel density estimation (KDE) method was conducted to determine the optimal bandwidth value. The experimental design is shown in Table 3, and some experimental samples are illustrated in Figure 8.
In this experiment, a Gaussian kernel function was used, and five different bandwidth values (100, 150, 200, 250, 300) were tested. Each bandwidth value corresponds to four test samples, labeled as Sample A, Sample B, Sample C, and Sample D. A comparative analysis of the kernel density estimation results under different bandwidth values was conducted to determine the optimal bandwidth value (Figure 9).
According to the results of the kernel density estimation, the high-density areas in the images were clearly identified, with well-defined boundaries that closely match the actual distribution. In the strawberry images, the center points of strawberries concentrated in distribution were correctly classified into the same high-density region in the estimation map. This indicates that when the bandwidth value is set to 200, the kernel density estimation can accurately reflect the actual strawberry density distribution, ensuring that all center points within high-density areas are consistently identified and classified. Therefore, a bandwidth value of 200 provides the best kernel density estimation results.
To further verify the stability of this evaluation method, the kernel density estimation algorithm with a bandwidth value of 200 was applied to estimate the density of the strawberry dataset. Mean, variance, skewness, kurtosis, and the Shapiro–Wilk test were introduced as evaluation metrics to assess the density estimation results of each data group. The specific data are shown in Table 4.
The evaluation results show that the mean values across the data groups range from 5.6101 to 5.7381, indicating that the algorithm’s average estimation is relatively consistent across different groups, with stable central tendency. The variance ranges from 0.1567 to 0.1819, with minimal fluctuation, suggesting that the degree of data dispersion is fairly consistent among the groups, demonstrating the stability of the estimation results. Most skewness and kurtosis values are close to 0, indicating that the data distributions in each group are approximately symmetrical and near-normal, showing that the algorithm handles the symmetry and concentration of the data distribution well. Additionally, the p-values from the Shapiro–Wilk test are all greater than 0.05, further confirming that the data in each group are close to a normal distribution.
In summary, the kernel density estimation algorithm exhibits a high degree of consistency and stability across different data groups, proving that this method is reliable and applicable for evaluating strawberry density distribution.

3.3. Target Area Segmentation and Density Evaluation Experiment

Based on the nearest neighbor analysis method, an experiment was conducted to segment regions and evaluate density using the image dataset. The experimental dataset was consistent with the one used in the kernel density estimation experiment to verify the reliability of the proposed method. First, a trial analysis was conducted on the key parameter ϵ, evaluating its effect on the segmentation of strawberry center points by setting different ϵ values (520 pixels, 620 pixels, 720 pixels) to determine the optimal distance threshold ϵ (Figure 10).
The experimental results indicate that when ϵ is set to 600 pixels, the balance between intra-group connectivity and inter-group independence in the strawberry images is optimal, effectively distinguishing the strawberries in different groups.
To quantitatively evaluate the performance of the region segmentation algorithm proposed in this study, metrics such as the number of calibrated groups (NCGs), the number of correctly predicted groups (NCPGs), the correct grouping rate (CGR), the misclassification rate (MR), the number of misclassifications (NMs), and the coefficient of determination (R2) were introduced to assess the segmentation results. The specific data are shown in Table 5.
The data results show that the correct grouping rate of the algorithm exceeds 94% across all test groups, with group4 achieving a correct grouping rate of 97.66%, demonstrating extremely high classification accuracy. The overall misclassification rate remains at 3.60%, matching the highest misclassification count of 8, indicating the algorithm’s stability and accuracy when processing larger datasets. The R2 values for all groups range between 0.963 and 0.965, indicating a high degree of goodness-of-fit and strong explanatory power. In summary, this algorithm can achieve precise segmentation of fruits in strawberry images.
Additionally, this study conducted a statistical analysis of the fruit distribution frequency within the dataset to assess the number and proportion of regions composed of different quantities of fruits. Subsequently, the weighted average kernel density formula was used to estimate the density of the target areas, providing detailed information on the strawberry distribution to accurately understand the distribution patterns of strawberries within each region.
As shown in Figure 11, there is a significant positive correlation between the number of fruits and the regional kernel density. Specifically, group2 (where the number of fruits in the region is 2) has the highest proportion among all groups (23.28%), indicating the prevalence of this specific fruit quantity configuration. Observing the regional density values, it is evident that as the number of fruits increases, the regional density gradually rises, which is particularly pronounced in groups with a larger number of fruits (e.g., groups 4 to 7). This trend suggests that in regions with a higher number of fruits, the distribution is denser.
This detailed strawberry distribution information is of great importance for optimizing planting density and determining the harvesting sequence. High-density regions require adjustments in management strategies to avoid competition between fruits, while properly scheduling the harvesting order can reduce fruit damage, thereby improving efficiency and quality.

4. Conclusions

This study aimed to enhance the accuracy and reliability of strawberry fruit distribution density evaluation by improving the yolov8n model and combining it with kernel density estimation and nearest neighbor analysis methods. The goal was to provide theoretical support and practical guidance for optimizing strawberry planting density and formulating harvesting strategies. The main conclusions of the study are as follows:
(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

Conceptualization, Y.W. and L.J.; methodology, L.J.; software, Y.W.; validation, Y.W., L.J. and C.W.; formal analysis, L.J.; investigation, L.J.; resources, L.J. and H.W.; data curation, Y.W.; writing—original draft preparation, Y.W.; writing—review and editing, Y.W.; visualization, L.J.; supervision, C.W.; project administration, L.J. and H W.; funding acquisition, L.J. and H.W. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by the Key R&d Project of the Shandong Province (2023TZXD057, 2022CXPT017) and Special Fund Project for Guiding Local Scientific and Technological Development by the Central Government (YDZX2023031).

Institutional Review Board Statement

Not applicable.

Data Availability Statement

Due to the sensitivity and confidentiality of the data, this study did not provide the original data when publishing the paper. For data acquisition, please contact the corresponding author.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. 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]
  2. 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]
  3. 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]
  4. 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]
  5. Haque, M.A.; Sakimin, S.Z. Planting arrangement and effects of planting density on tropical fruit crops. Horticulturae 2022, 8, 485. [Google Scholar] [CrossRef]
  6. 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]
  7. 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]
  8. 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]
  9. 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]
  10. 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]
  11. 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]
  12. 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]
  13. 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]
  14. 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]
  15. Cheng, C.; Fu, J.; Su, H.; Ren, L. Recent Advancements in Agriculture Robots: Benefits and Challenges. Machines 2023, 11, 48. [Google Scholar] [CrossRef]
  16. 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]
  17. 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]
  18. 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]
  19. 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]
  20. 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]
  21. 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]
  22. 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]
  23. Mumuni, A.; Mumuni, F. Data augmentation: A comprehensive survey of modern approaches. Array 2022, 16, 100258. [Google Scholar] [CrossRef]
  24. 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]
  25. 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]
  26. 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]
  27. 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]
  28. Kang, Y.J.; Noh, Y.; Lim, O.K. Kernel density estimation with bounded data. Struct. Multidiscip. Optim. 2018, 57, 95–113. [Google Scholar] [CrossRef]
  29. 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]
  30. 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]
  31. 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]
  32. 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]
Figure 1. Image acquisition process.
Figure 1. Image acquisition process.
Agriculture 14 01848 g001
Figure 3. Improved yolov8n network architecture.
Figure 3. Improved yolov8n network architecture.
Agriculture 14 01848 g003
Figure 4. SE feature attention mechanism network architecture.
Figure 4. SE feature attention mechanism network architecture.
Agriculture 14 01848 g004
Figure 5. Fruit density estimation process for strawberry images.
Figure 5. Fruit density estimation process for strawberry images.
Agriculture 14 01848 g005
Figure 6. Target area segmentation and density estimation process for strawberry images.
Figure 6. Target area segmentation and density estimation process for strawberry images.
Agriculture 14 01848 g006
Figure 7. Point-by-point difference analysis result for the strawberry localization experiment. (a) Predicted coordinates vs. reference coordinates of strawberry center points in images A and B; (b) predicted coordinates vs. reference coordinates of strawberry center points in images C and D; and (c) boxplot of difference analysis for strawberry center points in the four detection images.
Figure 7. Point-by-point difference analysis result for the strawberry localization experiment. (a) Predicted coordinates vs. reference coordinates of strawberry center points in images A and B; (b) predicted coordinates vs. reference coordinates of strawberry center points in images C and D; and (c) boxplot of difference analysis for strawberry center points in the four detection images.
Agriculture 14 01848 g007
Figure 8. (AD) Experimental sample images.
Figure 8. (AD) Experimental sample images.
Agriculture 14 01848 g008
Figure 9. Kernel density estimation results under different bandwidth values. (a) Kernel density estimation results for images A~B with bandwidth value of 100; (b) kernel density estimation results for images A~B with bandwidth value of 150; (c) kernel density estimation results for images A~B with bandwidth value of 200; (d) kernel density estimation results for images A~B with bandwidth value of 250; and (e) kernel density estimation results for images A~B with bandwidth value of 300.
Figure 9. Kernel density estimation results under different bandwidth values. (a) Kernel density estimation results for images A~B with bandwidth value of 100; (b) kernel density estimation results for images A~B with bandwidth value of 150; (c) kernel density estimation results for images A~B with bandwidth value of 200; (d) kernel density estimation results for images A~B with bandwidth value of 250; and (e) kernel density estimation results for images A~B with bandwidth value of 300.
Agriculture 14 01848 g009aAgriculture 14 01848 g009b
Figure 10. Strawberry fruit center point segmentation results under different distance thresholds. (a) Segmentation results of strawberry fruit center points in images A~B with ϵ = 520; (b) segmentation results of strawberry fruit center points in images A~B with ϵ = 620; and (c) segmentation results of strawberry fruit center points in images A~B with ϵ = 720.
Figure 10. Strawberry fruit center point segmentation results under different distance thresholds. (a) Segmentation results of strawberry fruit center points in images A~B with ϵ = 520; (b) segmentation results of strawberry fruit center points in images A~B with ϵ = 620; and (c) segmentation results of strawberry fruit center points in images A~B with ϵ = 720.
Agriculture 14 01848 g010
Figure 11. Fruit distribution frequency statistics and regional density estimation results. (a) Statistical and proportional distribution chart of fruit density regions; (b) boxplot of the relationship between fruit quantity and regional density.
Figure 11. Fruit distribution frequency statistics and regional density estimation results. (a) Statistical and proportional distribution chart of fruit density regions; (b) boxplot of the relationship between fruit quantity and regional density.
Agriculture 14 01848 g011
Table 1. Results of model comparison experiments.
Table 1. Results of model comparison experiments.
ModelPrecision/%Recall/%[email protected]~0.95Inference Time/ms
yolov3-tiny93.487.678.473.3
yolov5n93.889.88658.2
yolov6n93.789.986.250.6
yolov7-tiny 93.693.08591.4
Improved yolov8n94.790.787.362.7
Table 2. Experiment results of statistical analysis of variability between predicted and calibrated coordinates.
Table 2. Experiment results of statistical analysis of variability between predicted and calibrated coordinates.
GroupsNumber of PointsMean Euclidean DistanceMAERMSER2
group145317.025911.055514.88740.9994
group247518.621812.053315.16780.9998
group342618.586912.014616.02460.9977
group450217.186711.615315.58840.9982
group547717.665411.887615.84280.9988
Table 3. Experimental program design.
Table 3. Experimental program design.
BandwidthKernelSample Images
Sample ASample BSample CSample D
100gaussian1234
1505678
2009101112
25013141516
30017181920
Table 4. Evaluation of kernel density estimation experiment results.
Table 4. Evaluation of kernel density estimation experiment results.
GroupsMeanVarianceSkewnessKurtosisShapiro–Wilk Test
group15.91010.16390.1877−0.50640.9838
group25.69870.1612−0.47360.13470.9717
group35.80180.18190.3350−0.05480.9796
group45.5810.15670.40150.13650.9632
group55.62810.1624−0.27360.12560.9784
Table 5. Evaluation of regional segmentation results.
Table 5. Evaluation of regional segmentation results.
GroupsNCGsNCPGsCGRMRNMsR2
group114013495.714.2960.964
group221320596.233.7780.965
group315815094.945.0680.963
group425625097.662.3460.964
group517817296.633.3760.965
Overall94591196.403.60340.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.

Share and Cite

MDPI and ACS Style

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

AMA Style

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 Style

Jiang, 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 Style

Jiang, 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

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop