Road inspection track correction method based on improved hidden Markov model
By improving the Hidden Markov model and Viterbi algorithm to correct the trajectory of patrol vehicles, the problem of trajectory data deviation in complex road networks is solved, and the accuracy of patrol data and the accuracy of path planning are improved.
Patent Information
- Application Number
- CN202510634678.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-16
- Publication Date
- 2025-08-22
AI Technical Summary
In complex road networks, the trajectory of patrol vehicles is often affected by environmental factors, sensor errors and data acquisition intervals, resulting in trajectory data deviations, affecting the accuracy and path planning of the patrol system.
Using the improved hidden Markov model, the observation probability matrix and state transfer matrix are constructed, combined with the Viterbi algorithm and road network geometric constraints, the trajectory of the patrol vehicle is corrected.
It improves the accuracy and efficiency of GPS trajectory data during road inspection, ensuring the accuracy of path planning and the effectiveness of intelligent scheduling.
Smart Images

Figure CN120525151A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of trajectory data processing, and in particular relates to a road inspection trajectory correction method based on an improved hidden Markov model. Background Art
[0002] Road inspection is a critical component of traffic management and maintenance, involving the regular inspection and assessment of road facilities and conditions. Accurate road inspection trajectory data provides fundamental support for traffic management departments in developing maintenance plans and carrying out road repairs. Traditional trajectory correction methods rely primarily on the geometric and topological relationships between roads. However, in complex road networks, the trajectory of inspection vehicles is often affected by a variety of factors, including environmental factors, sensor errors, and data collection intervals, which can lead to significant deviations. This deviation not only reduces the accuracy of trajectory data but also affects the inspection system's path planning and intelligent scheduling, potentially resulting in untimely or inaccurate maintenance measures. Summary of the Invention
[0003] The purpose of the present invention is to propose a road inspection trajectory correction method based on an improved hidden Markov model, which can accurately correct the driving trajectory of inspection vehicles in complex road networks.
[0004] The technical solution for achieving the purpose of the present invention is: a road inspection trajectory correction method based on an improved hidden Markov model, comprising the following steps:
[0005] Step 1: The inspection vehicle collects raw trajectory data in real time through the on-board GPS device and pre-processes the raw trajectory data to obtain the candidate road section set and observation point sequence;
[0006] Step 2: Determine the hidden Markov model observation probability matrix based on the normal distribution projection distance;
[0007] Step 3: Construct the hidden Markov model state transition probability matrix;
[0008] Step 4: Based on the hidden Markov model, use the Viterbi algorithm to infer the optimal trajectory path;
[0009] Step 5: Based on the geometric constraints of the road network, refine the optimal path.
[0010] Compared with the existing technology, the present invention has the following significant advantages: by comprehensively considering the observation probability of GPS points and road segments, the connectivity of the road network and the state transition matrix, the present invention effectively improves the deviation problem of GPS trajectory data during road inspections, thereby improving the accuracy and efficiency of road inspections. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1This is a schematic diagram of the real road network vector data.
[0012] Figure 2 This is a schematic diagram of the effect of mapping real road network vector data onto an electronic map.
[0013] Figure 3 The present invention is a flow chart of the trajectory correction method.
[0014] Figure 4 This is a diagram of the trajectory correction results, where the green dots represent the original inspection vehicle trajectory, and the red dots represent the corrected trajectory. The original trajectory deviates significantly from the actual road section, especially at intersections. After correction, the trajectory is accurately mapped to the actual road. DETAILED DESCRIPTION
[0015] This paper provides a road inspection trajectory correction method based on a modified Hidden Markov Model (HMM). The following describes a specific implementation of this method, detailing how to systematically address the GPS trajectory correction issue during road inspections through a series of steps, thereby improving the accuracy and reliability of inspection trajectory data.
[0016] Step 1: Preprocessing of inspection vehicle trajectories.
[0017] Inspection vehicles use onboard GPS devices to collect raw trajectory data in real time. This data contains key information such as latitude and longitude coordinates and timestamps. Due to factors such as building obstructions in complex urban environments, raw trajectory data is often subject to noise such as point drift and sudden changes. To effectively remove this noise and outliers, the following processing flow is used:
[0018] To improve the accuracy and reliability of trajectory data, GPS data with excessively large sampling intervals is densified. When the time interval between adjacent trajectory points exceeds 5 seconds or the spatial distance is greater than 100 meters, an interpolation process is triggered. The geodetic distance between the two points is calculated using the Vincenty formula. Three-dimensional linear interpolation is then performed in a spherical coordinate system to accurately generate the latitude and longitude coordinates of the intermediate point. The timestamps of the interpolated points are evenly distributed according to the time scale. A new Boolean "Data Source" field is added to each trajectory point to distinguish how the data point was generated: when the field value is false, the trajectory point is raw data directly collected by the GPS device; when the field value is true, the point is supplementary data generated by the system through an interpolation algorithm.
[0019] For each trajectory point, a circular search area with a dynamic radius is established with its latitude and longitude coordinates as the center. The validity of each inspection trajectory point in the circular search area is verified, and abnormal points are eliminated. The haversine formula is used to calculate the vertical projection distance from the inspection trajectory point to each actual road section, and the distances are sorted in ascending order. Finally, several actual road sections with the closest possible matching distances are selected as the candidate matching set. The actual road sections in the candidate matching set are defined as the candidate section set R = {r1, r2, …, r N}.
[0020] During the search process, each inspection trajectory point is validated. If a trajectory point cannot be associated with any actual road section, it is considered an anomaly (possibly caused by a sudden change in the signal or severe drift) and is removed from the dataset.
[0021] The pre-processed GPS positioning data is defined as observation points and constructed as a discrete observation point sequence O = {o1, o2, ..., o T},,the observation point represents the location information collected by the vehicle at a specific moment.
[0022] Step 2: Modeling the observation probability of a hidden Markov model based on the normal distribution projection distance
[0023] The set of candidate road segments established in the trajectory preprocessing stage requires a mathematical model to quantify the matching probability relationship between each observation point and the candidate road segment.
[0024] The normal distribution is used to establish the probability relationship model between observation points and candidate road sections, specifically:
[0025]
[0026] Where x represents the vertical projection distance from the observation point to the candidate road segment, and σ is the standard deviation of GPS positioning.
[0027] For each observation point o t , which is consistent with the candidate road segment r j The matching probability is determined by the observation probability matrix element B t,j Indicates that the matrix element B t,j The specific calculation steps are as follows:
[0028] (1) Use the Haversine formula to calculate the vertical projection distance x between the observation point and all candidate road sections j ';
[0029] (2) Substitute the vertical projection distance into the probability density function f(x) and calculate the matching probability value B between the observation point and each candidate road segment t,j ′, that is, the calculated f(x) is the matching probability value B between the observation point and each candidate road segmentt,j ';
[0030] For each observation point o t , according to the matching probability value B t,j ' Sort in descending order; retain the top k candidate sections with the highest probability and calculate the result as the observation probability matrix B = {B t,j1 ,B t,j2 ,…,B t,jk}.
[0031] Step 3: Construct the hidden Markov model state transition probability matrix
[0032] Based on GPS trajectory data and road network data, the state transition probability between two consecutive observation point candidate sections is calculated:
[0033] (1) Calculate the straight-line distance L1 between adjacent GPS points:
[0034] ①Enter the latitude and longitude coordinates of adjacent GPS points;
[0035] ② Use the Haversine formula to calculate the distance between two points;
[0036] ③Output straight-line distance L1.
[0037] (2) Calculate the projection distance L2 of adjacent GPS points:
[0038] ① Project adjacent GPS points onto candidate road sections;
[0039] ② Use the Haversine formula to calculate the distance between two projection points;
[0040] ③Output straight-line distance L2.
[0041] (3) Constructing the state transition probability matrix
[0042] The state transition probability is calculated as:
[0043]
[0044] Where p(j,k) represents the j Transfer to section r k The state transition probability, the difference between the straight-line distance and the projection distance d t =|L1-L2|, β is the influence d t Adjustment parameter for the difference level.
[0045] Based on the connectivity characteristics of the road topology, a state transition probability matrix is constructed. This matrix represents the possibility of travel between adjacent road sections in a quantitative form, where each matrix element A j,k Indicates that from the current road segment r jTransfer to next road segment r k The normalized probability of each element A of the state transition matrix A j,k Defined as:
[0046]
[0047] where N (j) Represents the road segment r j The set of all directly connected adjacent road segments, ∑ k′∈N(j) p(j,k′) represents the road segment r j To all its adjacent segments r k The sum of the state transition probabilities of ′.
[0048] Step 4: Infer the optimal trajectory path based on the Viterbi algorithm
[0049] In the framework of the Hidden Markov Model, the Viterbi algorithm solves the optimal hidden state sequence (i.e., the sequence of road sections the vehicle actually travels) through dynamic programming, modeling the trajectory correction problem as a joint probability maximization problem of the observation sequence (GPS points) and the hidden state sequence (candidate road sections). The specific process is as follows:
[0050] (1) Recursive stage: From the first observation point o1 to the last observation point o1, calculate the maximum cumulative probability of each candidate road section one by one and record the optimal predecessor node. When t = 1:
[0051] δ1(j)=π j ·B j,1 ψ1(j)=0
[0052] Where δ1(j) represents the position at section r at time t=1 j The maximum cumulative probability, π j represents the initial state probability, B j,1 Indicates that the first GPS point o1 is connected to the road segment r j The probability of generation, ψ1(j) is the predecessor node index (there is no predecessor node at the starting point).
[0053] When t>1:
[0054]
[0055] δ t (k) represents the time until time t, with the road section r k is the maximum joint probability of the path to the end point. t (k) Record the predecessor segment index of the path for backtracking.
[0056] (2) Backtracking phase: From the last observation point o TGo back to the starting point and extract the optimal hidden state sequence. The termination stage is:
[0057]
[0058] in represents the optimal hidden state at time step t (i.e., the road section that the vehicle is most likely to travel at time t). At this time, the path is backtracked, and the time t is taken as t=T-1, T-2, ..., 1, and the following calculations are made in sequence:
[0059]
[0060] Finally, the optimal road segment sequence is obtained
[0061] Step 5: Fine-tune the inspection trajectory based on road network geometric constraints.
[0062] To improve the accuracy of inspection trajectory correction, based on the optimal road segment sequence output by the Hidden Markov Model (HMM), spatial projection correction is further performed to ensure that the trajectory points are strictly matched to the actual road centerline, eliminating coordinate offsets caused by GPS noise or matching errors. The specific implementation steps are as follows:
[0063] Input: optimal road state sequence And the observation point sequence O={o1,o2,…,o T}.
[0064] (4) Road segment geometry matching: For each time step t, GPS point o t Vertical projection to its corresponding optimal section The center line of the calibration point
[0065] (5) Topological validity constraint: Check adjacent correction points and Is it on the corresponding road section? and If the two segments are directly connected or reachable through an intermediate segment, the current match is retained; otherwise, a new correction point that satisfies the connectivity constraints is selected.
[0066] (6) Smoothness optimization: A sliding window mean filtering method is used to optimize data continuity. The window slides from the starting point to the end point of the trajectory, and the latitude and longitude mean of the trajectory points in the window are calculated in real time as the smoothed coordinates of the window center point. The smoothed coordinates are used to replace the original correction results, and the trajectory sequence is iteratively updated to suppress high-frequency noise and retain the road topology characteristics.
[0067] Output: Topologically legal corrected trajectory All points are strictly located on the centerline of the road network.
[0068] Through the above steps, the method of the present invention systematically solves the problem of GPS track deviation correction during road inspection.
Claims
1. A road inspection trajectory correction method based on an improved hidden Markov model, characterized in that: The following steps are involved: Step 1: The inspection vehicle collects raw trajectory data in real time through the on-board GPS device and pre-processes the raw trajectory data to obtain the candidate road section set and observation point sequence; Step 2: Determine the hidden Markov model observation probability matrix based on the normal distribution projection distance; Step 3: Construct the hidden Markov model state transition probability matrix; Step 4: Based on the hidden Markov model, use the Viterbi algorithm to infer the optimal trajectory path; Step 5: Based on the geometric constraints of the road network, refine the optimal path.
2. The road inspection trajectory correction method based on the improved hidden Markov model according to claim 1 is characterized in that: The specific method for preprocessing the original trajectory data and obtaining the observation point sequence is as follows: Densify GPS data with a sampling interval greater than a threshold; A circular search area with a dynamic radius is established with the latitude and longitude coordinates of each densified trajectory point as the center. The validity of each inspection trajectory point in the circular search area is verified, and abnormal points are eliminated. The vertical projection distance from the inspection trajectory point to each actual road section is calculated and sorted in ascending order of distance. Finally, several possible matching actual road sections with a distance less than the set distance are selected as the candidate matching set. The actual road sections in the candidate matching set are defined as the candidate section set R = {r1, r2, …, r N }; During the search process, the validity of each inspection trajectory point is verified. If the trajectory point cannot be associated with any actual road section, it is determined to be abnormal data and removed from the data set; The remaining GPS positioning data are defined as observation points and constructed as a discrete observation point sequence O = {o1, o2, ..., o T }.
3. The road inspection trajectory correction method based on the improved hidden Markov model according to claim 1 is characterized in that: The specific method for determining the observation probability matrix of the hidden Markov model based on the normal distribution projection distance is: Calculate the vertical projection distance x between the observation point and all candidate road segments j '; The probability relationship model between the observation point and the candidate road section is used to calculate the matching probability value B between the observation point and each candidate road section. t,j ′For each observation point o t , according to the matching probability value B t,j ' Sort in descending order; retain the top k candidate sections with the highest probability and calculate the result as the observation probability matrix B = {B t,j1 ,B t,j2 ,…,B t,jk }.
4. The road inspection trajectory correction method based on the improved hidden Markov model according to claim 3 is characterized in that: The normal distribution is used to establish the probability relationship model between observation points and candidate road sections, specifically: Where x represents the vertical projection distance from the observation point to the candidate road section, σ is the standard deviation of GPS positioning; B t,j ′ is the matching probability value between the observation point and each candidate road segment.
5. The road inspection trajectory correction method based on the improved hidden Markov model according to claim 1 is characterized in that: The specific method of constructing the state transition probability matrix of the hidden Markov model is: Based on GPS trajectory data and road network data, the state transition probability between two consecutive observation point candidate sections is calculated: Calculate the straight-line distance L1 between adjacent GPS points; Calculate the projection distance L2 of adjacent GPS points; The state transition probability is calculated as: Among them, p(j,k) represents the distance from road segment r j Transfer to section r k The state transition probability, the difference between the straight-line distance and the projection distance d t =|L1-L2|, β is the influence d t adjustment parameters for the difference levels; Based on the connectivity characteristics of the road topology, a state transition probability matrix is constructed, where each matrix element A j,k Indicates that from the current road segment r j Transfer to next road segment r k The normalized probability of each element of the state transition probability matrix A j,k Defined as: where N (j) Represents the road segment r j The set of all directly connected adjacent road segments, ∑ k′∈N(j) pj,k′) represents the road segment r j To all its adjacent segments r k The sum of the state transition probabilities of ′.
6. The road inspection trajectory correction method based on the improved hidden Markov model according to claim 1 is characterized in that: Based on the hidden Markov model, the specific method of using the Viterbi algorithm to infer the optimal path of the trajectory is as follows: (1) Recursive stage: From the first observation point o1 to the last observation point o1, calculate the maximum cumulative probability of each candidate road segment one by one and record the optimal predecessor node: When t = 1: δ1(j)=π j ·B j,1 ψ1(j)=0 Among them, δ1(j) represents the time at which the vehicle is located on the road section r at time t=1. j The maximum cumulative probability, π j represents the initial state probability, B j,1 Indicates that the first GPS point o1 is connected to the road segment r j The probability of generation, ψ1(j) is the predecessor node index; When t>1: δ t (k) represents the time until time t, with the road section r k is the maximum joint probability of the path to the end point, ψ t (k) is the predecessor segment index of the path; (2) Backtracking phase: From the last observation point o T Go back to the starting point and extract the optimal hidden state sequence. The termination stage is: in Represents the optimal hidden state at time step t. At this time, we backtrack the path and take t=T-1, T-2, ..., 1 for time t, and calculate in sequence: Finally, the optimal road segment sequence is obtained 7. The road inspection trajectory correction method based on the improved hidden Markov model according to claim 1 is characterized in that: The specific method for fine-tuning the optimal path based on the road network geometric constraints is as follows: For each time step t, GPS point o t Vertical projection to its corresponding optimal section The center line of the calibration point Check adjacent calibration points and Is it on the corresponding road section? and On the connected path, if the two segments are directly connected or reachable through an intermediate segment, the current match is retained; otherwise, a new correction point that satisfies the connectivity constraint is selected. The sliding window mean filtering method is used to optimize data continuity. The window slides from the starting point to the end point of the trajectory. The latitude and longitude mean of the trajectory points in the window are calculated in real time and used as the smoothed coordinates of the window center point. The smoothed coordinates are used to replace the original correction results. The trajectory sequence is iteratively updated to obtain a topologically legal correction trajectory. All points are strictly located on the centerline of the road network.