Green pepper fruit sequence detection method based on adaptive density clustering

Through the detection method based on adaptive density clustering, the problem of insufficient detection accuracy and robustness of the order of the green and green pepper fruit in the prior art is solved, and the accurate and efficient detection of the order of the green and green pepper fruit is achieved, reducing the detection cost.

CN116030274BActive Publication Date: 2025-04-25CHONGQING NORMAL UNIVERSITY +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211163387.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-23
Publication Date
2025-04-25
Estimated Expiration
2042-09-23

AI Technical Summary

Technical Problem

The existing method of blue and white pepper fruit sequence detection has poor detection accuracy and insufficient robustness, resulting in low efficiency and high cost in the early stage of blue and white pepper fruit setting.

Method used

The detection method based on adaptive density clustering is used, and the fruit dot map of blue and white pepper is clustered through HOG feature extraction, direction-intensity joint feature map fusion, mean filtering and adaptive density clustering algorithm to obtain the fruit order of blue and white pepper.

Benefits of technology

Accurate detection of the order of green and white pepper fruit is achieved, the detection accuracy and efficiency are improved, the cost of manual detection is reduced, and the cost is good robustness is achieved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure QLYQS_1
    Figure QLYQS_1
  • Figure QLYQS_2
    Figure QLYQS_2
  • Figure QLYQS_3
    Figure QLYQS_3
Patent Text Reader

Abstract

The invention provides a method for detecting a fruit sequence of Zanthoxylum bungeanum based on adaptive density clustering, comprising the following steps: collecting image information of Zanthoxylum bungeanum, dividing the image information of Zanthoxylum bungeanum into a plurality of unit areas, extracting HOG features from each unit area, and obtaining a HOG feature map; determining a direction-intensity joint feature map I based on the HOG feature map; performing plant region segmentation on an original Zanthoxylum bungeanum image by using an ExGR index, extracting a green plant region, and marking the green plant region to obtain a marking matrix PM; fusing the direction-intensity joint feature map I and the green plant region matrix PM to obtain a fused feature map F; performing mean filtering on the fused feature map F, and extracting a fruit grain point map of Zanthoxylum bungeanum from the filtered fused feature map F; performing clustering processing on the fruit grain point map by using an adaptive density clustering algorithm, and obtaining a fruit sequence of Zanthoxylum bungeanum; through the above method, the fruit sequence of Zanthoxylum bungeanum can be accurately detected, thereby providing accurate data support for the estimation of Zanthoxylum bungeanum yield.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to an image detection method, in particular to a green pepper fruit sequence detection method based on adaptive density clustering. Background Art

[0002] The detection of the number of inflorescences in the early stage of fruit setting of green pepper is a necessary preliminary step for estimating the yield of pepper. In the existing technology, manual detection is generally used for the detection of the number of inflorescences of green pepper. This monitoring method has high labor costs and low efficiency. With the development of technology, it is possible to detect the inflorescences of green pepper using machine vision, but there are few related studies. Existing clustering algorithms such as DBSCAN, OPTICS and ADPC-kNN have been proposed, which can be used for inflorescence detection of green pepper image information. However, the above algorithms have the following two defects: First, the detection accuracy is poor. If the accuracy is to be improved, the algorithm itself needs to be complicatedly improved, thereby reducing the efficiency. Second, the robustness is poor.

[0003] Therefore, in order to solve the above technical problems, it is urgent to propose a new technical means to solve them. Summary of the invention

[0004] In view of this, the purpose of the present invention is to provide a green pepper infructescence detection method based on adaptive density clustering, which can accurately detect the infructescence of green pepper, thereby providing accurate data support for the estimation of pepper yield, and the whole algorithm is simpler than the existing algorithm, more efficient, and has good robustness.

[0005] The invention provides a method for detecting the infructescence of Zanthoxylum bungeanum based on adaptive density clustering, comprising the following steps:

[0006] S1. Collecting green pepper image information, dividing the green pepper image into multiple unit areas, and extracting HOG features from each unit area to obtain a HOG feature map;

[0007] S2. Determine the direction-intensity joint feature map I based on the HOG feature map;

[0008] S3. Use the ExGR index to segment the green pepper image into plant regions, extract the green plant regions, and mark the green plant regions to obtain the marking matrix PM;

[0009] S4. Fusing the direction-intensity joint feature map I and the green plant region matrix to obtain a fused feature map F;

[0010] S5. Perform mean filtering on the fused feature map F, and extract the fruit point map of green pepper from the filtered fused feature map F;

[0011] S6. Adopt adaptive density clustering algorithm to cluster the fruit point map and obtain the fruit sequence of green pepper.

[0012] Further, step S2 specifically includes:

[0013] Binarize the HOG feature map:

[0014] I HOG '=sign(I HOG )

[0015]

[0016] Where: I HOG is the HOG feature map, I HOG ' is the feature map after binarization, threshold is the gray intensity threshold;

[0017] Calculate the gradient intensity area ratio I of the i-th unit area i :

[0018] Among them, cell i Represents the i-th unit area; cell j represents the jth cell area, x and y represent the cell area i and cell j Elements of

[0019] The gradient intensity area ratio I i If the ratio is greater than the ratio threshold ratio_th, it is set to 1, and the gradient intensity area ratio I i If the value is less than or equal to the ratio threshold ratio_th, it is set to 0;

[0020] Construct direction strength joint feature map I:

[0021] Among them, the value of each element of the direction-intensity joint feature map I is calculated according to the gradient intensity area ratio I i Whether it is greater than the ratio threshold ratio_th is determined, and m and n respectively represent the number of rows and columns of the unit area into which the original image information of the green pepper is divided.

[0022] Further, step S3 specifically includes:

[0023] Calculate the ExGR indicator:

[0024] ExGR=ExG-ExR

[0025] =(2g-rb)-(1.4rg)

[0026] =3g-2.4rb

[0027]

[0028]

[0029] Among them, r, g and b are normalized chromaticity channel values; R * , G * and B * are the normalized three-channel grayscale values, R, G, and B are the grayscale values ​​of each pixel;

[0030] The trough value in the ExGR indicator histogram is determined, and the trough value is used as the threshold. The area greater than the threshold is marked as the green plant area, and the area less than the threshold is marked as the non-green plant area, forming a green plant area matrix PM.

[0031] Further, step S4 specifically includes:

[0032] Upsampling the direction-intensity joint feature map I to obtain an upsampled direction-intensity joint feature map I';

[0033] Determine the fusion feature map F:

[0034] Among them: ⊙ represents the Hadamard product.

[0035] Further, step S5 specifically includes:

[0036] Define the sub-block f of the feature fusion graph F x,y :

[0037] L represents the size of the sub-block;

[0038] Take sub-block f x,y As a unit, the fusion feature map is mean filtered with the size of the unit area as the step size;

[0039] The unit area with a plant area ratio greater than the set threshold is regarded as a plant unit, and the sub-block is marked as 1, otherwise the sub-block is marked as 0; and the label values ​​of the sub-blocks constitute the output fusion feature map F', and the output fusion feature map F' is the fruit grain point map, where:

[0040]

[0041] Further, step S6 specifically includes:

[0042] Perform coarse clustering on the fruit grain point map:

[0043] S61. Determine the local density of the fruit particle point map: divide the fruit particle point map into multiple grids and distribute the fruit particle points at the intersection of the grids, and define the density ρ(x, y) at the fruit particle point (x, y):

[0044]

[0045] Θ is the selected neighborhood direction, den(x,y,θ) is the density of the fruit point (x,y) in the θ direction;

[0046] S62. Traverse the points in the θ direction and perform weighted accumulation of the eigenvalues ​​on the path points until the boundary is reached or the eigenvalue is 0, and the iteration stops. The density of the qth iteration is den(x, y, θ). (q) :

[0047]

[0048] in: g(q) is the Gaussian weighting function, a, b and c are coefficients, f travel The eigenvalue of the fruit point (x, y) is calculated as follows:

[0049]

[0050] in:

[0051]

[0052] γ is the weighting coefficient, △x and △y represent the coordinate changes, and Represents rounding down and rounding up respectively;

[0053] S63. Calculate the characteristic value FW (cell i) corresponding to the fruit point (x, y) i ):

[0054] Where cell_size represents the size of the cell area, χ(x) is an indicator function, which takes the value of 1 when x is 255, otherwise it takes the value of 0;

[0055] S64. Density ρ(x,y) and eigenvalue FW(cell i ) performs Hadamard product operation to obtain a characteristic density map, finds the maximum point in the characteristic density map, and uses the density maximum point as the cluster center;

[0056] S65. Number the cluster centers in order to form clusters, and assign the fruit points to the clusters;

[0057] S66. merging clusters with the same fruit grain points in each cluster;

[0058] Optimize clustering of clusters:

[0059] S67. Calculate the optimized clustering index LCH of any two clusters:

[0060]

[0061] Where: p and q represent the numbers of the two clusters to be merged, k is the number of clusters, and N represents the number of all fruit grains. k ′ is the intra-cluster divergence matrix, B k is the inter-cluster divergence matrix, T r (W k ′) and T r (B k ) represent the intra-cluster divergence matrix W k ′ and the inter-cluster divergence matrix B k traces;

[0062] S68. Find the maximum value of the optimized clustering index LCH of any two clusters, merge the two clusters corresponding to the maximum value, and then return to step S67 until two clusters remain;

[0063] S69. Calculate the silhouette coefficient S(i) each time cluster merging is performed:

[0064]

[0065] Where: S(i) represents the silhouette coefficient of the i-th fruit point, b(i) represents the average distance between the i-th fruit point and all fruit points in the nearest neighboring cluster to which the i-th fruit point belongs; a(i) represents the average distance between the i-th fruit point and other fruit points in the cluster to which it belongs;

[0066] Calculate the mean value of the silhouette coefficient SC(t) of all fruit grain points:

[0067]

[0068] S610. Find the maximum value of the mean value of the silhouette coefficient SC(t) each time the clusters are merged, and use the result of the cluster merging corresponding to the maximum value of the mean value of the silhouette coefficient SC(t) as the optimal clustering result, and use the number of clusters of the optimal clustering result as the number of fruit sequences of green pepper.

[0069] Further, in step S65, each fruit particle point is assigned to each cluster as follows:

[0070] Find other fruit grain points in the neighborhood of the current fruit grain point within the set distance range;

[0071] Determine the clusters to which other fruit grain points in the neighborhood of the current fruit grain point within a set distance range belong;

[0072] And the current fruit point is simultaneously assigned to the cluster to which other fruit points belong.

[0073] The beneficial effects of the present invention are as follows: through the present invention, the infructescence of green pepper can be accurately detected, thereby providing accurate data support for the estimation of pepper yield, and the entire algorithm is simpler than the existing algorithm, more efficient, and has good robustness. BRIEF DESCRIPTION OF THE DRAWINGS

[0074] The present invention will be further described below in conjunction with the accompanying drawings and embodiments:

[0075] Figure 1 It is a flow chart of the present invention.

[0076] Figure 2 It is a schematic diagram of particle distribution coordinates after feature fusion in the present invention.

[0077] Figure 3 It is a neighborhood distribution schematic diagram of the local density calculation formula of the present invention.

[0078] Figure 4 This is a trend diagram of the silhouette coefficient change during the cluster merging process of LCH.

[0079] Figure 5 Schematic diagram of the ExGR indicator histogram. DETAILED DESCRIPTION

[0080] The present invention is further described in detail below:

[0081] The invention provides a method for detecting the infructescence of Zanthoxylum bungeanum based on adaptive density clustering, comprising the following steps:

[0082] S1. Collecting green pepper image information, dividing the green pepper image into multiple unit areas, and extracting HOG features from each unit area to obtain a HOG feature map;

[0083] S2. Determine the direction-intensity joint feature map I based on the HOG feature map;

[0084] S3. Use the ExGR index to segment the green pepper image into plant regions, extract the green plant regions, and mark the green plant regions to obtain the marking matrix PM;

[0085] S4. Fusing the direction-intensity joint feature map I and the green plant region matrix to obtain a fused feature map F;

[0086] S5. Perform mean filtering on the fused feature map F, and extract the fruit point map of green pepper from the filtered fused feature map F;

[0087] S6. An adaptive density clustering algorithm is used to cluster the fruit point map to obtain the fruit sequence of green pepper. Through the above method, the fruit sequence of green pepper can be accurately detected, thereby providing accurate data support for the estimation of pepper yield. Moreover, the entire algorithm is simpler than the existing algorithm, more efficient, and has good robustness.

[0088] In this embodiment, step S2 specifically includes:

[0089] Binarize the HOG feature map:

[0090] I HOG '=sign(I HOG )

[0091]

[0092] Where: I HOG is the HOG feature map, I HOG ' is the feature map after binarization, threshold is the gray intensity threshold;

[0093] Calculate the gradient intensity area ratio I of the i-th unit area i :

[0094] Among them, cell i Represents the i-th unit area; cell j represents the jth cell area, x and y represent the cell area i and cell j Elements of

[0095] The gradient intensity area ratio I i If the ratio is greater than the ratio threshold ratio_th, it is set to 1, and the gradient intensity area ratio I i If the value is less than or equal to the ratio threshold ratio_th, it is set to 0;

[0096] Construct direction strength joint feature map I:

[0097] Among them, the value of each element of the direction-intensity joint feature map I is calculated according to the gradient intensity area ratio I i Whether it is greater than the ratio threshold ratio_th is determined, for example: I 1,1 The gradient intensity area ratio I i is greater than the threshold ratio_th, then I 1,1 The value of is 1, otherwise, the value is 0; m and n represent the number of rows and columns of the unit area into which the original image information of the green pepper is divided, that is, the original image is divided into m×n unit areas.

[0098] In this embodiment, step S3 specifically includes:

[0099] Calculate the ExGR indicator:

[0100] ExGR=ExG-ExR

[0101] =(2g-rb)-(1.4rg)

[0102] =3g-2.4rb

[0103]

[0104]

[0105] Among them, r, g and b are normalized chromaticity channel values; R * , G * and B * are the normalized three-channel grayscale values, R, G, and B are the grayscale values ​​of each pixel;

[0106] Determine the trough value in the ExGR indicator histogram, use the trough value as the threshold, mark the area greater than the threshold as the green plant area, and mark the area less than the threshold as the non-green plant area, forming a green plant area matrix PM, specifically: extract the grayscale point in the peak set of the ExGR indicator histogram and the frequency of the point in the original component histogram to form a new sub-histogram, perform Gaussian smoothing on the new sub-histogram, and iterate repeatedly until each new sub-histogram has two peak points remaining. Obtain two main peak points {L1, L2} of the histogram respectively;

[0107] Then, when the area greater than the trough value forms a green plant area, it is marked as 1, indicating a plant area, otherwise it is marked as 0, indicating a non-plant area, and then these marked values ​​are combined into a matrix PM.

[0108] In this embodiment, step S4 specifically includes:

[0109] The direction-intensity joint feature map I is upsampled to obtain an upsampled direction-intensity joint feature map I'; wherein:

[0110]

[0111] Each element in I' is a sub-matrix block I x,y ′, the sub-matrix block is obtained by upsampling I according to the size of L×L:

[0112]

[0113] Determine the fusion feature map F:

[0114] Among them: ⊙ represents the Hadamard product.

[0115] In this embodiment, step S5 specifically includes:

[0116] Define the sub-block f of the feature fusion graph F x,y That is, downsampling F yields:

[0117] L represents the size of the sub-block;

[0118] Take sub-block f x,y As a unit, the fusion feature map is mean filtered with the size of the unit area as the step size;

[0119] The unit area with a plant area ratio greater than the set threshold is regarded as a plant unit, and the sub-block is marked as 1, otherwise the sub-block is marked as 0; and the label values ​​of the sub-blocks constitute the output fusion feature map F', and the output fusion feature map F' is the fruit grain point map, where:

[0120]

[0121] In this embodiment, step S6 specifically includes:

[0122] Perform coarse clustering on the fruit grain point map:

[0123] S61. Determine the local density of the fruit particle point map: divide the fruit particle point map into multiple grids and distribute the fruit particle points at the intersection of the grids, and define the density ρ(x, y) at the fruit particle point (x, y):

[0124]

[0125] Θ is the selected neighborhood direction, den(x,y,θ) is the density of the fruit point (x,y) in the θ direction;

[0126] S62. Traverse the points in the θ direction and perform weighted accumulation of the eigenvalues ​​on the path points until the boundary is reached or the eigenvalue is 0, and the iteration stops. The density of the qth iteration is den(x, y, θ). (q) :

[0127]

[0128] in: g(q) is the Gaussian weighting function, a, b and c are coefficients, f travel The eigenvalue of the fruit point (x, y) is calculated as follows:

[0129]

[0130] in:

[0131]

[0132] γ is the weighting coefficient, △x and △y represent the coordinate changes, and Represents rounding down and rounding up respectively;

[0133] S63. Calculate the characteristic value FW (cell i) corresponding to the fruit point (x, y) i ):

[0134] Where cell_size represents the size of the cell area, χ(x) is an indicator function, which takes the value of 1 when x is 255, otherwise it takes the value of 0;

[0135] S64. Density ρ(x,y) and eigenvalue FW(cell i ) performs Hadamard product operation to obtain a characteristic density map, finds the maximum point in the characteristic density map, and uses the density maximum point as the cluster center;

[0136] S65. The cluster centers are numbered in sequence to form clusters, and the fruit grain points are assigned to the clusters; specifically:

[0137] Find other fruit grain points in the neighborhood of the current fruit grain point within the set distance range;

[0138] Determine the clusters to which other fruit grain points in the neighborhood of the current fruit grain point within a set distance range belong;

[0139] And the current fruit point is simultaneously assigned to the cluster to which other fruit points belong.

[0140] For example: if there are fruit points A and B in the neighborhood within the set distance range of a cluster center 1, then these two fruit points are assigned to the cluster of cluster center 1; and there are two fruit points B and C in the neighborhood of cluster center 2, then B and C are both assigned to cluster center 2; then for fruit point E, there are two fruit points A and C in its neighborhood, then at this time, fruit point E is simultaneously assigned to the clusters of cluster center 1 and cluster center 2; follow the above steps to traverse all fruit points to complete the assignment.

[0141] In the above clustering, there are two situations: the first is that a fruit point is assigned to multiple clusters at the same time, and the second is that a fruit point has no other fruit points in the neighborhood, that is, it cannot be assigned to any cluster. In this case, the fruit point is an abnormal point and is removed. For the first case, the next step is used for processing;

[0142] S66. The clusters with the same fruit grain points in each cluster are merged. For example, if the cluster described in cluster center 1 and the cluster to which cluster center 2 belongs have an intersection, that is, the two cluster centers have the same fruit grain points at the same time, then the two clusters are merged;

[0143] Optimize clustering of clusters:

[0144] S67. Calculate the optimized clustering index LCH of any two clusters:

[0145]

[0146] Where: p and q represent the numbers of the two clusters to be merged, k is the number of clusters, and N represents the number of all fruit grains. k ′ is the intra-cluster divergence matrix, B k is the inter-cluster divergence matrix, T r (W k ′) and T r (B k ) represent the intra-cluster divergence matrix W k ′ and the inter-cluster divergence matrix B k traces;

[0147] S68. Find the maximum value of the optimized clustering index LCH of any two clusters, merge the two clusters corresponding to the maximum value, and then return to step S67 until two clusters remain;

[0148] S69. Calculate the silhouette coefficient S(i) each time cluster merging is performed:

[0149]

[0150] Where: S(i) represents the silhouette coefficient of the ith fruit point, b(i) represents the average distance between the ith fruit point and all fruit points in the nearest adjacent cluster to which the ith fruit point belongs; a(i) represents the average distance between the ith fruit point and other fruit points in the cluster to which it belongs; the distances mentioned above all refer to Euclidean distances;

[0151] Calculate the mean value of the silhouette coefficient SC(t) of all fruit grain points:

[0152]

[0153] S610. Find the maximum value of the mean value of the silhouette coefficient SC(t) each time the clusters are merged, and use the result of the cluster merging corresponding to the maximum value of the mean value of the silhouette coefficient SC(t) as the optimal clustering result, and use the number of clusters of the optimal clustering result as the number of fruit sequences of green pepper. For example: after rough clustering, optimization clustering is performed for a total of 20 times. Through calculation, it is found that the mean value of the silhouette coefficient is the largest during the 9th clustering among these 20 times. Then the number of clusters obtained after the 9th optimization clustering is completed is the number of fruit sequences. Then the positions of these clusters are matched to the original image, and the fruit sequences of the original image can be marked.

[0154] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the purpose and scope of the technical solution of the present invention, which should be included in the scope of the claims of the present invention.

Claims

1. A method for detecting the fruit sequence of Zanthoxylum bungeanum based on adaptive density clustering, characterized in that: The following steps are involved: S1. Collecting green pepper image information, dividing the green pepper image information into multiple unit areas, and extracting HOG features from each unit area to obtain a HOG feature map; S2. Determine the direction-intensity joint feature map I based on the HOG feature map; S3. Use the ExGR index to segment the green pepper image into plant regions, extract the green plant regions, and mark the green plant regions to obtain the marking matrix PM; S4. Fusing the direction-intensity joint feature map I and the green plant region matrix to obtain a fused feature map F; S5. Perform mean filtering on the fused feature map F, and extract the fruit point map of green pepper from the filtered fused feature map F; S6. Adopt adaptive density clustering algorithm to cluster the fruit point map and obtain the fruit sequence of green pepper.

2. The method for detecting the fruit order of Zanthoxylum bungeanum based on adaptive density clustering according to claim 1, characterized in that: Step S2 specifically includes: Binarize the HOG feature map: I HOG '=sign(I HOG ) Where: I HOG is the HOG feature map, I HOG ' is the feature map after binarization, threshold is the gray intensity threshold; Calculate the gradient intensity area ratio I of the i-th unit area i : Among them, cell i Represents the i-th unit area; cell j represents the jth cell area, x and y represent the cell area i and cell j Elements of The gradient intensity area ratio I i If the ratio is greater than the ratio threshold ratio_th, it is set to 1, and the gradient intensity area ratio I i If the value is less than or equal to the ratio threshold ratio_th, it is set to 0; Construct direction strength joint feature map I: Among them, the value of each element of the direction-intensity joint feature map I is calculated according to the gradient intensity area ratio I i Whether it is greater than the ratio threshold ratio_th is determined, and m and n respectively represent the number of rows and columns of the unit area into which the original image information of the green pepper is divided.

3. The method for detecting the fruit order of Zanthoxylum bungeanum based on adaptive density clustering according to claim 2, characterized in that: Step S3 specifically includes: Calculate the ExGR indicator: ExGR=ExG-ExR =(2g-rb)-(1.4rg) =3g-2.4rb Among them, r, g and b are normalized chromaticity channel values; R * , G * and B * are the normalized three-channel grayscale values, R, G, and B are the grayscale values ​​of each pixel; The trough value in the ExGR indicator histogram is determined, and the trough value is used as the threshold. The area greater than the threshold is marked as the green plant area, and the area less than the threshold is marked as the non-green plant area, forming a green plant area matrix PM.

4. The method for detecting the fruit sequence of Zanthoxylum bungeanum based on adaptive density clustering according to claim 3, characterized in that: Step S4 specifically includes: Upsampling the direction-intensity joint feature map I to obtain an upsampled direction-intensity joint feature map I'; Determine the fusion feature map F: Among them: ⊙ represents the Hadamard product.

5. The method for detecting the fruit sequence of Zanthoxylum bungeanum based on adaptive density clustering according to claim 4, characterized in that: Step S5 specifically includes: Define the sub-block f of the feature fusion graph F x,y : L represents the size of the sub-block; Take sub-block f x,y As a unit, the fusion feature map is mean filtered with the size of the unit area as the step size; The unit area with a plant area ratio greater than the set threshold is regarded as a plant unit, and the sub-block is marked as 1, otherwise the sub-block is marked as 0; and the label values ​​of the sub-blocks constitute the output fusion feature map F', and the output fusion feature map F' is the fruit grain point map, where:

6. The method for detecting the fruit sequence of Zanthoxylum bungeanum based on adaptive density clustering according to claim 5, characterized in that: Step S6 specifically includes: Perform coarse clustering on the fruit grain point map: S61. Determine the local density of the fruit particle point map: divide the fruit particle point map into multiple grids and distribute the fruit particle points at the intersection of the grids, and define the density ρ(x, y) at the fruit particle point (x, y): Θ is the selected neighborhood direction, den(x,y,θ) is the density of the fruit point (x,y) in the θ direction; S62. Traverse the points in the θ direction and perform weighted accumulation of the eigenvalues ​​on the path points until the boundary is reached or the eigenvalue is 0. The iteration stops. The density of the qth iteration is den(x, y, θ)( q ): in: g(q) is the Gaussian weighting function, a, b and c are coefficients, f travel The eigenvalue of the fruit point (x, y) is calculated as follows: in: γ is the weighting coefficient, △x and △y represent the coordinate changes, and Represents rounding down and rounding up respectively; S63. Calculate the characteristic value FW (cell i) corresponding to the fruit point (x, y) i ): Where cell_size represents the size of the cell area, χ(x) is an indicator function, which takes the value of 1 when x is 255, otherwise it takes the value of 0; S64. Density ρ(x,y) and eigenvalue FW(cell i ) performs Hadamard product operation to obtain a characteristic density map, finds the maximum point in the characteristic density map, and uses the density maximum point as the cluster center; S65. Number the cluster centers in order to form clusters, and assign the fruit points to the clusters; S66. merging clusters with the same fruit grain points in each cluster; Optimize clustering of clusters: S67. Calculate the optimized clustering index LCH of any two clusters: Where: p and q represent the numbers of the two clusters to be merged, k is the number of clusters, and N represents the number of all fruit grains. k ′ is the intra-cluster divergence matrix, B k is the inter-cluster divergence matrix, T r (W k ′) and T r (B k ) represent the intra-cluster divergence matrix W k ′ and the inter-cluster divergence matrix B k traces; S68. Find the maximum value of the optimized clustering index LCH of any two clusters, merge the two clusters corresponding to the maximum value, and then return to step S67 until two clusters remain; S69. Calculate the silhouette coefficient S(i) each time cluster merging is performed: Where: S(i) represents the silhouette coefficient of the i-th fruit point, b(i) represents the average distance between the i-th fruit point and all fruit points in the nearest neighboring cluster to which the i-th fruit point belongs; a(i) represents the average distance between the i-th fruit point and other fruit points in the cluster to which it belongs; Calculate the mean value of the silhouette coefficient SC(t) of all fruit grain points: S610. Find the maximum value of the mean value of the silhouette coefficient SC(t) each time the clusters are merged, and use the result of the cluster merging corresponding to the maximum value of the mean value of the silhouette coefficient SC(t) as the optimal clustering result, and use the number of clusters of the optimal clustering result as the number of fruit sequences of green pepper.

7. The method for detecting the fruit sequence of Zanthoxylum bungeanum based on adaptive density clustering according to claim 6, characterized in that: In step S65, each fruit particle point is assigned to each cluster as follows: Find other fruit grain points in the neighborhood of the current fruit grain point within the set distance range; Determine the clusters to which other fruit grain points in the neighborhood of the current fruit grain point within a set distance range belong; And the current fruit point is simultaneously assigned to the cluster to which other fruit points belong.