A method for early rice seedling row detection based on root positioning
Through a detection method based on root positioning, deep learning and dynamic clustering search direction algorithms are used to achieve accurate detection of rice seedling rows, solve the problem of the influence of leaf morphology in early rice seedling row detection, and improve detection accuracy and robustness. Great sex.
Patent Information
- Application Number
- CN202210632384.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-07
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2042-06-07
AI Technical Summary
In rice fields, early rice seedling row detection is difficult to accurately identify rice rows with traditional image processing technology due to the divergent growth and uneven morphological characteristics of rice leaves. Moreover, methods based on convolutional neural networks rely on leaf recognition and cannot guarantee detection accuracy.
Using a detection method based on root positioning, we collect rice seedling root images, design triangular superpixel morphological masks for annotation, train a deep learning semantic segmentation model, generate binary mask images, perform minimum enclosing triangle fitting, and obtain anchor points. The scatter clustering algorithm in the dynamic clustering search direction is used for straight line fitting to achieve accurate detection of rice seedling rows.
It achieves accurate detection of early rice seedling rows in complex field environments, improves detection accuracy, is suitable for early rice seedling navigation operations, reduces dependence on rice leaf morphology, and has high robustness and promotion value.
Smart Images

Figure CN115170949B
Abstract
Description
Technical Field
[0001] The invention belongs to the field of agricultural automation, and specifically relates to image processing technology, and in particular to an early rice seedling row detection method based on root positioning. Background Art
[0002] Improving rice yields through automated production is a cost-effective solution to address the growing global demand for rice and the shrinking agricultural workforce, and implementing autonomous navigation in rice fields is a key prerequisite for rice production automation. Among the various available autonomous navigation systems such as satellite navigation and lidar navigation, visual navigation stands out for its low cost, flexibility, and ease of use, making it the preferred method for rice field navigation.
[0003] Crop row detection is the basis of visual navigation. In the early stages of rice field management, accurate detection of rice rows from images is more challenging than at other times due to the presence of weeds, duckweed, cyanobacteria, and water surface reflections. Traditional image processing techniques must use artificially constructed shallow features to identify rice seedlings, which inevitably leads to poor robustness of the detection algorithm and low recognition accuracy. In recent years, scholars have combined convolutional neural network methods with rice seedling row extraction, which has effectively improved the detection accuracy. However, in these studies based on convolutional neural networks, crop row extraction is based on rice leaf recognition. However, the accuracy of the rice row fitting line is often affected by the morphological characteristics of the rice seedlings in the image. The rice leaves grow divergently and are unevenly oriented. Therefore, relying on rice leaf recognition cannot guarantee the accuracy of rice row detection. Summary of the invention
[0004] In order to solve the shortcomings existing in previous research on rice seedling row detection, the purpose of the present invention is to provide an early rice seedling row detection method based on root positioning. The rice roots maintain a more stable growth posture than the leaves. The actual growth position of the rice can be easily determined through the rice roots, so that the final detection accuracy of the crop row straight line is higher.
[0005] The objective of the present invention is achieved through the following technical solution: a method for detecting early rice seedling rows based on root positioning. The method comprises the following steps:
[0006] S01. Collecting a root image of rice seedlings in the field, using a triangular superpixel morphological mask designed for the root growth morphological characteristics of a single rice seedling to mark all the roots of a single rice seedling in the root image of the rice seedling, and establishing a rice seedling root mask dataset;
[0007] S02. Using the rice seedling root mask dataset to train a semantic segmentation model based on deep learning, using the trained semantic segmentation model to predict the triangular superpixel morphological mask of the rice seedling root in the target rice row detection image, and generating a binary mask image of the same size as the target rice row detection image and containing only the predicted triangular superpixel morphological mask;
[0008] S03. performing minimum outer triangle contour fitting on the triangular superpixel morphological mask in the binary mask image, taking a single pixel point at the bottom end point of the minimum outer triangle contour as the anchor point of the rice seedling, and generating a binary anchor point image containing only the anchor point and having the same size as the target rice row detection image;
[0009] S04. Clustering and straight line fitting of anchor points belonging to different rice rows in the binary anchor point image are sequentially completed using a scattered point clustering algorithm based on a dynamic clustering search direction. The dynamic clustering search direction refers to that the reference clustering search direction used by the anchor points belonging to different rice rows in the binary anchor point image is dynamically inherited from the direction of the fitted straight line of the adjacent detected rice row.
[0010] Furthermore, in step S01, the root images of rice seedlings in the field should include root images of rice seedlings under different lighting conditions, different growth periods, and different weed pressure conditions.
[0011] Furthermore, the step S04 specifically includes the following steps:
[0012] a01. Divide the binary mask image into a number of vertical strips in the horizontal direction, and record the vertical strip with the largest number of pixels belonging to the triangular superpixel morphological mask as S max , randomly select the vertical strip in the binary anchor image S max Any anchor point in the corresponding area is used as the cluster search base point, the vertical direction is set as the base cluster search direction, the search angle range is set to a fixed value, and a cluster is established to store similar anchor points. class List;
[0013] a02. Search in the binary anchor point image for one or two other anchor points that belong to the same category as the cluster search base point and are closest to the cluster search base point. The single cluster search process is as follows: find other anchor points that are located within the same search angle range to the left and right of the cluster search base point along the reference cluster search direction, and record the anchor point that is above the cluster search base point and closest to the cluster search base point as P above, the anchor point located below the cluster search base point and closest to the cluster search base point is P below , if the anchor point P above and the anchor point P below If both exist, the anchor point P above and the anchor point P below Put it together with the cluster search base point into the class list, and the anchor point P above and the anchor point P below Update to the new cluster search base point, if P above and P below If only one of them exists, the existing anchor point and the cluster search base point are put into the class list, and updating the existing anchor point as a new cluster search base point;
[0014] a03. Loop through step a02 until there is no class Different anchors in the list are searched;
[0015] a04. Using the least squares method to class The anchor points in the list are fitted with a straight line, and the fitted straight line is recorded as L , the class The anchor points in the list are deleted from the binary anchor point image, and it is determined whether there are any anchor points in the binary mask image. If so, the reference cluster search direction is updated to the direction of the fitted straight line and the following scatter point processing steps are continued. class Clear the points in the list, if there are none, then end the scattered point processing process;
[0016] a05. Find the binary anchor point image in the straight line L On the left and with the straight line L The nearest anchor point is P left , find the binary anchor point image in the straight line L On the right side and with the straight line L The nearest anchor point is P right , if the P left and P right If both exist, theP left With the P right Update to the cluster search base point, if the P left and P right If only one exists, the existing anchor point is updated as the cluster search base point;
[0017] a06. Execute the steps a03, a04 and a05 in a loop until the scattered point processing process is completed, at which time it is considered that all straight lines representing the rice seedling rows in the target detection image have been extracted.
[0018] The beneficial effects of the present invention are that the method of the present invention realizes accurate detection of early rice seedling rows in complex field environments with the influence of natural light changes, weed noise, water surface reflection, etc. Compared with the traditional image processing algorithm for completing rice seedling row detection based on rice leaf positioning, the method will not be affected by the divergent growth form of rice leaves, further improving the detection accuracy of rice seedling rows, and is suitable for navigation operations in early rice seedling fields; suitable for row detection of other crops with dispersed leaves and compact roots that have similar growth conditions to rice seedlings; suitable for row detection of other crops that are similar to rice seedlings, with relatively regular crop arrangements and identifiable crop rows; and has high promotion and application value. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 The figure is a flow chart of an early rice seedling row detection method based on root positioning in an example of the present invention.
[0020] Figure 2 This is a schematic diagram of using a triangular superpixel morphological mask to mark the roots of a single rice seedling in an example of the present invention.
[0021] Figure 3 This is a schematic diagram of predicting the triangular superpixel morphological mask of rice seedlings in an example of the present invention.
[0022] Figure 4 Schematic diagram of a binary mask image containing only a triangular superpixel morphological mask in an example of the present invention.
[0023] Figure 5 It is a schematic diagram of a binary anchor point image containing only rice seedling-like anchor points in an example of the present invention.
[0024] Figure 6 Schematic diagram of the process of selecting the starting point of anchor point processing in an example of the present invention.
[0025] Figure 7It is a schematic diagram of the anchor point processing process in an example of the present invention.
[0026] Figure 8 It is a schematic diagram of the detection results of rice seedling rows in an example of the present invention.
[0027] Fig. 9 This is a schematic diagram of the mask segmentation results of rice seedling roots under different light, different growth periods, and different weed pressure conditions in an example of the present invention.
[0028] Fig.10 It is a schematic diagram of the detection results of rice seedling rows under different light, different growth periods and different weed pressure conditions in the examples of the present invention.
[0029] Fig.11 A schematic diagram showing the comparison of the effects of detecting rice rows using the rice row detection algorithm based on root recognition proposed by the present invention and the rice row detection algorithm based on leaf recognition in an example of the present invention. DETAILED DESCRIPTION
[0030] The specific implementation methods of the invention are further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solutions of the invention, and are not intended to limit the protection scope of the invention. The following embodiments take the image of rice seedling rows in a natural field environment as an example for detailed description.
[0031] Figure 1 A schematic flow chart of an early rice seedling row detection method based on root positioning provided by an embodiment of the present invention is provided. The method comprises the following steps:
[0032] S01. Collect images of rice seedling roots in the field under different light, growth period and weed pressure conditions, using Figure 2 The triangular superpixel morphological mask shown is used to mark the roots of all individual rice seedlings in the original data set of rice seedling roots, and a rice seedling root mask data set is established. Note that the segmentation of rice seedling roots is only an intermediate step in obtaining the growth anchor points of rice seedlings. If the roots are segmented pixel by pixel, the irregular root mask obtained after segmentation still requires tedious image post-processing to calculate the growth anchor points. At the same time, considering that the accurate segmentation of the rice root system at the pixel level requires huge manpower in the early data set annotation process, the present invention proposes to use a superpixel-level triangular morphological mask determined based on the growth morphology of the rice roots to mark the rice roots and construct a rice root mask data set. In this way, while accurately describing the root growth posture, a large amount of annotation costs are saved, and convenience and accuracy are provided for the determination of the rice seedling anchor points.
[0033] S02. The established rice seedling root mask dataset is divided into training set, validation set and test set in a ratio of 7:2:1, and the semantic segmentation model based on deep learning is trained. Here, the SegFormer semantic segmentation model is selected.
[0034] The parameters in the training process are as follows: the pixel size of the input image is 640*480; the transfer learning method is used in the training process, and the model weights that have been trained on the ADE20K dataset are used as pre-trained weights; data enhancement is performed before the image is fed into the network, and the enhancement methods include random rotation, random cropping, and random horizontal flipping; the model is implemented using the Pytorch API on the Windows 10 operating system, and the computer hardware configuration used for training includes Intel (R) Xeon (E) E3-1270@3.80 GHz CPU and NVIDIA Tesla V100 GPU; the model is evaluated using the cross entropy loss function, the batch size of the training is set to 4, and the total number of training iterations is 160,000. The average intersection-over-union ratio is used as the evaluation matrix; the optimizer used in the training process is AdamW, the initial learning rate is 0.00006, the polynomial factor is set to 1.0, and the decay rate is 0.01.
[0035] After training, the model weights that enable the SegFormer semantic segmentation model to predict the triangular superpixel morphological mask of the root of the rice seedling in the test set image are obtained. Example images of triangular superpixel morphological mask prediction for images in the test set are shown in the figure below. Figure 3 As shown in the figure, it can be seen that the semantic segmentation model cannot perfectly predict the regular triangle of the rice seedling root, but its prediction result is already very close to a triangle. The trained semantic segmentation model is used to predict the triangular superpixel morphological mask of the rice seedling in the target rice row detection image, and the following is generated: Figure 4 A binary mask image containing only the triangular superpixel morphological mask with the same size as the target rice row detection image is shown.
[0036] S03. Perform minimum outer triangle fitting on the triangular superpixel morphological mask in the binary mask image. The fitting function used is from the OpenCV-python toolkit. Take a single pixel point at the bottom endpoint of the outer triangle as the anchor point of the rice seedling to generate the following Figure 5 A binary anchor image containing only anchors of the same size as the target rice row detection image is shown.
[0037] S04. Use the scatter point clustering algorithm based on dynamic clustering search direction to sequentially complete the clustering and straight line fitting of the anchor points belonging to different rice rows in the binary anchor point image. The dynamic clustering search direction means that the reference clustering search direction used by the anchor points belonging to different rice rows in the binary anchor point image is dynamically inherited from the direction of the fitted straight line of the adjacent detected rice row. The schematic diagram of the anchor point processing process is shown in FIG. Figure 6 , 7 As shown, the specific steps include:
[0038] a01. With a step length of 10 pixels, the binary mask image is divided into several vertical strips in the horizontal direction. The vertical strip with the largest number of pixels belonging to the triangular superpixel morphological mask is S max , randomly select the vertical strip in the binary anchor image S max Any anchor point in the corresponding area is used as the cluster search base point, and the cluster search base point is recorded as P 1 , set the vertical direction as the reference cluster search direction, and record the slope of the reference cluster search direction as A 1 , set the search angle range to 30 degrees, and create a class List.
[0039] a02. Search for the binary anchor image P 1 Belong to the same category and close to each other P 1 The single cluster search process is as follows: find the nearest one or two other anchor points. P 1 Other anchor points within 30 degrees to the left and right of the reference cluster search direction are located at P 1 Above and at a distance P 1 The nearest anchor point is P above , recorded at P 1 Below and at a distance P 1 The nearest anchor point is P below ,like P above and P below If both exist, P above and P below and P 1Put in together class list, and P above and P below Update to the new cluster search base point, if P above and P below If only one exists in P 1 Put in together class The anchor point is added to the list and the existing anchor point is updated as the new cluster search base point.
[0040] a03. Loop through step a02 until there is no binary anchor point image that matches class The different anchors in the list are searched.
[0041] a04. Using the least squares method class The anchor points in the list are fitted with a straight line, and the fitted straight line is recorded as L 1 ,Will class The anchor points in the list are deleted from the binary anchor point image, and it is determined whether there are other anchor points in the binary mask image. If so, the reference cluster search direction is updated to the slope of the fitted line, and the updated slope is recorded as A 2 ,Will class The points in the list are cleared, and the following scattered point processing steps are continued. If there are none, it is considered that all scattered points in the binary anchor point image have been processed, and the entire scattered point processing process ends.
[0042] a05. Find the binary anchor point in the image L 1 Left and L 1 The nearest anchor point is P left , find the binary anchor point in the image L 1 Right side and L 1 The nearest anchor point is recorded as P right ,like P left and P right If both exist, P left and P right At the same time, it is updated as the cluster search base point. P left and Pright If only one exists, the existing anchor point is updated as the cluster search base point.
[0043] a06. Execute steps a03, a04 and a05 repeatedly until the scattered point processing process is completed. At this time, it is considered that all straight lines representing the rice seedling rows in the target detection image have been extracted. The rice seedling row detection result obtained is as follows: Figure 8 shown.
[0044] Fig. 9 The results of mask segmentation of rice seedling roots under different light, growth period and weed pressure conditions; Fig.10 The corresponding crop row detection results are given, where the red straight line (after conversion to grayscale, the red is lighter than the blue) is the true value line of the manually marked rice row, and the blue straight line is the crop row line detected by the present invention. It can be seen that the crop row detection algorithm proposed in the present invention has higher detection accuracy and better robustness.
[0045] Fig.11 In the figure, the blue straight line (after conversion to grayscale, blue is darker) is the crop row detected by the rice row detection algorithm based on root recognition proposed in the present invention, and the white straight line is the crop row line detected by the rice row detection algorithm based on canopy recognition. By comparison, it can be seen that the crop row detection algorithm proposed in the present invention will not be affected by leaf morphology, and has higher detection accuracy and better robustness.
[0046] The above-mentioned embodiments only express several implementation modes of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the invention. It should be pointed out that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the attached claims.
Claims
1. A method for early rice seedling row detection based on root positioning, It is characterized in that The method comprises the following steps: S01. Collecting a root image of rice seedlings in the field, using a triangular superpixel morphological mask designed for the root growth morphological characteristics of a single rice seedling to mark all the roots of a single rice seedling in the root image of the rice seedling, and establishing a rice seedling root mask dataset; S02. Using the rice seedling root mask dataset to train a semantic segmentation model based on deep learning, using the trained semantic segmentation model to predict the triangular superpixel morphological mask of the rice seedling root in the target rice row detection image, and generating a binary mask image of the same size as the target rice row detection image and containing only the predicted triangular superpixel morphological mask, thereby realizing the semantic segmentation of the rice seedling root mask; S03. performing minimum outer triangle contour fitting on the triangular superpixel morphological mask in the binary mask image, taking a single pixel point at the bottom end point of the minimum outer triangle contour as the anchor point of the rice seedling, and generating a binary anchor point image containing only the anchor point and having the same size as the target rice row detection image, thereby achieving the anchor point fixation of the rice seedling root; S04. using a scatter point clustering algorithm based on a dynamic clustering search direction to sequentially complete clustering and straight line fitting of anchor points belonging to different rice rows in the binary anchor point image; the dynamic clustering search direction means that the reference clustering search direction used by the anchor points belonging to different rice rows in the binary anchor point image is dynamically inherited from the direction of the fitted straight line of the adjacent detected rice row, thereby achieving clustering of anchor points at the root of rice seedlings and fitting of rice seedling rows, and finally obtaining the rice row detection result; The step S04 includes the following steps: a01. Divide the binary mask image into a number of vertical strips in the horizontal direction, and record the vertical strip with the largest number of pixels belonging to the triangular superpixel morphological mask as S max , randomly select the vertical strip in the binary anchor image S max Any anchor point in the corresponding area is used as the cluster search base point, the vertical direction is set as the base cluster search direction, the search angle range is set to a fixed value, and a cluster is established for storing similar anchor points. class List; a02. Search in the binary anchor point image for one or two other anchor points that belong to the same category as the cluster search base point and are closest to the cluster search base point. The single cluster search process is as follows: find other anchor points that are located within the same search angle range to the left and right of the cluster search base point along the reference cluster search direction, and record the anchor point that is above the cluster search base point and closest to the cluster search base point as P above , the anchor point located below the cluster search base point and closest to the cluster search base point is P below , if the anchor point P above and the anchor point P below If both exist, the anchor point P above and the anchor point P below Put it together with the cluster search base point into the class list, and the anchor point P above and the anchor point P below Update to the new cluster search base point, if P above and P below If only one of them exists, the existing anchor point and the cluster search base point are put into the class The existing anchor point is added to the list and updated as the new cluster search base point; a03. Loop through step a02 until there is no class Different anchors in the list are searched; a04. Using the least squares method to class The anchor points in the class are used for straight line fitting, and the fitting straight line is recorded as L , the class The anchor points in the list are deleted from the binary anchor point image, and it is determined whether there are any anchor points in the binary mask image. If so, the reference cluster search direction is updated to the fitting line. L direction and continue to perform the following scatter point processing steps to convert the class Clear the points in the list, if there are none, then end the scattered point processing process; a05. Find the binary anchor point image in the fitting line L On the left and with the straight line L The nearest anchor point is P left , find the binary anchor point image in the fitting line L The right side and the fitting straight line L The nearest anchor point is P right , if the P left and P right If both exist, the P left With the P right Update to the cluster search base point, if the P left and P right If only one exists, the existing anchor point is updated as the cluster search base point; a06. Execute the steps a03, a04 and a05 in a loop until the scattered point processing process is completed, at which time it is considered that all straight lines representing the rice seedling rows in the target rice row detection image have been extracted.
2. The method according to claim 1, It is characterized in that In the step S01, the root images of rice seedlings in the field include root images of rice seedlings under different lighting conditions, different growth periods, and different weed pressure conditions.
