Abnormal trajectory discrimination system based on graph neural network
By constructing trajectory graphs and performing deep modeling using an improved Graphormer model, the problems of trajectory structure information loss and unstable discrimination results in existing methods are solved, and efficient identification and reliable discrimination of abnormal trajectories are achieved.
Patent Information
- Application Number
- CN202511557856.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-29
- Publication Date
- 2026-02-03
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing abnormal trajectory recognition methods struggle to reliably filter out normal trajectory samples when dealing with noise, inconsistent sampling frequencies, and missing points. Furthermore, graph neural networks lack the ability to fully express trajectory structure information and continuously model abnormal features in abnormal trajectory discrimination, leading to unstable discrimination results.
An improved Graphormer model is constructed, which combines anomaly feature gating, multi-scale subgraph modeling, prototype alignment embedding, confidence propagation and anomaly residual channels. Through trajectory graph construction and deep modeling, anomaly scores are generated and threshold determination is performed by combining class probabilities.
It achieves comprehensive modeling of trajectory data, preserves abnormal features and outputs reliable discrimination results, improving the accuracy and stability of abnormal trajectory identification, and is suitable for traffic management and trajectory safety monitoring.
Smart Images

Figure CN121456743A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of artificial intelligence and intelligent transportation, and particularly relates to an abnormal trajectory discrimination system based on a graph neural network. BACKGROUND
[0002] With the growing demand for intelligent transportation and trajectory data mining, modeling and abnormal behavior discrimination technology for mobile target trajectories have attracted widespread attention. Existing abnormal trajectory recognition methods mostly rely on statistical threshold determination or sequence modeling methods based on convolutional neural networks and recurrent neural networks, but there are generally the following problems in practical applications:
[0003] Trajectory point data collection is often disturbed by noise, inconsistent sampling frequency and missing points, and conventional preprocessing and clustering methods are difficult to stably select normal trajectory samples, resulting in a lack of reliable benchmarks for subsequent models; most existing trajectory modeling represents trajectories as single-dimensional vectors or regular grids, which cannot simultaneously preserve the spatial proximity relationship between trajectory points, road topological relationship and time sequence relationship, resulting in serious structure information loss; commonly used graph neural networks are still limited to global attention or single adjacency propagation in the abnormal trajectory discrimination scenario, and abnormal sensitive features are easily over-smoothed in inter-layer transmission, lacking the ability to continuously model abnormal signals; in addition, existing methods mostly use simple probability thresholds in the output layer for abnormal discrimination, without combining prototype alignment and multi-distance measurement, resulting in unstable abnormal scores and insufficient confidence, making it difficult to meet the needs of actual traffic management and trajectory safety monitoring.
[0004] Therefore, how to provide an abnormal trajectory discrimination system based on a graph neural network is a problem that those skilled in the art need to solve. SUMMARY
[0005] One object of the present application is to provide an abnormal trajectory discrimination system based on a graph neural network, which constructs an improved Graphormer model, combines abnormal feature gating, multi-scale subgraph modeling, prototype alignment embedding, confidence propagation and abnormal residual channel methods, graphically represents and deeply models trajectory data, forms a global trajectory prototype and calculates an abnormal score, and then outputs abnormal trajectory discrimination results and confidence through joint threshold determination of class probability and abnormal score, having the advantages of comprehensive data modeling, sufficient abnormal feature preservation and reliable discrimination results.
[0006] According to an abnormal trajectory discrimination system based on a graph neural network according to an embodiment of the present application, the following modules are included:
[0007] A data acquisition and preprocessing module is used to acquire trajectory point data and perform preprocessing, generate a trajectory dataset, and select trajectories in a main cluster as normal trajectory samples using a density clustering method;
[0008] The trajectory graph construction module is used to construct a trajectory graph containing entity nodes, relation edges, and edge attributes based on the trajectory dataset.
[0009] The node representation generation module is used to extract spatial, temporal, and semantic features from entity nodes, generate node vectors and bind them to entity nodes, and combine them with the relation edges and edge attributes in the trajectory graph to form a trajectory graph representation.
[0010] The improved Graphormer modeling module is used to input trajectory graph representations into the improved Graphormer model, perform anomaly feature gating, multi-scale trajectory subgraph branching, prototype alignment embedding, confidence propagation, anomaly residual channeling, dual-path attention, dynamic sparse masking, and feature interaction, and output deep trajectory representations.
[0011] The global prototype generation module is used to calculate the category prototype vector based on normal trajectory samples, generate a global trajectory prototype, and measure the distance between the deep trajectory representation and the global trajectory prototype to calculate the anomaly score.
[0012] The anomaly detection module is used to input the anomaly score and deep trajectory representation into the classification head, generate category probabilities, perform weighted combination of category probabilities and anomaly scores, perform threshold determination, and output the anomaly trajectory detection result and confidence level.
[0013] An abnormal trajectory discrimination method based on a graph neural network according to an embodiment of the present invention includes the following steps:
[0014] Trajectory point data is collected and preprocessed to generate a trajectory dataset. Density clustering is applied to the trajectory dataset, and the trajectories in the main cluster are selected as normal trajectory samples.
[0015] Construct a trajectory graph containing entity nodes, relation edges, and edge attributes based on the trajectory dataset;
[0016] Spatial, temporal, and semantic features are extracted from entity nodes to generate node vectors and bind them to entity nodes. Combined with the relation edges and edge attributes in the trajectory graph, a trajectory graph representation is formed.
[0017] Inputting the trajectory graph representation into the improved Graphormer model generates a deep trajectory representation;
[0018] Calculate category prototype vectors based on normal trajectory samples, generate global trajectory prototypes, perform distance measurement between deep trajectory representations and global trajectory prototypes, and generate anomaly scores.
[0019] The anomaly score and deep trajectory representation are input into the classification head to generate category probabilities. The category probabilities are combined with the anomaly score, and anomaly discrimination is performed using a threshold calibration method. The anomaly trajectory discrimination result and confidence level are output.
[0020] Optionally, the process of collecting trajectory point data and preprocessing it to generate a trajectory dataset, and then applying a density clustering method to the trajectory dataset to select trajectories in the main cluster as normal trajectory samples, specifically includes:
[0021] Collect trajectory point data, including spatial location information, temporal information, kinematic information, and road attribute information;
[0022] The trajectory point data is processed by time alignment, noise removal, and missing point interpolation to obtain the trajectory dataset.
[0023] Statistical metrics for each trajectory are calculated based on the trajectory dataset, including path length, duration, mean velocity, mean acceleration, velocity variance, and rate of change of direction, generating corresponding trajectory attribute vectors.
[0024] All trajectory attribute vectors are combined into an attribute vector set. Density clustering is used to cluster the attribute vector set. Based on the preset neighborhood radius threshold and minimum sample number threshold, the cluster structure is identified and noise points are removed.
[0025] In the clustering results, the cluster containing the most trajectories is selected as the master cluster, and the trajectories in the master cluster are defined as normal trajectory samples.
[0026] Optionally, the construction of a trajectory graph containing entity nodes, relation edges, and edge attributes based on the trajectory dataset specifically includes:
[0027] Define the trajectory points in the trajectory dataset as entity nodes and assign identifiers to the entity nodes;
[0028] Spatial relationship edges are generated based on the spatial proximity of trajectory points, road topology relationship edges are generated based on the connection relationship of trajectory points in the road topology, and temporal order relationship edges are generated based on the temporal sequence of trajectory points, thus obtaining a set of relationship edges.
[0029] Calculate edge attributes for relation edges. The edge attributes of spatial relation edges include distance, the edge attributes of road topology relation edges include road level and connection status, and the edge attributes of temporal order relation edges include time interval and speed difference. Bind the edge attributes to the corresponding relation edges.
[0030] Combine entity nodes, relation edges, and edge attributes to form a trajectory graph.
[0031] Optionally, the step of extracting spatial, temporal, and semantic features from entity nodes, generating node vectors and binding them to entity nodes, and combining them with the relation edges and edge attributes in the trajectory graph to form a trajectory graph representation specifically includes:
[0032] Spatial features are extracted based on entity nodes. Spatial features include latitude and longitude coordinates, elevation, and spatial proximity.
[0033] Time features are extracted based on entity nodes. These time features include timestamps, sampling intervals, and relative time positions.
[0034] Semantic features are extracted based on entity nodes, including road grade, speed limit information, and node type.
[0035] Spatial features, temporal features, and semantic features are combined and encoded into node vectors, and the node vectors are bound to the corresponding entity nodes;
[0036] By combining the node vectors with the relation edges and edge attributes in the trajectory graph, a trajectory graph representation is generated.
[0037] Optionally, the step of inputting the trajectory graph representation into the improved Graphormer model to generate a deep trajectory representation specifically includes:
[0038] The improved Graphormer model includes an anomaly feature gating module, multi-scale trajectory subgraph branch, prototype alignment embedding layer, confidence propagation sublayer and anomaly residual channel, and combines a dual attention mechanism, dynamic sparse mask and feature interaction module.
[0039] The trajectory graph is input into the anomaly feature gating module. The gating weights are calculated based on the rate of change of speed, steering angle and dwell time. The trajectory node vector is weighted element by element, and the gating weighted representation is output.
[0040] The gated weighted representation is input into the global attention branch, and the global dependency representation is calculated using the relation edges and edge attributes in the trajectory graph. At the same time, the gated weighted representation is input into the multi-scale trajectory subgraph branch, and the subgraph is divided based on the trajectory time order and local attention calculation is performed to output the local dependency representation.
[0041] Input the global dependency representation and the local dependency representation into the fusion module, and output a multi-scale trajectory representation;
[0042] The multi-scale trajectory representation is input into the prototype-aligned embedding layer, and a distance metric is performed with the global trajectory prototype to output a difference vector. The difference vector is then superimposed on the multi-scale trajectory representation to generate the prototype-aligned representation.
[0043] The prototype alignment representation is used to propagate the input confidence sublayer, and mean and variance parameters are introduced in the attention weight calculation to output node representations with confidence.
[0044] Input the node representation with confidence into the abnormal residual channel, extract acceleration mutation features and orientation mutation features to generate abnormal residuals; merge the abnormal residuals with the node representation with confidence to output the node representation containing the abnormal residuals.
[0045] The node representation containing abnormal residuals is input into a dual-path attention mechanism. One path performs standard global attention computation and outputs a standard attention representation. The other path performs abnormal attention computation on abnormal candidate nodes and relation edges and outputs an abnormal attention representation. The standard attention representation and the abnormal attention representation are then merged to output a node update representation.
[0046] The node update representation is input into the dynamic sparse masking module, and the relation edges of each node are filtered based on the contribution score. Relation edges with scores exceeding the threshold or ranked in the top k are retained to generate a sparse node update representation.
[0047] The sparse node update representation is input to the feature interaction module, which performs cross-modeling of spatial and temporal features and outputs the node representation after interaction.
[0048] The interacted node representations are repeatedly input into the abnormal feature gating module, multi-scale trajectory subgraph branch, prototype alignment embedding layer, confidence propagation sublayer, abnormal residual channel, dual-path attention mechanism, dynamic sparse mask and feature interaction module in a layer-stacked manner. After stacking operations of a preset number of layers, a deep trajectory representation is output.
[0049] Optionally, the step of calculating a category prototype vector based on normal trajectory samples, generating a global trajectory prototype, performing a distance metric between the deep trajectory representation and the global trajectory prototype, and generating an anomaly score specifically includes:
[0050] Extract trajectory node vectors from normal trajectory samples, perform an averaging operation on node vectors belonging to the same category, and generate a set of category prototype vectors;
[0051] The global trajectory prototype is generated by weighting the set of category prototype vectors according to the number of samples corresponding to each category.
[0052] The distance between the deep trajectory representation and the global trajectory prototype is measured by Euclidean distance, cosine distance and Mahalanobis distance respectively.
[0053] The Euclidean distance, cosine distance, and Mahalanobis distance are weighted and summed according to preset weights to obtain the anomaly score.
[0054] Optionally, the step of inputting the anomaly score and deep trajectory representation into the classification head, generating category probabilities, combining the category probabilities with the anomaly score, performing anomaly discrimination using a threshold calibration method, and outputting the anomaly trajectory discrimination result and confidence level specifically includes:
[0055] The deep trajectory representation and anomaly score are input into the classification head. The classification head performs a fully connected mapping on the deep trajectory representation to obtain a linear transformation result. Then, Softmax normalization is performed on the linear transformation result to generate class probabilities.
[0056] The anomaly score is combined with the category probability, and a weighted summation method is used to calculate the comprehensive discrimination value.
[0057] The comprehensive discrimination value is compared with a threshold, which is determined based on the abnormal score distribution of normal trajectory samples. The threshold is obtained by calculating the quantile value of the abnormal score distribution. When the comprehensive discrimination value is greater than the threshold, the abnormal trajectory discrimination result is output as abnormal. When the comprehensive discrimination value is less than or equal to the threshold, the abnormal trajectory discrimination result is output as normal.
[0058] The maximum probability value is selected from the category probabilities. The maximum probability value and the anomaly score normalization result are weighted and averaged according to a preset ratio to obtain the final confidence value. The confidence value and the anomaly trajectory discrimination result are then output.
[0059] The beneficial effects of this invention are:
[0060] The proposed abnormal trajectory discrimination system based on graph neural networks achieves a complete closed loop in its overall design, encompassing data acquisition, trajectory graph construction, graph neural network modeling, and abnormal trajectory discrimination output, effectively overcoming several shortcomings of existing technologies. First, at the data level, this invention introduces trajectory point preprocessing and density clustering filtering mechanisms. By eliminating noise points, interpolating missing points, and clustering attribute vectors, stable normal trajectory samples can be obtained, providing a reliable benchmark for subsequent modeling. Second, at the representation level, this invention constructs a trajectory graph containing entity nodes, relational edges, and edge attributes. It simultaneously extracts spatial, temporal, and semantic features from the node representation, ensuring the integrity of trajectory information across three dimensions: spatial proximity, road topology, and temporal order, avoiding the structural information loss caused by oversimplification in traditional methods. Furthermore, this invention employs an improved Graphormer structure at the model level, integrating anomaly feature gating, multi-scale subgraph branching, prototype-aligned embedding, confidence propagation, and anomaly residual channels. It also combines dual-path attention, dynamic sparse masking, and feature interaction mechanisms to ensure that deep trajectory representations retain anomaly-sensitive features while suppressing over-smoothing, thus enhancing the model's ability to characterize anomaly trajectories. Finally, at the discrimination level, this invention calculates anomaly scores based on global trajectory prototypes and performs joint threshold determination using category probabilities. This not only outputs the anomaly trajectory discrimination results but also simultaneously generates confidence scores, providing reliable support for practical traffic management, trajectory safety monitoring, and abnormal behavior identification. Attached Figure Description
[0061] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings:
[0062] Figure 1 This is a schematic diagram of the structure of an abnormal trajectory discrimination system based on a graph neural network proposed in this invention;
[0063] Figure 2 This is a flowchart of an abnormal trajectory discrimination method based on graph neural networks proposed in this invention;
[0064] Figure 3 This is a framework diagram of the improved Graphormer model in the abnormal trajectory discrimination method based on graph neural networks proposed in this invention. Detailed Implementation
[0065] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, illustrating only the basic structure of the invention, and therefore only show the components relevant to the invention.
[0066] refer to Figure 1 An abnormal trajectory discrimination system based on graph neural networks includes the following modules:
[0067] The data acquisition and preprocessing module is used to collect trajectory point data and preprocess it to generate a trajectory dataset. It also uses density clustering to select trajectories in the main cluster as normal trajectory samples.
[0068] The trajectory graph construction module is used to construct a trajectory graph containing entity nodes, relation edges, and edge attributes based on the trajectory dataset.
[0069] The node representation generation module is used to extract spatial, temporal, and semantic features from entity nodes, generate node vectors and bind them to entity nodes, and combine them with the relation edges and edge attributes in the trajectory graph to form a trajectory graph representation.
[0070] The improved Graphormer modeling module is used to input trajectory graph representations into the improved Graphormer model, perform anomaly feature gating, multi-scale trajectory subgraph branching, prototype alignment embedding, confidence propagation, anomaly residual channeling, dual-path attention, dynamic sparse masking, and feature interaction, and output deep trajectory representations.
[0071] The global prototype generation module is used to calculate the category prototype vector based on normal trajectory samples, generate a global trajectory prototype, and measure the distance between the deep trajectory representation and the global trajectory prototype to calculate the anomaly score.
[0072] The anomaly detection module is used to input the anomaly score and deep trajectory representation into the classification head, generate category probabilities, perform weighted combination of category probabilities and anomaly scores, perform threshold determination, and output the anomaly trajectory detection result and confidence level.
[0073] refer to Figures 2-3 An abnormal trajectory discrimination method based on graph neural networks includes the following steps:
[0074] Trajectory point data is collected and preprocessed to generate a trajectory dataset. Density clustering is applied to the trajectory dataset, and the trajectories in the main cluster are selected as normal trajectory samples.
[0075] Construct a trajectory graph containing entity nodes, relation edges, and edge attributes based on the trajectory dataset;
[0076] Spatial, temporal, and semantic features are extracted from entity nodes to generate node vectors and bind them to entity nodes. Combined with the relation edges and edge attributes in the trajectory graph, a trajectory graph representation is formed.
[0077] Inputting the trajectory graph representation into the improved Graphormer model generates a deep trajectory representation;
[0078] Calculate category prototype vectors based on normal trajectory samples, generate global trajectory prototypes, perform distance measurement between deep trajectory representations and global trajectory prototypes, and generate anomaly scores.
[0079] The anomaly score and deep trajectory representation are input into the classification head to generate category probabilities. The category probabilities are combined with the anomaly score, and anomaly discrimination is performed using a threshold calibration method. The anomaly trajectory discrimination result and confidence level are output.
[0080] In this embodiment, the process of collecting trajectory point data and preprocessing it to generate a trajectory dataset, and then applying a density clustering method to the trajectory dataset to select trajectories in the main cluster as normal trajectory samples, specifically includes:
[0081] Collect trajectory point data, including spatial location information, temporal information, kinematic information, and road attribute information;
[0082] The trajectory point data is processed by time alignment, noise removal, and missing point interpolation to obtain the trajectory dataset.
[0083] Statistical metrics for each trajectory are calculated based on the trajectory dataset, including path length, duration, mean velocity, mean acceleration, velocity variance, and rate of change of direction, generating corresponding trajectory attribute vectors.
[0084] All trajectory attribute vectors are combined into an attribute vector set. Density clustering is used to cluster the attribute vector set. Based on the preset neighborhood radius threshold and minimum sample number threshold, the cluster structure is identified and noise points are removed.
[0085] In the clustering results, the cluster containing the most trajectories is selected as the master cluster, and the trajectories in the master cluster are defined as normal trajectory samples.
[0086] This implementation method introduces time alignment, noise removal, and missing point interpolation methods during the data acquisition and preprocessing stages, and combines density clustering to select the main cluster trajectories as normal trajectory samples. This ensures the integrity and consistency of the input data and effectively reduces the interference of outliers and noise on subsequent trajectory modeling. This approach provides stable and reliable benchmark data for trajectory map construction and model training, ensuring high data quality support for outlier trajectory identification from the outset, thereby improving the overall accuracy and robustness of the identification.
[0087] In this embodiment, the construction of a trajectory graph containing entity nodes, relation edges, and edge attributes based on the trajectory dataset specifically includes:
[0088] Define the trajectory points in the trajectory dataset as entity nodes and assign identifiers to the entity nodes;
[0089] Spatial relationship edges are generated based on the spatial proximity of trajectory points, road topology relationship edges are generated based on the connection relationship of trajectory points in the road topology, and temporal order relationship edges are generated based on the temporal sequence of trajectory points, thus obtaining a set of relationship edges.
[0090] Calculate edge attributes for relation edges. The edge attributes of spatial relation edges include distance, the edge attributes of road topology relation edges include road level and connection status, and the edge attributes of temporal order relation edges include time interval and speed difference. Bind the edge attributes to the corresponding relation edges.
[0091] Combine entity nodes, relation edges, and edge attributes to form a trajectory graph.
[0092] This implementation constructs a trajectory graph containing entity nodes, relational edges, and edge attributes based on a trajectory dataset. It unifies spatial proximity relationships, road topology relationships, and temporal order relationships within the graph structure, enabling explicit modeling of the trajectory's multidimensional constraints. By assigning edge attributes to different relational edges and associating them with entity nodes, it fully preserves the information relationships of the trajectory in spatial location, road structure, and temporal evolution. This provides comprehensive structured input for subsequent node representation generation and deep feature extraction, thus avoiding the problem of missing trajectory structure information in traditional methods.
[0093] In this embodiment, the step of extracting spatial, temporal, and semantic features from entity nodes, generating node vectors and binding them to entity nodes, and combining them with the relation edges and edge attributes in the trajectory graph to form a trajectory graph representation specifically includes:
[0094] Spatial features are extracted based on entity nodes. Spatial features include latitude and longitude coordinates, elevation, and spatial proximity.
[0095] Time features are extracted based on entity nodes. These time features include timestamps, sampling intervals, and relative time positions.
[0096] Semantic features are extracted based on entity nodes, including road grade, speed limit information, and node type.
[0097] Spatial features, temporal features, and semantic features are combined and encoded into node vectors, and the node vectors are bound to the corresponding entity nodes;
[0098] By combining the node vectors with the relation edges and edge attributes in the trajectory graph, a trajectory graph representation is generated.
[0099] This implementation extracts spatial, temporal, and semantic features from entity nodes, and encodes these three types of features into node vectors. These vectors are then combined with the relation edges and edge attributes in the trajectory graph to form a trajectory graph representation, achieving an integrated expression of multi-dimensional trajectory information. This method can simultaneously capture the geographical location, temporal dynamics, and road semantic attributes of vehicle operation, ensuring the integrity and diversity of the trajectory graph representation when input into the model. This provides accurate feature support for subsequent deep modeling, thereby enhancing the reliability of abnormal trajectory identification.
[0100] In this embodiment, the step of inputting the trajectory graph representation into the improved Graphormer model to generate a deep trajectory representation specifically includes:
[0101] The improved Graphormer model includes an anomaly feature gating module, multi-scale trajectory subgraph branch, prototype alignment embedding layer, confidence propagation sublayer and anomaly residual channel, and combines a dual attention mechanism, dynamic sparse mask and feature interaction module.
[0102] The trajectory graph is input into the anomaly feature gating module. The gating weights are calculated based on the rate of change of speed, steering angle and dwell time. The trajectory node vector is weighted element by element, and the gating weighted representation is output.
[0103] The gated weighted representation is input into the global attention branch, and the global dependency representation is calculated using the relation edges and edge attributes in the trajectory graph. At the same time, the gated weighted representation is input into the multi-scale trajectory subgraph branch, and the subgraph is divided based on the trajectory time order and local attention calculation is performed to output the local dependency representation.
[0104] Input the global dependency representation and the local dependency representation into the fusion module, and output a multi-scale trajectory representation;
[0105] The multi-scale trajectory representation is input into the prototype-aligned embedding layer, and a distance metric is performed with the global trajectory prototype to output a difference vector. The difference vector is then superimposed on the multi-scale trajectory representation to generate the prototype-aligned representation.
[0106] The prototype alignment representation is used to propagate the input confidence sublayer, and mean and variance parameters are introduced in the attention weight calculation to output node representations with confidence.
[0107] Input the node representation with confidence into the abnormal residual channel, extract acceleration mutation features and orientation mutation features to generate abnormal residuals; merge the abnormal residuals with the node representation with confidence to output the node representation containing the abnormal residuals.
[0108] The node representation containing abnormal residuals is input into a dual-path attention mechanism. One path performs standard global attention computation and outputs a standard attention representation. The other path performs abnormal attention computation on abnormal candidate nodes and relation edges and outputs an abnormal attention representation. The standard attention representation and the abnormal attention representation are then merged to output a node update representation.
[0109] The node update representation is input into the dynamic sparse masking module, and the relation edges of each node are filtered based on the contribution score. Relation edges with scores exceeding the threshold or ranked in the top k are retained to generate a sparse node update representation.
[0110] The sparse node update representation is input to the feature interaction module, which performs cross-modeling of spatial and temporal features and outputs the node representation after interaction.
[0111] The interacted node representations are repeatedly input into the abnormal feature gating module, multi-scale trajectory subgraph branch, prototype alignment embedding layer, confidence propagation sublayer, abnormal residual channel, dual-path attention mechanism, dynamic sparse mask and feature interaction module in a layer-stacked manner. After stacking operations of a preset number of layers, a deep trajectory representation is output.
[0112] This implementation constructs an improved Graphormer model, in which the trajectory graph representation sequentially undergoes anomaly feature gating, multi-scale subgraph branching, prototype-aligned embedding, confidence propagation, anomaly residual channels, dual-path attention, dynamic sparse masking, and feature interaction, generating a deep trajectory representation that preserves anomaly-sensitive features. This approach effectively avoids the problem of excessive smoothing or loss of anomaly features during propagation, achieving a balance between global trajectory patterns and local anomalies. It provides a high-quality feature foundation for subsequent anomaly scoring and discrimination, thereby improving the overall stability and accuracy of the identification.
[0113] In this embodiment, the step of calculating the category prototype vector based on normal trajectory samples, generating a global trajectory prototype, performing a distance metric between the deep trajectory representation and the global trajectory prototype, and generating an anomaly score specifically includes:
[0114] Extract trajectory node vectors from normal trajectory samples, perform an averaging operation on node vectors belonging to the same category, and generate a set of category prototype vectors;
[0115] The global trajectory prototype is generated by weighting the set of category prototype vectors according to the number of samples corresponding to each category.
[0116] The distance between the deep trajectory representation and the global trajectory prototype is measured by Euclidean distance, cosine distance and Mahalanobis distance respectively.
[0117] The Euclidean distance, cosine distance, and Mahalanobis distance are weighted and summed according to preset weights to obtain the anomaly score.
[0118] This implementation calculates category prototype vectors based on normal trajectory samples and generates a weighted global trajectory prototype. The deep trajectory representation and the global trajectory prototype are then measured using Euclidean distance, cosine distance, and Mahalanobis distance, and an anomaly score is obtained through weighted summation. This approach not only integrates the sensitivity of different measurement methods to trajectory differences but also makes the anomaly score more stable and reliable. This effectively distinguishes between normal and abnormal trajectories in complex traffic scenarios, providing a solid basis for subsequent classification and threshold determination.
[0119] In this embodiment, the step of inputting the anomaly score and deep trajectory representation into the classification head to generate category probabilities, combining the category probabilities with the anomaly score, performing anomaly discrimination using a threshold calibration method, and outputting the anomaly trajectory discrimination result and confidence level specifically includes:
[0120] The deep trajectory representation and anomaly score are input into the classification head. The classification head performs a fully connected mapping on the deep trajectory representation to obtain a linear transformation result. Then, Softmax normalization is performed on the linear transformation result to generate class probabilities.
[0121] The anomaly score is combined with the category probability, and a weighted summation method is used to calculate the comprehensive discrimination value.
[0122] The comprehensive discrimination value is compared with a threshold, which is determined based on the abnormal score distribution of normal trajectory samples. The threshold is obtained by calculating the quantile value of the abnormal score distribution. When the comprehensive discrimination value is greater than the threshold, the abnormal trajectory discrimination result is output as abnormal. When the comprehensive discrimination value is less than or equal to the threshold, the abnormal trajectory discrimination result is output as normal.
[0123] The maximum probability value is selected from the category probabilities. The maximum probability value and the anomaly score normalization result are weighted and averaged according to a preset ratio to obtain the final confidence value. The confidence value and the anomaly trajectory discrimination result are then output.
[0124] This implementation inputs the deep trajectory representation and anomaly score into the classification head, generates class probabilities using fully connected mapping and Softmax normalization, then weights and combines these probabilities with the anomaly score, and uses a threshold determined based on the quantiles of the normal trajectory sample distribution for judgment, outputting the anomaly trajectory discrimination result and confidence level. This approach can introduce anomaly score constraints while maintaining the interpretability of classification probabilities, making the discrimination results more robust and the confidence level calculation more valuable, thereby improving the reliability of anomaly identification.
[0125] Example 1:
[0126] To verify the feasibility of this invention in practice, it was applied to an anomaly trajectory discrimination task in a large urban taxi trajectory dataset. This dataset, sourced from the city's traffic management department's GPS positioning system, covers the operation records of over 5,000 taxis within a week, with a sampling frequency of once every 10 seconds and approximately 15 million trajectory points per day. The data includes the vehicle's latitude and longitude coordinates, timestamp, instantaneous speed, acceleration, heading angle, and road information, covering main roads, secondary roads, and highway sections. Due to the complex urban traffic environment, the trajectory data contains numerous anomalies, such as drivers taking detours, vehicles making illegal U-turns, and abnormal parking.
[0127] In the experiment, the trajectory point data was first cleaned using a data acquisition and preprocessing module. Preprocessing operations included timestamp alignment, missing point interpolation, noise removal, and abnormal offset correction. Taking a typical trajectory as an example, approximately 2.1% of the original collected points were missing. After imputation using a linear interpolation-based method, the continuity of the trajectory sequence was significantly improved. Furthermore, 1.7% of significant noise points were removed using speed thresholds and spatial proximity. The preprocessed trajectories were uniformly divided into fixed time periods, ensuring comparability between trajectories from different vehicles. Subsequently, density clustering was used to cluster the cleaned trajectory attribute vector set, resulting in multiple trajectory clusters. Within these clusters, the main cluster, comprising 73.5% of the total trajectories, was defined as normal trajectory samples.
[0128] When constructing a trajectory map based on preprocessed data, each trajectory point is defined as a physical node. Node features include latitude and longitude coordinates, elevation, timestamp, velocity, acceleration, and road grade. Relationship edges are categorized into spatial relationship edges, road topology relationship edges, and temporal relationship edges. Spatial relationship edges are attributed to the geographical distance between nodes, road topology relationship edges are attributed to road grade and connectivity, and temporal relationship edges are attributed to time intervals and velocity differences. The resulting trajectory map not only reflects the vehicle's spatial travel path but also embodies road topological constraints and temporal evolution characteristics.
[0129] In the node representation generation stage, spatial, temporal, and semantic features are extracted from trajectory points. Spatial features include latitude and longitude and spatial proximity; temporal features include timestamps and sampling intervals; and semantic features include road level and node type. These three types of features are combined and encoded to generate node vectors, which are then bound to corresponding entity nodes. These vectors, along with relational edges and their attributes, form a trajectory graph representation, which serves as subsequent input.
[0130] When the trajectory graph representation is input into the improved Graphormer modeling module, the model first models the rate of change of velocity, steering angle, and dwell time through an anomaly feature gating module, generating gating weights and weighting the node representations. Subsequently, the data simultaneously enters the global attention branch and the multi-scale subgraph branch. The former models the overall dependencies of the trajectory, while the latter focuses on anomalous behaviors in local trajectory segments. After the two types of representations are combined in the fusion module, they are then compared with the global trajectory prototype through a prototype alignment embedding layer to generate alignment residuals, ensuring that the node representations closely approximate the statistical characteristics of normal trajectories. The confidence propagation sublayer models the edge weights as a probability distribution, passing the mean and variance in each propagation, giving the node representations confidence intervals. The anomaly residual channel retains information on acceleration and orientation abrupt changes, preventing them from being over-smoothed during inter-layer propagation.
[0131] During model training, a stacked structure of 12 layers is employed, with each layer containing the aforementioned modules. After the deep trajectory representation is generated, distance metrics are performed between it and the global trajectory prototype formed by normal trajectory samples. Euclidean distance, cosine distance, and Mahalanobis distance are calculated respectively, and then weighted and summed according to preset weights to obtain an anomaly score. Finally, the anomaly score and the deep trajectory representation are input into the classification head to generate class probabilities. By comparing the comprehensive discrimination value with a threshold, the anomaly trajectory discrimination result can be output, and the confidence level is obtained by combining the maximum class probability and the normalized anomaly score.
[0132] To further verify the effectiveness, this invention was compared with traditional Convolutional Neural Networks (CNN), Long Short-Term Memory Networks (LSTM), and standard Graph Neural Networks (GCN). Evaluation metrics included accuracy, recall, F1 score, and discriminant confidence. The experimental results are shown in Table 1.
[0133] Table 1. Performance Comparison of Different Models in Abnormal Trajectory Detection Task
[0134] Model type Data pre-processing method Accuracy (%) Recall (%) F1 score (%) Average confidence CNN model Standardization + interpolation 86.3 81.7 83.9 0.74 LSTM model Standardization + interpolation 88.5 84.1 86.2 0.76 GCN model Standardization + graph construction 91.2 87.6 89.3 0.79 The method of the invention Clustering + graph construction 95.8 92.7 94.2 0.86
[0135] As shown in Table 1, the method of this invention significantly outperforms existing methods in terms of accuracy, recall, and F1 score. In particular, the recall rate of this invention reaches 92.7%, an improvement of 5.1 percentage points compared to GCN, indicating that this invention can more effectively identify abnormal trajectories. In terms of confidence score, the average value of this invention is 0.86, significantly higher than other models, indicating that the discrimination results are more reliable.
[0136] In practical applications, this invention can not only identify behaviors such as detours, illegal U-turns, and abnormal parking, but also pre-mark low-probability but high-risk trajectories, thereby providing auxiliary decision-making for traffic management departments. Through batch testing on more than 5 million trajectory segments, this invention maintains high discrimination efficiency, with an average processing time of less than 120 milliseconds per trajectory, meeting the needs of real-time monitoring.
[0137] This invention can stably filter normal trajectory samples in real-world scenarios, comprehensively model the spatial, temporal, and semantic features of trajectories, utilize an improved Graphormer to maintain anomaly-sensitive features and improve discrimination confidence, and ultimately achieve high accuracy and high reliability in anomaly trajectory discrimination, which has significant practical value and promising prospects for promotion.
[0138] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
Claims
1. An abnormal trajectory discrimination system based on graph neural networks, characterized in that, Includes the following modules: The data acquisition and preprocessing module is used to collect trajectory point data and preprocess it to generate a trajectory dataset. It also uses density clustering to select trajectories in the main cluster as normal trajectory samples. The trajectory graph construction module is used to construct a trajectory graph containing entity nodes, relation edges, and edge attributes based on the trajectory dataset. The node representation generation module is used to extract spatial, temporal, and semantic features from entity nodes, generate node vectors and bind them to entity nodes, and combine them with the relation edges and edge attributes in the trajectory graph to form a trajectory graph representation. The improved Graphormer modeling module is used to input trajectory graph representations into the improved Graphormer model, perform anomaly feature gating, multi-scale trajectory subgraph branching, prototype alignment embedding, confidence propagation, anomaly residual channeling, dual-path attention, dynamic sparse masking, and feature interaction, and output deep trajectory representations. The global prototype generation module is used to calculate the category prototype vector based on normal trajectory samples, generate a global trajectory prototype, and measure the distance between the deep trajectory representation and the global trajectory prototype to calculate the anomaly score. The anomaly detection module is used to input the anomaly score and deep trajectory representation into the classification head, generate category probabilities, perform weighted combination of category probabilities and anomaly scores, perform threshold determination, and output the anomaly trajectory detection result and confidence level.
2. The abnormal trajectory discrimination system based on graph neural network according to claim 1, characterized in that, The modules are connected in the following way: Trajectory point data is collected and preprocessed to generate a trajectory dataset. Density clustering is applied to the trajectory dataset, and the trajectories in the main cluster are selected as normal trajectory samples. Construct a trajectory graph containing entity nodes, relation edges, and edge attributes based on the trajectory dataset; Spatial, temporal, and semantic features are extracted from entity nodes to generate node vectors and bind them to entity nodes. Combined with the relation edges and edge attributes in the trajectory graph, a trajectory graph representation is formed. Inputting the trajectory graph representation into the improved Graphormer model generates a deep trajectory representation; Calculate category prototype vectors based on normal trajectory samples, generate global trajectory prototypes, perform distance measurement between deep trajectory representations and global trajectory prototypes, and generate anomaly scores. The anomaly score and deep trajectory representation are input into the classification head to generate category probabilities. The category probabilities are combined with the anomaly score, and anomaly discrimination is performed using a threshold calibration method. The anomaly trajectory discrimination result and confidence level are output.
3. The abnormal trajectory discrimination system based on graph neural network according to claim 2, characterized in that, The process involves collecting trajectory point data and preprocessing it to generate a trajectory dataset. Density clustering is then applied to this dataset, and trajectories within the main cluster are selected as normal trajectory samples. Specifically, this includes: Collect trajectory point data, including spatial location information, temporal information, kinematic information, and road attribute information; The trajectory point data is processed by time alignment, noise removal, and missing point interpolation to obtain the trajectory dataset. Statistical metrics for each trajectory are calculated based on the trajectory dataset, including path length, duration, mean velocity, mean acceleration, velocity variance, and rate of change of direction, generating corresponding trajectory attribute vectors. All trajectory attribute vectors are combined into an attribute vector set. Density clustering is used to cluster the attribute vector set. Based on the preset neighborhood radius threshold and minimum sample number threshold, the cluster structure is identified and noise points are removed. In the clustering results, the cluster containing the most trajectories is selected as the master cluster, and the trajectories in the master cluster are defined as normal trajectory samples.
4. The abnormal trajectory discrimination system based on graph neural network according to claim 2, characterized in that, The construction of a trajectory graph containing entity nodes, relation edges, and edge attributes based on the trajectory dataset specifically includes: Define the trajectory points in the trajectory dataset as entity nodes and assign identifiers to the entity nodes; Spatial relationship edges are generated based on the spatial proximity of trajectory points, road topology relationship edges are generated based on the connection relationship of trajectory points in the road topology, and temporal order relationship edges are generated based on the temporal sequence of trajectory points, thus obtaining a set of relationship edges. Calculate edge attributes for relation edges. The edge attributes of spatial relation edges include distance, the edge attributes of road topology relation edges include road level and connection status, and the edge attributes of temporal order relation edges include time interval and speed difference. Bind the edge attributes to the corresponding relation edges. Combine entity nodes, relation edges, and edge attributes to form a trajectory graph.
5. The abnormal trajectory discrimination system based on graph neural network according to claim 2, characterized in that, The process of extracting spatial, temporal, and semantic features from entity nodes, generating node vectors and binding them to entity nodes, and combining these with the relation edges and edge attributes in the trajectory graph to form a trajectory graph representation specifically includes: Spatial features are extracted based on entity nodes. Spatial features include latitude and longitude coordinates, elevation, and spatial proximity. Time features are extracted based on entity nodes. These time features include timestamps, sampling intervals, and relative time positions. Semantic features are extracted based on entity nodes, including road grade, speed limit information, and node type. Spatial features, temporal features, and semantic features are combined and encoded into node vectors, and the node vectors are bound to the corresponding entity nodes; By combining the node vectors with the relation edges and edge attributes in the trajectory graph, a trajectory graph representation is generated.
6. The abnormal trajectory discrimination system based on graph neural network according to claim 2, characterized in that, The step of inputting the trajectory graph representation into the improved Graphormer model to generate a deep trajectory representation specifically includes: The improved Graphormer model includes an anomaly feature gating module, multi-scale trajectory subgraph branch, prototype alignment embedding layer, confidence propagation sublayer and anomaly residual channel, and combines a dual attention mechanism, dynamic sparse mask and feature interaction module. The trajectory graph is input into the anomaly feature gating module. The gating weights are calculated based on the rate of change of speed, steering angle and dwell time. The trajectory node vector is weighted element by element, and the gating weighted representation is output. The gated weighted representation is input into the global attention branch, and the global dependency representation is calculated using the relation edges and edge attributes in the trajectory graph. At the same time, the gated weighted representation is input into the multi-scale trajectory subgraph branch, and the subgraph is divided based on the trajectory time order and local attention calculation is performed to output the local dependency representation. Input the global dependency representation and the local dependency representation into the fusion module, and output a multi-scale trajectory representation; The multi-scale trajectory representation is input into the prototype-aligned embedding layer, and a distance metric is performed with the global trajectory prototype to output a difference vector. The difference vector is then superimposed on the multi-scale trajectory representation to generate the prototype-aligned representation. The prototype alignment representation is used to propagate the input confidence sublayer, and mean and variance parameters are introduced in the attention weight calculation to output node representations with confidence. Input the node representation with confidence into the abnormal residual channel, extract acceleration mutation features and orientation mutation features to generate abnormal residuals; merge the abnormal residuals with the node representation with confidence to output the node representation containing the abnormal residuals. The node representation containing abnormal residuals is input into a dual-path attention mechanism. One path performs standard global attention computation and outputs a standard attention representation. The other path performs abnormal attention computation on abnormal candidate nodes and relation edges and outputs an abnormal attention representation. The standard attention representation and the abnormal attention representation are then merged to output a node update representation. The node update representation is input into the dynamic sparse masking module, and the relation edges of each node are filtered based on the contribution score. Relation edges with scores exceeding the threshold or ranked in the top k are retained to generate a sparse node update representation. The sparse node update representation is input to the feature interaction module, which performs cross-modeling of spatial and temporal features and outputs the node representation after interaction. The interacted node representations are repeatedly input into the abnormal feature gating module, multi-scale trajectory subgraph branch, prototype alignment embedding layer, confidence propagation sublayer, abnormal residual channel, dual-path attention mechanism, dynamic sparse mask and feature interaction module in a layer-stacked manner. After stacking operations of a preset number of layers, a deep trajectory representation is output.
7. The abnormal trajectory discrimination system based on graph neural network according to claim 2, characterized in that, The process of calculating category prototype vectors based on normal trajectory samples to generate a global trajectory prototype, performing a distance metric between the deep trajectory representation and the global trajectory prototype, and generating anomaly scores specifically includes: Extract trajectory node vectors from normal trajectory samples, perform an averaging operation on node vectors belonging to the same category, and generate a set of category prototype vectors; The global trajectory prototype is generated by weighting the set of category prototype vectors according to the number of samples corresponding to each category. The distance between the deep trajectory representation and the global trajectory prototype is measured by Euclidean distance, cosine distance and Mahalanobis distance respectively. The Euclidean distance, cosine distance, and Mahalanobis distance are weighted and summed according to preset weights to obtain the anomaly score.
8. The abnormal trajectory discrimination system based on graph neural network according to claim 2, characterized in that, The process of inputting anomaly scores and deep trajectory representations into a classification head to generate category probabilities, combining these probabilities with the anomaly scores, performing anomaly detection using a threshold calibration method, and outputting the anomaly trajectory detection result and confidence level specifically includes: The deep trajectory representation and anomaly score are input into the classification head. The classification head performs a fully connected mapping on the deep trajectory representation to obtain a linear transformation result. Then, Softmax normalization is performed on the linear transformation result to generate class probabilities. The anomaly score is combined with the category probability, and a weighted summation method is used to calculate the comprehensive discrimination value. The comprehensive discrimination value is compared with a threshold, which is determined based on the abnormal score distribution of normal trajectory samples. The threshold is obtained by calculating the quantile value of the abnormal score distribution. When the comprehensive discrimination value is greater than the threshold, the abnormal trajectory discrimination result is output as abnormal. When the comprehensive discrimination value is less than or equal to the threshold, the abnormal trajectory discrimination result is output as normal. The maximum probability value is selected from the category probabilities. The maximum probability value and the anomaly score normalization result are weighted and averaged according to a preset ratio to obtain the final confidence value. The confidence value and the anomaly trajectory discrimination result are then output.
Citation Information
Cited By
Unmanned aerial vehicle trajectory anomaly detection method based on depth probability generation
CN121723414A