Intelligent weeding and automatic row seedling strip center line extraction method
By improving the YOLOv5s object detection algorithm and least squares fitting method, combined with the deep learning herbicidal recognition algorithm, the problem of poor recognition and positioning effect in the complex background of corn seedlings is solved, and the precise navigation and automatic alignment of the herbicidal machinery are realized, improving the The weeding efficiency between crop rows.
Patent Information
- Application Number
- CN202411436910.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-15
- Publication Date
- 2025-02-11
AI Technical Summary
The prior art has poor identification and positioning effect in the complex background of corn seedlings, and it is difficult to diagnose the relative position of crops and herbicide institutions in real time, resulting in inaccurate weeding location.
The improved YOLOv5s object detection algorithm combined with the least squares fitting method is used to extract the identification characteristics of corn seedlings, and the center line of crop rows is calculated through the deep learning herbicidal recognition algorithm, controlling the left and right offsets of the herbicidal machinery to achieve automatic row alignment.
It improves the identification accuracy and robustness of corn seedlings, realizes accurate navigation and automatic alignment of the weeding machinery, reduces the driver's labor intensity, and improves the weeding efficiency between crop rows.
Smart Images

Figure CN119417879A_ABST
Abstract
Description
Technical field:
[0001] The invention relates to the field of detection technology, and in particular to a method for extracting the center line of a seedling belt of an intelligent weeding machine automatically. Background technology:
[0002] The early growth stage of corn is a critical time for weed management. Excessive use of chemical herbicides, while effective, can damage soil and water integrity. With the development of agricultural technology, there is an urgent need for innovative weed management solutions that can not only effectively suppress weeds, but also reduce labor, improve efficiency, and increase crop yields.
[0003] Mechanical weeding is a viable alternative to pesticides, saving labor and time compared to manual methods. However, traditional mechanical weeding often has difficulty accurately identifying and locating corn seedlings, which can easily cause seedling damage. Machine learning has been integrated into mechanical weeding, improving detection accuracy and reducing manual labor costs. For large-scale inter-row crop weed management, the accuracy of inter-row detection, weed identification, and automatic control is critical.
[0004] Despite advances such as GPS navigation, changes in plant spacing due to environmental factors and planter accuracy challenge the effectiveness of existing methods. Machine vision combined with precision control systems has been proposed to address these challenges, using image processing and sensor technology to reduce labor intensity and costs. Methods based on morphological features, however, have poor recognition effects in complex environments; methods using deep learning target detection algorithms need to improve the accuracy and robustness of small target recognition; using an improved backbone network to extract features, but the effect needs to be verified in the corn seedling scenario; using a single-stage target detection algorithm, the recognition efficiency is high, but the recognition ability is limited in situations such as target overlap. Overall, the recognition and positioning effects of current methods in the complex background of corn seedlings still need to be improved.
[0005] To solve this problem, this paper proposes an automatic recognition and navigation positioning method for corn seedlings based on the improved YOLOv5s target detection algorithm. This problem is mainly due to the fact that there are many types of weeds in the field and their uneven distribution, and the recognition accuracy and robustness of existing recognition methods need to be improved under complex backgrounds. It is impossible to diagnose the relative position of crops and weeding mechanisms in real time, and it is difficult to accurately control the weeding position. Therefore, the improved YOLOv5 algorithm target detection model is applied to the recognition and positioning of corn seedlings, and the least squares fitting method is used to extract the guide line. A method for extracting the center line of the seedling strip for intelligent weeding is studied to provide a reference position for inter-row weeding. Summary of the invention:
[0006] The purpose of the present invention is to overcome the shortcomings of the above-mentioned prior art and to provide a method for automatically extracting the center line of the seedling strip for intelligent weeding, which can effectively solve the problems that the current crop row recognition process is affected by natural conditions such as corn plant leaves blocking each other or exposed soil, soil straw residue interference, lighting conditions, and low recognition accuracy caused by vehicle bumps during the process.
[0007] Intelligent inter-row mechanical weeding equipment uses cameras to extract real-time seedling and weed information in the field, performs image recognition processing, and obtains a network model with high recognition accuracy by improving the deep convolutional network model and training the network, accurately distinguishing seedlings, weeds and soil, and locating the seedlings. The crop rows planted with corn seedlings are used as reference datums, and computer vision technology is introduced to fit the center lines of two crop rows. The middle position of the two lines is calculated as a guide line to control and adjust the lateral movement of the weeder. The weeder actuator uses the guide line as a reference to automatically adjust the lateral position as the vehicle deviates to maintain a safe distance from the crop rows.
[0008] To achieve the above purpose, the present invention adopts the following technical solutions: based on the deep learning weeding machine crop recognition algorithm, the precise position of the crop is accurately calculated to form two crop row fitting lines, and the center line of the two crop row fitting lines is obtained to control the left and right offset of the weeding machine, so as to keep the machine always located at the center of the two crop rows, and effectively remove the weeds in the weed removal area between the rows;
[0009] The specific steps include:
[0010] S1. Acquire a corn crop data set, and perform data preprocessing on the corn crop row data set;
[0011] S2. Improve the algorithm of YOLOv5s model;
[0012] S3, training the improved YOLOv5s model based on the preprocessed corn crop dataset;
[0013] S4. Develop a system to identify corn crops using the trained improved YOLOv5s model;
[0014] S5, constructing the ROI area in the image based on the relationship analysis between the camera pitch angle and the seedling imaging based on the collected RGB image of the crop rows between the ridges;
[0015] S6, obtaining the center coordinates of the identified crop and fitting the crop rows by the least square method;
[0016] S7, calculating the center line between the crop row lines;
[0017] S8. Calculate the distance between the weeding machine props and the center line.
[0018] The data preprocessing in step S1 includes the following contents:
[0019] 1) Rotate the dataset and perform preset angle rotation on the images in the corn crop dataset to simulate images formed by different shooting angles;
[0020] 2) Random image enhancement, which randomly adjusts the chromaticity, enhances the contrast, and changes the saturation of the rotated image to simulate images taken under different weather and lighting conditions;
[0021] 3) Sharpening processing: performing various sharpening processing on the randomly enhanced images to simulate the clarity differences caused by shooting with different devices;
[0022] 4) Noise addition: performing different types of noise processing on the processed images to simulate the effects of imaging under various shooting environments, so as to better adapt to the actual crop production environment;
[0023] 5) The enhanced data set is uniformly named in the format of YMxxxx and divided into training set, validation set and test set in a ratio of 8:1:1;
[0024] 6) Use Makesense software to mark the corn crop, and use the tool provided by Makesense to manually draw a box to select the corn crop and mark it as "maize";
[0025] 7) After completing the box selection for each image, save the annotation results. Export the annotation data to YOLO format (.txt), with one label file for each image, containing the category and coordinates of each annotation box.
[0026] In the step S2, the algorithm of YOLOv5s is improved, including: replacing CSPDarknet-53 with MobileNetv3 as the backbone network of YOLOv5s to perform feature extraction, studying the performance of the model and the running time of MobileNetv3, improving MobileNetv3 for the lightweight design of the model, replacing the SENet module with the CBAM attention mechanism in the network model to optimize the target detection accuracy and strengthen the focus on the detection target.
[0027] In the step S2, the improvement of the YOLOv5s model algorithm also includes: an improved non-maximum suppression algorithm (DIoU-NMS), which replaces the NMS non-maximum suppression improvement in the original YOLOv5s; DIoU-NMS improves the performance and accuracy of the model in the case of dense targets.
[0028] In the step S3, after training the improved YOLOv5s model based on the preprocessed corn crop data set, the improved YOLOv5s model is evaluated, and the one with the best evaluation effect is selected as the improved YOLOv5s model.
[0029] In the step S4, the crop image is input into the trained improved YOLOv5s model; CSPDarkNet53 is replaced by a lightweight backbone network MobileNetV3 to achieve a coordinated balance between lightweight, accuracy and efficiency. On this basis, the image is captured by a convolutional block attention module (CBAM) to obtain a first feature map; the first feature map is input into the improved Neck network, and the second feature map is generated after feature fusion processing by a weighted bidirectional feature pyramid module; at the same time, the small-scale features are processed in combination with a multi-scale feature extraction method to meet the detection requirements of targets of different sizes; finally, all feature maps are comprehensively predicted by DIoU-NMS to output the confidence of the target crop image.
[0030] In the step S5, during the actual navigation of the weeding machine, the traveling column is generally the guide line in the middle of the image. The crop rows on the left and right sides closest to the guide line of the weeding machine directly affect the accuracy of navigation. Therefore, the ROI area is screened out in advance in the image. This can reduce the amount of image data processing and reduce the interference of the crop columns at the edge of the image, making the subsequent image processing steps more efficient.
[0031] In step S6, the coordinate information is used to describe the position of the bounding box, and the first crop row fitting line L1 is obtained by least squares fitting, and the coordinates are used to obtain the second crop row fitting line L2 by least squares fitting. The seedling line fitting algorithm of the least squares method is used to obtain the fitting lines of the two crop rows in the area of interest.
[0032] In the step S7, the center line between the crop row fitting line L1 and the crop row fitting line L2 is obtained according to the slope m1 and the slope m2.
[0033] In the step S8, the distance between the weeding machine prop and the seedling is calculated.
[0034] The beneficial effects of the present invention are as follows: the present invention has a scientific and reasonable structure and is safe and convenient to use: a deep learning weeding and crop recognition algorithm is used to accurately calculate the precise position of the seedling center, quickly fit the crop row, and calculate the center line to control the offset between the weeding machine props and the center line of the crop row, thereby achieving automatic row alignment, keeping the props always between the crop rows, achieving rapid weeding between the crop rows, and reducing the labor intensity of the driver.
[0035] The main limitations of deep learning in plant detection include: dependence on a large amount of labeled data, poor learning effect of small samples, and weak model generalization ability. The use of deep separable convolution can effectively reduce the complexity of the model, improve the detection speed while maintaining accuracy, and is suitable for plant disease classification tasks. The improved YOLOv5s algorithm provides important support for the classification and positioning of these targets, which is crucial for precision agriculture and crop management. It demonstrates its practical feasibility in real-time applications, with higher recognition efficiency and no dependence on the regularity of crop rows. Compared with the method based on Hough transform, this method does not require the preset starting point of the crop row, and has stronger robustness, and can recognize regular or irregular curved and straight crop rows. The YOLOv5s model used has smaller parameters, faster recognition speed, and is more suitable for real-time applications. The small sample learning ability is improved by methods such as data enhancement, and the recognition ability is improved by adding modules such as CBAM, and the recognition effect is better. In addition, the lightweight design meets the needs of embedded applications and reduces computing costs. However, the recognition effect of this method is limited in complex backgrounds. In contrast, the CBAM module proposed in this paper enhances the feature extraction capability, DIoU-NMS reduces the false detection rate, and has better recognition effect. In summary, the algorithm design fully considers light weight, high efficiency and recognition accuracy, and is theoretically more suitable for the dataset scenario, thus achieving better recognition effect, especially in meeting the practical requirements of agricultural tasks and autonomous machinery operations.
[0036] Instruction manual attached:
[0037] Figure 1 is a flowchart of the steps of the visual navigation method of the present invention;
[0038] Figure 2 It is a network structure diagram of the improved YOLOv5s crop recognition model of the present invention;
[0039] Figure 3 It is the improved YOLOv5s crop recognition map of the present invention;
[0040] Figure 4 It is the effect diagram of the region of interest of the present invention;
[0041] Figure 5 It is the coordinate point diagram after crop recognition of the improved YOLOv5s of the present invention;
[0042] Figure 6 It is the fitted crop row graph after the improved YOLOv5s crop recognition of the present invention;
[0043] Figure 7 It is the improved YOLOv5s fitted crop row centerline map of the present invention. Specific implementation method:
[0044] The present invention specifically adopts the following implementation methods: based on the deep learning weeding machine crop recognition algorithm, the precise position of the crop is accurately calculated to form two crop row fitting lines, and the center line of the two crop row fitting lines is obtained to control the left and right offset of the weeding machine, so as to keep the machine always located at the center of the two crop rows, and effectively remove the weeds in the weed removal area between the rows;
[0045] The specific steps include:
[0046] S1. Acquire a corn crop data set, and perform data preprocessing on the corn crop row data set;
[0047] S2. Improve the algorithm of YOLOv5s model;
[0048] S3, training the improved YOLOv5s model based on the preprocessed corn crop dataset;
[0049] S4. Develop a system to identify corn crops using the trained improved YOLOv5s model;
[0050] S5, constructing the ROI area in the image based on the relationship analysis between the camera pitch angle and the seedling imaging based on the collected RGB image of the crop rows between the ridges;
[0051] S6, obtaining the center coordinates of the identified crop and fitting the crop rows by the least square method;
[0052] S7, calculating the center line between the crop row lines;
[0053] S8. Calculate the distance between the weeding machine props and the center line.
[0054] The data preprocessing step S1 includes the following contents:
[0055] 1) Rotate the dataset and perform preset angle rotation on the images in the corn crop dataset to simulate images formed by different shooting angles;
[0056] 2) Random image enhancement, which randomly adjusts the chromaticity, enhances the contrast, and changes the saturation of the rotated image to simulate images taken under different weather and lighting conditions;
[0057] 3) Sharpening processing: performing multiple sharpening processes on the randomly enhanced images to simulate the clarity differences caused by shooting with different devices;
[0058] 4) Noise addition: performing different types of noise processing on the processed images to simulate the effects of imaging under various shooting environments, so as to better adapt to the actual crop production environment;
[0059] 5) The enhanced data set is uniformly named in the format of YMxxxx and divided into training set, validation set and test set in a ratio of 8:1:1;
[0060] 6) Use Makesense software to mark the corn crop, and use the tool provided by Makesense to manually draw a box to select the corn crop and mark it as "maize";
[0061] 7) After completing the box selection for each image, save the annotation results. Export the annotation data to YOLO format (.txt), with one label file for each image, containing the category and coordinates of each annotation box.
[0062] In the step S2, the algorithm of YOLOv5s is improved, including: using MobileNetv3 instead of CSPDarknet-53 as the backbone network of YOLOv5s to extract features, studying the performance of the model and the running time of MobileNetv3, improving MobileNetv3 for the lightweight design of the model, replacing the SENet module with the CBAM attention mechanism in the network model to optimize the target detection accuracy and strengthen the focus on the detection target. In the step S2, the algorithm of the YOLOv5s model is also improved: an improved non-maximum suppression algorithm (DIoU-NMS) replaces the NMS non-maximum suppression improvement in the original YOLOv5s; DIoU-NMS improves the performance and accuracy of the model in the case of dense targets. In the step S3, after training the improved YOLOv5s model based on the corn crop data set after preprocessing, it also includes evaluating the improved YOLOv5s model and selecting the one with the best evaluation effect as the improved YOLOv5s model. In the step S4, the crop image is input into the trained improved YOLOv5s model; CSPDarkNet53 is replaced with a lightweight backbone network MobileNetV3 to achieve a coordinated balance between lightweight, accuracy and efficiency. On this basis, the image is captured by the convolutional block attention module (CBAM) to obtain the first feature map; the first feature map is input into the improved Neck network, and the second feature map is generated by the feature fusion processing of the weighted bidirectional feature pyramid module; at the same time, the small-scale features are processed by combining the multi-scale feature extraction method to meet the detection requirements of targets of different sizes; finally, all feature maps are comprehensively predicted by DIoU-NMS to output the confidence of the target crop image. In the step S5, in the actual navigation process of the weeding machine, the marching column is generally the guide line in the middle of the image, and the crop rows on the left and right sides closest to the guide line of the weeding machine directly affect the accuracy of navigation. Therefore, the ROI area is pre-screened in the image, which can reduce the image data processing amount and reduce the interference of the crop columns at the edge of the image, making the subsequent image processing steps more efficient. In the step S6, the coordinate information is used to describe the position of the bounding box, and the first crop row fitting line L1 is obtained by least squares fitting, and the coordinates are fitted by least squares fitting to obtain the second crop row fitting line L2, and the seedling line fitting algorithm of the least squares method is used to obtain the fitting lines of the two crop rows in the region of interest. In the step S7, the center line between the crop row fitting line L1 and the crop row fitting line L2 is obtained according to the slope m1 and the slope m2. In the step S8, the distance between the weeding machine prop and the seedling is calculated.
[0063] Example
[0064] This visual automatic row alignment method is mainly based on the deep learning weeding machine crop recognition algorithm to accurately calculate the precise position of the crop to form the fitting line of the two crop rows, and obtain the center line of the two crop rows to control the left and right offset of the weeding machine, so as to keep the machine always located at the center of the two crop rows, and effectively remove the weeds in the weed removal area between the rows;
[0065] The method for automatically extracting the center line of the seedling strip of an intelligent weeding plant provided by the present invention specifically comprises the following steps:
[0066] S1. Acquire a corn crop data set, and perform data preprocessing on the corn crop row data set;
[0067] S2. Improve the algorithm of YOLOv5s model;
[0068] S3, training the improved YOLOv5s model based on the preprocessed corn crop dataset;
[0069] S4. Develop a system to identify corn crops using the trained improved YOLOv5s model;
[0070] S5, constructing the ROI area in the image based on the relationship analysis between the camera pitch angle and the seedling imaging based on the collected RGB image of the crop rows between the ridges;
[0071] S6, obtaining the center coordinates of the identified crop and fitting the crop rows by the least square method;
[0072] S7, calculating the center line between the crop row lines;
[0073] S8. Calculate the distance between the weeding machine props and the center line.
[0074] Based on the above technical solution, in S1, the data set contains images under different plots and weather conditions, with high data diversity, which is conducive to the training of deep learning models. Rotate the data set and perform preset angle rotation on the images in the corn crop data set to simulate images formed by different shooting angles;
[0075] Random image enhancement: random chromaticity adjustment, contrast enhancement and saturation change are performed on the rotated images to simulate images taken under different weather and lighting conditions;
[0076] Sharpening: Perform various sharpening processes on the randomly enhanced images to simulate the difference in clarity caused by shooting with different devices;
[0077] Noise addition: performing different types of noise processing on the processed images to simulate the effects of imaging under various shooting environments, so as to better adapt to the actual crop production environment;
[0078] The enhanced data set is uniformly named in the format of YMxxxx and is divided into training set, validation set and test set in a ratio of 8:1:1;
[0079] Use Makesense software to mark the corn crop. Use the tool provided by Makesense to manually draw a box to select the corn crop and mark it as "maize";
[0080] After completing the box selection for each image, save the annotation results. Export the annotation data to YOLO format (.txt), with one label file for each image, containing the category and coordinates of each annotation box.
[0081] Based on the above technical solution, in step S2, the algorithm of YOLOv5s is improved, including: using MobileNetv3 instead of CSPDarknet-53 as the backbone network of YOLOv5s to extract features, studying the performance of the model and the running time of MobileNetv3, improving MobileNetv3 for the lightweight design of the model, replacing the SENet module with the CBAM attention mechanism in the network model to optimize the target detection accuracy and strengthen the focus on the detection target. The specific network structure is as follows: Figure 2 shown.
[0082] Based on the above technical solution, in step S2, improving the YOLOv5s model further includes:
[0083] Improved non-maximum suppression algorithm (DIoU-NMS), replaces the NMS non-maximum suppression improvement in the original YOLOv5s; DIoU-NMS improves the performance and accuracy of the model in dense target situations.
[0084] The algorithm uses MobileNetV3 as the backbone network, with a lightweight design to reduce the amount of computation. MobileNetV3 uses a residual structure and deep separable convolution to reduce computational costs while maintaining accuracy to meet the needs of embedded applications. At the same time, the CBAM module is introduced to enhance feature extraction capabilities, which is conducive to identifying small targets and complex backgrounds. The algorithm uses DIoU-NMS instead of NMS. The algorithm considers the distance between the center points of the boxes, better distinguishes overlapping boxes while retaining the target, improves accuracy while maintaining the recall rate, reduces the mutual influence between targets, and reduces the false detection rate.
[0085] Based on the above technical solution, in step S3, after training the improved YOLOv5s model based on the preprocessed corn crop data set, it also includes evaluating the improved YOLOv5s model and selecting the one with the best evaluation effect as the improved YOLOv5s model.
[0086] Furthermore, the system hardware configuration for model training and reasoning used in the embodiment of the present invention is shown in Table 1.
[0087] Table 1 Hardware system in the embodiment of the present invention
[0088] operating system Windows 11 CPU 12thGenIntel(R)Core(TM)i7-12700H2.30GHz GPU NVIDIAGeForceRTX40708G RAM 16 GB harddisk PCLe 4.0 5 12GB SSD
[0089] The software environment configuration used is shown in Table 2
[0090] Table 2 Software environment configuration
[0091]
[0092] In the training input stage, the embodiment of the present invention uniformly sets the size of all input images to 640*640. During the model training process, stochastic gradient descent (SGD) is used as the optimizer, the momentum factor is set to 0.937, the initial learning rate is 0.01, and the learning rate is adjusted by cosine annealing. The weight decay coefficient is set to 0.0005, the batch size is set to 32, and the training epoch is set to 200.
[0093] During the implementation of the example of the present invention, in order to verify the performance of the improved algorithm of the embodiment of the present invention, a number of ablation tests were carried out during the experiment. From the tests, it can be obtained that the various parameter indicators compared with the original YOLOv5s are as shown in Table 3.
[0094] Table 3 Improved Yolov5s ablation experiment parameter indicators
[0095]
[0096] Evaluate the training results and select the improved YOLOv5s model with the best evaluation effect
[0097] Based on the above technical solution, in step S4, the crop image is input into the trained improved YOLOv5s model;
[0098] CSPDarkNet53 is replaced with a lightweight backbone network MobileNetV3 to achieve a coordinated balance between lightweight, accuracy, and efficiency. On this basis, the convolutional block attention module (CBAM) captures the region of interest of the image to obtain the first feature map;
[0099] The first feature map is input into the improved Neck network, and is subjected to feature fusion processing by a weighted bidirectional feature pyramid module to generate a second feature map.
[0100] At the same time, combined with the multi-scale feature extraction method, the small-scale third feature map is processed to meet the detection requirements of targets of different sizes;
[0101] Finally, all feature maps are comprehensively predicted by DIoU-NMS, and the confidence of the target crop image is output to identify the crop. Figure 3 shown.
[0102] Based on the above technical solution, in step S5, during the actual navigation of the weeding machine, the traveling column is generally the guide line in the middle of the image, and the crop rows on the left and right sides closest to the guide line of the weeding machine directly affect the accuracy of navigation. Therefore, the ROI area is pre-screened in the image, which can reduce the image data processing volume and reduce the interference of the crop columns at the edge of the image, making the subsequent image processing steps more efficient, such as Figure 4 shown.
[0103] ROI specific determination process
[0104] Under perspective projection, the pixel distances DOG and DO'H at the upper and lower ends of the center line of the corn seedling row have the following relationship: Where G G Yes D OG With D O'H The ratio of θ is the angle between the camera optical axis and the horizontal line, which is 45° to 60°; α is the vertical field of view of the camera.
[0105] The pixel distance between point M and point H obtained from camera imaging is d is the average distance between rows, in mm; f is the focal length of the camera, in mm; H is the height of the camera optical center from the ground, in mm; K is the physical size of a single pixel in the image, in mm.
[0106] When the camera depression angle is maximum (θ = 60°), the pixel distance DO'H between point O' and point H is maximum. Substituting θ = 60° into the formula, we can get D O'H and D OG , at this time D O'H and D OG As a reference value, set the area within the quadrilateral ABDC as ROI, and perform mask filling on the non-ROI part of the image. O′D =D O′B =cD MQ , D OC =D OA =cD OG , c is the margin coefficient (c = 1.2), the ROI extraction effect is as follows Figure 4 shown.
[0107] Based on the above technical solution, in step S6, the coordinate information is used to describe the position of the bounding box. Since the corn seedling detection part only gives the bounding box containing the coordinates of the vertex of the bounding box, the corn position information is simplified to a coordinate value to represent its position in the xy coordinate of the image. The coordinate system of the input image of size 416×416 is displayed, where the y-axis ranges from 0 to 416 and the x-axis ranges from 0 to 416.
[0108] Based on the above technical solution, the coordinate information is used to describe the position of the bounding box. Starting from the vertex closest to the origin, and then moving the coordinate position clockwise, the position of the vertex of the bounding box is defined as follows: (x min ,y min ), (x max ,y min ), (x max ,y max ), (x min ,y max ), use x min 、x max ,y min and max To define the position of the corn seedling, where (x, y) is the coordinate of the center of the corn seedling guide line like Figure 5 shown.
[0109] Based on the above technical solution, in S6, the first crop row fitting line L1 is obtained by least squares fitting, and the coordinates are fitted by least squares fitting to obtain the second crop row fitting line L2. The seedling line fitting algorithm of the least squares method is used to obtain the fitting lines of the two crop rows in the region of interest, such as Figure 6 shown.
[0110] Considering that the crop rows in field management have no deflection in a short distance. In addition, since the tractor moves slowly at a speed of about 0.6m / s, a simple line fitting method can be used, using the seedling line fitting algorithm of the least square method, and the center navigation line is fitted with a linear fit.
[0111] in represents the average value of the abscissa of all points representing maize seedlings; Represents the average value of the ordinates of all points. (x i ,y i ) are the coordinates of each seedling numbered i. m is the slope and b is the intercept. The crop row fitting line can be expressed as y=mx+b.
[0112] In order to ensure that the two crop rows are separated, a threshold value is set, represented by x th , and a reference point s c (xc ,y c ), and define the other points as (x i ,y i ), where i≤n is the serial number for identifying the crop, and n is the total number of points excluding the reference point. Since the corn crop row extends along the positive y direction, and it is necessary to classify these points into different crop rows, only the horizontal axis is used as the research object, and the x axis is used as the coordinate. ci =x c -x i value to calculate, when |x ci |≤x th Classified as L1 crop row, when |x ci |>x th After classifying all detection points, the expressions of m and b of L1 and L2 crop rows are calculated by equations as follows:
[0113] Based on the above technical solution, in step S7, the center line between the crop row fitting line L1 and the crop row fitting line L2 is obtained according to the slope m1 and the slope m2;
[0114] The crop rows in agricultural reclamation areas are highly standardized, and the inter-row weeder controls the lateral displacement of the weeding shovel to remove weeds between the rows. Figure 4 This can be obtained by averaging the fitted lines of the two rows of crops to obtain the navigation center line as shown in the formula Where m1 and m2 are the slopes of the two crop rows, and b1 and b2 are the intercepts of the two crop rows.
[0115] Based on the above technical solution, in step S8, the distance between the weeding machine prop and the center line of the crop row is calculated, such as Figure 7 shown.
[0116] h x It is expressed as a function of the position of the weeder and the crop row fitting line. Assume that the vehicle position is (x vehicle ,y vehicle ), then h x As shown in the formula
[0117] m center The slope of the center guide line, b center is the intercept of the center guide line. x Considered as the position of the lawnmower (x vehicle ,y vehicle ). x Find the location that minimizes weeding machinery.
[0118] In summary, the method for extracting the center line of the seedling belt for automatic row alignment in intelligent weeding has a scientific and reasonable structure and is safe and convenient to use: the deep learning weeding recognition and crop recognition algorithm is used to accurately calculate the precise position of the seedling center, quickly fit the crop row, and calculate the center line to control the offset between the weeding mechanical props and the center line of the crop row, realize automatic row alignment, keep the props always between the crop rows, realize rapid weeding between crop rows, and reduce the labor intensity of the driver.
[0119] The main limitations of deep learning in plant detection include: dependence on a large amount of labeled data, poor learning effect of small samples, and weak model generalization ability. The use of deep separable convolution can effectively reduce the complexity of the model, improve the detection speed while maintaining accuracy, and is suitable for plant disease classification tasks. The improved YOLOv5s algorithm provides important support for the classification and positioning of these targets, which is crucial for precision agriculture and crop management. It demonstrates its practical feasibility in real-time applications, with higher recognition efficiency and no dependence on the regularity of crop rows. Compared with the method based on Hough transform, this method does not require the preset starting point of the crop row, and has stronger robustness, and can recognize regular or irregular curved and straight crop rows. The YOLOv5s model used has smaller parameters, faster recognition speed, and is more suitable for real-time applications. The small sample learning ability is improved by methods such as data enhancement, and the recognition ability is improved by adding modules such as CBAM, and the recognition effect is better. In addition, the lightweight design meets the needs of embedded applications and reduces computing costs. However, the recognition effect of this method is limited in complex backgrounds. In contrast, the CBAM module proposed in this paper enhances the feature extraction capability, DIoU-NMS reduces the false detection rate, and has better recognition effect. In summary, the algorithm design fully considers light weight, high efficiency and recognition accuracy, and is theoretically more suitable for the dataset scenario, thus achieving better recognition effect, especially in meeting the practical requirements of agricultural tasks and autonomous machinery operations.
Claims
1. A method for automatically extracting the center line of the seedling strip for intelligent weeding, characterized in that: The crop recognition algorithm for weeding machinery based on deep learning can accurately calculate the precise position of the crop to form a fitting line between two crop rows, and obtain the center line of the two crop row fitting lines to control the left and right offset of the weeding machinery, so that the machinery is always located in the center of the two crop rows, and the weeds in the weed removal area between the rows can be effectively removed; The specific steps include: S1. Acquire a corn crop data set, and perform data preprocessing on the corn crop row data set; S2. Improve the algorithm of YOLOv5s model; S3, training the improved YOLOv5s model based on the preprocessed corn crop dataset; S4. Develop a system to identify corn crops using the trained improved YOLOv5s model; S5, constructing the ROI area in the image based on the relationship analysis between the camera pitch angle and the seedling imaging based on the collected RGB image of the crop rows between the ridges; S6, obtaining the center coordinates of the identified crop and fitting the crop rows by the least square method; S7, calculating the center line between the crop row lines; S8. Calculate the distance between the weeding machine props and the center line.
2. According to claim 1, a method for extracting the center line of the seedling strip for automatic weeding is characterized by: The data preprocessing in step S1 includes the following contents: 1) Rotate the dataset and perform preset angle rotation on the images in the corn crop dataset to simulate images formed by different shooting angles; 2) Random image enhancement, which randomly adjusts the chromaticity, enhances the contrast, and changes the saturation of the rotated image to simulate images taken under different weather and lighting conditions; 3) Sharpening processing: performing various sharpening processing on the randomly enhanced images to simulate the clarity differences caused by shooting with different devices; 4) Noise addition: performing different types of noise processing on the processed images to simulate the effects of imaging under various shooting environments, so as to better adapt to the actual crop production environment; 5) The enhanced data set is uniformly named in the format of YMxxxx and divided into training set, validation set and test set in a ratio of 8:1:1; 6) Use Makesense software to mark the corn crop, and use the tool provided by Makesense to manually draw a box to select the corn crop and mark it as "maize"; 7) After completing the box selection for each image, save the annotation results. Export the annotation data to YOLO format (.txt), with one label file for each image, containing the category and coordinates of each annotation box.
3. The method for extracting the center line of the seedling strip in an intelligent weeding automatic row according to claim 1 is characterized by: In the step S2, the algorithm of YOLOv5s is improved, including: replacing CSPDarknet-53 with MobileNetv3 as the backbone network of YOLOv5s to perform feature extraction, studying the performance of the model and the running time of MobileNetv3, improving MobileNetv3 for the lightweight design of the model, replacing the SENet module with the CBAM attention mechanism in the network model to optimize the target detection accuracy and strengthen the focus on the detection target.
4. The method for extracting the center line of the seedling strip in an intelligent weeding automatic row according to claim 1 is characterized in that: In the step S2, the improvement of the YOLOv5s model algorithm also includes: an improved non-maximum suppression algorithm (DIoU-NMS), which replaces the NMS non-maximum suppression improvement in the original YOLOv5s; DIoU-NMS improves the performance and accuracy of the model in the case of dense targets.
5. The method for extracting the center line of the seedling strip in an intelligent weeding system according to claim 1, characterized in that: In the step S3, after training the improved YOLOv5s model based on the preprocessed corn crop data set, the improved YOLOv5s model is evaluated, and the one with the best evaluation effect is selected as the improved YOLOv5s model.
6. The method for extracting the center line of the seedling strip in an intelligent weeding system according to claim 1, characterized in that: In the step S4, the crop image is input into the trained improved YOLOv5s model; CSPDarkNet53 is replaced by a lightweight backbone network MobileNetV3 to achieve a coordinated balance between lightweight, accuracy and efficiency. On this basis, the image is captured by a convolutional block attention module (CBAM) to obtain a first feature map; the first feature map is input into the improved Neck network, and the second feature map is generated after feature fusion processing by a weighted bidirectional feature pyramid module; at the same time, the small-scale features are processed in combination with a multi-scale feature extraction method to meet the detection requirements of targets of different sizes; finally, all feature maps are comprehensively predicted by DIoU-NMS to output the confidence of the target crop image.
7. The method for extracting the center line of the seedling strip in an intelligent weeding system according to claim 1, characterized in that: In the step S5, during the actual navigation of the weeding machine, the traveling column is generally the guide line in the middle of the image. The crop rows on the left and right sides closest to the guide line of the weeding machine directly affect the accuracy of navigation. Therefore, the ROI area is screened out in advance in the image. This can reduce the amount of image data processing and reduce the interference of the crop columns at the edge of the image, making the subsequent image processing steps more efficient.
8. The method for extracting the center line of the seedling strip in an intelligent weeding system according to claim 1, characterized in that: In step S6, the coordinate information is used to describe the position of the bounding box, and the first crop row fitting line L1 is obtained by least squares fitting, and the coordinates are used to obtain the second crop row fitting line L2 by least squares fitting. The seedling line fitting algorithm of the least squares method is used to obtain the fitting lines of the two crop rows in the area of interest.
9. The method for automatically extracting the center line of the seedling strip for intelligent weeding according to claim 1, characterized in that: In the step S7, the center line between the crop row fitting line L1 and the crop row fitting line L2 is obtained according to the slope m1 and the slope m2.
10. The method for extracting the center line of the seedling strip in an intelligent weeding automatic row according to claim 1, characterized in that: In the step S8, the distance between the weeding machine prop and the seedling is calculated.
Citation Information
Cited By
Visual identification-based row-control weeding method, system and equipment
CN121459074A