Fruit picking point recognition method based on deep learning and multi-dimensional information fusion clustering
Through deep learning and multi-dimensional information fusion clustering technology, combined with K-means clustering and morphological processing, the problem of insufficient robustness of existing picking point identification methods in complex environments is solved, achieving high accuracy and robustness. Identification of fruit picking points.
Patent Information
- Application Number
- CN202210452246.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-27
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2042-04-27
AI Technical Summary
Existing picking point identification methods are not robust in complex agricultural environments, are susceptible to interference from factors such as fruit maturity, and are difficult to effectively identify fruit stems, resulting in insufficient picking accuracy and robustness.
Using a method based on deep learning and multi-dimensional information fusion clustering, color and depth images are collected through a depth camera, combined with K-means clustering algorithm and morphological processing, to adaptively adjust the weight of depth information to identify the target class and background of fruits and branches. Class, pinpoint the picking point.
It improves the accuracy and robustness of picking point identification, reduces the impact of interference, ensures the success rate of fruit picking and reduces the fruit damage rate, and adapts to different picking environments.
Smart Images

Figure CN114842337B
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of robotic agricultural picking, and in particular relates to a method for identifying fruit picking points based on deep learning and multi-dimensional information fusion clustering, which is suitable for scenarios in which picking robots in plant factories or plant greenhouses pick fruits by cutting stems. Background Art
[0002] Agriculture, as a basic industry of the national economy, is being reconstructed and upgraded by new technologies such as the Internet, big data, and artificial intelligence. Artificial intelligence has become an important direction for the development of agricultural modernization. Agricultural mechanization is the foundation for building modern agriculture. The emergence of agricultural robots has given agricultural mechanization a new way to achieve it, and is an inevitable product of the development of robotics and artificial intelligence technologies. Picking operations are highly seasonal, labor-intensive, and expensive, so ensuring that fruits are harvested in time and reducing harvesting costs are important ways to increase agricultural income. Due to the complexity of picking operations, the degree of picking automation is still very low. The increase in labor costs has led to a significant increase in the cost of picking fruits and vegetables, and picking robots have gradually become a research hotspot.
[0003] As a kind of intelligent agricultural equipment, the picking robot not only integrates advanced technologies such as robots, sensors and control, but also needs to adapt to complex agricultural scenes. Therefore, its development and research has high technical difficulty. At present, the technical bottlenecks that restrict the performance improvement of picking robots are mainly concentrated in target recognition, positioning and control. The picking robot mainly recognizes and locates the target through the visual system, and then transmits the information to the actuator, which completes the picking task. The speed, accuracy, robustness of the visual system recognition and the adaptability to the picking environment have a great impact on the robot's work efficiency and working time. In the existing picking point recognition research, such as the patent publication number CN112861654A "A method for obtaining the location information of the famous tea picking point based on machine vision", although the patent uses the OSTU algorithm to segment the image of the region of interest in the HSV color space, this method cannot screen the color components that are effective for image segmentation, and does not consider the beneficial segmentation effect caused by reducing interference by using depth information, and is only suitable for ideal picking environments. Therefore, it is necessary to design a fruit picking point recognition algorithm to improve the accuracy and robustness of recognition to cope with complex agricultural picking environments. Summary of the invention
[0004] In order to overcome the problem that the existing picking point recognition methods are not robust and are easily interfered by factors such as fruit maturity, the present invention proposes a fruit picking point recognition method based on deep learning and multidimensional information fusion clustering from the aspects of improving the accuracy and robustness of picking point recognition.
[0005] The fruit picking point recognition method is applicable to the scenario where an agricultural picking robot picks fruits by cutting the fruit stems, that is, the fruit picking point is set at the fruit stems. The agricultural picking robot adopts a six-degree-of-freedom robotic arm, which is installed on a movable wheeled robot platform, and a depth camera is installed at the end of the robotic arm. The picking method of cutting the fruit stems requires accurate identification and positioning of the fruit stems. Improving the accuracy of fruit picking point recognition will increase the success rate of fruit picking and reduce the damage rate of the fruit. The picking environment should have good lighting conditions, and the brightness V∈[50,255] of the fruit picking area is required to meet the lighting conditions.
[0006] Due to the complex picking environment, direct identification of fruit stalks may result in the target fruit and the identified fruit stalk not belonging to the same plant body, and there are interferences from factors such as fruit stalks, branch stems, and main stems of other fruits in the environment, making it difficult to directly identify the fruit stalk. Therefore, the present invention selects the target fruit to be picked first, and then identifies the picking point of interest area corresponding to the target fruit to be picked.
[0007] The specific technical solution of the present invention is: a fruit picking point identification method based on deep learning and multi-dimensional information fusion clustering, comprising the following steps:
[0008] Step 1: The picking robot selects the target fruit to be picked;
[0009] After the picking robot arrives at the picking position, the depth camera collects images of the target picking area, including color images and depth images; selects the fruit with the highest confidence in the color image as the target picking fruit; obtains the coordinates of the target picking fruit recognition frame, where the upper left corner coordinate is (x min ,y min ), the coordinate of the lower right corner is (x max ,y max );
[0010] Step 2: Obtain the area of interest of the fruit picking point;
[0011] According to the coordinates of the recognition box in step 1, calculate the width w of the target fruit in the captured image object , height h object ; Set the width w of the ROI of the picking point ROI , height h ROI ; and the coordinates of the upper left corner of the ROI of the picking point to ensure that the entire fruit stalk structure is covered;
[0012] Step 3: Preprocess the depth image to remove noise and retain edges;
[0013] Step 4: Cluster the multi-dimensional information of the picking point area of interest, and realize that fruits and branches are used as target classes, and leaves and blank areas are used as background classes; in the clustering process:
[0014] Step 4.1: Take the pixels in the area of interest of the picking point as the cluster data sample X, which contains N objects X = {X1, X2, X3, ... X N}, where N is the number of pixels in the area of interest of the picking point; select the color space and segment the effective color components of the color image; each object has a multi-dimensional attribute of multiple effective color components and grayscale information of the depth image; in the color histogram of the effective color component, the target class and the background class present a bimodal distribution;
[0015] Step 4.2, defining the depth information adaptive weight coefficient λ, λ can achieve adaptive adjustment according to the different fruit picking environments and the different degrees of reliance on depth information when segmenting the region of interest;
[0016] Step 4.3, using the K-means based clustering algorithm, combined with the depth information multiplied by the adaptive weight coefficient λ, to obtain the clustering result;
[0017] Step 4.4, define a single-channel image with the same size as the picking point interest area to receive the clustering results. At this time, the pixels in the image have been divided into two categories, and the clustering result map is converted into a binary image;
[0018] Step 5: Perform morphological processing on the binary image to obtain a refined image;
[0019] Step 6: Traverse the pixel points of the refined image to find the upper and lower endpoints of the fruit stalk; determine the coordinates of the picking point in the picking point area of interest, and then convert the coordinates to the position of the initial color image; read the depth camera internal parameters to calculate the depth value z of the point; based on the coordinate transformation relationship obtained by hand-eye calibration, finally obtain the fruit picking point (x, y, z) in the robot arm base coordinate system.
[0020] Furthermore, in step 1, the Yolo algorithm is used to identify fruits that meet the maturity requirements in the color image of the picking area, and the coordinates of the identification frame are obtained.
[0021] Furthermore, in step 2, the width w of the target fruit to be picked in the collected image is object , height h object As shown in formula (1) and (2):
[0022] w object =x max -x min (1)
[0023] h object =y max -y min (2)
[0024] According to the growth form of the fruit, set the appropriate size of the ROI at the picking point to ensure that the ROI can contain the complete fruit stalk and that the target class pixel area in step 4 is smaller than the background class pixel area;
[0025] Set the width w of the ROI of the picking point ROI , height h ROI As shown in formula (3) and (4):
[0026] w ROI =g1*w object (3)
[0027] h ROI =g2*h object (4)
[0028] Where g1, g2 are constants;
[0029] The picking point region of interest is set at the upper area of the target fruit to be picked. If it exceeds the image boundary, the boundary of the region of interest is set at the boundary of the initial acquisition image.
[0030] Furthermore, step 3 preprocesses the depth image, which specifically includes the following steps:
[0031] Step 3.1: Using the hole filling algorithm, first obtain the pixel values of the four adjacent directions of the missing data pixel, select the maximum grayscale value among the four pixels, and assign it to the missing data pixel.
[0032] Step 3.2: Perform spatial edge-preserving filtering on the depth image; the spatial edge-preserving filter adopts a bilateral filter.
[0033] Furthermore, in step 4.1, the attribute dimension M∈[2,4] is defined, that is, the attribute includes the depth information of the object and 1-3 valid color components.
[0034] Define that there are n valid color components, where n∈[1,3],n∈N * . Then the attribute dimension M = n + 1;
[0035] The grayscale information of n effective color components and depth image is normalized as shown in equations (5) and (6);
[0036] s p =S p / 255 p=1,…,n (5)
[0037] d=D / 65535 (6)
[0038] Where S p represents the pth valid color component and Sp ∈[0,255], D∈[0,65535], s p ,d∈[0,1].
[0039] Furthermore, the calculation method of the depth information adaptive weight coefficient λ in step 4.2 is:
[0040] In the color histogram of the color component, the target class and the background class present a standard bimodal distribution, that is, two high-frequency areas are separated by a low-frequency area; in the color histogram of the color component, the gray value L with the lowest frequency in the low-frequency area is obtained, and its value range is (0,255);
[0041] Select the gray value interval U1, U2; U1, U2 should meet the following three conditions at the same time:
[0042] (1) The length of the interval U1 and U2 is min(L,255-L);
[0043] (2)
[0044] (3) U1 has the largest number of pixels in the interval, and U2 has the largest number of pixels under condition (2);
[0045] The center points μ1 and μ2 of the two intervals U1 and U2 are the expectation of the bimodal distribution after being regarded as two Gaussian distributions f1(x) and f2(x);
[0046] Since Gaussian fitting is time-consuming, the following method is used to roughly obtain the expectations of Gaussian distribution f1(x) and f2(x).
[0047] The pixel gray value aggregation degree Δ is defined as shown in formula (7):
[0048]
[0049] Among them, N1 and N2 are the number of pixels in the U1 and U2 regions, and N is the number of pixels in the region of interest;
[0050] The adaptive weight coefficient λ is shown in formula (8);
[0051]
[0052] Where k1, k2 are constants, 0.3<λ<2.3.
[0053] Furthermore, the K-means-based clustering algorithm described in step 4.3 includes one of K-means++, Mini-BatchK-Means, and Kernel K-means.
[0054] Furthermore, step 4.3 uses the K-means++ clustering algorithm. The specific steps are as follows:
[0055] Step 4.3.1, select two initial cluster center points;
[0056] Select a center point C1 from the random uniform distribution of the data sample; then determine another center point C2;
[0057] Define the Euclidean distance F(X) between two objects X i ,X j ), each object has multiple dimension attributes. Define the attribute dimension M∈[2,4], that is, the attribute contains the depth information of the object and 1-3 valid color components.
[0058] Map the data samples to the space of corresponding dimensions, that is, the position of each object in the space is (s1,…,s n ,λd); two samples X i ,X j The Euclidean distance F(X i ,X j ) is defined as shown in formula (9);
[0059]
[0060] where s pi ,s pj They are samples X i , X j The pth color component value of d i , d j They are samples X i , X j The depth value of
[0061] Select P(X i ) takes the object X with the maximum value as the second cluster center, P(X i ) as shown in formula (10);
[0062]
[0063] Where F(X i ,C1) is the object X i The Euclidean distance from the selected cluster center C1;
[0064] Step 4.3.2, calculate the Euclidean distance F(X) from each object to the cluster centers C1 and C2 i ,C j ), compare the distances of each object to the cluster centers C1 and C2 in turn, assign the object to the cluster with the closest cluster center, and obtain two clusters {S1, S2};
[0065] Step 4.3.3, when all objects are assigned to clusters, the N pixels are divided into two clusters, S1 and S2; calculate the mean of the objects in the cluster in M dimensions and set it as the new cluster center C l ; New cluster center C l As shown in formula (11);
[0066]
[0067] Among them, C l represents the lth cluster center, l = 1, 2, count (S l ) represents the number of objects in the lth cluster, X t represents the tth object in the lth cluster, 1≤t≤count(S l );
[0068] Iterate step 4.3.2 and step 4.3.3 until the termination condition is met: the square error J is less than the set minimum square error value MSE or the number of iterations is reached; the square error J is shown in formula (12).
[0069]
[0070] Among them, C l represents the lth cluster center, l = 1, 2, F(X t ,C l ) is the object X t With the selected cluster center point C l The Euclidean distance between l ) represents the number of objects in the lth cluster, X t represents the tth object in the lth cluster, 1≤t≤count(S l ).
[0071] Furthermore, step 5 specifically includes the following steps:
[0072] Step 5.1: Filter out small connected areas of the target class; define the minimum connected domain threshold Threshold, traverse all connected areas in the clustering result map, and if the number of pixels in the connected area n < Threshold, set the grayscale value of the connected area from 255 to 0 and convert it to the background class;
[0073] Step 5.2: Image opening operation; that is, first erosion operation, then dilation operation;
[0074] Step 5.3: Image thinning processing; the thinning algorithm adopts the Zhang-Suen thinning algorithm; through multiple iterations, the pixel points that meet the thinning conditions are corroded, and the connected areas with a width greater than 1 pixel in the target class are converted into a skeleton with a width of 1 pixel to obtain a thinned image.
[0075] Further, step 6 comprises:
[0076] Select the coordinate point with the smallest ordinate in the skeleton (x top ,y top ) is set as the upper end point of the fruit stalk;
[0077] Traverse the pixel points of the thinned image. If the number of pixel points with a grayscale value of 255 among the 8 pixel points around the pixel point is 3 or 4, the pixel point is considered to be a skeleton intersection point. If the number of skeleton intersection points is greater than 1, the pixel point with the horizontal coordinate closest to w is considered to be a skeleton intersection point. ROI / 2 is set as the skeleton intersection point of the fruit stem lower end point (x c ,y c ); At this time, the height of the fruit stalk in the image is shown in formula (13);
[0078] h s =y top -y c (13)
[0079] Assume the position of the picking point in the refined image is (x r ,y r ); Set the picking point at 1 / 2 of the fruit stem length as the picking point, then the ordinate y of the picking point r As shown in formula (14);
[0080] y r =y top +0.5*h s (14)
[0081] Horizontal axis x r Select grayscale value 255 and closest to w ROI / 2 pixel point is used as the picking point;
[0082] The coordinates of the picking point in the picking point area of interest (x r ,y r ), this coordinate needs to be converted to the position of the initial color image; the coordinates of the upper left corner of the fruit stalk area of interest are known to be (x f ,y f ), then the coordinates of the picking point in the color image pixel coordinate system are (x f +x r ,y f +y r), read the internal parameters of the depth camera to calculate the depth value z of the point; according to the coordinate transformation relationship obtained by hand-eye calibration, the fruit picking point (x, y, z) in the base coordinate system of the robotic arm is obtained.
[0083] Beneficial effects of the present invention:
[0084] In a fruit picking point recognition method based on deep learning and multi-dimensional information fusion clustering, the depth image is preprocessed. On the one hand, there are areas in the depth image where the depth data cannot be effectively measured. The pixel points with unknown depth values are assigned values through the hole filling algorithm to eliminate the noise. On the other hand, a spatial edge preservation filter is used to enhance the smoothness of the depth image while retaining the edge information. The sudden change of the depth value of non-edge pixels is reduced to prevent interference during clustering.
[0085] In a fruit picking point recognition method based on deep learning and multi-dimensional information fusion clustering, the color component of the color image and the depth information of the depth image are adaptively fused. After adding the depth information, the interference objects that are close to the actual picking point in the color image but have a large difference in depth value from the actual picking point can be effectively classified as background objects to avoid interference with the recognition of the picking point. In addition, an adaptive depth information weight coefficient λ is introduced to make adaptive adjustments according to the different fruit picking environments and the different degrees of reliance on depth information when segmenting the region of interest.
[0086] In a fruit picking point recognition method based on deep learning and multi-dimensional information fusion clustering, the endpoints of the fruit stalk are determined according to the skeleton intersection points in the refined image to determine the position and length of the fruit stalk. The middle point of the fruit stalk is selected as the fruit picking point, which can avoid damaging the fruit and extend the storage time.
[0087] In summary, the present invention proposes a fruit picking point recognition method based on deep learning and multi-dimensional information fusion clustering. First, the Yolo algorithm identifies the target fruit to be picked, and then determines the picking point interest area of the target fruit to be picked, selects the filtered color components and the pre-processed depth information, and adaptively fuses to form data samples of multiple dimensions. The picking point interest area is clustered based on K-means through the above data samples, and finally, after removing small area connected areas, opening operations, and image refinement in morphological processing, the fruit stalks are accurately recognized, and the fruit picking points are located according to the fruit stalk information. By adopting the above multiple methods for joint recognition, the robustness of the algorithm is improved, and reliable picking point location information is provided for agricultural picking robots. BRIEF DESCRIPTION OF THE DRAWINGS
[0088] Figure 1 This is a flowchart for identifying bell pepper picking points based on deep learning and multi-dimensional information fusion clustering.
[0089] Figure 2 It is a schematic diagram of the area of interest for the bell pepper picking site.
[0090] Figure 3 This is a schematic diagram of the clustering effect of the areas of interest at the bell pepper picking points.
[0091] Figure 4 This is a diagram of bell pepper picking locations.
[0092] Figure 5 This is a picture of a simulated bell pepper picking environment.
[0093] Figure 6 1 is a diagram showing the identification result of the bell pepper picking point in the simulation environment of the embodiment, (a) the result of step 5.2; (b) the result of step 5.3.
[0094] Figure 7 1 is a diagram showing the result of identifying the picking point of bell peppers in a complex environment with additional interference in the embodiment, (a) the result of step 5.2; (b) the result of step 5.3. DETAILED DESCRIPTION
[0095] The present invention will be described in detail below in conjunction with the accompanying drawings.
[0096] The present invention proposes a method for fruit picking point recognition based on deep learning and multi-dimensional information fusion clustering. The method is applied in standardized planting scenes such as plant factories and plant greenhouses to realize the fruit picking operation of agricultural picking robots. The fruit described in the present invention takes sweet pepper as an example to realize the sweet pepper picking point recognition based on deep learning and multi-dimensional information fusion clustering. The sweet pepper picking point recognition flow chart is as follows Figure 1 As shown in the figure, the picking environment should have good lighting conditions, and the brightness V∈[50,255] of the fruit picking area is required to meet the lighting conditions.
[0097] The specific implementation steps are as follows:
[0098] Step 1: The picking robot selects the target pepper to be picked;
[0099] After the picking robot arrives at the picking position, the depth camera collects images of the target picking area, including color images and depth images. In the embodiment, the image size is 1280*720 and is published through the ROS topic. The robot subscribes to the color image topic and uses the Yolo algorithm to identify the peppers that meet the maturity requirements in the color image of the picking area and obtains the coordinates of the recognition frame. The pepper with the highest confidence in the color image is selected as the target pepper to be picked; the coordinates of the target pepper recognition frame are obtained, where the upper left corner coordinate is (x min ,y min ), the coordinate of the lower right corner is (x max ,y max );
[0100] Step 2: Obtain the area of interest of the bell pepper picking point;
[0101] According to the coordinates of the recognition box in step 1, calculate the width w of the target picked bell pepper in the collected image object , height h object ; Set the width w of the ROI of the picking point ROI , height h ROI ; and the coordinates of the upper left corner of the ROI of the picking point to ensure that the entire fruit stalk structure is covered;
[0102] The width w of the target picked bell pepper in the captured image object , height h object As shown in formula (1) and (2):
[0103] w object =x max -x min (1)
[0104] h object =y max -y min (2)
[0105] According to the growth morphology of the sweet pepper, set the appropriate size of the ROI at the picking point to ensure that the ROI can contain the complete fruit stalk and that the target class pixel area in step 4 is smaller than the background class pixel area;
[0106] Set the width w of the ROI of the picking point ROI , height h ROI As shown in formula (3) and (4):
[0107] w ROI =g1*w object (3)
[0108] h ROI =g2*h object (4)
[0109] In the embodiment, g1=0.6, g2=0.6;
[0110] The picking point ROI is set to the area above the target pepper. If it exceeds the image boundary, the ROI boundary is set at the boundary of the initial acquisition image. Figure 2 shown.
[0111] Step 3: Preprocess the depth image to remove noise and retain edges;
[0112] Step 3.1: Using the hole filling algorithm, first obtain the pixel values of the four adjacent directions of the missing data pixel, select the maximum grayscale value among the four pixels, and assign it to the missing data pixel.
[0113] Step 3.2: Perform spatial edge-preserving filtering on the depth image; the spatial edge-preserving filter adopts a bilateral filter.
[0114] Step 4: Cluster the multi-dimensional information of the picking point area of interest, and realize that fruits and branches are used as target classes, and leaves and blank areas are used as background classes; in the clustering process:
[0115] Step 4.1: Take the pixels in the area of interest of the picking point as the cluster data sample X, which contains N objects X = {X1, X2, X3, ... X N}, where N is the number of pixels in the area of interest of the picking point; select the color space and segment the effective color components of the color image; each object has a multi-dimensional attribute of multiple effective color components and grayscale information of the depth image; in the color histogram of the effective color component, the target class and the background class present a bimodal distribution;
[0116] In the embodiment, the saturation (S) component and the brightness (V) component in the HSV color space are selected. Since the dimensions of each component information of the color image and the depth information of the depth image are inconsistent, the saturation (S) component and the brightness (V) component of each object and the grayscale information of the depth image are normalized as shown in equations (5), (6), and (7);
[0117] s=S / 255 (5)
[0118] v=V / 255 (6)
[0119] d=D / 65535 (7)
[0120] Where S,V∈[0,255],D∈[0,65535],s,v,d∈[0,1].
[0121] Step 4.2, defining the depth information adaptive weight coefficient λ, λ can achieve adaptive adjustment according to the different fruit picking environments and the different degrees of reliance on depth information when segmenting the region of interest;
[0122] The calculation method of the depth information adaptive weight coefficient λ is:
[0123] In the color histogram of the color component, the target class and the background class present a standard bimodal distribution, that is, two high-frequency areas are separated by a low-frequency area; in the color histogram of the color component, the gray value L with the lowest frequency in the low-frequency area is obtained, and its value range is (0,255);
[0124] Select the gray value interval U1, U2; U1, U2 should meet the following three conditions at the same time:
[0125] (1) The length of the interval U1 and U2 is min(L,255-L);
[0126] (2)
[0127] (3) U1 has the largest number of pixels in the interval, and U2 has the largest number of pixels under condition (2);
[0128] The center points μ1 and μ2 of the two intervals U1 and U2 are the expectation of the bimodal distribution after being regarded as two Gaussian distributions f1(x) and f2(x);
[0129] Since Gaussian fitting is time-consuming, the following method is used to roughly obtain the expectations of Gaussian distribution f1(x) and f2(x).
[0130] The definition of pixel gray value aggregation degree Δ is as shown in formula (8):
[0131]
[0132] Among them, N1 and N2 are the number of pixels in the U1 and U2 regions, and N is the number of pixels in the area of interest;
[0133] The adaptive weight coefficient λ is shown in formula (9);
[0134]
[0135] In the embodiment, k1 = 1.5, k2 = 3. Therefore, λ∈(0.44, 1.03).
[0136] Step 4.3, using the K-means based clustering algorithm, combined with the depth information multiplied by the adaptive weight coefficient λ, to obtain the clustering result;
[0137] The specific steps of using K-means++ clustering algorithm are as follows:
[0138] Step 4.3.1, select two initial cluster center points;
[0139] Select a center point C1 from the random uniform distribution of the data sample; then determine another center point C2;
[0140] Define the Euclidean distance F(X) between two objects X i ,X j ). Since two effective color components are selected in the embodiment, the attribute dimension is three-dimensional.
[0141] Map the data samples into a three-dimensional space, that is, the position of each object in the three-dimensional space is (s, v, λd); two samples X i ,X j The Euclidean distance F(X i ,X j ) is defined as shown in formula (10);
[0142]
[0143] where s i ,s j They are samples X i , X j The saturation (s) component, v i , v j They are samples X i , X j The lightness (v) component, d i , d j They are samples X i , X j The depth value of
[0144] Select P(X i ) takes the object X with the maximum value as the second cluster center, P(X i ) as shown in formula (11);
[0145]
[0146] Where F(X i ,C1) is the object X i The Euclidean distance from the selected cluster center C1;
[0147] Step 4.3.2, calculate the Euclidean distance F(X) from each object to the cluster centers C1 and C2 i ,C j ), compare the distances of each object to the cluster centers C1 and C2 in turn, assign the object to the cluster with the closest distance to the cluster center, and obtain two clusters {S1, S2};
[0148] Step 4.3.3, when all objects are assigned to clusters, the N pixels are divided into two clusters, S1 and S2; the mean of the objects in the cluster in the three dimensions is calculated and set as the new cluster center C l ; New cluster center C l As shown in formula (12);
[0149]
[0150] Among them, C lrepresents the lth cluster center, l = 1, 2, count (S l ) represents the number of objects in the lth cluster, X t represents the tth object in the lth cluster, 1≤t≤count(S l );
[0151] Iterate step 4.3.2 and step 4.3.3.
[0152] In the embodiment, the termination condition is set as the square error J < 0.01 or the number of iterations reaches 100.
[0153] The square error J is shown in formula (13).
[0154]
[0155] Among them, C l represents the lth cluster center, l = 1, 2, count (S l ) represents the number of objects in the lth cluster, X t represents the tth object in the lth cluster, 1≤t≤count(S l );
[0156] Step 4.4, define a single-channel image of the same size as the ROI of the picking point to receive the clustering results. At this time, the pixels in the image have been divided into two categories, and the clustering result map is converted into a binary image. The schematic diagram of the clustering effect of the ROI of the bell pepper picking point is as follows: Figure 3 As shown;
[0157] Step 5: Perform morphological processing on the binary image to obtain a refined image;
[0158] The specific steps include:
[0159] Step 5.1: Filter out small connected areas of the target class; in the embodiment, the minimum connected domain threshold Threshold=100 is defined, and all connected areas in the clustering result graph are traversed. If the number of pixels in the connected area n<Threshold, the grayscale value of the connected area is set from 255 to 0 and converted to the background class;
[0160] Step 5.2: Image opening operation; that is, first erosion operation, then dilation operation;
[0161] Step 5.3: Image thinning processing; the thinning algorithm adopts the Zhang-Suen thinning algorithm; through multiple iterations, the pixel points that meet the thinning conditions are corroded, and the connected areas with a width greater than 1 pixel in the target class are converted into a skeleton with a width of 1 pixel to obtain a thinned image.
[0162] Step 6: Determine the pepper picking point (x, y, z);
[0163] First, obtain the vertical coordinate range of the fruit stalk skeleton. Select the coordinate point with the smallest vertical coordinate in the skeleton (x top ,y top ) is set as the upper end point of the fruit stalk;
[0164] Traverse the pixel points of the thinned image. If the number of pixel points with a grayscale value of 255 among the 8 pixel points around the pixel point is 3 or 4, then the pixel point is considered to be a skeleton intersection point. If the number of skeleton intersection points is greater than 1, the pixel point with the horizontal coordinate closest to w is considered to be a skeleton intersection point. ROI / 2 is set as the skeleton intersection point of the fruit stem lower end point (x c ,y c ). At this point, we can know that the height of the fruit stem in the image is as shown in formula (14);
[0165] h s =y top -y c (14)
[0166] Assume the position of the picking point in the refined image is (x r ,y r ). Set the picking point at 1 / 2 of the fruit stem length, and the ordinate y of the picking point is r As shown in formula (15);
[0167] y r =y top +0.5*h s (15)
[0168] Horizontal axis x r Select grayscale value 255 and closest to w ROI / 2 pixel point is used as the picking point. The schematic diagram of the sweet pepper picking point is as follows Figure 4 As shown;
[0169] The coordinates of the picking point in the picking point area of interest (x r ,y r ), and this coordinate needs to be converted to the position of the original color image. The coordinates of the upper left corner of the fruit stalk area of interest are known to be (x f ,y f ), so the coordinates of the picking point in the color image pixel coordinate system are (x f +x r ,y f +y r ), read the internal parameters of the depth camera to calculate the depth value z of the point. According to the coordinate transformation relationship obtained by hand-eye calibration, the fruit picking point (x, y, z) in the robot arm base coordinate system is obtained.
[0170] In order to test the effectiveness of the method proposed in the present invention, the above embodiment is used to perform a picking point recognition test in a simulated sweet pepper picking environment. Figure 5 shown.
[0171] The test was conducted in a bell pepper simulation environment. The bell pepper picking point recognition result diagram in the simulation environment (results of step 5.2 and step 5.3) is shown in the figure below: Figure 6 shown.
[0172] Add interference in the sweet pepper picking environment, and simulate the complex environment of additional interference to identify the sweet pepper picking point results (step 5.2 results and step 5.3 results) as shown in the figure Figure 7 The additional interference is divided into the following two aspects:
[0173] (1) The branches are placed at a certain distance behind the fruit stem of the target pepper (away from the depth camera).
[0174] (2) Place branches on the left and right sides of the target pepper stalk.
[0175] For interference (1), adding depth information with adaptive weights during clustering in step 4 solves the interference with depth differences.
[0176] For interference (2), in step 6, the horizontal coordinate x r Select grayscale value 255 and closest to w ROI / 2 pixel points are used as picking points to solve the interference on the left and right sides of the fruit stalk.
[0177] The invention is less affected by the interference of the picking environment, has robustness and a high picking point recognition accuracy, and has a fast recognition speed, and can detect the sweet pepper picking point in real time.
Claims
1. A fruit picking point recognition method based on deep learning and multi-dimensional information fusion clustering, characterized in that: The steps include: Step 1: The picking robot selects the target fruit to be picked; After the picking robot arrives at the picking position, the depth camera collects images of the target picking area, including color images and depth images; selects the fruit with the highest confidence in the color image as the target fruit to be picked; obtains the coordinates of the target fruit identification frame, where the upper left corner coordinate is (x min ,y min ), the coordinate of the lower right corner is (x max ,y max ); Step 2: Obtain the area of interest of the fruit picking point; According to the coordinates of the recognition box in step 1, calculate the width w of the target fruit in the captured image object , height h object ; Set the width w of the ROI of the picking point ROI , height h ROI ; and the coordinates of the upper left corner of the ROI of the picking point to ensure that the entire fruit stalk structure is covered; Step 3: Preprocess the depth image; Eliminate noise and preserve edges; Step 4: Cluster the multi-dimensional information of the picking point area of interest, and realize that fruits and branches are used as target classes, and leaves and blank areas are used as background classes; in the clustering process: Step 4.1: Take the pixels in the area of interest of the picking point as the cluster data sample X, which contains N objects X = {X1, X2, X3, ... X N }, where N is the number of pixels in the area of interest of the picking point; Selecting a color space and segmenting a color image into effective color components; each object has a multi-dimensional attribute of multiple effective color components and grayscale information of a depth image; in a color histogram of the effective color components, the target class and the background class present a bimodal distribution; Step 4.2, defining the depth information adaptive weight coefficient λ, λ can achieve adaptive adjustment according to the different fruit picking environments and the different degrees of reliance on depth information when segmenting the region of interest; Step 4.3, using the K-means based clustering algorithm, combined with the depth information multiplied by the adaptive weight coefficient λ, to obtain the clustering result; Step 4.4, define a single-channel image with the same size as the picking point interest area to receive the clustering results. At this time, the pixels in the image have been divided into two categories, and the clustering result map is converted into a binary image; Step 5: Perform morphological processing on the binary image to obtain a refined image; Step 6: Traverse the pixel points of the refined image to find the upper and lower endpoints of the fruit stalk; Determine the coordinates of the picking point in the picking point area of interest, and then convert the coordinates to the position of the initial color image; read the depth camera internal parameters to calculate the depth value z of the point; according to the coordinate conversion relationship obtained by hand-eye calibration, finally obtain the fruit picking point (x, y, z) in the robot arm base coordinate system.
2. The fruit picking point identification method based on deep learning and multidimensional information fusion clustering according to claim 1 is characterized in that: In the step 1, the Yolo algorithm is used to identify fruits that meet the maturity requirements in the color image of the picking area, and the coordinates of the identification frame are obtained.
3. The fruit picking point identification method based on deep learning and multidimensional information fusion clustering according to claim 1 is characterized in that: The width w of the target fruit to be picked in step 2 in the collected image object , height h object As shown in formula (1) and (2): w object =x max -x min (1)h object =y max -y min (2) Setting an appropriate ROI size for the picking point according to the growth morphology of the fruit, ensuring that the ROI can contain the complete fruit stalk and that the target class pixel area in step 4 is smaller than the background class pixel area; Set the width w of the ROI of the picking point ROI , height h ROI As shown in formula (3) and (4): w ROI =g1*w object (3)h ROI =g2*h object (4) Where g1, g2 are constants; The picking point ROI is set at the upper area of the target fruit to be picked. If it exceeds the image boundary, the ROI boundary is set at the boundary of the initial acquisition image.
4. The fruit picking point identification method based on deep learning and multidimensional information fusion clustering according to claim 1 is characterized in that: Step 3 preprocesses the depth image, which specifically includes the following steps: Step 3.1: Use the hole filling algorithm to first obtain the pixel values of the four adjacent directions of the missing data pixel, select the maximum grayscale value among the four pixels, and assign it to the missing data pixel; Step 3.2: Perform spatial edge-preserving filtering on the depth image; the spatial edge-preserving filter adopts a bilateral filter.
5. The fruit picking point identification method based on deep learning and multidimensional information fusion clustering according to claim 1 is characterized in that: In step 4.1, the attribute dimension M∈[2,4] is defined, that is, the attribute contains the depth information of the object and 1-3 valid color components; Define that there are n valid color components, where n∈[1,3],n∈N * ; then the attribute dimension M = n + 1; The grayscale information of n effective color components and depth image is normalized as shown in equations (5) and (6); s p =S p / 255 p=1,…,n (5) d=D / 65535 (6) Where S p represents the pth valid color component and S p ∈[0,255],D∈[0,65535],s p ,d∈[0,1].
6. The fruit picking point identification method based on deep learning and multidimensional information fusion clustering according to claim 1 is characterized in that: The calculation method of the depth information adaptive weight coefficient λ in step 4.2 is: In the color histogram of the color component, the target class and the background class present a standard bimodal distribution, that is, two high-frequency areas are separated by a low-frequency area; in the color histogram of the color component, the gray value L with the lowest frequency in the low-frequency area is obtained, and its value range is (0,255); Select the gray value interval U1, U2; U1, U2 should meet the following three conditions at the same time: (1) The length of the interval U1 and U2 is min(L,255-L); (2) (3) U1 has the largest number of pixels in the interval, and U2 has the largest number of pixels under condition (2); The center points μ1 and μ2 of the two intervals U1 and U2 are the expectation of the bimodal distribution after being regarded as two Gaussian distributions f1(x) and f2(x). The degree of grayscale aggregation of the pixel points Δ is defined as shown in formula (7): Among them, N1 and N2 are the number of pixels in the U1 and U2 regions, and N is the number of pixels in the region of interest; The adaptive weight coefficient λ is shown in formula (8); Where k1, k2 are constants, 0.3<λ<2.
3.
7. The fruit picking point identification method based on deep learning and multidimensional information fusion clustering according to claim 1 is characterized in that: The K-means-based clustering algorithm described in step 4.3 includes one of K-means++, Mini-BatchK-Means, and KernelK-means.
8. The fruit picking point identification method based on deep learning and multidimensional information fusion clustering according to claim 7 is characterized in that: Step 4.3 uses the K-means++ clustering algorithm. The specific steps are as follows: Step 4.3.1, select two initial cluster center points; Select a center point C1 from the random uniform distribution of the data sample; then determine another center point C2; Define the Euclidean distance F(X) between two objects X i ,X j ), each object has M-dimensional attributes, M∈[2,4], that is, the attributes contain the depth information of the object and 1-3 valid color components; Map the data samples into the space of corresponding dimensions, that is, the position of each object in the space is (s1,…,s n ,λd); two samples X i ,X j The Euclidean distance F(X i ,X j ) is defined as shown in formula (9); where s pi ,s pj They are samples X i , X j The pth color component value; d i , d j They are samples X i , X j The depth value of Select P(X i ) takes the object X with the maximum value as the second cluster center, P(X i ) as shown in formula (10); Where F(X i ,C1) is the object X i The Euclidean distance from the selected cluster center C1; Step 4.3.2, calculate the Euclidean distance F(X) from each object to the cluster centers C1 and C2 i ,C j ), compare the distances of each object to the cluster centers C1 and C2 in turn, assign the object to the cluster with the closest cluster center, and obtain two clusters {S1, S2}; Step 4.3.3, when all objects are assigned to clusters, the N pixels are divided into two clusters, S1 and S2; the mean of the objects in the cluster in the three dimensions is calculated and set as the new cluster center C l ; New cluster center C l As shown in formula (11); Among them, C l represents the lth cluster center, l = 1, 2, count (S l ) represents the number of objects in the lth cluster, X t represents the tth object in the lth cluster, 1≤t≤count(S l ); Iterate step 4.3.2 and step 4.3.3 until the termination condition is met: the square error J is less than the set minimum square error value MSE or the number of iterations is reached; the square error J is shown in formula (12): Among them, C l represents the lth cluster center, l = 1, 2, F(X t ,C l ) is the object X t With the selected cluster center point C l The Euclidean distance between l ) represents the number of objects in the lth cluster, X t represents the tth object in the lth cluster, 1≤t≤count(S l ).
9. The fruit picking point identification method based on deep learning and multidimensional information fusion clustering according to claim 1 is characterized in that: Step 5 specifically includes the following steps: Step 5.1: Filter out small connected areas of the target class; define the minimum connected domain threshold Threshold, traverse all connected areas in the clustering result map, and if the number of pixels in the connected area n < Threshold, set the grayscale value of the connected area from 255 to 0 and convert it to the background class; Step 5.2: Image opening operation; that is, first erosion operation, then dilation operation; Step 5.3: Image thinning processing; the thinning algorithm adopts the Zhang-Suen thinning algorithm; through multiple iterations, the pixel points that meet the thinning conditions are corroded, and the connected areas with a width greater than 1 pixel in the target class are converted into a skeleton with a width of 1 pixel to obtain a thinned image.
10. The fruit picking point identification method based on deep learning and multi-dimensional information fusion clustering according to claim 1, characterized in that: Step 6 includes: Select the coordinate point with the smallest ordinate in the skeleton (x top ,y top ) is set as the upper end point of the fruit stalk; Traverse the pixel points of the thinned image. If the number of pixel points with a grayscale value of 255 among the 8 pixel points around the pixel point is 3 or 4, the pixel point is considered to be a skeleton intersection point. If the number of skeleton intersection points is greater than 1, the pixel point with the horizontal coordinate closest to w is considered to be a skeleton intersection point. ROI / 2 is set as the skeleton intersection point of the fruit stem lower end point (x c ,y c ); At this time, the height of the fruit stalk in the image is shown in formula (13); h s =y top -y c (13) Assume the position of the picking point in the refined image is (x r ,y r ); Set the picking point at 1 / 2 of the fruit stem length as the picking point, then the ordinate y of the picking point r As shown in formula (14); y r =y top +0.5*h s (14) Horizontal axis x r Select grayscale value 255 and closest to w ROI / 2 pixel point is used as the picking point; The coordinates of the picking point in the picking point area of interest (x r ,y r ), this coordinate needs to be converted to the position of the initial color image; the coordinates of the upper left corner of the fruit stalk area of interest are known to be (x f ,y f ), then the coordinates of the picking point in the color image pixel coordinate system are (x f +x r ,y f +y r ), read the internal parameters of the depth camera to calculate the depth value z of the point; according to the coordinate transformation relationship obtained by hand-eye calibration, the fruit picking point (x, y, z) in the base coordinate system of the robotic arm is obtained.
