Detection and segmentation method of stuck rice grains based on deep learning

Through the detection and segmentation method based on deep learning, the detection misjudgment problem caused by sticky rice grains is solved, and the accuracy of rice appearance quality detection and efficient segmentation effect in complex situations is achieved, ensuring the crushed rice rate, chalk rice rate and yellow rice grains are Accurate detection of rate.

CN114066916BActive Publication Date: 2024-11-26ZHEJIANG GONGSHANG UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111283505.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-01
Publication Date
2024-11-26
Estimated Expiration
2041-11-01

AI Technical Summary

Technical Problem

When detecting the appearance of rice, adhesion rice particles leads to misjudgment in image processing, affecting the accuracy of broken rice, chalky rice rate and yellow rice particle rate, especially in complex adhesion cases, the detection effect is poor.

Method used

Using a deep learning-based detection and segmentation method, the rice grain image is converted into grayscale and binary images, and the rice grain contour lines are segmented and fusion using the region connectivity method and segmentation network, combining adaptive segmentation threshold and feature map fusion, optimized segmentation The loss function and boundary feature processing of the network realize accurate segmentation of rice particles.

Benefits of technology

The accuracy and accuracy of rice grain segmentation are improved, and the accuracy of rice appearance quality detection is ensured, especially in complex adhesions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114066916B_ABST
    Figure CN114066916B_ABST
Patent Text Reader

Abstract

The present invention discloses a detection and segmentation method of sticky rice grains based on deep learning, comprising: converting an original image into a grayscale image; converting it into a binary black-and-white image; processing the binary black-and-white image to obtain a rice grain contour image; traversing each rice grain contour line in the rice grain contour image, deleting all inner contour lines, and obtaining a first contour line; inputting the original image into a segmentation network to obtain a first mask image, and extracting a second contour line from the first mask image; fusing the first contour line and the second contour line to obtain a second mask image; and extracting a corresponding area from the original image according to the second mask image. The detection and segmentation method of sticky rice grains based on deep learning of the present invention first obtains a segmentation mask of the rice grains, and then further performs segmentation post-processing, combines the contour lines obtained during image preprocessing, and further fuses the two, thereby obtaining a more accurate segmentation effect of sticky rice grains.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a detection and segmentation method of stuck rice grains based on deep learning. Background Art

[0002] The appearance of rice is a very important indicator of rice quality and an important factor affecting the market price of rice. The detection of rice quality with the help of computer vision technology has begun to be applied in practice. First, a high-definition image of the tested rice is obtained through an image acquisition system, and then the broken rice rate, the chalkiness of rice, and the yellow rice grain rate are obtained by combining computer image processing technology with colorimetry theory for analysis and calculation. Performance indicators can well replace manual labor and greatly improve the quality of detection.

[0003] However, when collecting rice grain sample images, since the rice grains are randomly placed on the sample loading platform or conveyor belt, some rice grains will inevitably touch each other, causing the rice grain contours obtained during image processing to stick together. If the stuck rice grains are not segmented first, multiple rice grains stuck together will be misjudged as one rice grain in subsequent detections, resulting in errors in the detection of rice appearance indicators such as broken rice rate, chalky rice rate, and yellow rice rate.

[0004] Traditional methods based on image rice grain contours mainly include edge detection algorithms based on morphological erosion and dilation, region segmentation algorithms based on watershed transform, algorithms based on contour analysis, and algorithms based on concave point matching. These methods have better detection effects when the adhesion is not too much, but the detection effect will be poor when the adhesion is very complex. Summary of the invention

[0005] The present invention provides a detection and segmentation method for sticky rice grains based on deep learning. By using computer vision, the sticky rice grains in the rice grain image can be accurately segmented, thereby ensuring that subsequent rice appearance quality inspections such as broken rice rate, rice chalkiness and chalky grain rate, yellow rice grain rate and other performance indicators can be correctly detected. The following technical solutions are adopted:

[0006] A detection and segmentation method for sticky rice grains based on deep learning, comprising the following steps:

[0007] Convert the acquired original image in RGB format containing several rice grains into a grayscale image;

[0008] Convert grayscale images into binary black and white images;

[0009] The binary black-and-white image is processed by the region connectivity method to obtain the rice grain contour image;

[0010] Traverse each rice grain contour line in the rice grain contour image, delete all inner contour lines, keep only the outer contour line, and finally obtain the first contour line;

[0011] The original image is input into the segmentation network to obtain a first mask image in which rice grains are segmented one by one, and a second contour line is extracted from the first mask image;

[0012] The first contour line and the second contour line are merged to determine the final contour line of each rice grain, and the second mask image corresponding to each rice grain is obtained by regional connection;

[0013] According to the second mask image, the corresponding area is extracted from the original image to obtain the image of each rice grain.

[0014] Furthermore, the specific method of converting the grayscale image into a binary black and white image is:

[0015] Filter and denoise grayscale images;

[0016] Calculate the adaptive segmentation threshold of the processed grayscale image;

[0017] The grayscale image is converted into a binary black and white image according to the calculated adaptive threshold.

[0018] Furthermore, the specific method for calculating the adaptive segmentation threshold of the processed grayscale image is:

[0019] The adaptive segmentation threshold of the processed grayscale image is calculated by using the maximum variance method between classes.

[0020] Furthermore, the specific method of inputting the original image into the segmentation network to obtain the first mask image in which the rice grains are segmented one by one is as follows:

[0021] Input the original image into a backbone network to obtain the first feature map group C2-C5;

[0022] Then the first feature map group C2-C5 is input into the FPN network to obtain the second feature map group P2-P7;

[0023] The second feature map group P2-P7 is subjected to the bottom up augmentation layer to obtain the third feature map group N3-N7. After the third feature map group N3-N7 is subjected to convolution, normalization and Relu operations, one branch is sent to the classification head to obtain the classification, and the other branch is sent to the regression head, ctrl head and top features head respectively to obtain the regression box, center degree and top features;

[0024] P2 in the second feature map group P2-P7 is input to the boundary branch, and the features of P4 and P5 are bilinearly interpolated, and then the result of adding them to P3 is input to the mask branch. These two input feature maps are first ROIAligned to obtain R m and R b

[0025] R m After four consecutive 3×3 convolutions, a spatial attention module SAM and a 3×3 convolution, the mask feature F is obtained. m , R b After 4 consecutive 3×3 convolutions, the boundary features are obtained. Boundary Features and the mask feature F m After fusion, two consecutive 3×3 convolutions are performed to obtain the output boundary feature F b , and then output the boundary feature F b With the mask feature F m Fusion obtains the mask feature F m2 , mask feature F m2 After a 3x3 convolution, it is mixed with the top features to obtain the input of the mask, which is the first mask image.

[0026] Furthermore, the backbone network includes two parallel improved VoVNet networks.

[0027] Furthermore, the loss function of the segmentation network is:

[0028] L=L cls +αL reg +βL mask +γL b ,

[0029] Among them, L cls For classification loss, focal loss is used, L reg For regression loss, GIOU loss is used, L mask is the mask loss, using binary cross entropy loss, L b is the boundary loss, p b ∈R H×W represents the prediction boundary for a specific class, y b ∈R H ×W represents the corresponding boundary truth value, LDice is Dice loss, LBCE is BCE loss, and α, β, γ, and λ are adjustment weight balance parameters.

[0030] Furthermore, the first contour line and the second contour line are merged to determine the final contour line of each rice grain, and the specific method of performing regional connection to obtain the second mask image corresponding to each rice grain is as follows:

[0031] Calculate the average circumference of rice grains based on the second contour line;

[0032] Calculate the perimeter of each closed contour line according to the first contour line;

[0033] By comparing the relationship between the perimeter of each closed contour and the average perimeter, it is determined whether the closed contour is a single rice grain or a bonded rice grain;

[0034] For a single rice grain, replacing the corresponding contour line in the second contour line by the contour line of the single rice grain in the first contour line;

[0035] For the stuck rice grains, the contour lines of the stuck rice grains in the second contour lines are optimized.

[0036] Furthermore, the average circumference is calculated by the following formula:

[0037]

[0038] Among them, l is the average perimeter, n is the number of rice grains, l i is the circumference of a single rice grain;

[0039] If m i ≤s*l, the contour line is considered to be a single rice grain;

[0040] If m i >s*l, the contour line is considered to be a sticky rice grain;

[0041] Among them, m i is the contour line of a single rice grain, and s is the adjustment factor.

[0042] Furthermore, the value of s is 1.2.

[0043] Furthermore, the specific method for optimizing the contour line of the adhered rice grains in the second contour line is:

[0044] The contour lines of the multiple individual rice grains segmented in the area corresponding to the sticky rice grains in the second contour line are traversed, and pixel by pixel are checked in sequence. If non-smooth broken line changes or large-scale non-elliptical changes are detected in part of the contour lines during the traversal process, least squares curve fitting can be performed on the part, and then the original non-smooth part can be replaced by the fitted new curve.

[0045] The benefit of the present invention lies in the deep learning-based detection and segmentation method for stuck rice grains, which first obtains the segmentation mask of the rice grains, and then further performs post-segmentation processing, and combines the contour lines obtained during image preprocessing to further fuse the two, thereby obtaining a more accurate segmentation effect for stuck rice grains. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 is a schematic diagram of a method for detecting and segmenting stuck rice grains based on deep learning of the present invention;

[0047] Figure 2 is a structural diagram of a segmentation network of the present invention;

[0048] Figure 3 is a schematic diagram of an OSA module of the present invention;

[0049] Figure 4 Schematic diagram of the spatial attention module SAM of the present invention. DETAILED DESCRIPTION

[0050] The present invention is described in detail below with reference to the accompanying drawings and specific embodiments.

[0051] like Figure 1 The present invention shows a detection and segmentation method for sticky rice grains based on deep learning, which mainly includes the following steps: S1: converting the original image in RGB format containing several rice grains into a grayscale image; S2: converting the grayscale image into a binary black and white image; S3: processing the binary black and white image by a region connectivity method to obtain a rice grain contour image; S4: traversing the contour lines of each rice grain in the rice grain contour image, deleting all inner contour lines, retaining only the outer contour lines, and finally obtaining the first contour line; S5: inputting the original image into a segmentation network to obtain a first mask image in which the rice grains are separated one by one, and extracting the second contour line from the first mask image; S6: fusing the first contour line and the second contour line to determine the final contour line of each rice grain, and thereby performing region connectivity to obtain the second mask image corresponding to each rice grain; S7: according to the second mask image, extracting the corresponding area from the original image to obtain the image of each rice grain. Through the above steps, the segmentation mask of the rice grains is first obtained, and then further segmentation post-processing is performed, and the contour lines obtained during image preprocessing are further fused to obtain a more accurate segmentation effect of the adhered rice grains. The above steps are described in detail below.

[0052] For step S1: convert the acquired original image in RGB format containing several rice grains into a grayscale image.

[0053] First, the rice grain image is collected by an image acquisition device. In the present application, the image collected by the image acquisition device is an RGB image, which is first converted into a grayscale image during processing.

[0054] For step S2: convert the grayscale image into a binary black and white image.

[0055] Specifically, the method for converting a grayscale image into a binary black-and-white image is as follows: filtering and denoising the grayscale image; calculating an adaptive segmentation threshold of the processed grayscale image; and converting the grayscale image into a binary black-and-white image according to the calculated adaptive threshold. The adaptive segmentation threshold of the processed grayscale image is calculated by using the maximum variance method between classes.

[0056] For step S3: the binary black and white image is processed by the region connectivity method to obtain the rice grain contour image.

[0057] For step S4: traverse the contour lines of each rice grain in the rice grain contour image, delete all inner contour lines, and only keep the outer contour lines, and finally obtain the first contour line.

[0058] It is understandable that the non-adhesive rice grains have only one layer of contour lines, which need not be processed and can be directly retained. However, the adhering rice grains will generate two layers of contour lines, inner and outer. In this application, only the closed outer contour lines of the adhering rice grains need to be retained, and all the inner contour lines need to be deleted.

[0059] For step S5: the original image is input into the segmentation network to obtain a first mask image in which the rice grains are segmented one by one, and the second contour line is extracted from the first mask image.

[0060] like Figure 2 The following is a diagram of the structure of the segmentation network of the present application. Figure 2 The specific method of inputting the original image into the segmentation network to obtain the first mask image in which the rice grains are separated one by one is described.

[0061] Table 1 Backbone network structure

[0062]

[0063] First, the original image is input into a backbone network. The backbone network of this application is based on VoVNet, and further improvements have been made to it, so that it can greatly reduce the memory access cost and is more suitable for integration into embedded devices. Specifically, the backbone network consists of two parallel improved VoVNet networks. The structure of each improved VoVNet network is shown in Table 1, using 11 convolutional layers and a total of 5 convolutional stages. The first stage consists of 3 3x3 convolutional layers, followed by 4 stages of OSA modules. Figure 3The OSA module used in this application consists of a 3×3 convolution layer and a 1×1 convolution layer. The input image is connected to the 3×3 convolution layer on one side to produce a feature map with a larger receptive field, and the subsequent feature maps are aggregated on the other side. After the 1×1 convolution operation, a diversified feature map is obtained. Send to the eSE channel attention module, Applied as channel attention feature descriptor to diverse feature maps To obtain richer information and obtain a refined feature map Finally, the input is added to the refined feature map using a residual connection At the end of each OSA stage, a 3x3 maximum pooling layer with a stride of 2 is used for downsampling. The feature maps of the same scale extracted from the two improved VoVNet branches are added channel by channel and element by element. After the addition, the ReLU nonlinear activation function is used to reduce the mutual dependence between the parameters. The backbone network finally outputs the first feature map group C2-C5 of different sizes. The first feature map group C2-C5 is input into the FPN network to obtain the second feature map group P2-P7. The FPN network passes high-level semantic information downward and uses high-level semantic information to improve the effect of the lower layer. In order to pass the low-level information upward again and further improve the utilization rate of the underlying information, this application designs an upward transmission bottom up augmentation layer. The second feature map group P2-P7 passes through the bottom up augmentation layer to obtain the third feature map group N3-N7. The third feature map group N3-N7 passes through multiple convolution blocks. After convolution, normalization and Relu operations, one branch is sent to the classification head to obtain classification, and the other branch is sent to the regression head, ctrl head and top features head respectively to obtain the regression box, center and top features. The dimension of the top features is (N, K*14*14), N is the number of instances, and K is 4. P2 in the second feature map group P2-P7 inputs the boundary branch, and the features of P4 and P5 are bilinearly interpolated, and then the result of adding them to P3 is input into the mask branch. These two input feature maps are first ROIAligned and then get R respectively. m and R b , where R m After four consecutive 3×3 convolutions, Figure 4 The spatial attention module SAM shown and a 3×3 convolution obtain the mask feature F mAmong them, the spatial attention module SAM first performs maximum pooling and average pooling on the input, then concatenates the two, and then performs a 3x3 convolution, and then uses the sigmoid function to normalize, and then multiplies the output with the original input to obtain the final output. b After 4 consecutive 3×3 convolutions, the boundary features are obtained. Boundary Features and the mask feature F m After fusion, two consecutive 3×3 convolutions are performed to obtain the output boundary feature F b , the feature fusion mechanism is shown as follows:

[0064]

[0065] Among them, f represents 1×1 convolution and ReLU activation function, and g represents two 3×3 convolutions.

[0066] Then output the boundary feature F b With the mask feature F m Fusion, using boundary information to enrich mask features, promote more accurate mask prediction, and obtain mask features F m2 , the feature fusion mechanism is shown as follows:

[0067] F m2 =F m +f(F b ) (2)

[0068] Mask feature F m2 After a 3x3 convolution, the number of channels is reduced to K dimensions to become F k , and then mixed with top features to get the input of the mask, which is the first mask image. The top features before mixing need to be upsampled, converting Kx14x14 to kx56x56, called S k , then with F k After the dot multiplication, the sum is taken on the K channels, and the result is the output of the mask, as shown in the following formula.

[0069]

[0070] In this application, the loss function of the segmentation network is:

[0071] L=L cls +αL reg +βL mask +γL b (4)

[0072] Among them, L cls For classification loss, focal loss is used, Lreg For regression loss, GIOU loss is used, L mask is the mask loss, using binary cross entropy loss, L b is the boundary loss, boundary loss L b The calculation of is as follows:

[0073] Lb(pb,yb)=LDice(pb,yb)+λLBCE(pb,yb) (5)

[0074] Among them, LDice is Dice loss, that is, Dice loss, which is calculated as shown in formula (6):

[0075]

[0076] LBCE is BCE loss, i.e. cross entropy loss, and its calculation formula is shown in formula (7):

[0077] LBCE=-xlogy-(1-x)log(1-y) (7)

[0078] Among them, x is the corresponding true value, y is the predicted value, H and W are the height and width of the predicted boundary map, respectively, and p b ∈R H×W represents the prediction boundary for a specific class, y b ∈R H×W Represents the corresponding boundary true value. α, β, γ, λ are all weight balance parameters.

[0079] For step S6: the first contour line and the second contour line are merged to determine the final contour line of each rice grain, and then regional connection is performed to obtain the second mask image corresponding to each rice grain.

[0080] Although the segmentation effect of the deep learning of step S5 is good, especially the segmentation effect of the rice adhesion part is very good, but because the example segmentation is an algorithm that is refined to pixels, and some pictures may have some distortions to the judgment of the pixels near the edge of the rice grains of some non-adhesion points due to the problem of light, thereby causing the segmentation of the rear part of the rice grains to form a jagged non-smooth contour line when extracting the edge, and traditional contour line extraction algorithms such as the maximum variance method between classes, canny operators or Laplace operators can more accurately obtain the accurate contour of non-adhesion rice grains, but these contour extraction algorithms are powerless to the segmentation of the rice grain adhesion point part. Therefore, in the present application, the accurate information of these two methods is combined to obtain a better segmentation effect.

[0081] As a preferred implementation, the first contour line and the second contour line are merged to determine the final contour line of each rice grain, and the specific method of performing regional interconnection to obtain the second mask image corresponding to each rice grain is as follows:

[0082] The average perimeter of the rice grains is calculated according to the second contour line; the perimeter of each individual closed contour line is calculated according to the first contour line, and the perimeter of each closed contour line is compared with the average perimeter to determine whether the closed contour line is a single rice grain or a group of rice grains that are connected. For a single rice grain, the corresponding positions of the first contour line and the second contour line are compared, and the corresponding contour line in the second contour line is replaced by the closed contour line of the single rice grain in the first contour line. For the connected rice grains, the contour line of the connected rice grains in the second contour line is optimized.

[0083] Specifically, the average circumference is calculated by the following formula:

[0084]

[0085] Among them, l is the average perimeter, n is the number of rice grains, l i is the perimeter of a single rice grain. Each closed space in the second contour line represents a rice grain. The number of rice grains n is obtained by counting the number of closed spaces in the second contour line, and the length of the contour line corresponding to each closed space in the second contour line is calculated to obtain l. i Assume that m i is the contour line of a single rice grain, and s is the adjustment factor. i ≤s*l, the contour is considered to be a single rice grain. i >s*l, the contour line is considered to be a sticky rice grain. In this application, s is taken as 1.2.

[0086] In the present application, a specific method for optimizing the contour line of the adhered rice grains in the second contour line is: traversing the contour lines of the multiple individual rice grains divided in the corresponding area of ​​the adhered rice grains in the second contour line, and checking pixel by pixel in a top-to-bottom and left-to-right order. Since the contour line of a normal rice grain should be a smoother elliptical contour line, if non-smooth broken line changes or large non-elliptical changes are detected in part of the contour line during the traversal process, the least squares curve fitting can be performed on the part, and then the original non-smooth part can be replaced by the fitted new curve.

[0087] For step S7: according to the second mask image, the corresponding area is extracted from the original image to obtain the image of each rice grain.

[0088] By using the second mask image, the corresponding area is extracted from the original image to obtain the image of each rice grain.

[0089] The above shows and describes the basic principles, main features and advantages of the present invention. Those skilled in the art should understand that the above embodiments do not limit the present invention in any form, and any technical solution obtained by equivalent replacement or equivalent transformation falls within the protection scope of the present invention.

Claims

1. A detection and segmentation method for sticky rice grains based on deep learning, characterized in that: The following steps are involved: Convert the acquired original image in RGB format containing several rice grains into a grayscale image; Converting the grayscale image into a binary black-and-white image; Processing the binary black-and-white image by a region connectivity method to obtain a rice grain contour image; Traversing each rice grain contour line in the rice grain contour image, deleting all inner contour lines, retaining only the outer contour line, and finally obtaining a first contour line; Inputting the original image into a segmentation network to obtain a first mask image in which rice grains are segmented one by one, and extracting a second contour line from the first mask image; The first contour line and the second contour line are merged to determine the final contour line of each rice grain, and the second mask image corresponding to each rice grain is obtained by regional interconnection; According to the second mask image, a corresponding area is extracted from the original image to obtain an image of each rice grain.

2. The method for detecting and segmenting stuck rice grains based on deep learning according to claim 1, characterized in that: The specific method of converting the grayscale image into a binary black and white image is: Filtering and denoising the grayscale image; Calculating an adaptive segmentation threshold of the processed grayscale image; The grayscale image is converted into the binary black-and-white image according to the calculated adaptive threshold.

3. The method for detecting and segmenting stuck rice grains based on deep learning according to claim 2, characterized in that: The specific method of calculating the adaptive segmentation threshold of the grayscale image after processing is: The adaptive segmentation threshold of the processed grayscale image is calculated by adopting the inter-class maximum variance method.

4. The method for detecting and segmenting stuck rice grains based on deep learning according to claim 1, characterized in that: The specific method of inputting the original image into the segmentation network to obtain the first mask image in which the rice grains are segmented one by one is: Input the original image into a backbone network to obtain a first feature map group C2-C5; Then, the first feature map group C2-C5 is input into the FPN network to obtain the second feature map group P2-P7; The second feature map group P2-P7 is subjected to the bottom up augmentation layer to obtain the third feature map group N3-N7. After the third feature map group N3-N7 is subjected to convolution, normalization and ReLU operations, one branch is sent to the classification head to obtain the classification, and the other branch is sent to the regression head, ctrl head and top features head respectively to obtain the regression box, center degree and top features; P2 in the second feature map group P2-P7 is input to the boundary branch, and the features of P4 and P5 are bilinearly interpolated, and then the result of adding them to P3 is input to the mask branch. The two input feature maps are firstly ROIAligned to obtain R m and R b R m After four consecutive 3×3 convolutions, a spatial attention module SAM and a 3×3 convolution, the mask feature F is obtained. m , R b After 4 consecutive 3×3 convolutions, the boundary features are obtained. Boundary Features and the mask feature F m After fusion, two consecutive 3×3 convolutions are performed to obtain the output boundary feature F b , and then output the boundary feature F b With the mask feature F m Fusion obtains the mask feature F m2 , mask feature F m2 After a 3x3 convolution, it is mixed with the top features to obtain the mask input, which is the first mask image.

5. The method for detecting and segmenting stuck rice grains based on deep learning according to claim 1, characterized in that: The backbone network includes two parallel improved VoVNet networks.

6. The method for detecting and segmenting stuck rice grains based on deep learning according to claim 1, characterized in that: The loss function of the segmentation network is: L=L cls +αL reg +βL mask +γL b , Lb(pb,yb)=LDice(pb,yb)+λLBCE(pb,yb), Among them, L cls For classification loss, focal loss is used, L reg For regression loss, GIOU loss is used, L mask is the mask loss, using binary cross entropy loss, L b is the boundary loss, pb∈R H×W represents the prediction boundary for a specific class, y b ∈R H×W represents the corresponding boundary truth value, LDice is Dice loss, LBCE is BCE loss, and α, β, γ, and λ are adjustment weight balance parameters.

7. The method for detecting and segmenting stuck rice grains based on deep learning according to claim 1, characterized in that: The specific method of fusing the first contour line and the second contour line to determine the final contour line of each rice grain, and thereby performing regional interconnection to obtain the second mask image corresponding to each rice grain is: Calculating the average perimeter of the rice grains according to the second contour line; Calculate the perimeter of each closed contour line according to the first contour line; By comparing the perimeter of each closed contour line with the average perimeter, it is determined whether the closed contour line is a single rice grain or a connected rice grain; For a single rice grain, replacing a corresponding contour line in the second contour lines with a closed contour line of the single rice grain in the first contour lines; For the stuck rice grains, the contour lines of the stuck rice grains in the second contour lines are optimized.

8. The method for detecting and segmenting stuck rice grains based on deep learning according to claim 7, characterized in that: The average circumference is calculated by the following formula: Wherein, l is the average perimeter, n is the number of rice grains, l i is the circumference of a single rice grain; If m i ≤s*l, the contour line is considered to be a single rice grain; If m i >s*l, the contour line is considered to be a sticky rice grain; Among them, m i is the contour line of a single rice grain, and s is the adjustment factor.

9. The method for detecting and segmenting stuck rice grains based on deep learning according to claim 8, characterized in that: The value of s is 1.

2.

10. The method for detecting and segmenting stuck rice grains based on deep learning according to claim 7, characterized in that: The specific method for optimizing the contour line of the adhered rice grains in the second contour line is: The contour lines of the plurality of separate rice grains segmented in the area corresponding to the adhered rice grains in the second contour line are traversed, and are checked pixel by pixel in sequence. If a non-smooth broken line change or a relatively large non-elliptical change is detected in part of the contour lines during the traversal process, a least squares curve fitting can be performed on the part, and then the original non-smooth part is replaced by the fitted new curve.