A fruit clustering recognition and positioning method based on deep learning
Patent Information
- Application Number
- CN202611003559.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-07
- Publication Date
- 2026-09-22
AI Technical Summary
[0009]针对现有技术的不足,本发明提供了一种基于深度学习的果实聚类识别与定位方法,旨在解决现有模型计算量大、遮挡场景识别差、传统聚类仅考虑空间距离、路径规划冗余、振动采摘区域划分不合理等技术问题
1.轻量化且抗遮挡能力强:幽灵动态卷积与动态上采样结合,参数量降低约 30%,推理速度提升约 25%,遮挡场景识别精度显著提高;
Smart Images

Figure CN122799280A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent agricultural harvesting technology, specifically to a deep learning-based method for fruit clustering identification and localization, applicable to the automated identification, spatial distribution analysis, and intelligent decision-making for vibration harvesting of small, high-density, and easily obscured fruits such as camellia oleifera. Background Technology
[0002] Camellia oleifera is a unique woody oil crop in my country, and the harvesting of its fruits is the most labor-intensive and costly part of the camellia oleifera industry chain. Traditional manual harvesting is inefficient, costly, and unsafe, making mechanized vibration harvesting an inevitable trend for the large-scale and modern development of the camellia oleifera industry. However, camellia oleifera fruits are generally characterized by dense growth, small size, severe shading by branches and leaves, and uneven spatial distribution, making it difficult for existing intelligent recognition and path planning technologies to meet the needs of actual operations.
[0003] While some automated fruit harvesting solutions exist on the market, these technologies generally suffer from the following significant drawbacks: 1. The detection model is bulky and has weak anti-occlusion ability: the general YOLO series model has a large number of parameters and high computational complexity, making it difficult to deploy on edge devices; and the recognition accuracy for overlapping and occluded fruits is insufficient, with a high rate of missed detection and false detection.
[0004] 2. The clustering method is too simplistic and only considers spatial distance: Existing harvesting schemes mostly use traditional clustering methods such as CLIQUE and ordinary KMeans, which rely solely on Euclidean distance to divide the area without considering fruit density and harvesting path constraints. As a result, the clustering results are disconnected from the vibration harvesting operation.
[0005] 3. Outdated path planning algorithms: Traditional solutions rely on TSP, genetic algorithms, standard ant colony or sparrow algorithms, without taking into account the characteristics of fruit distribution, making them prone to getting trapped in local optima, resulting in high path redundancy and low operation efficiency.
[0006] 4. Lack of a dedicated decision-making mechanism for vibration harvesting: Most methods only achieve single fruit identification and positioning, without dividing the area according to the characteristics of vibration harvesting head operation, and cannot directly guide precise operation.
[0007] Compared with existing publicly available technologies, these technologies cannot simultaneously achieve lightweight and high-precision recognition, intelligent clustering guided by density, space, and path, as well as multi-layer intelligent path planning and intelligent division of vibration-harvesting areas. Therefore, they are unable to meet the needs of efficient, low-damage, and automated harvesting of fruits such as camellia oleifera.
[0008] Therefore, developing a lightweight, anti-shading, rationally clustered, optimally integrated path, and directly guiding vibration harvesting method for identifying and locating camellia fruits is of great significance for breaking through existing technological bottlenecks and promoting the intelligent upgrading of the camellia industry. Summary of the Invention
[0009] To address the shortcomings of existing technologies, this invention provides a deep learning-based fruit clustering identification and localization method, aiming to solve technical problems such as high computational load, poor recognition of occluded scenes, traditional clustering only considering spatial distance, redundant path planning, and unreasonable division of vibration-harvested areas.
[0010] To address the aforementioned technical problems, this invention provides a fruit clustering identification and localization method based on deep learning, comprising the following steps: Step S1: Collect fruit images, construct a dataset, and label it; Step S2: Construct a lightweight object detection network YOLO-GDC, incorporating a ghost dynamic convolution module into the backbone network of the object detection network and employing a dynamic upsampling module with a spatially adaptive kernel; Step S3: Use the YOLO-GDC network to detect the input image and output the detection results, which include the bounding box information and confidence score of each fruit; Step S4: Extract the center point coordinates of each fruit from the detection results and construct a two-dimensional spatial point set P = {p1, p2, …, p n}, p n This represents the coordinates of the center point of the nth fruit; Step S5: Employ the KMS-SSA clustering algorithm, which integrates the improved sparrow search algorithm with path-oriented KDE-KMeans, to transform the clustering problem into a combinatorial optimization problem with path constraints. Dynamically calculate the optimal picking path within each cluster and update the cluster centers, generating a clustering result C = {C1, C2,…, C...} that balances spatial compactness, fruit density, and the shortest picking path. k}, C k This represents the k-th cluster after clustering is complete; Step S6: Construct a two-layer path planning mechanism of intra-cluster density-first search + inter-cluster improved ant colony traversal to complete the global optimal fruit picking path decision; Step S7: Based on the clustering results, construct a fruit vibration harvesting area model to provide a decision-making basis for zoned vibration harvesting.
[0011] Furthermore, the construction method of the Ghost dynamic convolution module is as follows: combining Ghost convolution with dynamic convolution, generating more feature maps through linear transformation, and using dynamically perceptive convolution kernel weights to adapt to different input features; the dynamic upsampling module adopts a spatially adaptive kernel, dynamically adjusting the weights of the upsampling kernel according to the spatial position of the input feature map, so as to improve the discrimination ability of occluded and overlapping targets.
[0012] Furthermore, the loss function of the YOLO-GDC network comprehensively optimizes the bounding box coordinates, confidence, and classification probability, treating object detection as a regression problem and directly predicting the probability and coordinates of the bounding box on the input image.
[0013] Furthermore, the formula for extracting the center point coordinates in step S4 is as follows: For each detected fruit bounding box (x, y, w, h), its center point coordinates are (x + w / 2, y + h / 2), where x and y represent the horizontal and vertical coordinates of the upper left corner of the bounding box, respectively, and w and h represent the width and height of the bounding box, respectively.
[0014] Furthermore, the KMS-SSA clustering algorithm in step S5 includes: (1) Calculate the local density of the fruit based on kernel density estimation (KDE), and select the K points with the highest density peaks as the initial cluster centers; (2) Sample allocation was completed using kernel density-weighted comprehensive distance; (3) Calculate the optimal picking path within each cluster using the improved sparrow search algorithm; (4) Construct a three-objective optimization function that integrates intra-cluster compactness, intra-cluster average density, and intra-cluster path length; (5) The cluster center is updated by weighting the traditional centroid, density center, and sparrow optimal node; (6) After iteration to convergence, global path planning between clusters is completed by improving the ant colony algorithm.
[0015] Furthermore, the kernel density-weighted composite distance formula is: D (p i ,c j )=α d_space (p i ,c j )+β d_density (p i ,c j )+(1 α β) d_path (p i ,c j Where α is the spatial distance weight, β is the density weight, d_space is the Euclidean distance, d_density is the kernel density difference distance, d_path is the path cost, and p i Let c be the coordinates of the center point of the i-th camellia fruit. j Let be the coordinates of the center of the j-th cluster.
[0016] Furthermore, the three-objective optimization function is: J_new=∑(ω1) Sj + ω2 ρ j + ω3 L j ), where S j For cluster compactness, ρ j L represents the average fruit density within the cluster. j ω1 is the optimal path length for the improved sparrow algorithm within the cluster, ω2 is the average density weight within the cluster, and ω3 is the path length weight within the cluster.
[0017] Furthermore, the cluster center update formula is: c j _new=η j +λ p_density+(1 η λ) p_sparrow_best, where j p is the traditional centroid, p_density is the density center within the cluster, p_sparrow_best is the optimal node of the improved sparrow path, η is the weight of the traditional centroid, and λ is the weight of the density center within the cluster.
[0018] Furthermore, the two-layer path planning mechanism in step S6 is as follows: within a cluster, a density-first greedy search strategy is adopted, and between clusters, an improved ant colony algorithm that integrates distance and density information is used to determine the optimal traversal order.
[0019] Furthermore, step S8 is included: based on the vibration harvesting area model and the global optimal harvesting path, the working trajectory, movement sequence and vibration parameters of the vibration harvesting head are planned.
[0020] This invention also proposes a fruit clustering recognition and localization system based on deep learning, comprising an image acquisition module, a recognition and localization module, a coordinate extraction module, a KMS-SSA clustering optimization module, a two-layer path planning module, and an output module connected in sequence; the modules cooperate with each other to execute the above-described method.
[0021] Compared with existing technologies, the fruit clustering identification and localization method based on deep learning provided by this invention has the following beneficial effects: 1. Lightweight and highly occluded: The combination of ghost dynamic convolution and dynamic upsampling reduces the number of parameters by about 30%, increases inference speed by about 25%, and significantly improves the recognition accuracy in occluded scenes; 2. More scientific clustering: Based on the three factors of space, density, and path, a comprehensive path-oriented approach is adopted, and the clustering results perfectly match the needs of vibration harvesting; 3. More advanced algorithm: It uses an improved sparrow and an improved ant colony algorithm to replace the traditional TSP, which shortens the path length by more than 20% and is less likely to get trapped in local optima; 4. More efficient path: Creatively utilizing a two-layer planning mechanism to improve harvesting efficiency by more than 30%; 5. Enhanced practicality: Clustering results directly generate vibration operation areas, significantly reducing fruit damage rates and improving harvesting quality. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below.
[0023] Figure 1 This is a schematic diagram of the composition of a fruit clustering identification and localization system provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of a YOLO-GDC network structure provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the KMS-SSA clustering principle provided in an embodiment of the present invention; Figure 4 This is an image showing the effect of identifying camellia fruit according to an embodiment of the present invention; Figure 5 This is a spatial distribution map of camellia fruit clustering identification and location provided in one embodiment; Figure 6 This is a diagram illustrating the construction effect of a vibration-assisted harvesting area model according to an embodiment of the present invention. Detailed Implementation
[0024] To enable those skilled in the art to better understand the technical solutions in this invention, the technical solutions in the embodiments of this invention will be clearly and completely described below.
[0025] Please refer to the following: Figures 1 to 6 This embodiment provides a deep learning-based fruit clustering identification and localization system and corresponding method for real-time identification, spatial localization and harvesting area division of camellia oleifera fruits.
[0026] Figure 1 A deep learning-based fruit clustering recognition and localization system is presented, applicable to fruit picking such as camellia oleifera fruit. It includes an image acquisition module, a recognition and localization module, a coordinate extraction module, a KMS-SSA clustering optimization module, a two-layer path planning module, and an output module connected in sequence. The modules cooperate with each other for the deep learning-based fruit clustering recognition and localization method.
[0027] The fruit clustering identification and localization method based on deep learning proposed in this invention includes the following steps: Step S1: Collect images of camellia oleifera fruits, construct a multi-scene dataset, and complete the annotation. Image acquisition covers various scenarios including sunny, cloudy, and rainy days, with acquisition times ranging from 7:00 AM to 11:00 AM and 1:00 PM to 7:00 PM. Lighting conditions include overexposure, backlighting, direct sunlight, and sidelighting. Accurate annotation is preferably performed using the RobotFlow tool. Step S1 is executed by the image acquisition module.
[0028] Step S2: Construct a lightweight object detection network, YOLO-GDC. A ghost dynamic convolution module is integrated into the backbone of the object detection network. Combining the advantages of Ghost convolution and dynamic convolution, it generates rich feature maps with low-cost linear transformation and dynamically adjusts the convolution kernel weights to adapt to different input features using dynamically aware convolution kernel weights. Simultaneously, a dynamic upsampling module with a spatially adaptive kernel is employed to adaptively adjust the upsampling kernel weights according to the spatial location of the input feature map, enhancing the ability to recover details of occluded fruits and significantly improving the recognition ability of occluded and overlapping fruits.
[0029] Step S3: Use YOLO-GDC to detect objects in the input image and output the detection results. The detection results include the bounding box, confidence score, and category information for each identified fruit. The loss function of the YOLO-GDC network comprehensively optimizes the bounding box coordinates, confidence score, and classification probability, treating object detection as a regression problem and directly performing accurate predictions on the input image using a regression approach.
[0030] Steps S2-S3 are executed by the identification and positioning module. A schematic diagram of the YOLO-GDC network structure is shown below. Figure 2 As shown, it includes: ① Input layer: The input is a color image of camellia fruit, which is normalized in size and then fed into the backbone network.
[0031] ② Backbone: Utilizing the CSPDarknet architecture, its core innovation is the embedded Ghost Dynamic Convolution (GDC) module. This module combines Ghost convolution with dynamic convolution, generating rich feature maps through low-cost linear transformations while dynamically adjusting convolution kernel weights. This reduces the number of parameters by approximately 30%, improves inference speed, and enhances the feature extraction capabilities for small targets and occluded fruits.
[0032] The C3K2-GDC module is a lightweight feature extraction unit designed based on the CSPDarknet backbone network. Its core innovation lies in replacing the standard convolution in the traditional C3K2 module with Ghost Dynamic Convolution (GDC). The specific structure of this module is as follows: 1. Input feature map segmentation: The input feature map is divided into two parts along the channel dimension. One part is directly passed to the module output to retain the original features, and the other part is sent to multiple serial Bottleneck_GDC sub-modules for deep feature extraction.
[0033] 2. Bottleneck_GDC Submodule: In each Bottleneck structure, the original Conv2D layer is replaced with a GDC module. The GDC module first extracts the main feature map through grouped convolution, and then uses a dynamic weight generator (composed of global average pooling, 1×1 convolution and sigmoid function) to adaptively generate channel attention weights to dynamically weight and enhance the main feature map; subsequently, redundant feature maps are generated through the low-cost linear transformation of the Ghost module, and then concatenated with the main feature map along the channel dimension to form a fused feature map.
[0034] 3. Feature Fusion and Output: The feature maps that are directly passed to the output of all Bottleneck_GDC submodules are concatenated along the channel dimension, and then subjected to 1×1 convolution for channel compression and feature fusion to obtain the final output feature map.
[0035] This module significantly enhances the feature extraction capability for occluded and overlapping small targets by reducing the number of parameters by about 30% through the synergistic effect of adaptive adjustment of dynamic convolution kernels and Ghost linear transformation.
[0036] ③ Neck Network: The PANet feature pyramid structure is adopted to achieve multi-scale feature fusion. The key improvement is the spatial adaptive dynamic upsampling module, which can dynamically adjust the weight of the upsampling kernel according to the spatial position of the feature map, accurately recover the detailed features of overlapping and occluded camellia fruits, and improve the detection robustness of small targets and occluded targets.
[0037] ④ Detection Head: A decoupled head structure is adopted to output bounding box coordinates, confidence scores, and category information respectively; the loss function comprehensively optimizes the localization, confidence scores, and classification losses, and directly predicts the location of the camellia fruit in a regression manner, and finally outputs the bounding box and confidence score of a single fruit, providing an accurate basis for subsequent center point extraction.
[0038] Step S4: Extract the coordinates of the fruit's center point from the detection box and construct a two-dimensional spatial point set P={p1,p2,…,pn}, p n This represents the coordinates of the center point of the nth fruit; step S4 is executed by the coordinate extraction module. The formula for extracting the center point coordinates is as follows: for each detected fruit bounding box (x, y, w, h), its center point coordinates are (x + w / 2, y + h / 2), where x and y represent the horizontal and vertical coordinates of the upper left corner of the bounding box, respectively, and w and h represent the width and height of the bounding box, respectively.
[0039] Step S5: Employ the KMS-SSA clustering algorithm, which is a path-oriented KDE-KMeans algorithm that integrates an improved sparrow search algorithm. This transforms the traditional spatial clustering problem into a combinatorial optimization problem with path constraints. The optimal picking path within each cluster is dynamically calculated, and the cluster centers are updated. This generates a clustering result C = {C1, C2, …, C} that balances spatial compactness, fruit density, and the shortest picking path. k}, C k This represents the k-th cluster after clustering is complete; Step S5 is executed by the KMS-SSA clustering optimization module, and specifically includes: (1) Calculate the local density of each fruit point based on kernel density estimation (KDE). The preferred calculation formula is: , where n is the number of fruits and K is the number of clusters; Select the k points with the highest density peaks as the initial cluster centers C. (0) ; (2) Use kernel density weighted comprehensive distance to allocate samples, and assign fruits to the clusters with the closest comprehensive distance; The formula for the kernel density-weighted composite distance is: D (p i ,c j )=α d_space (p i ,c j )+β d_density(p i ,c j )+(1 α β) d_path (p i ,c j Where α is the spatial distance weight, β is the density weight, d_space is the Euclidean distance, d_density is the kernel density difference distance, d_path is the path cost, and p i Let c be the coordinates of the center point of the i-th camellia fruit. j Let be the coordinates of the center of the j-th cluster.
[0040] Preferably, α+β≤1.
[0041] (3) The improved sparrow search algorithm replaces the traditional TSP to solve for the optimal picking path within each cluster, and the optimal path length L is obtained. j And determine the optimal node for the path; (4) Construct a three-objective optimization function that integrates cluster compactness, average density, and path length, and minimize the weighted sum of compactness, density, and path length for each cluster through objective optimization; The objective optimization function for each cluster is calculated as follows: J_new=∑(ω1 S j + ω2 ρ j + ω3 L j ), where S j For cluster compactness, ρ j L represents the average fruit density within the cluster. j The optimal path length for the improved sparrow algorithm within a cluster is given by ω1, which is the cluster compactness weight, ω2, which is the cluster average density weight, and ω3, which is the cluster path length weight. Preferably, ω1 + ω2 + ω3 = 1.
[0042] (5) The cluster center is updated by a triple weighting mechanism based on the traditional centroid, density center and sparrow optimal node, so that it shifts towards the optimal picking point; Calculate three types of reference centers: traditional centroid, density center, and sparrow optimal node; The cluster center update formula is: c j _new=η j +λ p_density+(1 η λ) p_sparrow_best, where j Let p_density be the traditional centroid, p_density be the density center within the cluster, p_sparrow_best be the optimal node in the improved sparrow path, η be the weight of the traditional centroid, and λ be the weight of the density center within the cluster. Preferably, η + λ ≤ 1.
[0043] (6) After iterating to convergence, complete the accurate clustering.
[0044] If the convergence error between two consecutive J_new iterations is less than a preset threshold, or if the maximum number of iterations is reached, then the clustering converges, and the k clusters and the final cluster centers C = {C1, C2, …, C} are output. k Otherwise, return to step (2) and continue iterating.
[0045] Step S6: Construct a two-layer path planning mechanism of intra-cluster density-first search + inter-cluster improved ant colony traversal; within the cluster, a greedy search strategy is selected based on fruit density, prioritizing high-density areas; then, the global path planning between clusters is completed through the improved ant colony algorithm, thereby completing the global optimal fruit picking path decision. Among them, an improved ant colony algorithm that integrates distance and density information is used between clusters to obtain the shortest global movement order and determine the optimal traversal order.
[0046] For each cluster, intra-cluster path planning based on density-first search is employed, including: 1) Starting from the cluster center; 2) Using a greedy search strategy to visit unpicked points according to the local fruit density from high to low; 3) Output the optimal picking path within the cluster; An improved ant colony algorithm is used for global path planning between clusters, including: 1) Construct a heuristic function that integrates distance and density, using the cluster center as the node; 2) Search for the optimal traversal order by improving the ant colony algorithm; 3) Output the globally optimal inter-cluster path.
[0047] After the planning is completed, the optimal paths within each cluster are connected in the order between clusters to form a complete global optimal harvesting path.
[0048] Step S7: Based on the clustering results, construct a fruit vibration harvesting area model to provide a decision-making basis for zoned vibration harvesting. Specifically, each determined cluster corresponds to a vibration operation unit, with each cluster center C... j As the point of vibration, based on the cluster radius R j (For example, the maximum distance from the center point or a preset safety radius) to determine the working range, and after calculation, output the vibration working area and path planning results, as well as other working parameters. Steps S6 and S7 are executed by the dual-layer path planning module and the output module.
[0049] Furthermore, the output module also executes step S8: based on the vibration harvesting area model and the global optimal harvesting path, it plans the working trajectory, movement sequence and vibration parameters of the vibration harvesting head to realize intelligent harvesting decision-making throughout the entire process.
[0050] As an example, the schematic diagram of the KMS-SSA clustering principle used in this invention is shown below. Figure 3 As shown, combined with Figure 3 The following is an explanation. The processing flow includes: I. Input Processing YOLO The detection results of camellia fruit output by the GDC network are used as input. The center point coordinates of the bounding box of each camellia fruit are extracted to construct a two-dimensional spatial point set of camellia fruit, which serves as the raw data for the clustering algorithm.
[0051] II. Core Process of Iterative Clustering 1. Kernel density estimation and initial cluster center selection: Calculate the local density of the center point of each camellia fruit, and select the K points with the highest density as the initial cluster centers to ensure that the initial clusters fit the high-density distribution area of the fruit.
[0052] 2. Sample allocation: Taking into account spatial distance, fruit density and harvesting path costs, each camellia fruit center point is assigned to the cluster center with the best matching degree to complete the initial classification of samples.
[0053] 3. Intra-cluster path optimization: For each cluster, an improved sparrow search algorithm is used to solve the optimal picking path within the cluster, and to determine the best picking order and key nodes within the cluster.
[0054] 4. Evaluation of three-objective clustering effect: The clustering quality is comprehensively evaluated from three dimensions: intra-cluster spatial compactness, average fruit density, and picking path length, providing a basis for iterative optimization.
[0055] 5. Cluster center update: Combining the information of spatial center, density center and optimal picking node within the cluster, the cluster center is updated with weighted average to make the clustering results take into account spatial distribution, fruit density and picking efficiency.
[0056] 6. Convergence judgment: Repeat the above allocation, optimization and update steps until the clustering results are stable or the set number of iterations is reached, and complete the final clustering division.
[0057] III. Two-level path planning After clustering convergence, a two-layer path planning process is implemented: within each cluster, a density-first greedy search is used to prioritize harvesting fruits from high-density areas; between clusters, an improved ant colony algorithm is employed, combining distance and density information to determine the optimal traversal order for each cluster, generating a globally optimal harvesting path. Finally, the optimal paths within each cluster are connected in the inter-cluster order to form a complete globally optimal harvesting path.
[0058] IV. Output of Vibration Harvesting Area Model By using the center of each cluster as the vibration harvesting point and the distribution range of fruits within the cluster as the vibration operation radius, a vibration harvesting area model for camellia fruit is constructed, providing a precise basis for mechanized zoned vibration harvesting.
[0059] As an application example, this invention collects images of camellia oleifera fruit ripening during 2023-2024, covering various weather, time periods, and lighting conditions. After screening, annotation, and enhancement, a high-quality dataset is constructed. The data is then input into a pre-constructed YOLO-GDC network, which is an improvement on YOLOv11n, incorporating a ghost dynamic convolution module into the backbone network. After detection and recognition, YOLO-GDC outputs bounding boxes and confidence scores, such as... Figure 4 To identify the camellia fruit, the coordinates of the center point of each fruit are calculated, and a spatial point set is constructed. Then, the KMS-SSA clustering optimization module, planning module, and output module execute steps S5-S6, as follows: Figure 5 The image shows the converged spatial distribution map of camellia fruit cluster identification and localization, including three cluster centers: C1, C2, and C3. Finally, step S7 is used to construct the vibration harvesting area model and output the decision, as shown below. Figure 6 The image shown is a rendering of the calculated vibration harvesting area model.
[0060] Compared with existing solutions, this method achieves a detection accuracy of ≥95% in complex scenarios with occlusion and overlap. The model is lightweight, has a shorter path, and more reasonable clustering, fully meeting the actual engineering needs of mechanized vibration harvesting of camellia oleifera fruit.
[0061] The above description is merely an embodiment of the present invention. It should be noted that those skilled in the art can make improvements without departing from the inventive concept of the present invention, but these improvements all fall within the protection scope of the present invention.
Claims
1. A fruit clustering identification and localization method based on deep learning, characterized in that, Includes the following steps: Step S1: Collect fruit images, construct a dataset, and label it; Step S2: Construct a lightweight object detection network YOLO-GDC, incorporating a ghost dynamic convolution module into the backbone network of the object detection network and employing a dynamic upsampling module with a spatially adaptive kernel; Step S3: Use the YOLO-GDC network to detect the input image and output the detection results, which include the bounding box information and confidence score of each fruit; Step S4: Extract the center point coordinates of each fruit from the detection results and construct a two-dimensional spatial point set P = {p1, p2, ..., p...} n }, p n This represents the coordinates of the center point of the nth fruit; Step S5: Employ the KMS-SSA clustering algorithm, which integrates the improved sparrow search algorithm with path-oriented KDE-KMeans, to transform the clustering problem into a combinatorial optimization problem with path constraints. Dynamically calculate the optimal picking path within each cluster and update the cluster centers, generating a clustering result C = {C1, C2, …, C} that balances spatial compactness, fruit density, and the shortest picking path. k }, C k This represents the k-th cluster after clustering is complete; Step S6: Construct a two-layer path planning mechanism of intra-cluster density-first search + inter-cluster improved ant colony traversal to complete the decision on the globally optimal fruit picking path; Step S7: Based on the clustering results, construct a fruit vibration harvesting area model to provide a decision-making basis for zoned vibration harvesting.
2. The method according to claim 1, characterized in that, The construction method of the Ghost dynamic convolution module is as follows: combining Ghost convolution with dynamic convolution, generating more feature maps through linear transformation, and using dynamically perceptive convolution kernel weights to adapt to different input features; the dynamic upsampling module adopts a spatially adaptive kernel, dynamically adjusting the weights of the upsampling kernel according to the spatial position of the input feature map to improve the discrimination ability of occluded and overlapping targets; the loss function of the YOLO-GDC network comprehensively optimizes the bounding box coordinates, confidence and classification probability, treating target detection as a regression problem, and directly predicting the probability and coordinates of the bounding box on the input image.
3. The method according to claim 1, characterized in that, The formula for extracting the center point coordinates in step S4 is as follows: For each detected fruit bounding box (x, y, w, h), its center point coordinates are (x + w / 2, y + h / 2), where x and y represent the horizontal and vertical coordinates of the upper left corner of the bounding box, respectively, and w and h represent the width and height of the bounding box, respectively.
4. The method according to claim 1, characterized in that, The KMS-SSA clustering algorithm described in step S5 includes: (1) Calculate the local density of the fruit based on kernel density estimation (KDE), and select the K points with the highest density peaks as the initial cluster centers; (2) Sample allocation was completed using kernel density-weighted comprehensive distance; (3) Calculate the optimal picking path within each cluster using the improved sparrow search algorithm; (4) Construct a three-objective optimization function that integrates intra-cluster compactness, intra-cluster average density, and intra-cluster path length; (5) The cluster center is updated by weighting the traditional centroid, density center, and sparrow optimal node; (6) After iteration to convergence, global path planning between clusters is completed by improving the ant colony algorithm.
5. The method according to claim 4, characterized in that, The formula for the density-weighted composite distance is: D(p i ,c j )=α d_space (p i ,c j )+β d_density (p i ,c j )+(1 α β) d_path (p i ,c j Where α is the spatial distance weight, β is the density weight, d_space is the Euclidean distance, d_density is the kernel density difference distance, d_path is the path cost, and p i Let c be the coordinates of the center point of the i-th camellia fruit. j Let be the coordinates of the center of the j-th cluster.
6. The method according to claim 4, characterized in that, The three-objective optimization function is: J_new=∑(ω1) S j + ω2 ρ j + ω3 L j ), where S j For cluster compactness, ρ j L represents the average fruit density within the cluster. j ω1 is the optimal path length for the improved sparrow algorithm within the cluster, ω2 is the average density weight within the cluster, and ω3 is the path length weight within the cluster.
7. The method according to claim 4, characterized in that, The cluster center update formula is: c j _new=η j +λ p_density+(1 η λ) p_sparrow_best, where j p is the traditional centroid, p_density is the density center within the cluster, p_sparrow_best is the optimal node of the improved sparrow path, η is the weight of the traditional centroid, and λ is the weight of the density center within the cluster.
8. The method according to claim 1, characterized in that, The two-layer path planning mechanism described in step S6 is as follows: within a cluster, a density-first greedy search strategy is adopted, and between clusters, an improved ant colony algorithm that integrates distance and density information is used to determine the optimal traversal order.
9. The method according to claim 1, characterized in that, It also includes step S8: based on the vibration harvesting area model and the global optimal harvesting path, plan the working trajectory, movement sequence and vibration parameters of the vibration harvesting head.
10. A fruit clustering recognition and localization system based on deep learning, characterized in that, It includes an image acquisition module, an identification and positioning module, a coordinate extraction module, a KMS-SSA clustering optimization module, a two-layer path planning module, and an output module connected in sequence; the modules cooperate with each other to perform the method described in any one of claims 1-9.