Multi-scene-oriented agricultural machine operation area calculation method based on GNSS trajectory
The field trajectory segmentation is performed by trajectory clustering based on space-time density and the improved YOLOv8 model, combining cubic spline interpolation and dynamic buffer generation, and solving the problem of insufficient accuracy in multiple scenarios in the existing technology, realizing high-precision agricultural machinery operation area calculation.
Patent Information
- Application Number
- CN202510198524.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-23
- Publication Date
- 2025-06-10
AI Technical Summary
The existing agricultural machinery operation area calculation method based on GNSS trajectory is insufficient in generalization capabilities in many scenarios, especially when dealing with complex operation modes and unsmooth actual operation trajectories, the accuracy is low.
Field trajectory segmentation is performed by using agricultural machinery trajectory clustering method based on space-time density and an improved YOLOv8 instance segmentation model. The agricultural machinery operation area is calculated by combining cubic spline interpolation and dynamic buffer generation method.
It realizes high-precision agricultural machinery operation area calculation in multiple scenarios, adapts to complex terrain and diversified operation modes, and significantly improves calculation accuracy and robustness.
Smart Images

Figure CN120125644A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of agricultural machinery operation area calculation methods, and more specifically, relates to a multi-scenario-oriented agricultural machinery operation area calculation method based on GNSS trajectories. Background Art
[0002] A GNSS (Global Navigation Satellite System) terminal installed on agricultural machinery can collect information such as longitude, latitude, speed, and direction angle during the operation of the agricultural machinery in real time. These data constitute a complete operation trajectory of the agricultural machinery. Based on the operation trajectory of the agricultural machinery, the operation area of the agricultural machinery can be automatically calculated. Compared with manual acreage measurement, it saves a large amount of manpower and resources, and at the same time improves the accuracy and reliability of area calculation. The operation area of agricultural machinery is the main basis for carrying out agricultural machinery operation subsidies and operation efficiency evaluation. At present, with the wide deployment and use of GNSS terminals on agricultural machinery, it is of great significance to study a high-precision agricultural machinery operation area calculation method based on GNSS trajectories for multiple operation scenarios formed by various operation regions, operation types, and operation methods.
[0003] The calculation of operation area based on trajectories usually includes two stages: firstly, field-road trajectory segmentation, which segments farmland trajectory points from GNSS trajectory data; and then calculating the operation area based on the farmland trajectory points. At present, there are relevant studies on the calculation of operation area based on trajectories. For example, automatic trajectory segmentation and area calculation are realized by using trajectory geometric characteristics or feature extraction algorithms. However, most of these methods are only applicable to a single operation scenario (such as crops like wheat and rice). Other studies optimize trajectory segmentation or area calculation respectively, but lack a fusion solution in multi-scenarios.
[0004] At present, field-road trajectory segmentation methods are mainly divided into clustering-based segmentation methods, machine learning-based segmentation methods, and deep learning-based methods. The clustering-based segmentation method uses a density-based clustering method to segment the driving trajectory into field and road segments. This method is limited by the density of the trajectory and has unstable effects in multi-operation scenarios. The machine learning-based segmentation method uses traditional fully supervised machine learning methods to segment the trajectory. This method depends on the feature extraction scheme and may lead to a decrease in segmentation accuracy when facing different scenarios, especially when the feature design fails to fully reflect the trajectory characteristics. The deep learning-based segmentation method uses mainstream deep learning models to extract spatio-temporal feature information from trajectory points and perform segmentation, significantly improving the segmentation accuracy. However, it faces problems of large resource consumption and low computational efficiency when processing large-scale trajectory data.
[0005] The calculation methods of agricultural machinery operation area are mainly divided into two categories: boundary-based and trajectory-based. The boundary-based calculation method relies on handheld or vehicle-mounted measuring instruments to circle the boundary of the operation area to determine the operation area of agricultural machinery. This method not only consumes a large amount of manpower and resources, but also is difficult to accurately calculate the operation area of a single agricultural machine. With the increase of large-scale operation and diverse scenarios of agricultural machinery, the application limitations of this method become more and more obvious, and it is difficult to meet the requirements of modern agriculture for efficiency and accuracy. In contrast, the trajectory-based calculation method can complete the area calculation more automatically by analyzing the GNSS trajectory data generated during the operation of agricultural machinery. However, in multi-scenario applications, existing trajectory-based methods such as the distance-width method, the outer contour method, and the buffer method show the problem of insufficient generalization ability. These methods have obvious errors when dealing with complex operation modes (such as re-tilling, the figure-eight operation mode, missed tillage, etc.), especially when facing uneven actual operation trajectories, the accuracy is further affected.
[0006] In summary, the present invention proposes a high-precision agricultural machinery trajectory segmentation algorithm and area calculation method based on GNSS trajectory for multi-operation scenarios. Summary of the Invention
[0007] The present invention provides a method for calculating the operation area of agricultural machinery based on GNSS trajectory for multi-scenarios, and the process is as Figure 1 shown.
[0008] The technical solution adopted by the present invention is as follows: Step 1: Obtain the trajectory data uploaded during the operation of agricultural machinery. The agricultural machinery trajectory data refers to the trajectory data uploaded through the GNSS terminal during the operation of agricultural machinery, covering multi-scenario agricultural machinery operation trajectories; Step 2: Preprocess the trajectory obtained in Step 1, including data cleaning, null value filling, and linear interpolation of sparse trajectories. Among them, the data for data cleaning includes: random noise trajectories, repeated trajectories, stay trajectories, and drift trajectories; Step 3: For the trajectory after trajectory preprocessing in Step 2, use a spatio-temporal density-based agricultural machinery trajectory clustering method for clustering. According to different agricultural machinery operation scenarios, adaptively select clustering parameters, segment the preprocessed trajectory into independent trajectory segments, filter out noise points and merge adjacent small clusters to form a trajectory cluster corresponding to the farm operation area; Step 4: Convert the obtained trajectory cluster into a trajectory image according to the custom trajectory mapping relationship, use the trained field-road trajectory segmentation model based on the improved YOLOv8 to extract semantic features in the multi-scenario agricultural machinery trajectory image, further correct the mis-segmented trajectories in the trajectory cluster, and obtain the operation trajectory points in the farmland; Step 5: Divide the continuous operation trajectory into multiple independent operation farmland plots according to the timestamps of the agricultural machinery GNSS trajectory points and the distance intervals between adjacent points. Classify the trajectory segments with similar directions into the same tillage row according to the direction angle, and use the cubic spline interpolation algorithm to generate a smooth and continuous trajectory for the single-row trajectory points; Step 6: Generate an equal-width band buffer along the interpolation trajectory based on the working width of the agricultural machinery. Merge the intersecting areas to form a polygon. Convert the polygon from the WGS84 geographic coordinate system to the UTM plane coordinate system, and calculate the buffer area through the polygon area algorithm, which is the working area of the agricultural machinery, and output the calculation result.
[0009] Further, in Step 2, the trajectory preprocessing includes: Step 2.1: Random noise trajectory removal. In the case that the trajectory points in the sample trajectory data exceed the target range, delete the trajectory points; Step 2.2: Repeated trajectory removal. When the trajectory points in the sample trajectory data have the same timestamp or the same longitude and latitude coordinates, except for the first trajectory point, the other trajectory points are considered repeated trajectories and are deleted; Step 2.3: Stopping trajectory removal. When there are trajectories of the agricultural machinery staying among the trajectory points in the sample trajectory data, which are scattered in a small area around the agricultural machinery and show a high density in space, delete the trajectory points; Step 2.4: Null value filling. When there are missing values in the direction angles of some trajectory points in the trajectory data, calculate and fill them through the following direction angle formula; Δlon = lon 2 -lon 1 θ = atan2(sin(Δlon)*cos(lat 2 ), cos(lat 1 )*sin(lat 2 ) - sin(lat 1 )*cos(lat 2 )*cos(Δlon)) where lon and lat represent the longitude and latitude of the trajectory points; Step 2.5: Sparse trajectory linear interpolation. When there are sparse trajectories with a sampling interval less than the average value among the trajectory points in the trajectory data, perform linear interpolation on the trajectories to complete the missing trajectories.
[0010] In Step 3, the agricultural machinery trajectory clustering method based on spatio-temporal density includes: Step 3.1: Extract the timestamp and longitude and latitude values of each trajectory point from the trajectory data; Step 3.2: Adaptively set the spatial neighborhood radius eps, maximum time neighborhood max_time, and minimum number of points min_points according to the operation type and operation area of the agricultural machinery. Here, eps is set to twice the operation width, max_time is set to the time for the agricultural machinery to complete the operation tasks of two adjacent single operation rows in the farmland, and min_points is fixed as a value through analyzing the trajectory data; Step 3.3: Calculate the average speed of the ten trajectory points before and after each trajectory point as the average speed of the current point, then calculate the time interval of each trajectory point, and use eps divided by the average speed to determine the minimum time neighborhood min_time of each trajectory point; Step 3.3: Combine the time and space dimensions to define the spatio-temporal neighborhood of the trajectory points. Divide the maximum time neighborhood and the minimum time neighborhood along the time dimension, denoted as Δt. In the two-dimensional plane area, the spatial neighborhood with a radius of eps is denoted as Δs, and Δt×Δs represents a three-dimensional space body, that is, the spatio-temporal neighborhood Δc; Step 3.4: Select an unclassified trajectory point p. Determine whether p is a core point according to the defined spatio-temporal neighborhood. As long as the number of trajectory points within the spatio-temporal neighborhood of the trajectory point exceeds min_points, it will be considered a core point. If so, create a new cluster C; otherwise, reselect a new trajectory point; Step 3.5: Traverse other trajectory points in the spatio-temporal domain centered on point p. If the trajectory point q is a core point, add it to the new cluster C; otherwise, select other trajectory points and repeat the above steps until all trajectory points are processed.
[0011] Furthermore, the method for field-road trajectory segmentation based on the improved YOLOv8 described in step 4 includes: Step 4.1: Perform the mapping of longitude and latitude and image pixel coordinate positions according to the formula, and calculate the color channel value of each pixel through the speed, acceleration, and direction angle of the trajectory; where: x and y represent the pixel coordinates after longitude and latitude mapping, R, G, and B are the three-channel pixel values, mid is the coordinate of the middle position of the image, center_lon and center_lat are the longitude and latitude values of the trajectory center, Interval is the pixel interval, speed(i) represents the speed of the i-th trajectory point, jerk(i) represents the acceleration of the i-th trajectory point, and bearing_rate(i) represents the direction change rate between the i-th trajectory point and the (i - 1)-th trajectory point; Step 4.2: According to step 4.1, use the Image function in the PIL software package to generate the trajectory map of each trajectory cluster; Step 4.3: Use the labelme software to label the farmland area formed by the agricultural machinery operation trajectory in the trajectory map, divide the labeled images into datasets, and divide them into a training set, a test set, and a validation set according to 8:1:1; Step 4.4: Train an image instance segmentation model. After processing the newly input trajectory data according to Steps 4.1 and 4.2, use the trained segmentation model to perform farmland-road trajectory segmentation.
[0012] Furthermore, the instance segmentation model training in Step 4.4 includes: Step 4.4.1: Initialize the model structure and parameters, and load the instance segmentation network structure, including the backbone network, the feature fusion network, and the segmentation head; Step 4.4.2: Input the training set, including images, instance annotations (bounding boxes and class labels), and segmentation masks; Step 4.4.3: Input the enhanced images into the network, extract features through the backbone network, perform multi-scale feature fusion through the neck network, and finally output through the segmentation head: bounding boxes, class probabilities, and segmentation masks; Step 4.4.4: Calculate the loss function. The loss function consists of three parts: the bounding box loss uses CIoU to calculate the difference between the predicted box and the ground truth box, the class loss uses cross-entropy loss to measure the class prediction error, and the segmentation loss uses Dice loss to evaluate the mask prediction accuracy. Finally, these three parts of the loss are weighted and summed to obtain the total loss for model optimization; Step 4.4.5: According to the total loss, use the backpropagation algorithm to calculate the gradients of the loss function with respect to the weights and biases, use the Adam gradient descent method to update the weights and biases, run for 50 rounds and then end, and save the model.
[0013] Furthermore, the buffer area algorithm improved based on cubic spline interpolation in Steps 5 and 6 includes: Step 5.1: Based on the double thresholds of the time interval and the distance interval of the agricultural machinery operation trajectory points, divide the continuous operation trajectory into multiple independently operated farmland plots to complete the automatic division of the farmland plots; Step 5.2: The major direction changes of agricultural machinery mainly occur during turning around and changing rows. For the direction mutation characteristics in agricultural machinery operations, identify the turning-around and row-changing trajectory points through an angle threshold, and extract the single-operation row trajectory segments with linear characteristics within each farmland plot; Step 5.3: Perform cubic spline interpolation on the segmented single-row trajectories, and construct a cubic polynomial function between adjacent trajectory points: S 0 (x)=a 0 +b 0 (x-x 0 )2 +c 0 (x - x 0 ) 2 +d(x - x 0 ) 3 S 1 (x) = a 1 +b 1 (x - x 1 ) 2 +c 1 (x - x 1 ) 2 +d(x - x 1 ) 3 … S n (x) = a n +b n (x - x n ) 2 +c n (x - x n ) 2 +d(x - x n ) 3 Replace the traditional linear interpolation method to achieve smooth fitting with continuous trajectory curvature; Step 5.4: Based on the single operation row trajectory segment obtained by the above method, taking the interpolated trajectory segment L as the central axis, translate the buffer distance R bidirectionally along the trajectory normal direction to generate a dynamic rectangular buffer area. The buffer distance R is dynamically adjusted according to the agricultural machinery operation width parameter: where W is the operation width of the implement and δ is the width compensation amount; Step 5.5: Merge the intersecting areas to form a polygon, convert the polygon from the WGS84 geographic coordinate system to the UTM plane coordinate system, and calculate the buffer area through the polygon area algorithm, which is the agricultural machinery operation area, and output the calculation result.
[0014] Compared with the existing technical solutions, the beneficial effects of the present invention are:
[0015] 1. The present invention proposes an agricultural machinery trajectory clustering method based on spatio-temporal density, improves the problems existing in DBSCAN, adds time features on the basis of the original agricultural machinery trajectory spatial density, enables the algorithm to solve the segmentation of high-density road trajectories, and at the same time, adaptively selects parameters according to the agricultural machinery operation type and area, is applicable to multi-scenario agricultural machinery trajectory clustering, and realizes efficient segmentation of massive trajectories.
[0016] 2. The present invention uses an instance segmentation model improved based on YOLOv8 for field-road trajectory segmentation. By adding an efficient multi-scale attention mechanism (EMA) and a deformable convolutional network (DCN) to the original network structure, multi-scale semantic features can be extracted. These semantic features not only cover the key information of the operation trajectories within the farmland but also can effectively distinguish the road driving trajectories and drift trajectories near the farmland, thus achieving high-precision segmentation of the field roads.
[0017] 3. The present invention designs a buffer area algorithm improved based on cubic spline interpolation. Combining cubic spline interpolation with a dynamic buffer generation method, for different operation scenarios, the buffer distance is adjusted according to the width of the agricultural machinery, and the buffer area is calculated through the polygon area algorithm, thereby obtaining the operation area of the agricultural machinery. By adapting to complex terrains, coping with diverse operation modes, and dealing with re-cultivation and missed cultivation situations, this algorithm significantly improves the accuracy of operation area calculation in different scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 is a flowchart of an agricultural machinery operation area calculation method based on GNSS trajectories for multi-scenarios provided by the present invention;
[0019] Figure 2 is a schematic diagram of the overall process of agricultural machinery operation area calculation in the present invention;
[0020] Figure 3 is a flowchart of an agricultural machinery trajectory clustering method based on spatio-temporal density proposed by the present invention;
[0021] Figure 4 is a network model diagram of a field-road trajectory segmentation based on the improved YOLOv8 of the present invention;
[0022] Figure 5 is a schematic diagram of the spatio-temporal density clustering results of randomly selected trajectories;
[0023] Figure 6 is a schematic diagram of the trajectory segmentation results of randomly selected trajectories;
[0024] Figure 7 is a schematic diagram of the area calculation results of randomly selected trajectories;
[0025] Figure 8 is a diagram showing the results of agricultural machinery trajectory segmentation and operation area calculation in the embodiments of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0026] The following describes the specific embodiments of the present invention to facilitate those skilled in the art of the present technology to understand the present invention. The technical solutions of the present invention are further described in combination with the accompanying drawings and embodiments. It includes two stages, namely field-road trajectory segmentation and area calculation, as Figure 2as shown
[0027] The specific implementation process of this embodiment is as follows: Step 1: Obtain the trajectory data uploaded during the operation of agricultural machinery. The agricultural machinery trajectory data refers to the trajectory data uploaded through the GNSS terminal during the operation of agricultural machinery, covering the operation trajectories of agricultural machinery in multiple scenarios; Step 2: Preprocess the trajectories obtained in Step 1, including data cleaning, null value filling, and linear interpolation of sparse trajectories. Among them, the data for data cleaning includes: random noise trajectories, duplicate trajectories, stay trajectories, and drift trajectories; Step 3: For the trajectories after trajectory preprocessing in Step 2, use a clustering method for agricultural machinery trajectories based on spatio-temporal density to perform clustering. According to different agricultural machinery operation scenarios, adaptively select clustering parameters, segment the preprocessed trajectories into independent trajectory segments, filter out noise points, and merge adjacent small clusters to form trajectory clusters corresponding to farm operation areas; Step 4: Convert the obtained trajectory clusters into trajectory images according to the custom trajectory mapping relationship, use the trained field-road trajectory segmentation model based on the improved YOLOv8 to extract semantic features in the multi-scenario agricultural machinery trajectory images, further correct the mis-segmented trajectories in the trajectory clusters, and obtain the operation trajectory points in the farmland; Step 5: According to the time stamps of the agricultural machinery GNSS trajectory points and the distance intervals between adjacent points, divide the continuous operation trajectories into multiple independent operation farmland plots, classify the trajectory segments with similar directions into the same tillage row according to the direction angle, and use the cubic spline interpolation algorithm to generate smooth and continuous trajectories for single-row trajectory points; Step 6: Generate an equal-width band buffer along the interpolation trajectory based on the operation width of the agricultural machinery, merge the intersecting areas to form a polygon, convert the polygon from the WGS84 geographic coordinate system to the UTM plane coordinate system, and calculate the buffer area through the polygon area algorithm, which is the operation area of the agricultural machinery, and output the calculation result.
[0028] Embodiment
[0029] The experimental data used in this embodiment includes a multi-scenario dataset and an open-source dataset. The multi-scenario dataset includes 900 operation trajectories selected from the agricultural machinery big data platform, with various operation types (such as rice transplanting, rice harvesting, wheat harvesting, rotary tillage, and corn harvesting, etc.) and operation areas (including operation data in multiple provinces and autonomous regions such as Henan, Heilongjiang, Inner Mongolia, Xinjiang, and Hebei) as well as various operation methods. The open-source dataset includes 150 operation trajectories of wheat harvesters collected from the data service platform of the precision agriculture application project. Each trajectory point is characterized by seven parameters: time stamp, coordinates (longitude and latitude, WGS84), speed (m / s), direction , height (m), and label. This embodiment includes the following steps:
[0030] Step 1: Obtain trajectory data. Use the GNSS terminal installed on the agricultural machinery to collect the operation trajectory of the agricultural machinery. The trajectory of each agricultural machinery per day is a complete trajectory data;
[0031] Step 2: In the real scenario, due to signal interference and signal loss, the GNSS terminal may collect abnormal trajectory data. Therefore, preprocessing operations are carried out before trajectory segmentation. The specific methods include: 1) Random noise trajectory elimination: The collection area of the agricultural machinery trajectory data is China. Trajectory points with longitude and latitude coordinates outside the range of China's longitude and latitude are abnormal trajectories, and such trajectory points are deleted; 2) Repeated trajectory elimination: Clear trajectories with the same continuous trajectory timestamps or longitude and latitude, and retain the first trajectory; 3) Stay trajectory elimination: Clear a large number of stay trajectories generated when the agricultural machinery stays. Statistically, through a sliding window, trajectory points with a speed less than 0.5 m / s for 10 consecutive trajectory points are deleted; 4) Null value filling: Calculate and fill in the missing direction angle values through the following direction angle formula; Δlon = lon 2 -lon 1 θ = atan2(sin(Δlon)*cos(lat 2 ), cos(lat 1 )*sin(lat 2 ) - sin(lat 1 )*cos(lat 2 )*cos(Δlon)) where lon and lat represent the longitude and latitude of the trajectory points. 5) Sparse trajectory linear interpolation. Calculate the time interval between two trajectory points, and perform linear interpolation on trajectories with a sampling interval less than the average value to complete the missing trajectories;
[0032] Step 3: Perform spatio-temporal density clustering on the preprocessed trajectories, and adopt appropriate clustering parameters for the agricultural machinery trajectory data in different scenarios: 1) Obtain the working width of the agricultural machinery according to the operation type of the agricultural machinery, and set the spatial neighborhood radius eps to twice the working width; 2) Set max_time to the time for the agricultural machinery to complete the operation tasks of two single operation rows in the farmland. Select parameters according to different operation areas. Generally, the operation area affects the size of the plot. Through a large number of experimental analyses in the present invention, the optimal parameters are obtained. For example, when the agricultural machinery operates in a small plot, a smaller max_time is selected, and when the agricultural machinery operates in a large plot, a larger max_tine is selected; 3) Calculate the average speed of the ten trajectory points before and after each trajectory point as the average speed of the current point, then calculate the time interval of each trajectory point, and use eps divided by the average speed to determine the minimum time neighborhood min_time of each trajectory point; After adaptively setting the parameters, spatio-temporal density clustering can be carried out. The specific process is as Figure 3 shown. Figure 5 It is a schematic diagram of the trajectory clustering result randomly selected. Through spatio-temporal density clustering, efficient segmentation of a large number of trajectories is realized, and the original trajectories are segmented into multiple trajectory clusters.
[0033] Step 4: The original trajectories are initially segmented into trajectory clusters. As Figure 6 shown by the points in the circular area in a, there are two types of incorrect "farmland" trajectories in each trajectory cluster, mainly including drifting trajectories and road trajectories near farmland. The present invention proposes a field-road trajectory segmentation model (Yolo-FRS) based on improved YOLOv8 to perform trajectory segmentation. The model structure is as Figure 4 shown. In actual execution, in order to extract the spatio-temporal motion features contained in the trajectory data from different dimensions, for the sample trajectory data, the trajectory map corresponding to the trajectory cluster is drawn using its longitude and latitude coordinate information. The color channels of traditional images are composed of three colors: red, green, and blue. In order to fuse the motion features of the trajectory data and the temporal correlation of adjacent trajectory points in the trajectory sequence, the mapping between longitude and latitude and the image pixel coordinate positions is carried out according to the following formula and the three-channel values of the corresponding pixels are calculated; where: x and y represent the pixel coordinates after longitude and latitude mapping, R, G, and B are the three-channel pixel values, mid is the coordinate of the middle position of the image, center_lon and center_lat are the longitude and latitude values of the trajectory center, Interval is the pixel interval, speed(i) represents the speed of the i-th trajectory point, jerk(i) represents the acceleration of the i-th trajectory point, and bearing_rate(i) represents the direction change rate between the i-th trajectory point and the (i - 1)-th trajectory point. According to the above method, the trajectory map is generated using the Image function in the PIL software package. Then, the trained field-road segmentation model based on improved YOLOv8 is used for fine-grained trajectory segmentation to remove the road driving trajectories and drifting trajectories near farmland in the farmland trajectory cluster. An example of the segmentation result is as Figure 6 shown in b. The field-road trajectory segmentation model based on YOLOv8 corrects the incorrectly segmented trajectory points in step 3, and the accuracy of field-road trajectory segmentation is increased to 96.22%.
[0034] Step 5, area calculation, the specific steps include: (1) The farmland trajectory points are obtained through field-road trajectory segmentation. AsFigure 6 As shown, on this basis, calculate the time intervals and distance intervals of all trajectories, set interval thresholds, and divide continuous GNSS trajectories into independent farmland plots; (2) Identify the characteristic points of the agricultural machinery turning around and changing rows based on angle thresholds, and extract the linear trajectory segments of a single operation row; (3) Use cubic spline interpolation to construct a smooth trajectory with continuous curvature to overcome the trajectory jitter caused by GNSS noise; (4) Taking the interpolated trajectory as the central axis, adjust the buffer distance (R = W / 2 + 1.5 m) according to the working width (W) of the agricultural machinery to generate a working buffer zone; (5) Finally, through the polygon area algorithm, achieve accurate calculation of the working areas of multiple plots. The final algorithm for the randomly selected agricultural machinery operation trajectory calculates the working area of 27.482 mu. As Figure 7 shown, the actual measured area of this plot on the satellite map is 18,580.66 square meters. Converted to mu using the calculation formula, it is 27.871 mu. The deviation between the algorithm-calculated area and the actual plot area is 1.39%.
[0035] Experimental Results
[0036] Based on the above-mentioned field-road trajectory segmentation method, experimental verification was carried out on the selected data. The two data sets were randomly divided into a training set, a validation set, and a test set according to the ratio of 8:1:1. Four state-of-the-art methods, namely decision tree (DT), DBSCAN+rules, graph convolutional network (GCN), and GAN-BiLSTM, were selected for comparative experiments with the method proposed in the present invention. The final experimental results are shown in Tables 1 and 2. Table 1 Segmentation Results of Different Methods on Multi-Scene Data Sets Table 2 Segmentation Results of Different Methods on Open-Source Data Sets
[0037] The experimental results show that the method of the present invention has significant advantages in terms of performance indicators: on the multi-scene data set, it reaches an F1-score of 96.3% and an accuracy of 96.2%; on the open-source data set, it performs more stably, reaching an F1-score of 87.5% and an accuracy of 90.0%. Comparative analysis shows that: in terms of computational efficiency, DBSCAN+Rules, DT, and GAN-BiLSTM perform excellently, but the segmentation accuracy has not been significantly improved; although GCN is outstanding in improving the segmentation accuracy, when dealing with the open-source data set, due to the large computational overhead in the process of constructing the spatio-temporal relationship graph, the average inference time reaches 33.30 seconds. In contrast, the method of the present invention realizes the clustering of multi-scene agricultural machinery trajectories through adaptive parameter design, and extracts the trajectory image features in complex scenes based on the deep learning network, significantly improving the computational efficiency while achieving accurate segmentation.
[0038] Further, six real agricultural machinery operation trajectories under different scenarios are selected in the present invention. A total of 14 farmland plots are obtained through the field-road trajectory segmentation algorithm. As Figure 8 shown, each of the trajectories in operation areas 001 to 003 has one plot, operation area 004 has five plots, and operation areas 005 and 006 each have three plots. To verify the method proposed in the present invention, the areas of the 14 plots in the above six trajectories are actually measured as the actual operation area S real . The calculation results of the agricultural machinery operation area are shown in Table 3. Table 3 Calculation results of operation area
[0039] As shown in Table 3, the method for calculating the agricultural machinery operation area based on GNSS trajectories for multi-scenarios proposed in this paper can adaptively adjust parameters according to the agricultural machinery operation scenarios, realizing high precision and strong robustness in calculating the operation area under complex scenarios. Experimental verification shows that the absolute value of the area calculation error of this method does not exceed 3%.
[0040] The above-described embodiments are only examples for clearly illustrating the present invention and are not used to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A method for calculating agricultural machinery operation area based on GNSS trajectory for multiple scenarios, characterized in that: include: Step 1: Acquire the trajectory data uploaded by the agricultural machinery during operation. The agricultural machinery trajectory data refers to the trajectory data uploaded by the agricultural machinery through the GNSS terminal during operation, covering the operation trajectories of agricultural machinery in multiple scenarios; Step 2: Preprocess the trajectory obtained in step 1, including data cleaning, null value filling and sparse trajectory linear interpolation, wherein the data cleaned includes: random noise trajectory, repeated trajectory, stay trajectory and drift trajectory; Step 3: Cluster the trajectories preprocessed in step 2 using the agricultural machinery trajectory clustering method based on spatiotemporal density. Adaptively select clustering parameters according to different agricultural machinery operation scenarios, segment the preprocessed trajectories into independent trajectory segments, filter out noise points, and merge adjacent small clusters to form trajectory clusters corresponding to the farmland operation area. Step 4: The obtained trajectory clusters are converted into trajectory images according to the customized trajectory mapping relationship. The trained field road trajectory segmentation model based on improved YOLOv8 is used to extract the semantic features in the multi-scene agricultural machinery trajectory images, and the wrong segmented trajectories in the trajectory clusters are further corrected to obtain the operation trajectory points in the farmland. Step 5: According to the timestamp of the agricultural machinery GNSS trajectory point and the distance interval between adjacent points, the continuous operation trajectory is divided into multiple independent operation farmland plots, and the trajectory segments with similar directions are classified into the same tillage row according to the direction angle. The cubic spline interpolation algorithm is used for the single-row trajectory points to generate a smooth continuous trajectory; Step 6: Generate uniformly wide buffer zones along the interpolation trajectory based on the width of the agricultural machinery operation, merge the intersecting areas to form polygons, convert the polygons from the WGS84 geographic coordinate system to the UTM plane coordinate system, calculate the buffer zone area using the polygon area algorithm, which is the agricultural machinery operation area, and output the calculation results.
2. The method for calculating agricultural machinery operation area based on GNSS trajectory for multiple scenarios according to claim 1 is characterized in that: In step 2, the trajectory preprocessing includes: Step 2.1: random noise trajectory elimination, when the trajectory point of the sample trajectory data exceeds the target range, the trajectory point is deleted; Step 2.2: Duplicate trajectory removal: when the trajectory points of the sample trajectory data have the same timestamp or the same longitude and latitude coordinates, except for the first trajectory point, the other trajectory points are considered as duplicate trajectories and the trajectory points are deleted; Step 2.3: Removing the stop track: if there is a track of the agricultural machinery stopping at the track point of the sample track data, which is scattered in a small range around the agricultural machinery and presents a high density in space, the track point is deleted; Step 2.4: Fill in the empty values. If the direction angles of some trajectory points in the trajectory data are missing values, they are calculated and filled in using the following direction angle formula; Δlon=lon2-lon1 θ=atan2(sin(Δlon)*cos(lat2),cos(lat1)*sin(lat2)-sin(lat1)*cos(lat2)*cos(Δlon)) Among them, lon and lat represent the longitude and latitude of the trajectory point; Step 2.5: Sparse trajectory linear interpolation: if there are sparse trajectories with sampling intervals less than the average value in the trajectory points of the trajectory data, linear interpolation is performed on the trajectories to complete the missing trajectories.
3. The method for calculating agricultural machinery operation area based on GNSS trajectory for multiple scenarios according to claim 1 is characterized in that: In step 3, the agricultural machinery trajectory clustering method based on spatiotemporal density includes: Step 3.1: Extract the timestamp and longitude and latitude values of each trajectory point from the trajectory data; Step 3.2: According to the operation type and operation area of the agricultural machinery, the spatial neighborhood radius eps, the maximum time neighborhood max_time and the minimum number of points min_points are adaptively set, where eps is set to twice the operation width, max_time is set to the time for the agricultural machinery to complete the operation tasks of two adjacent single operation rows in the farmland, and min_points is fixed to a value by analyzing the trajectory data; Step 3.3: Calculate the average speed of the ten trajectory points before and after each trajectory point as the average speed of the current point, then calculate the time interval of each trajectory point, and use eps divided by the average speed to determine the minimum time neighborhood min_time of each trajectory point; Step 3.3: Combine the time and space dimensions to define the spatiotemporal neighborhood of the trajectory point. Divide the maximum time neighborhood and the minimum time neighborhood along the time dimension, denoted as Δt. In the two-dimensional plane area, the spatial neighborhood with eps as the radius is represented as Δs. Δt×Δs represents a three-dimensional space body, namely the spatiotemporal neighborhood Δc. Step 3.4: Select an unclassified trajectory point p and determine whether p is a core point based on the defined spatiotemporal neighborhood. As long as the number of trajectory points in the spatiotemporal neighborhood of the trajectory point exceeds min_points, it will be considered a core point. If it is, create a new cluster C; otherwise, reselect a new trajectory point; Step 3.5: Traverse other trajectory points in the space-time domain centered on point p. If trajectory point q is a core point, add it to the new cluster C; otherwise, select other trajectory points and repeat the above steps until all trajectory points have been processed.
4. The method for calculating agricultural machinery operation area based on GNSS trajectory for multiple scenarios according to claim 1 is characterized in that: In step 4, the field road trajectory segmentation method based on improved YOLOv8 includes: Step 4.1: Map the longitude and latitude to the image pixel coordinates according to the formula, and calculate the color channel value of each pixel through the velocity, acceleration, and direction angle of the trajectory; Where: x, y represent the pixel coordinates after longitude and latitude mapping, R, G, B are the three-channel pixel values, mid is the coordinate of the middle position of the image, center_lon and center_lat are the longitude and latitude values of the center of the track, Interval is the pixel interval, speed(i) represents the speed of the ith track point, jerk(i) represents the acceleration of the ith track point, bearing_rate(i) represents the direction change rate between the ith track point and the i-1th track point; Step 4.2: According to step 4.1, use the Image function in the PIL software package to generate a trajectory map of each trajectory cluster; Step 4.3: Use labelme software to annotate the farmland areas formed by the agricultural machinery operation tracks in the track map, and divide the annotated images into training set, test set and validation set according to the ratio of 8:1:1; Step 4.4: Train an image instance segmentation model, process the newly input trajectory data in steps 4.1 and 4.2, and then use the trained segmentation model to segment the field and road trajectories.
5. The method for calculating agricultural machinery operation area based on GNSS trajectory for multiple scenarios according to claim 1 is characterized in that: The instance segmentation model training in step 4.4 includes: Step 4.4.1: Initialize the model structure and parameters, load the instance segmentation network structure, including the backbone network (Backbone), feature fusion network (Neck) and segmentation head; Step 4.4.2: Input the training set, including images, instance annotations (bounding boxes and category labels), and segmentation masks; Step 4.4.3: Input the enhanced image into the network, extract features through Backbone, perform multi-scale feature fusion through Neck, and finally output the bounding box, category probability and segmentation mask through the segmentation head; Step 4.4.4: Calculate the loss function. The loss function consists of three parts: the bounding box loss uses CIoU to calculate the difference between the predicted box and the true box, the category loss uses the cross entropy loss to measure the category prediction error, and the segmentation loss uses the Dice loss to evaluate the mask prediction accuracy. Finally, the weighted sum of these three losses is used to obtain the total loss for model optimization; Step 4.4.5: Based on the total loss, use the back-propagation algorithm to calculate the gradient of the loss function with respect to the weights and biases. Use the Adam gradient descent method to update the weights and biases. Run for 50 rounds and save the model.
6. The method for calculating agricultural machinery operation area based on GNSS trajectory for multiple scenarios according to claim 1 is characterized in that: In step 5 and step 6, the buffer area algorithm improved based on cubic spline interpolation includes: Step 5.1: Based on the dual thresholds of the time interval and distance interval of the agricultural machinery operation trajectory points, the continuous operation trajectory is divided into multiple independent operation farmland plots to complete the automatic division of the farmland plots; Step 5.2: The large-scale direction changes of agricultural machinery are mainly concentrated in the U-turn and line-changing operations. According to the sudden change characteristics of the direction in the agricultural machinery operation, the U-turn and line-changing trajectory points are identified by angle thresholds, and the single operation line trajectory segments with linear characteristics in each farmland plot are extracted; Step 5.3: Perform cubic spline interpolation on the segmented single-line trajectory and construct a cubic polynomial function between adjacent trajectory points: S0(x)=a0+b0(x-x0) 2 +c0(x-x0) 2 +d(x-x0) 3 S1(x)=a1+b1(x-x1) 2 +c1(x-x1) 2 +d(x-x1) 3 … S n (x)=a n +b n (x-x n ) 2 +c n (x-x n ) 2 +d(x-x n ) 3 Replace the traditional linear interpolation method to achieve smooth fitting with continuous trajectory curvature; Step 5.4: Based on the single operation line trajectory segment obtained by the above method, the interpolated trajectory segment L is used as the central axis, and the buffer distance R is translated bidirectionally along the trajectory normal direction to generate a dynamic rectangular buffer zone. The buffer distance R is dynamically adjusted according to the agricultural machinery operation width parameter: Where W is the machine working width, δ is the width compensation amount; Step 5.5: Merge the intersecting areas to form polygons, convert the polygons from the WGS84 geographic coordinate system to the UTM plane coordinate system, calculate the buffer area using the polygon area algorithm, which is the agricultural machinery operation area, and output the calculation results.
Citation Information
Cited By
Method and system for counting progress of rice transplanting operation of rice machine
CN120892479A
A rice machine transplanting operation progress statistics method and system
CN120892479B