A vehicle trajectory anomaly detection method and system based on deep learning
By constructing a road offset continuous field and scale-adjusted query vector based on deep learning for vehicle trajectory anomaly detection, and combining it with a long short-term memory network, the problem of insufficient adaptability of traditional methods in complex environments is solved, and high-precision and high-reliability trajectory anomaly detection is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHEJIANG COLLEGE OF SECURITY TECH
- Filing Date
- 2026-04-08
- Publication Date
- 2026-07-24
AI Technical Summary
Traditional vehicle trajectory anomaly detection methods lack adaptability in complex and ever-changing driving environments, making it difficult to achieve accurate anomaly identification in highly dynamic traffic scenarios. They are also prone to false alarms and missed alarms, especially when trajectory data is sparse or sampling intervals are uneven, making it difficult to effectively uncover hidden motion modes.
A deep learning-based approach is adopted to construct a continuous road offset field, a scale-adjusted query vector, and a long short-term memory network. This approach adaptively reconstructs the feature scale, performs anomaly scoring weight product modulation in conjunction with the trajectory energy gradient, and utilizes trilinear interpolation to construct a continuous confidence probability surface, thereby achieving globally optimal anomaly localization.
It effectively suppresses local positioning error interference, improves the detection accuracy of sparse sampling trajectory, ensures high generalization and high reliability trajectory monitoring in complex road network environments, and improves the robustness and accuracy of detection.
Smart Images

Figure CN121997103B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of vehicle trajectory analysis technology, and in particular to a method and system for detecting vehicle trajectory anomalies based on deep learning. Background Technology
[0002] The field of vehicle trajectory analysis technology mainly involves the collection, modeling, and analysis of spatiotemporal motion data of vehicles in road networks. Its core aspects include acquiring basic data such as latitude and longitude coordinates, speed, acceleration, heading angle, and timestamps of vehicles through satellite positioning devices, inertial measurement units, vehicle-mounted communication terminals, and roadside sensing equipment; performing coordinate transformation, trajectory segmentation, trajectory matching, and path reconstruction on continuous trajectory points; and constructing vehicle motion behavior models by combining road topology, traffic rules, and historical operation data. This allows for a systematic analysis of vehicle operating status, path selection, driving patterns, and abnormal behaviors. This technology is widely used in scenarios such as intelligent traffic management, vehicle network operation monitoring, logistics transportation scheduling, and traffic safety supervision. It is a comprehensive technology direction that integrates positioning technology, data acquisition technology, and pattern analysis methods.
[0003] Traditional vehicle trajectory anomaly detection methods refer to identification methods for situations such as deviations from the normal driving path, abnormal speed changes, or abnormal stopping behavior that occur during vehicle operation. The technical issue it addresses is to determine whether the trajectory deviates from the normal driving mode within a certain time period from a large number of continuous trajectory point sequences. Traditional methods usually first divide the speed value, acceleration value, and direction change angle into intervals based on manually set thresholds, and mark the trajectory points that exceed the set range as suspicious points. Then, based on pre-statistical historical trajectory samples, the Euclidean distance or dynamic time warp distance between trajectories is calculated, and the trajectory to be detected is compared point by point with a standard trajectory template. When the overall cumulative deviation value exceeds a set proportion, it is judged as an anomaly. Alternatively, the trajectory is segmented and the feature values such as the average speed, maximum yaw angle, and dwell time of each segment are extracted. The anomaly type is judged by comparing each rule in a manually constructed rule table, thereby completing the identification of abnormal vehicle trajectory situations.
[0004] Traditional detection methods rely on manually setting fixed thresholds to divide speed and yaw angle into intervals. This results in a lack of adaptability in anomaly judgment criteria under complex and variable driving environments. Simply comparing the calculated Euclidean distance or dynamic time warp distance between trajectories with a standard template ignores the limiting effect of road geometric topology on vehicle displacement. Furthermore, static template matching modes are difficult to cover diverse driving styles and long-term time-series evolution patterns, leading to high sensitivity to positioning errors of discrete sampling points and a tendency to produce false positives and false negatives. Especially when trajectory data is sparse or sampling intervals are uneven, traditional methods cannot effectively mine hidden motion modes and cannot support the accurate anomaly identification requirements in highly dynamic traffic scenarios, thus limiting the overall detection robustness and generalization ability. Summary of the Invention
[0005] The purpose of this invention is to address the shortcomings of existing technologies by proposing a deep learning-based method and system for detecting vehicle trajectory anomalies.
[0006] To achieve the above objectives, the present invention adopts the following technical solution: a vehicle trajectory anomaly detection method based on deep learning, comprising the following steps: S1: Obtain the vehicle trajectory point coordinates, displacement increment length, sampling time interval, road left boundary line coordinate sequence and road right boundary line coordinate sequence through the vehicle positioning terminal, calculate the left distance value of the trajectory point coordinates to the road left boundary line coordinate sequence and the right distance value of the trajectory point to the road right boundary line coordinate sequence, and obtain the road distance analysis results; S2: Based on the road distance analysis results, the left distance value and right distance value of the trajectory point are calculated by difference to obtain the symbol offset. The symbol offset is then interpolated to construct a symbol offset sequence and a road offset continuous field. S3: Calculate the ratio of displacement increment length to sampling time interval to generate instantaneous velocity value, average the instantaneous velocity value to obtain the reference velocity, use the instantaneous velocity value and the reference velocity to calculate the time ratio imbalance parameter, and construct the scale adjustment query vector; S4: Input the road offset continuous field and scale adjustment query vector into the pre-trained long short-term memory network model to perform feature extraction, construct the trajectory embedding vector and the original trajectory anomaly score, calculate the trajectory energy value, calculate the rate of change of the trajectory energy value with respect to the sampling time interval, and construct the trajectory energy gradient value; S5: Compare the trajectory energy gradient value with the preset benchmark gradient threshold, modulate the original trajectory anomaly score, generate a corrected anomaly score, interpolate and expand the corrected anomaly score, establish a confidence probability surface, and obtain the vehicle trajectory anomaly detection result.
[0007] The present invention is improved in that the road offset continuous field includes a topological mapping matrix, a regional deformation tensor, and a lateral distribution cloud map; the scale adjustment query vector includes a dynamic attention mask, a feature activation map, and a spatiotemporal fusion weight; the trajectory energy gradient value includes a state change scalar, a fluctuation evolution amplitude, and a kinetic energy decay exponent; and the vehicle trajectory anomaly detection result includes a risk severity level, a behavior violation category, and a trajectory failure mode.
[0008] The present invention is improved in that the steps for obtaining the road distance analysis results are specifically as follows: S111: Collect vehicle trajectory point coordinates, displacement increment length, sampling time interval, road left boundary line coordinate sequence and road right boundary line coordinate sequence through vehicle-mounted positioning terminal; perform discretization sample alignment processing on trajectory point coordinates and displacement increment length according to clock synchronization signal; process geographic coordinates by combining road topology connection relationship, data frame verification rules and projection transformation algorithm to obtain vehicle trajectory spatiotemporal parameter characteristics. S112: Based on the spatiotemporal parameter features of the vehicle trajectory, retrieve the coordinates of the vehicle trajectory points and the coordinate sequence of the left boundary line of the road, retrieve the point-line projection vector of the vehicle trajectory point coordinates within the coverage area of the left boundary line coordinate sequence, calculate the minimum Euclidean distance from the vehicle trajectory point coordinates to the matching line segment of the left boundary line coordinate sequence according to the geometric distance determination rules and coordinate interpolation logic, and generate the left distance value of the trajectory point. S113: Based on the spatiotemporal parameter characteristics of the vehicle trajectory, retrieve the coordinate sequence of the right boundary line of the road and the sampling time interval, match the dynamic sampling index value of the vehicle trajectory point coordinates in the horizontal axis distribution direction, calculate the minimum Euclidean distance from the vehicle trajectory point coordinates to the matching line segment of the right boundary line coordinate sequence as the right distance value of the trajectory point, perform correlation processing based on the left distance value of the trajectory point, organize the left distance value and the right distance value of the trajectory point, and obtain the road distance analysis result.
[0009] The present invention is improved in that the step of obtaining the road offset continuous field is specifically as follows: S211: Based on the road distance analysis results, call the left distance value and the right distance value of the trajectory point to perform difference calculation, determine the lateral orientation polarity of the vehicle trajectory point relative to the road center axis, obtain the geometric constraint parameters of the road cross section, perform lateral vector mapping for the geographical area where the trajectory point coordinates are located, combine the preset positive and negative sign discrimination criteria to convert the spatial displacement scalar, perform polar alignment operation and numerical polarity correction, and generate sign offset; S212: Based on the symbol offset, obtain the road mileage sequence parameters, call the linear smooth interpolation function to perform numerical continuous fitting processing on the symbol offset in the road mileage evolution dimension, eliminate the noise of positional jumps between discrete trajectory sampling points, and perform moving average-based logical resampling processing on the fitted values, and perform second-order derivative constraint verification and local monotonicity check on the offset change rate to obtain a signed offset sequence. S213: For the signed offset sequence, the spatial embedding layer weight matrix is called to perform high-dimensional feature nonlinear mapping processing, converting the scalar offset features into high-dimensional vector representations with spatial topological attributes, associating global road topological connection constraints and lane line geometric topological distribution information, mapping the displacement state of each sampling point to the global spatial grid tensor structure, performing coordinate projection transformation, tensor slice aggregation and feature dimension alignment, and establishing a continuous field of road offset.
[0010] The present invention is improved in that the step of obtaining the scale adjustment query vector is specifically as follows: S311: Obtain the displacement increment length and sampling time interval, perform a division ratio operation based on the sampling time interval on the displacement increment length to generate instantaneous velocity values, and perform mean aggregation calculation on multiple instantaneous velocity values continuously distributed within the acquisition window to obtain the reference velocity; S312: Call the instantaneous speed value, the reference speed and the sampling time interval to obtain the reference road segment length, the trajectory arc curvature and the resonant frequency, perform a deviation ratio measurement on the instantaneous speed value and the reference speed, and calculate and obtain the time ratio imbalance parameter; S313: Based on the vehicle position, heading angle and acceleration query commands, construct the original query vector, call the time ratio imbalance parameter for each feature dimension of the original query vector to perform dimensional space linear mapping stretching transformation, calculate the weight product of the time ratio imbalance parameter and the hidden state feature value in the original query vector, perform vector distribution scale reconstruction mapping processing to obtain the scale-adjusted query vector.
[0011] The present invention is improved in that the formula for calculating and obtaining the time ratio imbalance parameter is specifically as follows: ; in, The parameter representing the time-proportional imbalance. Represents the instantaneous velocity value. Represents the reference speed. This represents the normalized value of the reference road segment length. The normalized value of the curvature of the representative arc trajectory. This represents the normalized value of the sampling time interval. This represents the normalized value of the resonant frequency.
[0012] The present invention is improved in that the step of obtaining the trajectory energy gradient value is specifically as follows: S411: Map the road offset continuous field and scale adjustment query vector to a pre-trained long short-term memory network to perform feature extraction, call the neuron weight matrix and bias parameters to calculate the tensor dot product, recursively update the cell state through forgetting gate, input gate and output gate, aggregate the long-range temporal dependency of trajectory using nonlinear activation processing, map the hidden layer output vector to the fully connected feature mapping layer, perform dimensionality reduction projection transformation, and establish the trajectory embedding vector and the original trajectory anomaly score. S412: For the trajectory embedding vector, extract the feature numerical components of each dimension of the vector space, call the vector 2 norm calculation logic to process the squaring operation of all dimension components, use the linear superposition operator to perform the numerical aggregation and summation of the full-dimensional square terms, map the distribution density of trajectory points relative to the origin of coordinates in the high-dimensional feature space, establish the energy representation attribute of trajectory motion state, associate the temporal weight distribution matrix to enhance the features, and generate trajectory energy value. S413: Based on the trajectory energy value, call the sampling time interval, calculate the first-order discrete difference result of the trajectory energy value of adjacent trajectory points in the time series, calculate the normalized quotient of the first-order discrete difference result with respect to the sampling time interval, obtain the rate of change of energy with time, and combine the trajectory kinematic constraint discrimination criterion, data frame verification rules and smoothing filter logic correction value to obtain the trajectory energy gradient value.
[0013] The present invention is improved in that the steps for obtaining the vehicle trajectory anomaly detection result are specifically as follows: S511: Obtain a preset benchmark gradient threshold, call the trajectory energy gradient value and benchmark gradient threshold to perform numerical subtraction and offset deviation quantization, calculate the deviation of trajectory energy evolution state over time relative to benchmark gradient threshold, perform logical threshold discrimination and nonlinear interval mapping transformation, and generate deviation comparison judgment result. S512: Based on the deviation comparison judgment result, obtain the original trajectory anomaly score, map the nonlinear weight correction coefficient to the deviation comparison judgment result, call the original trajectory anomaly score to perform weight product modulation processing, calculate the product value of the original trajectory anomaly score and the weight correction coefficient, perform dimensional alignment and suppression correction processing, and generate a corrected anomaly score. S513: Based on the corrected anomaly score, obtain the sampling time interval, call the trilinear interpolation function to perform three-dimensional spatial continuous numerical completion for the corrected anomaly score in chronological order, map the probability distribution density of the score value in the spatiotemporal dimension, perform smooth surface unfolding processing in association with global trajectory temporal evolution constraints, perform grid node numerical alignment, and establish a continuous confidence probability surface. S514: For the continuous confidence probability surface, perform local extremum detection optimization, retrieve the coordinates of the distribution position of the maximum value of numerical confidence within the continuous confidence probability surface, obtain the peak feature point of the continuous confidence probability surface, and combine the preset anomaly classification judgment criteria, risk assessment indicators and driving state stability indicators to judge the vehicle trajectory anomaly and obtain the vehicle trajectory anomaly detection result.
[0014] The present invention is improved in that the process of setting the benchmark gradient threshold is specifically as follows: retrieve a preset sample dataset, extract the energy gradient distribution characteristics of historical normal trajectory points under multiple driving conditions, and use the percentile threshold or mean-weighted variance of the statistical distribution to determine the reference boundary value characterizing the stability of energy evolution as the benchmark gradient threshold. The process of mapping the nonlinear weight correction coefficient specifically involves calling the Sigmoid function or a piecewise power function to construct a nonlinear mapping link from the deviation comparison judgment result to the weight scalar. Based on the degree of offset of the deviation comparison judgment result relative to the zero bias, the corresponding dynamic modulation ratio is matched within the weight saturation interval to perform amplitude mapping on the original trajectory anomaly score.
[0015] A deep learning-based vehicle trajectory anomaly detection system, wherein the deep learning-based vehicle trajectory anomaly detection system is used to implement the aforementioned deep learning-based vehicle trajectory anomaly detection method, the system comprising: The trajectory distance analysis module obtains the vehicle trajectory point coordinates, displacement increment length, sampling time interval, road left boundary line coordinate sequence and road right boundary line coordinate sequence through the vehicle positioning terminal, calculates the left distance value of the trajectory point coordinates to the road left boundary line coordinate sequence and the right distance value of the trajectory point to the road right boundary line coordinate sequence, and obtains the road distance analysis results. The road offset division module, based on the road distance analysis results, calculates the difference between the left and right distances of the trajectory points to obtain the symbol offset, performs interpolation on the symbol offset, and constructs a symbol offset sequence and a road offset continuous field. The proportional imbalance analysis module calculates the ratio of the displacement increment length to the sampling time interval, generates instantaneous velocity values, aggregates the instantaneous velocity values by mean, obtains the baseline velocity, and uses the instantaneous velocity values and the baseline velocity to calculate the time proportional imbalance parameter and construct a scale adjustment query vector. The trajectory gradient analysis module inputs the road offset continuous field and scale adjustment query vector into a pre-trained long short-term memory network model to perform feature extraction, construct trajectory embedding vector and original trajectory anomaly score, calculate trajectory energy value, calculate the rate of change of trajectory energy value with respect to sampling time interval, and construct trajectory energy gradient value; The trajectory anomaly detection module compares the trajectory energy gradient value with a preset benchmark gradient threshold, modulates the original trajectory anomaly score, generates a corrected anomaly score, interpolates and expands the corrected anomaly score, establishes a confidence probability surface, and obtains the vehicle trajectory anomaly detection result.
[0016] Compared with the prior art, the advantages and positive effects of the present invention are as follows: In this invention, by constructing a signed offset sequence and a continuous road offset field, vehicle displacement features are deeply coupled with road cross-sectional geometric constraints. Spatial embedding mapping is used to eliminate noise from abrupt changes in the location of discrete trajectory sampling points. The query vector dimension is linearly stretched by combining the dynamic ratio of instantaneous speed to reference speed, and the feature scale under different speed change amplitudes is adaptively reconstructed. A long short-term memory network is introduced to recursively iterate and aggregate the long-range temporal dependencies of the trajectory. The anomaly score weight product modulation processing is performed by coordinating the trajectory energy gradient. A continuous confidence probability surface is constructed using trilinear interpolation, and the discrete score is transformed into a spatiotemporally continuous distribution probability. Global optimal anomaly localization is achieved by searching for peak feature points on the surface. This effectively suppresses local positioning error interference and improves the detection accuracy of sparsely sampled trajectories, ensuring high generalization and high reliability of trajectory monitoring in complex road network environments. Attached Figure Description
[0017] Figure 1 This is a flowchart of the method of the present invention; Figure 2 This is a flowchart illustrating the process of obtaining road distance analysis results according to the present invention; Figure 3 This is a flowchart for obtaining the continuous field of road offset in this invention; Figure 4 This is a flowchart illustrating how the scale adjustment query vector is obtained in this invention; Figure 5 This is a flowchart illustrating the process of obtaining trajectory energy gradient values according to the present invention; Figure 6 This is a flowchart illustrating the process of obtaining vehicle trajectory anomaly detection results according to the present invention. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0019] In the description of this invention, it should be understood that the terms "length," "width," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," and "outer," etc., indicating orientation or positional relationships, are based on the orientation or positional relationships shown in the accompanying drawings and are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the invention. Furthermore, in the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.
[0020] Please see Figure 1This invention provides a technical solution: a vehicle trajectory anomaly detection method based on deep learning, comprising the following steps: S1: Obtain the vehicle trajectory point coordinates, displacement increment length, sampling time interval, road left boundary line coordinate sequence, and road right boundary line coordinate sequence through the vehicle-mounted positioning terminal; calculate the left distance value of the trajectory point coordinates from the vehicle trajectory point coordinates to the road left boundary line coordinate sequence; calculate the right distance value of the trajectory point coordinates from the vehicle trajectory point coordinates to the road right boundary line coordinate sequence; and obtain the road distance analysis results. S2: Based on the road distance analysis results, the left distance value and the right distance value of the trajectory point are called to perform difference calculation to generate a sign offset. According to the road mileage order, the sign offset is interpolated by a linear smooth interpolation function to construct a signed offset sequence. The road offset continuous field is constructed by performing feature mapping on the signed offset sequence through a spatial embedding layer. S3: Obtain the displacement increment length and sampling time interval, calculate the instantaneous velocity value generated by dividing the displacement increment length by the sampling time interval, generate the reference velocity based on the average of multiple instantaneous velocity values, calculate the ratio of the instantaneous velocity value to the reference velocity to generate the time scale imbalance parameter, and perform dimensional linear stretching processing on the original query vector by calling the time scale imbalance parameter to construct the scale adjustment query vector. S4: Input the road offset continuous field and scale adjustment query vector into the pre-trained long short-term memory network model to perform feature extraction, construct trajectory embedding vector and original trajectory anomaly score, perform square summation on trajectory embedding vector to generate trajectory energy value, and calculate the rate of change of trajectory energy value with respect to sampling time interval based on trajectory energy value to construct trajectory energy gradient value; S5: Perform a deviation comparison judgment on the trajectory energy gradient value and the set benchmark gradient threshold to generate a deviation comparison judgment result. Based on the deviation comparison judgment result, perform weighted product modulation processing on the original trajectory anomaly score to generate a corrected anomaly score. Use a trilinear interpolation function to perform surface expansion on the corrected anomaly score in time sequence to construct a continuous confidence probability surface. Obtain the peak value of the continuous confidence probability surface to determine the vehicle trajectory anomaly detection result.
[0021] The road offset continuous field includes the topological mapping matrix, the regional deformation tensor, and the lateral distribution cloud map. The scale adjustment query vector includes the dynamic attention mask, the feature activation map, and the spatiotemporal fusion weight. The trajectory energy gradient value includes the state change scalar, the fluctuation evolution amplitude, and the kinetic energy decay exponent. The vehicle trajectory anomaly detection results include the risk severity level, the behavior violation category, and the trajectory failure mode.
[0022] Please see Figure 2 The specific steps for obtaining the road distance analysis results are as follows: S111: Collect vehicle trajectory point coordinates, displacement increment length, sampling time interval, road left boundary line coordinate sequence and road right boundary line coordinate sequence through vehicle-mounted positioning terminal; perform discretization sample alignment processing on trajectory point coordinates and displacement increment length according to clock synchronization signal; process geographic coordinates by combining road topology connection relationship, data frame verification rules and projection transformation algorithm to obtain vehicle trajectory spatiotemporal parameter characteristics. A high-frequency vehicle-mounted positioning terminal deployed at the vehicle's center of gravity synchronously acquires the coordinates of the vehicle's trajectory points in a global coordinate system at a fixed frequency of 10Hz, obtaining raw spatial components including longitude, latitude, and elevation information. Simultaneously, an inertial measurement unit (IMU) is used to acquire the displacement increment length between adjacent sampling times, with the positioning terminal's internal crystal oscillator signal serving as the reference for the sampling time interval. High-resolution map data pre-stored in a geographic information system (GIS) database is retrieved to extract the left and right boundary line coordinate sequences of roads containing continuous coordinate nodes. To eliminate the cumulative errors caused by positioning delays and sensor synchronization inconsistencies, a globally unified clock synchronization signal is established. Non-uniformly spaced raw sensor pulses are discretized and aligned using a zero-order hold, ensuring that each trajectory point coordinate corresponds to a defined displacement increment length. For the acquired geographic coordinates, a Gauss-Kruger projection transformation algorithm is used to project them from a spherical coordinate system to a Cartesian coordinate system. During the projection process, the central meridian is selected as 121 degrees. Using a nonlinear mapping formula between geodetic coordinates and plane coordinates, latitude and longitude are converted into horizontal and vertical coordinates in meters. By combining the road topology and connectivity, isolated outliers with positioning drift exceeding 5 meters are eliminated using data frame verification rules. Finally, through affine transformation of translation and rotation matrices, spatiotemporal parameter features of vehicle trajectory with timestamp, spatial coordinates, velocity vector, and displacement attributes are obtained. For example, in a certain sampling, the aligned horizontal coordinate is 35421.56 meters and the vertical coordinate is 42185.32 meters, with the corresponding sampling time interval being constant at 0.1 seconds.
[0023] S112: Based on the spatiotemporal parameter features of vehicle trajectory, retrieve the coordinates of vehicle trajectory points and the coordinate sequence of the left boundary line of the road, retrieve the point-line projection vector of the vehicle trajectory point coordinates within the coverage area of the left boundary line coordinate sequence, calculate the minimum Euclidean distance from the vehicle trajectory point coordinates to the matching line segment of the left boundary line coordinate sequence according to the geometric distance judgment rules and coordinate interpolation logic, and generate the left distance value of the trajectory point. The system retrieves the vehicle trajectory point coordinates in a Cartesian coordinate system and a preset road left boundary line coordinate sequence. To accurately locate the vehicle's lateral offset reference, it retrieves the two nearest adjacent boundary nodes from the left boundary line sequence, constructing a left boundary vector segment representing the local road direction. The perpendicular coordinates from the vehicle trajectory point coordinates to this segment are calculated, and the components of the trajectory point in the boundary tangent and normal directions are extracted through point-line projection vector operations. Based on geometric distance rules, the trajectory point coordinates are traversed and matched with discrete points in the left boundary line coordinate sequence. Using bilinear coordinate interpolation logic, a smooth boundary curve equation is fitted between the discrete boundary points. The minimum Euclidean distance from the vehicle trajectory point coordinates to this fitted line segment is calculated. This calculation involves algebraic operations between the trajectory point coordinates (x, y) and the line segment endpoints (x1, y1) and (x2, y2). If the trajectory point is within the line segment projection range, the distance formula from a point to a line is used directly; if the projection exceeds the boundary, the minimum value at the endpoints is taken. The final generated left distance value of the trajectory point is used to characterize the physical gap between the left side profile of the vehicle and the road edge. For example, when the trajectory point coordinates are (100.5, 200.0), and the two endpoints of the matched left boundary line segment are (98.0, 190.0) and (98.0, 210.0) respectively, the calculated left distance value of the trajectory point is 2.50 meters.
[0024] S113: Based on the spatiotemporal parameter characteristics of vehicle trajectory, retrieve the coordinate sequence of the right boundary line of the road and the sampling time interval, match the dynamic sampling index value of the vehicle trajectory point coordinates in the horizontal axis distribution direction, calculate the minimum Euclidean distance from the vehicle trajectory point coordinates to the matching line segment of the right boundary line coordinate sequence as the right distance value of the trajectory point, perform correlation processing based on the left distance value of the trajectory point, organize the left distance value and the right distance value of the trajectory point, and obtain the road distance analysis results; Based on the extracted spatiotemporal parameter features of the vehicle trajectory, the coordinate sequence of the right boundary line of the road is retrieved synchronously. To achieve synchronous analysis of bilateral distances, the dynamic sampling index value of the vehicle trajectory point coordinates in the horizontal axis distribution direction is matched according to the index of the sampling time interval in the temporal dimension. This index value represents the corresponding position of the trajectory point on the tangential mileage of the road. Using the same geometric retrieval logic as for the left distance calculation, the optimal line segment matching the current mileage index is searched in the right boundary line coordinate sequence. The minimum Euclidean distance from the vehicle trajectory point coordinates to this matching right boundary line segment is calculated and defined as the right distance value of the trajectory point. During this process, association processing based on the left distance value of the trajectory point is performed. By summing the left and right distance values, it is verified whether the sum is within the preset road width range (e.g., between 3.5 meters and 3.75 meters). If the sum exceeds this range, it is determined to be positioning drift or missing boundary data, and the effective distance from the previous moment needs to be retrieved for linear extrapolation correction. The left and right distance values of the trajectory points at each sampling time are collected, arranged in time series, and an attribute matrix containing bilateral constraint features is constructed to obtain complete road distance analysis results. These results serve as the core basic data for subsequent judgment of whether vehicles have deviated or crossed the line.
[0025] Please see Figure 3 The specific steps for obtaining the road offset continuous field are as follows: S211: Based on the road distance analysis results, call the left distance value and the right distance value of the trajectory point to perform difference calculation, determine the lateral orientation polarity of the vehicle trajectory point relative to the road center axis, obtain the geometric constraint parameters of the road cross section, perform lateral vector mapping for the geographical area where the trajectory point coordinates are located, combine the preset positive and negative sign discrimination criteria to convert the spatial displacement scalar, perform polar alignment operation and numerical polarity correction, and generate sign offset; The lateral polarity of the vehicle trajectory point relative to the road centerline is determined by calculating the difference between the left and right distance values and comparing it with the value 0. If the difference is positive, the vehicle is determined to be deviating to the right side of the road; if the difference is negative, the vehicle is determined to be deviating to the left side of the road. Preset road cross-section geometric constraint parameters are retrieved, including a standard lane width of 3.75 meters. Lateral vector mapping is performed on the geographical area where the trajectory point coordinates are located, converting the absolute displacement within the geographical space into a relative displacement relative to the road baseline. Combining a preset positive / negative sign discrimination criterion, a conversion logic of left deviation being negative and right deviation being positive is set, and the spatial displacement scalar is subjected to polar alignment calculation. For instantaneous polarity jumps caused by sampling noise, numerical polarity correction is performed; that is, when two adjacent points have opposite signs and their absolute values are both less than 0.05 meters, they are uniformly corrected to the polarity of the previous moment, thereby generating a sign offset with directional attributes. This offset accurately reflects the degree of physical deviation of the vehicle's centerline from the ideal lane centerline.
[0026] S212: Based on the sign offset, obtain the road mileage sequence parameters, call the linear smooth interpolation function to perform numerical continuous fitting processing on the sign offset in the road mileage evolution dimension, eliminate the noise of sudden position jumps between discrete trajectory sampling points, and perform moving average-based logical resampling processing on the fitted values. Perform second derivative constraint verification and local monotonicity check on the offset change rate to obtain the signed offset sequence. Based on the generated symbolic offset sequence, the corresponding road mileage sequence parameter is obtained, which is the cumulative length of the trajectory point extending along the road centerline. To eliminate the noise caused by abrupt jumps in the position of discrete sampling points due to the multipath effect of the positioning system, a linear smoothing interpolation function is called to perform numerical continuity fitting processing on the symbolic offset in the road mileage evolution dimension. In this fitting process, the moving window size is set to 10 sampling points, and the offset within the window is resampled using weighted moving average logic. The weight coefficients are allocated according to the time decay function, with points closer to the current time having a larger weight (e.g., the current point has a weight of 0.3, and the farthest point has a weight of 0.05). Kinematic constraint checks are performed on the fitted signed offset numerical sequence, specifically calculating the first derivative (rate of change) and second derivative (curvature) of the offset with respect to mileage. The second derivative constraint threshold is set to 0.2. If the second derivative of a certain segment of the sequence exceeds this value, it indicates that the offset change at that point does not conform to the physical limits of vehicle steering, and local monotonicity checks are required. The Lagrange multiplier method is used to smooth and suppress abnormal values. Through the above processing, a signed offset sequence that has been filtered out of high-frequency noise and conforms to dynamic characteristics is obtained. For example, a trajectory with a length of 50 meters has an offset sequence that exhibits a smooth cosine wave pattern.
[0027] S213: For signed offset sequences, call the spatial embedding layer weight matrix to perform high-dimensional feature nonlinear mapping processing, convert the scalar offset features into high-dimensional vector representations with spatial topological properties, associate global road topological connection constraints and lane line geometric topological distribution information, map the displacement state of each sampling point to the global spatial grid tensor structure, perform coordinate projection transformation, tensor slice aggregation and feature dimension alignment, and establish a continuous field of road offset. To extract higher-dimensional spatial correlation features within the deep learning framework for the processed signed offset sequence, a 64-dimensional spatial embedding layer weight matrix is used to perform nonlinear mapping. This matrix, pre-trained on a large-scale road trajectory sample set, transforms one-dimensional scalar offset features into high-dimensional vector representations with spatial topological properties. Each offset value not only represents distance but also implicitly contains environmental context information such as road curvature and lane type. Global road topology connectivity constraints and lane line geometric topology distribution information are correlated, and coordinate projection transformation is used to map sampling points from one-dimensional linear space to a pre-defined global spatial grid tensor structure. The grid resolution of this tensor structure is set to 0.2 meters by 0.2 meters, covering a rectangular area around the vehicle. Tensor slicing aggregation is performed to align the feature dimensions of offset vectors within different time windows, and max pooling is used to extract salient features within each grid cell. Finally, a multi-dimensional, continuous road offset continuum with physical constraints is established in the spatiotemporal domain. This field can intuitively display the lateral dynamic evolution trajectory of the vehicle trajectory over a continuous mileage and the potential deviation risk trend.
[0028] Please see Figure 4 The specific steps for obtaining the scale-adjusted query vector are as follows: S311: Obtain the displacement increment length and sampling time interval, perform a division ratio operation based on the sampling time interval on the displacement increment length to generate instantaneous velocity values, and perform mean aggregation calculation on multiple instantaneous velocity values continuously distributed within the acquisition window to obtain the reference velocity; The displacement increment length and sampling time interval for each sampling period are obtained from the sensor's underlying driver interface. A division ratio calculation based on the sampling time interval is performed on the displacement increment length to calculate the vehicle's instantaneous velocity value in real time. To reflect the steady-state dynamic characteristics of the vehicle during a driving process, a sliding observation window is set, covering 50 sampling points. Multiple continuously distributed instantaneous velocity values within the window are collected, and their arithmetic mean is aggregated to obtain a baseline velocity representing the current driving condition. For example, within a 5-second observation period, if the sampled instantaneous velocity sequence fluctuates between 14.5 m / s and 15.5 m / s, the calculated baseline velocity is 15.0 m / s. This baseline velocity is used as a reference for subsequent assessment of whether the vehicle's motion state has experienced drastic fluctuations or abnormal imbalances.
[0029] S312: Retrieves the instantaneous speed value, reference speed, and sampling time interval to obtain the reference road segment length, trajectory curvature, and resonant frequency. It then performs a deviation ratio measurement between the instantaneous speed value and the reference speed using the following formula: ; The time ratio imbalance parameter is obtained through calculation. in, The parameter representing the time-proportional imbalance. The instantaneous velocity value is obtained by the ratio of displacement to time. Represents the baseline speed, obtained by calculating the average of speed samples. The normalized value representing the reference road segment length is extracted from the road database. The normalized value of the arc curvature of the representative trajectory is obtained based on the geometric relationships of the trajectory points. This represents the normalized value of the sampling time interval, obtained from the positioning terminal's clock signal. This represents the normalized value of the resonant frequency, obtained based on frequency analysis of the vibration sensor. The ratio of the deviation between the instantaneous speed value and the reference speed is used to measure the relative intensity of speed fluctuations, employing the formula: ; The time ratio imbalance parameter is obtained through calculation.
[0030] In the application of this formula, the parameters are obtained and assigned values in the following way: instantaneous velocity value The value is taken as 16.5 m / s, the reference speed. The value is taken as 15.0 m / s. Reference road segment length normalized value. Based on the speed limit and curve radius of the current road segment, the value is extracted from a preset road feature mapping table and set to 50.0 (dimensionless, representing a standard length unit). This is the normalized value of the trajectory arc curvature. The value is obtained by calculating the reciprocal of the radius of the circumcircle formed by the three trajectory points before and after the current moment, and is set to 0.02 (in meters). Normalized value of the sampling time interval. The resonant frequency is determined by a 10Hz sampling frequency from the positioning terminal, with a value of 0.10 (in seconds). Normalized value of the resonant frequency. Fast Fourier transform analysis was performed using the accelerometers mounted on the vehicle body to extract the dominant vibration frequency of the vehicle body in the vertical or lateral direction, with a value of 1.20 (in Hertz).
[0031] In practice, the obtained , , , , , Substitute into the calculation formula: ; The first calculation is the speed deviation: ; The second item calculates the spatiotemporal geometric correlation term: ; ; Summing to obtain the final result: ; The calculated value is 2.9867. In practical engineering implementation, to maintain the consistency of numerical dimensions, it is rounded to 2.99. This result indicates that when the imbalance parameter reaches 2.99, it means that the current motion state of the vehicle (especially the matching degree between lateral geometric constraints and time sampling) deviates from the ideal balance condition. It is necessary to use this parameter to perform scale stretching on the subsequent query vector to amplify the expression of abnormal features.
[0032] S313: Based on the vehicle position, heading angle and acceleration query commands, construct the original query vector, call the time scale imbalance parameter for each feature dimension of the original query vector to perform dimensional space linear mapping stretching transformation, calculate the product of the time scale imbalance parameter and the weight of the hidden state feature value in the original query vector, perform vector distribution scale reconstruction mapping processing to obtain the scale-adjusted query vector. Obtain the initial query vector as input to the deep learning model. This vector is generated by mapping the spatiotemporal features of the trajectory through a preliminary fully connected layer, containing raw semantic information such as vehicle position, heading angle, and acceleration. For each feature dimension of the initial query vector (e.g., dimension size 128), perform a linear mapping stretching transformation of the dimensional space using the calculated time scale imbalance parameter. Specifically, calculate the weighted product of the time scale imbalance parameter and each hidden state feature value in the initial query vector. If the value is large (e.g., greater than 2.5), increase the response weight of the velocity and acceleration-related dimensions in the query vector, making them dominant in the attention mechanism operation; if If the value is within the normal range (e.g., 0.8 to 1.2), the dimensional weights remain balanced. By performing a reconstruction mapping process on the vector distribution scale, the geometric broadening of the query vector in the feature space is adaptively adjusted according to the driving state, ultimately resulting in a scale-adjusted query vector. This process enables the model to enhance its ability to capture subtle trajectory anomalies under high-dynamic conditions such as rapid lane changes or sudden braking by adjusting the feature scale.
[0033] Please see Figure 5 The specific steps for obtaining the trajectory energy gradient value are as follows: S411: Map the road offset continuous field and scale-adjusted query vector to a pre-trained long short-term memory network to perform feature extraction, call the neuron weight matrix and bias parameters to calculate the tensor dot product, recursively update the cell state through forgetting gate, input gate and output gate, use non-linear activation to aggregate the long-range temporal dependency of the trajectory, map the hidden layer output vector to the fully connected feature mapping layer, perform dimensionality reduction projection transformation, and establish the trajectory embedding vector and the original trajectory anomaly score; The generated road offset continuous field tensor and scale-adjusted query vector are used as combined inputs and mapped to a pre-trained Long Short-Term Memory (LSTM) network for deep feature extraction. This network consists of an input layer, hidden layers, and an output layer, with the hidden layers using 64 LSTM units. During processing, the weight matrices within the neurons are invoked. With bias parameters Calculate the tensor dot product of the current input and the hidden state from the previous time step. The cooperative forgetting gate controls the proportion of old state information discarded based on the current input, the input gate uses a sigmoid activation function to determine the storage of new information, and the output gate calculates the final hidden output based on the current cell state. Utilizing... A nonlinear activation function normalizes cell states, effectively aggregating long-range dependencies in trajectory time and capturing offset patterns over the past 30 seconds. The hidden layer output vector is mapped to a fully connected feature mapping layer, performing dimensionality reduction and projection transformation to establish a trajectory embedding vector with strong semantic representation capabilities. Simultaneously, a preliminary raw trajectory anomaly score is generated based on a Softmax classification layer. This score ranges from 0 to 1, reflecting the probability that the trajectory statistically deviates from the normal pattern.
[0034] Table 1 lists the hyperparameter settings of the Long Short-Term Memory network and their impact on training performance; Table 1. Long Short-Term Memory Network Configuration and Performance ; As shown in Table 1, by setting scientific hyperparameters, the network is ensured to have high robustness when processing complex road offset data.
[0035] S412: For the trajectory embedding vector, extract the feature numerical components of each dimension of the vector space, call the vector 2 norm calculation logic to process the squaring operation of all dimension components, use the linear superposition operator to perform the numerical aggregation and summation of the full-dimensional square terms, map the distribution density of trajectory points relative to the origin in the high-dimensional feature space, establish the energy representation attribute of trajectory motion state, associate the temporal weight distribution matrix to enhance the features, and generate trajectory energy value. For the acquired trajectory embedding vector, feature numerical components of each dimension within its vector space are extracted, such as a 64-dimensional component sequence. To quantify the physical intensity of the trajectory motion, the vector L2 norm calculation logic is invoked to process the squaring of all dimensional components. A linear superposition operator is then used to perform numerical aggregation and summation of the squared terms across all dimensions. This process maps the trajectory points in the high-dimensional feature space to a distribution density relative to the origin, establishing an energy representation attribute for the trajectory motion state. To enhance sensitivity under specific abnormal conditions, a pre-defined temporal weight distribution matrix is associated to perform weighted enhancement processing on the dimensions representing abrupt changes in the embedding vector. Finally, a trajectory energy value is generated, which is a scalar that dynamically changes over time, intuitively reflecting the stability energy of the vehicle's driving. For example, the energy value remains around 1.5 during smooth driving, while it rapidly spikes to over 5.0 during frequent swaying or skidding.
[0036] S413: Based on the trajectory energy value, call the sampling time interval, calculate the first-order discrete difference result of the trajectory energy value of adjacent trajectory points in the time series, calculate the normalized quotient of the first-order discrete difference result with respect to the sampling time interval, obtain the rate of change of energy with time, and combine the trajectory kinematic constraint discrimination criterion, data frame verification rules and smoothing filter logic correction value to obtain the trajectory energy gradient value. Based on the calculated trajectory energy value sequence, the sampling time interval recorded by the sensor is called. The first-order discrete difference result of the trajectory energy values between adjacent trajectory points within the time series is calculated, i.e., using... Energy value at time minus The energy value at any given time is calculated. The normalized quotient of the first-order discrete difference result with respect to the sampling time interval is calculated to obtain the rate of change of energy over time. To ensure the authenticity and usability of the data, a maximum energy change rate threshold of 10 units per second is set based on the vehicle trajectory kinematics constraint criteria. If the calculated value exceeds this threshold, it indicates that the data is affected by sensor jumps, and median filtering logic needs to be called to correct the value. By performing a smoothing filter on the processed rate of change, discrete noise in the calculation process is removed, and the final trajectory energy gradient value is obtained. This gradient value represents the derivative of the energy field in the time dimension, and can sensitively detect the instantaneous abrupt signal of the vehicle transitioning from a stable state to a runaway mode.
[0037] Please see Figure 6 The specific steps for obtaining vehicle trajectory anomaly detection results are as follows: S511: Obtain the preset baseline gradient threshold, call the trajectory energy gradient value and the baseline gradient threshold to perform numerical subtraction and offset deviation quantization, calculate the deviation of the trajectory energy evolution state over time relative to the baseline gradient threshold, perform logical threshold discrimination and nonlinear interval mapping transformation, and generate deviation comparison judgment results. The specific process of setting the benchmark gradient threshold is as follows: retrieve the preset sample dataset, extract the energy gradient distribution characteristics of historical normal trajectory points under multiple driving conditions, and use the percentile threshold or mean-weighted variance of the statistical distribution to determine the reference boundary value characterizing the stability of energy evolution as the benchmark gradient threshold. A preset baseline gradient threshold is obtained, which is set by retrieving a sample dataset containing one thousand normal driving records. Energy gradient distribution characteristics of historical normal trajectory points under multiple driving conditions, including straight lines, turns, and U-turns, are extracted. Using a statistical distribution 95th percentile threshold combined with a mean-weighted variance method, a reference boundary value characterizing the stability of energy evolution is determined; for example, the baseline gradient threshold is set to 2.8. The currently calculated real-time trajectory energy gradient value (e.g., 4.2) is subtracted from the baseline gradient threshold to calculate the quantized offset deviation. The deviation magnitude of the trajectory energy evolution over time relative to the baseline gradient threshold is calculated. A logical threshold judgment is performed; when the deviation magnitude is greater than 0, it is judged as a potential anomaly. Through a nonlinear interval mapping transformation, the deviation is scaled to a standardized interval of -1 to 1, generating a deviation comparison judgment result, which serves as the logical driving signal for subsequent weight adjustments.
[0038] S512: Based on the deviation comparison judgment result, obtain the original trajectory anomaly score, map the nonlinear weight correction coefficient to the deviation comparison judgment result, call the original trajectory anomaly score to perform weight product modulation processing, calculate the product operation value of the original trajectory anomaly score and the weight correction coefficient, perform dimensional alignment and suppression correction processing, and generate the corrected anomaly score. The process of mapping nonlinear weight correction coefficients is as follows: calling the Sigmoid function or piecewise power function to construct a nonlinear mapping link from the deviation comparison judgment result to the weight scalar; based on the degree of deviation of the deviation comparison judgment result relative to the zero bias, matching the corresponding dynamic modulation ratio within the weight saturation interval to perform amplitude mapping on the original trajectory anomaly score. Based on the generated deviation comparison judgment result, the original trajectory anomaly score from step S411 is obtained synchronously. Nonlinear weight correction coefficients are then mapped onto the deviation comparison judgment result. Specifically, the mapping process involves calling the Sigmoid function to construct the mapping link: ; Among them, parameters The sensitivity coefficient was set to 2.5 after experimental verification. The result is used for deviation comparison and judgment. Based on the degree of deviation relative to zero bias, the corresponding dynamic modulation ratio is matched within the weight saturation interval (0,1). The original trajectory anomaly score is called to perform weighted product modulation processing. For example, if the original score is 0.6 and the currently calculated weight correction coefficient is 1.5, the product operation yields a value of 0.9. Dimensional alignment and suppression correction processing is performed to ensure that the final corrected anomaly score is within a reasonable confidence interval, generating a corrected anomaly score that enhances the response strength to sudden energy fluctuations.
[0039] S513: Based on the corrected anomaly score, obtain the sampling time interval, call the trilinear interpolation function to perform three-dimensional spatial continuous numerical completion for the corrected anomaly score in chronological order, map the probability distribution density of the score value in the spatiotemporal dimension, perform smooth surface unfolding processing in association with global trajectory temporal evolution constraints, perform grid node numerical alignment, and establish a continuous confidence probability surface. Based on the generated corrected anomaly scores, the precise sampling time interval is obtained. To obtain spatiotemporally continuous detection results, a trilinear interpolation function is invoked to perform continuous numerical completion in three-dimensional space (longitude, latitude, and time axis) for the corrected anomaly scores in chronological order. During this process, discrete score points are treated as nodes in a spatiotemporal grid, and the probability distribution density of the score values in the spatiotemporal dimension is mapped by calculating the distance weights of the values from surrounding nodes. Global trajectory temporal evolution constraints are considered, and a thin-plate spline interpolation algorithm is used to perform smooth surface unfolding to eliminate score discontinuities caused by sampling gaps. Grid node numerical alignment is performed to establish a continuous confidence probability surface with smooth transition characteristics; the peak value of this surface represents the region with the highest probability of anomaly occurrence.
[0040] S514: For the continuous confidence probability surface, perform local extremum detection optimization, retrieve the coordinates of the distribution position of the maximum value of numerical confidence within the continuous confidence probability surface, obtain the peak feature point of the continuous confidence probability surface, and combine the preset anomaly classification criteria, risk assessment indicators and driving state stability indicators to judge the vehicle trajectory anomaly and obtain the vehicle trajectory anomaly detection result. For the constructed continuous confidence probability surface, a local extremum detection optimization algorithm is executed, using a hill-climbing method to retrieve the coordinates of the maximum distribution of numerical confidence scores within the surface. Peak feature points of the continuous confidence probability surface are obtained, corresponding to the specific time and spatial location of trajectory anomalies. These points are then combined with pre-defined anomaly classification criteria (such as deviation thresholds and oscillation frequencies), risk assessment indicators (such as collision probability), and driving stability indicators. If the peak confidence score exceeds 0.85 and the corresponding energy gradient duration exceeds 0.5 seconds, the vehicle is determined to be in a trajectory anomaly state. By comprehensively considering multiple indicators, vehicle trajectory anomaly detection results are obtained.
[0041] A deep learning-based vehicle trajectory anomaly detection system is provided. This system implements the aforementioned deep learning-based vehicle trajectory anomaly detection method. The system includes: The trajectory distance analysis module obtains the vehicle trajectory point coordinates, displacement increment length, sampling time interval, road left boundary line coordinate sequence and road right boundary line coordinate sequence through the vehicle positioning terminal, calculates the left distance value of the trajectory point coordinates to the road left boundary line coordinate sequence and the right distance value of the trajectory point to the road right boundary line coordinate sequence, and obtains the road distance analysis results. The road offset segmentation module, based on the road distance analysis results, calculates the difference between the left and right distances of the trajectory points to obtain the symbol offset, performs interpolation on the symbol offset, and constructs a symbol offset sequence and a road offset continuous field. The proportional imbalance analysis module calculates the ratio of the displacement increment length to the sampling time interval, generates instantaneous velocity values, aggregates the instantaneous velocity values by mean, obtains the baseline velocity, and uses the instantaneous velocity values and the baseline velocity to calculate the time proportional imbalance parameter and construct a scale adjustment query vector. The trajectory gradient analysis module inputs the road offset continuous field and scale adjustment query vector into a pre-trained long short-term memory network model to perform feature extraction, construct trajectory embedding vectors and original trajectory anomaly scores, calculate trajectory energy values, calculate the rate of change of trajectory energy values with respect to the sampling time interval, and construct trajectory energy gradient values. The trajectory anomaly detection module compares the trajectory energy gradient value with a preset baseline gradient threshold, modulates the original trajectory anomaly score, generates a corrected anomaly score, interpolates and expands the corrected anomaly score, establishes a confidence probability surface, and obtains the vehicle trajectory anomaly detection result.
[0042] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments that can be applied to other fields. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the protection scope of the present invention.
Claims
1. A deep learning-based method for detecting vehicle trajectory anomalies, characterized in that, Includes the following steps: S1: Obtain the vehicle trajectory point coordinates, displacement increment length, sampling time interval, road left boundary line coordinate sequence and road right boundary line coordinate sequence through the vehicle positioning terminal, calculate the left distance value of the trajectory point coordinates to the road left boundary line coordinate sequence and the right distance value of the trajectory point to the road right boundary line coordinate sequence, and obtain the road distance analysis results; S2: Based on the road distance analysis results, the left distance value and right distance value of the trajectory point are calculated by difference to obtain the symbol offset. The symbol offset is then interpolated to construct a symbol offset sequence and a road offset continuous field. S3: Calculate the ratio of displacement increment length to sampling time interval to generate instantaneous velocity value, average the instantaneous velocity value to obtain the reference velocity, use the instantaneous velocity value and the reference velocity to calculate the time ratio imbalance parameter, and construct the scale adjustment query vector; The steps for obtaining the scale adjustment query vector are as follows: S311: Obtain the displacement increment length and sampling time interval, perform a division ratio operation based on the sampling time interval on the displacement increment length to generate instantaneous velocity values, and perform mean aggregation calculation on multiple instantaneous velocity values continuously distributed within the acquisition window to obtain the reference velocity; S312: Call the instantaneous speed value, the reference speed and the sampling time interval to obtain the reference road segment length, the trajectory arc curvature and the resonant frequency, perform a deviation ratio measurement on the instantaneous speed value and the reference speed, and calculate and obtain the time ratio imbalance parameter; The specific formula for obtaining the time ratio imbalance parameter is as follows: ; in, The parameter representing the time-proportional imbalance. Represents the instantaneous velocity value. Represents the reference speed. This represents the normalized value of the reference road segment length. The normalized value of the curvature of the representative arc trajectory. This represents the normalized value of the sampling time interval. This represents the normalized value of the resonant frequency obtained through fast Fourier transform analysis using the accelerometer sensor mounted on the vehicle body. S313: Based on the vehicle position, heading angle and acceleration query commands, construct an original query vector. For each feature dimension of the original query vector, call the time ratio imbalance parameter to perform a linear mapping stretching transformation of the dimension space. Calculate the weighted product of the time ratio imbalance parameter and each hidden state feature value in the original query vector. Perform a reconstruction mapping process of the vector distribution scale so that the geometric expansion of the query vector in the feature space is adaptively adjusted according to the driving state, and obtain a scale-adjusted query vector. S4: Input the road offset continuous field and scale adjustment query vector into a pre-trained long short-term memory network model to perform feature extraction, construct a trajectory embedding vector and an original trajectory anomaly score; for the trajectory embedding vector, extract the feature numerical components of each dimension of the vector space, call the vector L2 norm calculation logic to process the squaring operation of all dimension components, use the linear superposition operator to perform full-dimensional squared term numerical aggregation and summation, map the distribution density of trajectory points relative to the origin in the high-dimensional feature space, establish the trajectory motion state energy representation attribute, associate the temporal weight distribution matrix to enhance the feature, and generate the trajectory energy value; calculate the rate of change of the trajectory energy value with respect to the sampling time interval, and construct the trajectory energy gradient value; S5: Compare the trajectory energy gradient value with the preset benchmark gradient threshold, modulate the original trajectory anomaly score, generate a corrected anomaly score, interpolate and expand the corrected anomaly score, establish a confidence probability surface, and obtain the vehicle trajectory anomaly detection result.
2. The vehicle trajectory anomaly detection method based on deep learning according to claim 1, characterized in that, The road offset continuous field includes a topological mapping matrix, a regional deformation tensor, and a lateral distribution cloud map. The scale adjustment query vector includes a dynamic attention mask, a feature activation map, and a spatiotemporal fusion weight. The trajectory energy gradient value includes a state mutation scalar, a fluctuation evolution amplitude, and a kinetic energy decay exponent. The vehicle trajectory anomaly detection result includes a risk severity level, a behavior violation category, and a trajectory failure mode.
3. The vehicle trajectory anomaly detection method based on deep learning according to claim 1, characterized in that, The specific steps for obtaining the road distance analysis results are as follows: S111: Collect vehicle trajectory point coordinates, displacement increment length, sampling time interval, road left boundary line coordinate sequence and road right boundary line coordinate sequence through vehicle-mounted positioning terminal; perform discretization sample alignment processing on trajectory point coordinates and displacement increment length according to clock synchronization signal; process geographic coordinates by combining road topology connection relationship, data frame verification rules and projection transformation algorithm to obtain vehicle trajectory spatiotemporal parameter characteristics. S112: Based on the spatiotemporal parameter features of the vehicle trajectory, retrieve the coordinates of the vehicle trajectory points and the coordinate sequence of the left boundary line of the road, retrieve the point-line projection vector of the vehicle trajectory point coordinates within the coverage area of the left boundary line coordinate sequence, calculate the minimum Euclidean distance from the vehicle trajectory point coordinates to the matching line segment of the left boundary line coordinate sequence according to the geometric distance determination rules and coordinate interpolation logic, and generate the left distance value of the trajectory point. S113: Based on the spatiotemporal parameter characteristics of the vehicle trajectory, retrieve the coordinate sequence of the right boundary line of the road and the sampling time interval, match the dynamic sampling index value of the vehicle trajectory point coordinates in the horizontal axis distribution direction, calculate the minimum Euclidean distance from the vehicle trajectory point coordinates to the matching line segment of the right boundary line coordinate sequence as the right distance value of the trajectory point, perform correlation processing based on the left distance value of the trajectory point, organize the left distance value and the right distance value of the trajectory point, and obtain the road distance analysis result.
4. The vehicle trajectory anomaly detection method based on deep learning according to claim 3, characterized in that, The specific steps for obtaining the road offset continuous field are as follows: S211: Based on the road distance analysis results, call the left distance value and the right distance value of the trajectory point to perform difference calculation, determine the lateral orientation polarity of the vehicle trajectory point relative to the road center axis, obtain the geometric constraint parameters of the road cross section, perform lateral vector mapping for the geographical area where the trajectory point coordinates are located, combine the preset positive and negative sign discrimination criteria to convert the spatial displacement scalar, perform polar alignment operation and numerical polarity correction, and generate sign offset; S212: Based on the symbol offset, obtain the road mileage sequence parameters, call the linear smooth interpolation function to perform numerical continuous fitting processing on the symbol offset in the road mileage evolution dimension, eliminate the noise of positional jumps between discrete trajectory sampling points, and perform moving average-based logical resampling processing on the fitted values, and perform second-order derivative constraint verification and local monotonicity check on the offset change rate to obtain a signed offset sequence. S213: For the signed offset sequence, the spatial embedding layer weight matrix is called to perform high-dimensional feature nonlinear mapping processing, converting the scalar offset features into high-dimensional vector representations with spatial topological attributes, associating global road topological connection constraints and lane line geometric topological distribution information, mapping the displacement state of each sampling point to the global spatial grid tensor structure, performing coordinate projection transformation, tensor slice aggregation and feature dimension alignment, and establishing a continuous field of road offset.
5. The vehicle trajectory anomaly detection method based on deep learning according to claim 1, characterized in that, The specific steps for constructing the trajectory embedding vector and the original trajectory anomaly score are as follows: S411: Map the road offset continuous field and scale adjustment query vector to a pre-trained long short-term memory network to perform feature extraction, call the neuron weight matrix and bias parameters to calculate the tensor dot product, recursively update the cell state through forgetting gate, input gate and output gate, aggregate the long-range temporal dependency of the trajectory using nonlinear activation processing, map the hidden layer output vector to the fully connected feature mapping layer, perform dimensionality reduction projection transformation, and establish the trajectory embedding vector and the original trajectory anomaly score.
6. The vehicle trajectory anomaly detection method based on deep learning according to claim 5, characterized in that, The specific steps for constructing the trajectory energy gradient value are as follows: S413: Based on the trajectory energy value, call the sampling time interval, calculate the first-order discrete difference result of the trajectory energy value of adjacent trajectory points in the time series, calculate the normalized quotient of the first-order discrete difference result with respect to the sampling time interval, obtain the rate of change of energy with time, and combine the trajectory kinematic constraint discrimination criterion, data frame verification rules and smoothing filter logic correction value to obtain the trajectory energy gradient value.
7. The deep learning-based vehicle trajectory anomaly detection method according to claim 6, characterized in that, The specific steps for obtaining the vehicle trajectory anomaly detection results are as follows: S511: Obtain a preset benchmark gradient threshold, call the trajectory energy gradient value and benchmark gradient threshold to perform numerical subtraction and offset deviation quantization, calculate the deviation of trajectory energy evolution state over time relative to benchmark gradient threshold, perform logical threshold discrimination and nonlinear interval mapping transformation, and generate deviation comparison judgment result. S512: Based on the deviation comparison judgment result, obtain the original trajectory anomaly score, map the nonlinear weight correction coefficient to the deviation comparison judgment result, call the original trajectory anomaly score to perform weight product modulation processing, calculate the product value of the original trajectory anomaly score and the weight correction coefficient, perform dimensional alignment and suppression correction processing, and generate a corrected anomaly score. S513: Based on the corrected anomaly score, obtain the sampling time interval, call the trilinear interpolation function to perform three-dimensional spatial continuous numerical completion for the corrected anomaly score in chronological order, map the probability distribution density of the score value in the spatiotemporal dimension, perform smooth surface unfolding processing in association with global trajectory temporal evolution constraints, perform grid node numerical alignment, and establish a continuous confidence probability surface. S514: For the continuous confidence probability surface, perform local extremum detection optimization, retrieve the coordinates of the distribution position of the maximum value of numerical confidence within the continuous confidence probability surface, obtain the peak feature point of the continuous confidence probability surface, and combine the preset anomaly classification judgment criteria, risk assessment indicators and driving state stability indicators to judge the vehicle trajectory anomaly and obtain the vehicle trajectory anomaly detection result.
8. The vehicle trajectory anomaly detection method based on deep learning according to claim 7, characterized in that, The specific process of setting the benchmark gradient threshold is as follows: retrieve a preset sample dataset, extract the energy gradient distribution characteristics of historical normal trajectory points under multiple driving conditions, and use the percentile threshold or mean-weighted variance of the statistical distribution to determine the reference boundary value characterizing the stability of energy evolution as the benchmark gradient threshold. The process of mapping the nonlinear weight correction coefficient specifically involves calling the Sigmoid function or a piecewise power function to construct a nonlinear mapping link from the deviation comparison judgment result to the weight scalar. Based on the degree of offset of the deviation comparison judgment result relative to the zero bias, the corresponding dynamic modulation ratio is matched within the weight saturation interval to perform amplitude mapping on the original trajectory anomaly score.
9. A vehicle trajectory anomaly detection system based on deep learning, characterized in that, The system is used to implement the deep learning-based vehicle trajectory anomaly detection method according to any one of claims 1-8, and the system comprises: The trajectory distance analysis module obtains the vehicle trajectory point coordinates, displacement increment length, sampling time interval, road left boundary line coordinate sequence and road right boundary line coordinate sequence through the vehicle positioning terminal, calculates the left distance value of the trajectory point coordinates to the road left boundary line coordinate sequence and the right distance value of the trajectory point to the road right boundary line coordinate sequence, and obtains the road distance analysis results. The road offset division module, based on the road distance analysis results, calculates the difference between the left and right distances of the trajectory points to obtain the symbol offset, performs interpolation on the symbol offset, and constructs a symbol offset sequence and a road offset continuous field. The proportional imbalance analysis module calculates the ratio of the displacement increment length to the sampling time interval, generates instantaneous velocity values, aggregates the instantaneous velocity values by mean, obtains the baseline velocity, and uses the instantaneous velocity values and the baseline velocity to calculate the time proportional imbalance parameter and construct a scale adjustment query vector. The trajectory gradient analysis module inputs the road offset continuous field and scale adjustment query vector into a pre-trained long short-term memory network model to perform feature extraction, construct trajectory embedding vector and original trajectory anomaly score, calculate trajectory energy value, calculate the rate of change of trajectory energy value with respect to sampling time interval, and construct trajectory energy gradient value; The trajectory anomaly detection module compares the trajectory energy gradient value with a preset benchmark gradient threshold, modulates the original trajectory anomaly score, generates a corrected anomaly score, interpolates and expands the corrected anomaly score, establishes a confidence probability surface, and obtains the vehicle trajectory anomaly detection result.