A Real-Time Anomaly Trajectory Detection Method for Urban Traffic Data
By constructing an urban traffic network and spatiotemporal model, and combining it with path planning algorithms for real-time abnormal trajectory detection, the problems of high false alarm rate and reliance on historical data in existing methods are solved, achieving accurate and efficient detection of abnormal urban traffic trajectories.
Patent Information
- Application Number
- CN202310585391.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-23
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2043-05-23
AI Technical Summary
Existing abnormal trajectory detection methods in urban traffic suffer from problems such as high false alarm rates, inability to detect abnormal trajectories in real time, and strong dependence on historical trajectory data. In particular, they cannot trigger timely warnings when taxi drivers take detours.
The city's traffic network is constructed, roads are serialized, and traffic trajectory datasets of GPS points are obtained. A spatiotemporal model of SD pairs is established. Multinomial regression is used to consider time and spatial characteristics. Real-time abnormal trajectory detection is carried out in combination with path planning algorithms. Online detection is performed using dual judgment criteria.
It improves the accuracy and efficiency of real-time abnormal trajectory detection, enabling the early detection of safety hazards in urban traffic, overcoming the dependence on historical trajectory data, and reducing the false alarm rate.
Smart Images

Figure CN116597647B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent transportation technology, and in particular to a method for real-time abnormal trajectory detection of urban traffic data. Background Technology
[0002] With the development of intelligent sensing technology and the widespread use of GPS mobile devices, a large amount of trajectory data is generated every day. This trajectory data is spatiotemporal data generated by moving objects (such as animals, pedestrians, and cars) during their movement. It can describe the movement behavior of moving objects within a specific spatiotemporal range and objectively reflect the movement patterns of moving objects. Trajectory data not only consists of standardized data that conforms to standards, but also contains some potentially abnormal data that does not conform to standards. This abnormal data provides the possibility for detecting malicious behavior. Therefore, it is necessary to mine more practically valuable abnormal data from trajectory data.
[0003] The process of identifying abnormal trajectories from large amounts of trajectory data is called anomaly trajectory detection. In anomaly trajectory detection research, a small number of trajectories that show significant differences from other trajectories are typically defined as anomalous, reflecting their "few" and "different" characteristics compared to normal trajectories. Anomaly trajectory detection is widely used in public transportation, safety management, and logistics. Analyzing the causes of anomalies based on the results of anomaly trajectory detection and proposing timely and standardized handling solutions helps to effectively avoid such anomalies in the future, improving the safety and stability of urban traffic.
[0004] In real life, some experienced taxi drivers may avoid peak-hour traffic congestion by taking detours. If anomaly detection is performed on such trajectories based on the above-mentioned definition of abnormal trajectories, normal trajectories will be incorrectly reported as abnormal, leading to a high false alarm rate. The above definition of abnormal trajectories ignores the significant impact of time features on trajectory data. To address this limitation, the STR algorithm defines two spatiotemporal models to describe the relationship between displacement and travel distance, and displacement and travel time. Only when both travel distance and travel time exceed the normal range will the trajectory be reported as abnormal. However, the STR algorithm has certain limitations. When a taxi driver starts from the starting point and deliberately detours in the opposite direction of the destination, the travel time and travel distance increase with the gradual increase in displacement. Before both travel time and travel distance exceed the normal range, the STR algorithm cannot trigger an early warning for this type of anomaly. In addition, some existing offline abnormal trajectory detection algorithms always require sufficient historical trajectory data. When historical trajectory data is scarce or non-existent, such methods will not be effective. Currently, there is relatively little research on online abnormal trajectory detection methods, and most existing abnormal trajectory detection methods are offline anomaly detection methods, and the detection results cannot provide early warnings. Summary of the Invention
[0005] This invention provides a real-time abnormal trajectory detection method for urban traffic data to overcome the above-mentioned technical problems.
[0006] A real-time abnormal trajectory detection method for urban traffic data includes,
[0007] S1. Construct the urban traffic network and serialize the roads in the urban traffic network to obtain a traffic trajectory dataset containing GPS points. Map the GPS points in the traffic trajectory dataset to the urban traffic network using map matching. Obtain the road segment sequence for each trajectory from the urban traffic network. Construct SD pairs for the trajectory based on the starting and ending road segments in the road segment sequence. Store all trajectories, the corresponding road segment sequences, and the corresponding SD pairs to the first set.
[0008] S2. Divide the traffic trajectory dataset into different training sets according to the SD pairs in the first set. Construct spatiotemporal models based on SD pairs according to the trajectories in different training sets. Store all spatiotemporal models based on SD pairs and their corresponding SD pairs into the model set.
[0009] S3. Obtain the test trajectory and determine whether the test trajectory includes unreached trajectories.
[0010] If the test trajectory does not include any unreached trajectories, it indicates that the test trajectory is a reached trajectory. Anomaly detection is performed on the reached trajectory, and the result is obtained. If the reached trajectory is normal, the test trajectory is marked as a normal trajectory; if the reached trajectory is abnormal, the test trajectory is marked as an abnormal trajectory.
[0011] If the test trajectory includes unreached trajectories, the test trajectory is divided into reached trajectories and unreached trajectories. Anomaly detection is performed on the reached trajectories, and the detection result is obtained.
[0012] When the reached trajectory is normal, perform anomaly judgment on the unreached trajectory and obtain the judgment result. When the unreached trajectory is an abnormal trajectory, mark the test trajectory as an abnormal trajectory. When the unreached trajectory is a normal trajectory, mark the test trajectory as a normal trajectory.
[0013] When the reached trajectory is abnormal, the test trajectory will be marked as an abnormal trajectory.
[0014] Preferably, the step of determining anomalies in the reached trajectory and obtaining the determination result includes:
[0015] S41. The trajectories are divided into three categories: the first category consists of trajectories whose SD pairs exist in the model set; the second category consists of trajectories whose SD pairs do not exist in the model set; and the third category consists of trajectories whose SD pairs have either a starting or ending road segment in the model set.
[0016] S42. Obtain the SD pairs and road segment sequences of the reached trajectories. Compare the SD pairs and road segment sequences with the model set to determine the type of the reached trajectory. If the type of the reached trajectory is Class I, execute S43; if the type is Class II, execute S44; if the type is Class III, execute S45.
[0017] S43. For the first type of reached trajectory, obtain the spatiotemporal model based on SD pairs from the model set, predict the trajectory points in the reached trajectory based on the spatiotemporal model based on SD pairs, and judge whether the trajectory points and the reached trajectory are abnormal based on the prediction results and generate the judgment results.
[0018] S44. For the second type of reached trajectory, generate recommended trajectories for the reached trajectory according to the path generation algorithm, calculate the distance difference between the trajectory point and the recommended point in different time intervals, determine whether the trajectory point is abnormal based on the distance difference, and determine whether the reached trajectory is abnormal based on the number of abnormal trajectory points, and generate a judgment result.
[0019] S45. For the third type of reached trajectory, after matching the road segment sequence of the reached trajectory with the SD pairs in the model set, the reached trajectory is divided into sub-trajectories, and the sub-trajectories are treated as different reached trajectories. According to S42, the different reached trajectories are re-judged for anomalies and judgment results are generated.
[0020] Preferably, the step of judging the anomaly of the unreached trajectory and obtaining the judgment result includes obtaining the start point and end point of the test trajectory, generating a full recommended trajectory about the start point and end point according to the path planning algorithm, calculating the first completion time required to complete the full recommended trajectory, generating the unreached recommended trajectory of the unreached trajectory according to the path planning algorithm, calculating the second completion time to complete the unreached recommended trajectory, obtaining the travel time of the reached trajectory, calculating the sum of the second completion time and travel time and representing it as the third completion time, and judging whether the unreached trajectory is abnormal based on the difference between the first completion time and the third completion time.
[0021] Preferably, S1 includes,
[0022] Construct an urban traffic network, denoted by G(V,E,W), where V={v1,v2,...} is the vertex set representing road intersections, and E={e1<v...} is the vertex set representing road intersections. i ,v j >, e2 < v m ,v n >, ...} represents the set of roads between two adjacent vertices, and W = {w1, w2, ...} is the set of road weights, representing the actual distance between two adjacent vertices. Each road in the urban traffic network is divided into a sequence of road segments, i.e., road e. iAfter division, the road segment sequence L = {L} is obtained. j ,L j+1 ,...,L k}, This is called a road section.
[0023] Obtain a traffic trajectory dataset containing GPS points. Map the GPS points in the traffic trajectory dataset to the urban traffic network using map matching. Extract the road segment sequence for each trajectory from the urban traffic network. That is, for any trajectory T... i ={p1,p2,...,p n In the urban traffic network, the corresponding road segment sequence is TL={L1,L2,...,L...} m}, where the starting segment L of the road segment sequence TL S =L1, Terminating segment L D =L m Trajectory T is constructed based on the starting and ending road segments in the road segment sequence. i The SD pairs are used to store all trajectories, the corresponding road segment sequences, and the corresponding SD pairs into the first set.
[0024] Preferably, S2 includes,
[0025] S21. Initialize SD to empty index and initialize i = 1, obtain the number of trajectories in the first set and represent it as N, initialize the second set to empty.
[0026] S22. When i > N, proceed to S3. When i ≤ N, obtain the i-th trajectory and its corresponding i-th SD pair from the first set. Determine if the SD pair index contains the i-th SD pair. If it does, let i = i + 1, and re-obtain the i-th trajectory and its corresponding i-th SD pair from the first set. If it does not, search for SD pairs from the first set whose starting segment is the same as the starting segment of the i-th SD pair and whose ending segment is the same as the ending segment of the i-th SD pair. Obtain the trajectory of the SD pair and represent it as the same trajectory. Add the same trajectory to the second set. Search for road segment sequences from the first set that contain the starting segment and ending segment of the i-th SD pair. Obtain the trajectory between the two road segments in the road segment sequence and represent it as the included trajectory. Add the included trajectory to the second set.
[0027] S23. Calculate the travel distance and travel time for each trajectory in the second set. Calculate the median travel distance and median travel time in the second set. If the travel distance of a trajectory is greater than the median travel distance or the travel time is greater than the median travel time, delete the trajectory from the second set.
[0028] S24. For each trajectory in the second set, calculate the travel time and destination distance of each GPS point in each trajectory and store them in the training set. Construct a spatiotemporal model of the i-th SD pair regarding travel time and destination distance. Train the spatiotemporal model based on the training set and obtain the trained spatiotemporal model. Store the SD pair and the trained spatiotemporal model in the model set. Let i = i + 1, set the second set to empty, and return to S22.
[0029] Preferably, the construction of the spatiotemporal model of the i-th SD pair regarding travel time and destination distance includes construction according to formula (1).
[0030] D end =f(t) ij ;β)+ε,ε~N(0,σ 2 (1)
[0031] Where, f(t) ij ;β)=β0+β1t ij +β2t ij 2 +β3t ij 3 ......, t ij For travel time, t ij Represents the trajectory point p i Travel to trajectory point p j The time taken for each point, β=[β0,β1,β2,β3…] T It is f(t) ij The parameter vector of β), where ε is a random variable following a normal distribution, and D end =dist(p i D) is the distance to the destination, D end Representing trajectory point p i The Euclidean distance from point D is the distance from point D to the endpoint of the trajectory.
[0032] This invention provides a real-time abnormal trajectory detection method for urban traffic data, capable of detecting motion trajectories deviating from normal patterns online. This solves the problem that offline abnormal trajectory detection methods cannot detect abnormal trajectories in real time, facilitating the early detection of safety hazards in urban traffic. Compared to existing abnormal trajectory detection methods, this invention does not ignore the significant impact of temporal features on trajectory data. Instead, it utilizes multinomial regression to simultaneously consider the temporal and spatial characteristics of the motion trajectory, constructing a spatiotemporal model. Furthermore, this invention employs a path planning algorithm to overcome the dependence of existing abnormal trajectory detection methods on historical trajectory datasets, improving the effectiveness of real-time abnormal trajectory detection. The real-time abnormal trajectory detection method in this invention is an extension of the proposed offline abnormal trajectory detection method. On one hand, this invention stores SD pairs and the spatiotemporal model based on SD pairs in a model set, improving the retrieval efficiency of trajectory data for the real-time abnormal trajectory detection algorithm. On the other hand, this invention uses a dual-criteria approach to detect motion trajectories in real time, further improving the accuracy of the real-time abnormal trajectory detection algorithm. Attached Figure Description
[0033] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0034] Figure 1 This is a flowchart of the method of the present invention;
[0035] Figure 2 This is the trajectory and road network mapping diagram of the present invention;
[0036] Figure 3 The endpoint distance representation diagram of this invention;
[0037] Figure 4 This is the anomaly point determination diagram of the present invention;
[0038] Figure 5 This is the distance between the endpoints of the test trajectory and the recommended trajectory of this invention;
[0039] Figure 6 This is the sub-trajectory anomaly judgment diagram of the present invention. Detailed Implementation
[0040] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0041] Figure 1 This is a flowchart of the method of the present invention, as shown below. Figure 1 As shown, the method in this embodiment may include:
[0042] S1. Construct the urban traffic network and serialize the roads in the urban traffic network to obtain a traffic trajectory dataset containing GPS points. Map the GPS points in the traffic trajectory dataset to the urban traffic network using map matching. Obtain the road segment sequence for each trajectory from the urban traffic network. Construct SD pairs for the trajectory based on the starting and ending road segments in the road segment sequence. Store all trajectories, the corresponding road segment sequences, and the corresponding SD pairs to the first set.
[0043] S2. Divide the traffic trajectory dataset into different training sets according to the SD pairs in the first set. Construct spatiotemporal models based on SD pairs according to the trajectories in different training sets. Store all spatiotemporal models based on SD pairs and their corresponding SD pairs into the model set.
[0044] S3. Obtain the test trajectory and determine whether the test trajectory includes unreached trajectories.
[0045] If the test trajectory does not include any unreached trajectories, it indicates that the test trajectory is a reached trajectory. Anomaly detection is performed on the reached trajectory, and the result is obtained. If the reached trajectory is normal, the test trajectory is marked as a normal trajectory; if the reached trajectory is abnormal, the test trajectory is marked as an abnormal trajectory.
[0046] If the test trajectory includes unreached trajectories, the test trajectory is divided into reached trajectories and unreached trajectories. Anomaly detection is performed on the reached trajectories, and the detection result is obtained.
[0047] When the reached trajectory is normal, perform anomaly judgment on the unreached trajectory and obtain the judgment result. When the unreached trajectory is an abnormal trajectory, mark the test trajectory as an abnormal trajectory. When the unreached trajectory is a normal trajectory, mark the test trajectory as a normal trajectory.
[0048] When the reached trajectory is abnormal, the test trajectory will be marked as an abnormal trajectory.
[0049] Based on the above scheme, it is possible to detect motion trajectories that deviate from the normal pattern online, solving the problem that offline abnormal trajectory detection methods cannot detect abnormal trajectories in real time, which is beneficial for early detection of safety hazards in urban traffic. Compared with existing abnormal trajectory detection methods, this invention does not ignore the important influence of time features on trajectory data, but instead uses multinomial regression to consider both the time and spatial features of the motion trajectory to construct a spatiotemporal model. In addition, this invention uses a path planning algorithm to overcome the dependence of existing abnormal trajectory detection methods on historical trajectory datasets, improving the effectiveness of real-time abnormal trajectory detection methods. The real-time abnormal trajectory detection method in this invention is an extension of the proposed offline abnormal trajectory detection method. On the one hand, this invention stores SD pairs and spatiotemporal models based on SD pairs in a model set, improving the retrieval efficiency of trajectory data by the real-time abnormal trajectory detection algorithm; on the other hand, this invention uses a dual judgment criterion to detect motion trajectories in real time, further improving the accuracy of the real-time abnormal trajectory detection algorithm.
[0050] S1. Construct the urban traffic network and serialize the roads in the urban traffic network to obtain a traffic trajectory dataset containing GPS points. Map the GPS points in the traffic trajectory dataset to the urban traffic network using map matching. Obtain the road segment sequence for each trajectory from the urban traffic network. Construct SD pairs for the trajectory based on the starting and ending road segments in the road segment sequence. Store all trajectories, the corresponding road segment sequences, and the corresponding SD pairs to the first set.
[0051] Specifically, S1 includes constructing the urban traffic network, denoted by G(V,E,W), where V={v1,v2,...} is the vertex set representing road intersections, and E={e1,v2,...} is the vertex set representing road intersections. <v i ,v j >,e2 <v m ,v n >,...} represents the set of roads between two adjacent vertices, and W={w1,w2,...} is the set of road weights, representing the actual distance between two adjacent vertices. Each road in the urban traffic network is divided into a sequence of road segments, i.e., road e. i After division, the road segment sequence L = {L} is obtained. j ,L j+1 ,...,L k}, This is called a road segment, such as Figure 2 As shown, virtual nodes (gray nodes in the diagram) are added to the edges in the road network. Edge <v1,v2> is partitioned into the sequence {L1,L2}, and edge <v2,v4> is partitioned into the sequence {L3,L4}.<v4,v5> It is divided into the sequence {L5, L6}.
[0052] Obtain a traffic trajectory dataset containing GPS points, arranged in chronological order, forming a trajectory T = {p1, p2, ..., p...} n}. Among them, GPS point p i =(x i ,y i ,t i ), x i y i t i p i The longitude, latitude, and timestamp of a point, such as Figure 2 As shown, GPS points in the traffic trajectory dataset are mapped to the urban traffic network via map matching. The GPS points are then mapped to the edges of the road network. Map matching is a relatively mature field, and existing algorithms can be directly called to obtain the road segment sequence for each trajectory from the urban traffic network. That is, for any trajectory T... i ={p1,p2,...,p n In the urban traffic network, the corresponding road segment sequence is TL={L1,L2,...,L...} m}, where the starting segment L of the road segment sequence TL S =L1, Terminating segment L D =L m Trajectory T is constructed based on the starting and ending road segments in the road segment sequence. i The SD pairs are used to store all trajectories, the corresponding road segment sequences, and the corresponding SD pairs into the first set.
[0053] S2. Divide the traffic trajectory dataset into different training sets based on the SD pairs in the first set. Construct spatiotemporal models based on SD pairs based on the trajectories in different training sets. Store all spatiotemporal models based on SD pairs into the model set.
[0054] Specifically, S2 includes,
[0055] S21. Initialize SD to empty index and initialize i = 1, obtain the number of trajectories in the first set and represent it as N, initialize the second set to empty.
[0056] S22. When i > N, proceed to S3. When i ≤ N, obtain the i-th trajectory and its corresponding i-th SD pair from the first set. Determine if the SD pair index contains the i-th SD pair. If it does, let i = i + 1, and re-obtain the i-th trajectory and its corresponding i-th SD pair from the first set. If it does not, search for SD pairs from the first set whose starting segment is the same as the starting segment of the i-th SD pair and whose ending segment is the same as the ending segment of the i-th SD pair. Obtain the trajectory of the SD pair and represent it as the same trajectory. Add the same trajectory to the second set. Search for road segment sequences from the first set that contain the starting segment and ending segment of the i-th SD pair. Obtain the trajectory between the two road segments in the road segment sequence and represent it as the included trajectory. Add the included trajectory to the second set.
[0057] S23. Calculate the travel distance and travel time for each trajectory in the second set. Calculate the median travel distance and median travel time in the second set. If the travel distance of a trajectory is greater than the median travel distance or the travel time is greater than the median travel time, delete the trajectory from the second set.
[0058] S24. For each trajectory in the second set, calculate the travel time and destination distance of each GPS point in each trajectory and store them in the training set. Construct a spatiotemporal model of the i-th SD pair regarding travel time and destination distance. Train the spatiotemporal model based on the training set and obtain the trained spatiotemporal model. Store the SD pair and the trained spatiotemporal model in the model set. Let i = i + 1, set the second set to empty, and return to S22.
[0059] For example, given a set of historical trajectories H = {T1, T2, ..., T...} N The set of historical trajectories H contains multiple historical trajectories. For any trajectory T in the historical trajectory set H... i ={p1,p2,...,p n There exists a corresponding road segment sequence TL={L1,L2,...,L}. m}, where the starting segment L of the road segment sequence TL S =L1, Terminating segment L D =L m , for T i Construct start-end pairs <L S ,L D >(abbreviated as SD pair).
[0060] Construct a list SD_List. If the SD pair does not exist in SD_List, it means that the SD pair has not been retrieved. Add the SD pair to SD_List and record the trajectory T. i Add to trajectory set T_Set, and search for the element containing L in H. S To LD The trajectory of the road segment, retain L S to L D The trajectory of the road segment is added to the trajectory set T_Set. T_Set contains trajectories i with the same L S and the same L D as the trajectory T
[0061] Secondly, the trajectory set T_Set contains trajectories i with the same L S and the same L D as the trajectory T. Trajectories in T_Set with both travel distance and travel time less than the median are selected as training trajectories to ensure the accuracy of the training trajectories and avoid interference from abnormal trajectories
[0062] Finally, for the trajectory T = {p1(x1,y1,t1), p2(x2,y2,t2),...}, if there exist p i points and p j points which are two GPS points on the trajectory T (i < j), then the travel time from the p i point to the p j point is denoted as t ij , defined as: t ij = t j - t i . Denote the starting position of the trajectory T as S, the destination as D, and the end - point distance of the moving object at a certain p i point as: the Euclidean distance from the p i point to the destination D, that is D end = dist(p i , D), as shown in Figure 3 . Given a training set, for each trajectory in the training set, calculate the travel time (abbreviated as T) and the end - point distance (abbreviated as D end ) of each point
[0063] The travel time of the p i point refers to the time it takes for the moving object to travel from the starting position S to a certain position point p i ; the end - point distance of the p i point refers to the Euclidean distance from the moving object traveling from the starting position S to a certain position point p i , at the p i point to the destination D, as shown in Figure 3
[0064] The travel time t ij = t i - t1
[0065] The end - point distance D end = dist(pi D)
[0066] Using travel time as the independent variable and distance to the destination as the dependent variable, a TD (Travel Time and Distance) model is established. end The model reveals the spatiotemporal relationship between travel time and destination distance. TD end The model is defined as follows:
[0067] D end =f(t) ij ;β)+ε,ε~N(0,σ 2 ) (1)
[0069] Where, f(t) ij ;β)=β0+β1t ij +β2t ij 2 +β3t ij 3 ......, t ij The travel time is t. ij The driving object is represented by p i Drive to p j The time taken for each point, β=[β0,β1,β2,β3…] T It is f(t) ij The parameter vector of β needs to be learned. Given a training set, the travel time and destination distance of the training trajectory are calculated at each point. Then, the maximum likelihood estimation is used to fit the data to obtain the model parameters β and σ corresponding to the training set. 2 ε is a random variable that follows a normal distribution.
[0070] By fitting the model using maximum likelihood estimation, the regression coefficient β and the variance σ of the random variable can be determined. 2 Then, the parameters β and σ 2 Stored in the model parameters mp, and in pairs of SD corresponding to the training set. <L S ,L D The learned model parameters mp are stored in the model set M using the index '>' for later retrieval.
[0071] After obtaining the regression coefficient β and the variance σ of the random variable 2 Then, initialize a model parameter mp, and set mp.coefficient = β; mp.variance = σ 2 ;
[0072] The model parameters mp are stored in the model set M, indexed by SD pairs. Specifically:
[0073] Construct a hash table StartMap, and use StartMap.put(L S,mp);
[0074] Create a list called DestList, using DestList.add(StartMap);
[0075] M.put(L D DestList)
[0076] M stores different termination road segments L D The corresponding list, each L D The corresponding list stores different starting road segments L. S The corresponding model parameters mp, i.e., M stores different SD pairs. <L s ,L D >The corresponding model parameter mp.
[0077] S3. Obtain the test trajectory and determine whether it includes unreached trajectories. If the test trajectory does not include unreached trajectories, it indicates that the test trajectory is a reached trajectory. Perform anomaly judgment on the reached trajectory and obtain the judgment result. When the reached trajectory is normal, mark the test trajectory as a normal trajectory; when the reached trajectory is abnormal, mark the test trajectory as an abnormal trajectory.
[0078] The step of performing anomaly detection on the reached trajectory and obtaining the detection result includes...
[0079] S41. The trajectories are divided into three categories: the first category consists of trajectories whose SD pairs exist in the model set; the second category consists of trajectories whose SD pairs do not exist in the model set; and the third category consists of trajectories whose SD pairs have either a starting or ending road segment in the model set.
[0080] S42. Obtain the SD pairs and road segment sequences of the reached trajectories. Compare the SD pairs and road segment sequences with the model set to determine the type of the reached trajectory. If the type of the reached trajectory is Class I, execute S43; if the type is Class II, execute S44; if the type is Class III, execute S45.
[0081] S43. For the first type of reached trajectory, obtain the spatiotemporal model based on SD pairs from the model set, predict the trajectory points in the reached trajectory based on the spatiotemporal model based on SD pairs, and judge whether the trajectory points and the reached trajectory are abnormal based on the prediction results and generate the judgment results.
[0082] S44. For the second type of reached trajectory, generate recommended trajectories for the reached trajectory according to the path generation algorithm, calculate the distance difference between the trajectory point and the recommended point in different time intervals, determine whether the trajectory point is abnormal based on the distance difference, and determine whether the reached trajectory is abnormal based on the number of abnormal trajectory points, and generate a judgment result.
[0083] S45. For the third type of reached trajectory, after matching the road segment sequence of the reached trajectory with the SD pairs in the model set, the reached trajectory is divided into sub-trajectories, and the sub-trajectories are treated as different reached trajectories. According to S42, the different reached trajectories are re-judged for anomalies and judgment results are generated.
[0084] If the test trajectory includes unreached trajectories, the test trajectory is divided into reached trajectories and unreached trajectories. Anomaly detection is performed on reached trajectories and the detection result is obtained. When a reached trajectories are normal, anomaly detection is performed on unreached trajectories and the detection result is obtained. When an unreached trajectories are abnormal, the test trajectory is marked as an abnormal trajectory. When an unreached trajectories are normal, the test trajectory is marked as a normal trajectory. When a reached trajectories are abnormal, the test trajectory is marked as an abnormal trajectory.
[0085] The process of determining anomalies in unreached trajectories and obtaining the determination result includes obtaining the start and end points of the test trajectory, generating a recommended trajectory for the entire journey based on the start and end points using a path planning algorithm, calculating the first completion time required to complete the recommended trajectory, generating an unreached recommended trajectory for the unreached trajectory based on the path planning algorithm, calculating the second completion time to complete the unreached recommended trajectory, obtaining the travel time of the reached trajectory, calculating the sum of the second completion time and travel time and representing it as the third completion time, and determining whether the unreached trajectory is abnormal based on the difference between the first completion time and the third completion time.
[0086] Specifically, for reached trajectories with SD pairs existing in the model set, anomaly detection is performed. This includes obtaining the SD pairs of reached trajectories, determining whether the SD pairs are in the model set, and when both the termination and originating segments of the SD pairs are in the model set, obtaining the spatiotemporal models corresponding to the originating and termination segments, calculating the travel time and destination distance for each test point in the reached trajectory, inputting the travel time of all test points into the spatiotemporal model to calculate the predicted destination distance, and determining the difference between the destination distance and the predicted destination distance for each test point. If the difference exceeds a first threshold, the test point is marked as an anomaly; if the difference is less than the first threshold, the test point is marked as a normal point.
[0087] When the termination and starting road segments are not in the model set, a recommended trajectory for the test trajectory is generated according to the path generation algorithm. The distance difference between the test point and the recommended point is calculated at the same time. If the distance difference exceeds a first threshold, the test point is marked as an anomaly; otherwise, it is marked as a normal point.
[0088] When the starting or ending road segment is in the model set, the reached trajectory is matched with the SD pairs in the model set based on the road segment sequence. The reached trajectory is then divided, and the starting and ending road segments of each sub-trajectory are obtained. The corresponding spatiotemporal models for each starting and ending segment are also obtained. The travel time and destination distance for each test point in each sub-trajectory are calculated. The travel time of all test points in each sub-trajectory is input into the corresponding spatiotemporal model to calculate the predicted destination distance. For each sub-trajectory, the difference between the destination distance and the predicted destination distance for each test point is sequentially evaluated. If the difference exceeds a first threshold, the test point is marked as an anomaly; if the difference is less than the first threshold, the test point is marked as a normal point. The number of anomalies in the sub-trajectory determines whether the sub-trajectory is abnormal. If a sub-trajectory is abnormal, the reached trajectory is marked as an abnormal trajectory. If a sub-trajectory is normal, the next sub-trajectory is re-evaluated for abnormality. When all sub-trajectories are normal, the reached trajectory is marked as a normal trajectory.
[0089] The system retrieves the number of abnormal points in the reached trajectory. When the number of abnormal points exceeds a second threshold, the test trajectory is marked as an abnormal trajectory; otherwise, it is marked as a normal trajectory.
[0090] The process of performing offline abnormal trajectory detection in this embodiment is as follows:
[0091] Given a test trajectory Tr = {p1, p2, p3, ..., p i The corresponding road segment sequence is T. L ={L1,L2,...,L j After preliminary learning of TD end The model set M already stores many model parameters that can be directly accessed.
[0092] First, for the test trajectory Tr, retrieve the model set M with L as the starting point. j For the model parameters of the terminating road segment, if such model parameters exist, further retrieval is performed using L... j The model parameters are used to terminate the road segment and start the road segment from L1. Secondly, if model parameters that meet this requirement exist, the regression coefficient β in the model parameters is substituted into the polynomial function f(t). ij In β), for each test point on the test trajectory, calculate its travel time t. ij and the distance from the endpoint D end , will t ij Substituting it as an independent variable into the trained TD end In the model, the predicted endpoint distance D' will be obtained. end , where the random variable D' end ~N(f(t) ij ;β),σ 2Substituting the regression coefficient β into the polynomial function, TD end The only unknown quantity remaining is the travel time t. ij Calculate the travel time t at the test point. ij Then, by substituting it as the independent variable, we can obtain the random variable D'. end random variable D' end It follows a normal distribution, and its variance is σ in the model parameters. 2 If the endpoint of a point on the test trajectory is D end Exceeding the prediction range Then the point is judged as an outlier, such as Figure 4 As shown, when the travel time is t, if the endpoint distance of the test trajectory exceeds the endpoint distance of the recommended trajectory (i.e., the prediction range), this point is identified as an anomaly and added to the anomaly point set. If the proportion of anomaly points in the test trajectory is greater than the trajectory anomaly threshold τ, the test trajectory is determined to be an abnormal trajectory; otherwise, the test trajectory is a normal trajectory. If no model parameters meeting the requirements are found in the above steps, anomaly detection is performed on the test trajectory according to Algorithm I. The specific steps of Algorithm I are as follows:
[0093] Assume the test trajectory Tr starts at time t1 and ends at time t. i Set the time interval to t. delay (s), let t=t1+t delay And use path planning algorithms (such as Dijkstra's algorithm, Floyd's algorithm, etc.) to obtain p1 to p i Recommended trajectory T c When t <t i At time t, the test trajectory Tr reaches position p. t Recommended trajectory T c The position reached at time t is p. c Calculate p respectively t Distance from the endpoint of the point and p c Distance from the endpoint of the point like Figure 5 As shown, there is a difference between the endpoint distance of the test trajectory and the endpoint distance of the recommended trajectory. Further calculation of this difference... when When p is less than the abnormal threshold θ at the endpoint t The point is identified as an outlier, added to the outlier set, and t = t + t is set. delay Repeat the above steps to identify any anomalies at other points on the test trajectory. If t is not satisfied... <t iThe loop ends when a condition is met. At this point, the abnormal trajectory is determined based on the proportion of abnormal points in the test trajectory. If the proportion of abnormal points is greater than the given trajectory abnormality threshold τ, the test trajectory is determined to be an abnormal trajectory; otherwise, the test trajectory is a normal trajectory.
[0094] This embodiment implements the process of real-time abnormal trajectory detection;
[0095] Given a test trajectory Tr = {p1, p2, ..., p i ...}, the trajectory is currently traveling to p i Point P, destination D. Assume P... i The road segment where the point is located is L j At this point, the road segment sequence corresponding to Tr is T. L ={L1,L2,...,L j}. When in p i When a point triggers real-time abnormal trajectory detection, the test trajectory is detected online based on a dual judgment standard. This dual judgment standard includes the detection of reached trajectories and the detection of unreached trajectories. The reached trajectory is defined as T. 1→i ={p1,p2,...,p i The trajectory not reached is T. i→D ={p i ,...,D}, such as Figure 6 As shown.
[0096] Step 2.1: Perform anomaly detection on the reached trajectory;
[0097] Perform a first-level index in the model set M: retrieve data starting with p i Section L j For the model parameters of the terminating road segment, there are two cases: the content of the first-level index is retrieved from the model set M with p i Section L j These are the model parameters for the terminated road segment.
[0098] The search results are in L j The list represents the termination points of the road segments, and the list contains different L values. S The corresponding model parameter mp,
[0099] ① Model parameters exist. A secondary index is used; the secondary index searches within the result set of the primary index for a specific L. s The model parameters mp for the initial road segment: the sequence of road segments traversed T L From T L Starting from the initial road segment L1, T is detected sequentially. L If a road segment is found that matches the starting position of the first-level index result, the traversal ends.
[0100] If no suitable road segment is found until the end of the traversal, then the trajectory T that has been reached is... 1→i ={p1,p2,...,p i Algorithm I is called to perform anomaly detection. If the returned result is an anomaly marker, the test trajectory Tr is directly determined to be an anomaly trajectory. Otherwise, the process jumps to step 2.2 to continue anomaly detection on the unreached part of the test trajectory.
[0101] Suppose that after searching, it is found that there exists a T L L in k The road segment is the starting road segment, L j The model parameters for the road segment are the terminating road segment, and road segment L... k The point closest to p1 is p. n The point farthest from p1 is p. m Then for the sub-trajectory T n→i ={p n ,...,p m ,...,p i Using TD end The model performs detection, such as Figure 6 As shown. If the returned result is marked as abnormal, then the test trajectory Tr is directly determined to be an abnormal trajectory; if the returned result is marked as normal, and L... k If the value of p1 matches the value of L1 in the road segment where p1 is located, it means that the entire trajectory has been detected. At this point, it is necessary to proceed to step 2.2 to perform a second round of evaluation on the test trajectory. Otherwise, p1 will be removed from the evaluation. m Assign a value to p i Repeat step 2.1 for the remaining undetected trajectories.
[0102] ② No model parameters exist. In this case, Algorithm I is needed to analyze the reached trajectory T. 1→i ={p1,p2,...,p i If an anomaly detection is performed and the returned result is an anomaly marker, the test trajectory Tr is directly determined to be an anomaly trajectory; otherwise, the process will jump to step 2.2 to continue anomaly detection on the unreached portion of the test trajectory.
[0103] Step 2.2: Perform anomaly detection on unreached trajectories;
[0104] Determine if there are any anomalies in the unreached portions of the test trajectory. If the unreached portion is also normal, assuming the reached portion is normal, the test trajectory is considered normal; otherwise, it is considered abnormal. The specific steps of Algorithm II are as follows:
[0105] First, a recommended trajectory T from the starting position p1 to the destination D is obtained using path planning algorithms (such as Dijkstra's algorithm, Floyd's algorithm, etc.). a And calculate Ta The actual route distance l a Then, using the average speed v of the moving object, calculate T. a Expected travel time t a .
[0106] Secondly, the current destination p is obtained using a path planning algorithm. i Recommended trajectory T to destination D b And calculate T b The actual route distance l b Then, using the average speed v of the moving object, calculate T. b Expected travel time t b .
[0107] Finally, time1 and time2 are calculated using formulas (2) and (3) respectively:
[0108] time1 = t 1→i +t b (2)
[0109] time2=t a +λ (3)
[0110] Among them, t 1→i The object being driven travels from point p1 to point p. i The travel time at a point, where λ is a given abnormal travel time threshold.
[0111] If time1 is greater than time2 at this time, the test trajectory is determined to be an abnormal trajectory; otherwise, the test trajectory is a normal trajectory.
[0112] Overall beneficial effects:
[0113] This invention provides a real-time abnormal trajectory detection method for urban traffic data, capable of detecting motion trajectories deviating from normal patterns online. This solves the problem that offline abnormal trajectory detection methods cannot detect abnormal trajectories in real time, facilitating the early detection of safety hazards in urban traffic. Compared to existing abnormal trajectory detection methods, this invention does not ignore the significant impact of temporal features on trajectory data. Instead, it utilizes multinomial regression to simultaneously consider the temporal and spatial characteristics of the motion trajectory, constructing a spatiotemporal model. Furthermore, this invention employs a path planning algorithm to overcome the dependence of existing abnormal trajectory detection methods on historical trajectory datasets, improving the effectiveness of real-time abnormal trajectory detection. The real-time abnormal trajectory detection method in this invention is an extension of the proposed offline abnormal trajectory detection method. On one hand, this invention stores SD pairs and the spatiotemporal model based on SD pairs in a model set, improving the retrieval efficiency of trajectory data for the real-time abnormal trajectory detection algorithm. On the other hand, this invention uses a dual-criteria approach to detect motion trajectories in real time, further improving the accuracy of the real-time abnormal trajectory detection algorithm.
[0114] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A real-time abnormal trajectory detection method for urban traffic data, characterized in that, include, S1. Construct the urban traffic network and serialize the roads in the urban traffic network to obtain a traffic trajectory dataset containing GPS points. Map the GPS points in the traffic trajectory dataset to the urban traffic network using map matching. Obtain the road segment sequence for each trajectory from the urban traffic network. Construct SD pairs for the trajectory based on the starting and ending road segments in the road segment sequence. Store all trajectories, the corresponding road segment sequences, and the corresponding SD pairs to the first set. S2. Divide the traffic trajectory dataset into different training sets according to the SD pairs in the first set. Construct a spatiotemporal model based on SD pairs according to the trajectories in different training sets. Store all spatiotemporal models based on SD pairs and their corresponding SD pairs into the model set. Construct the spatiotemporal model of the i-th SD pair regarding travel time and destination distance according to formula (1). D end =f(t ij ;β)+ε,ε~N(0,σ 2 ) (1) Where, f(t) ij ;β)=β0+β1t ij +β2t ij 2 +β3t ij 3 ......, t ij For travel time, t ij Represents the trajectory point p i Travel to trajectory point p j The time taken for each point, β=[β0,β1,β2,β3…] T It is f(t) ij The parameter vector of β), where ε is a random variable following a normal distribution, and D end =dist(p i D) is the distance to the destination, D end Representing trajectory point p i The Euclidean distance from point D, where D is the endpoint of the trajectory; S3. Obtain the test trajectory and determine whether the test trajectory includes unreached trajectories. If the test trajectory does not include any unreached trajectories, it indicates that the test trajectory is a reached trajectory. Anomaly detection is performed on the reached trajectory, and the result is obtained. If the reached trajectory is normal, the test trajectory is marked as a normal trajectory; if the reached trajectory is abnormal, the test trajectory is marked as an abnormal trajectory. If the test trajectory includes unreached trajectories, the test trajectory is divided into reached trajectories and unreached trajectories. Anomaly detection is performed on the reached trajectories, and the detection result is obtained. This anomaly detection and result acquisition for reached trajectories includes... S41. The trajectories are divided into three categories: the first category consists of trajectories whose SD pairs exist in the model set; the second category consists of trajectories whose SD pairs do not exist in the model set; and the third category consists of trajectories whose SD pairs have either a starting or ending road segment in the model set. S42. Obtain the SD pairs and road segment sequences of the reached trajectories. Compare the SD pairs and road segment sequences with the model set to determine the type of the reached trajectory. If the type of the reached trajectory is Class I, execute S43; if the type is Class II, execute S44; if the type is Class III, execute S45. S43. For the first type of reached trajectory, obtain the spatiotemporal model based on SD pair from the model set, predict the trajectory points in the reached trajectory based on the spatiotemporal model based on SD pair, and judge whether the trajectory points and the reached trajectory are abnormal based on the prediction results and generate judgment results. When the termination segment and the starting segment of the SD pair are both in the model set, obtain the spatiotemporal model corresponding to the starting segment and the termination segment, calculate the travel time and destination distance of each test point in the reached trajectory, input the travel time of all test points into the spatiotemporal model to calculate the predicted destination distance, judge the difference between the destination distance of each test point and the predicted destination distance, when the difference exceeds the first threshold, mark the test point as an abnormal point, when the difference is less than the first threshold, mark the test point as a normal point. S44. For the second type of reached trajectory, a recommended trajectory is generated based on the path generation algorithm. The distance difference between the trajectory point and the recommended point is calculated at different time intervals. The trajectory point is judged as abnormal based on the distance difference. That is, when the termination segment and the starting segment are not in the model set, a recommended trajectory for the test trajectory is generated based on the path generation algorithm. The distance difference between the test point and the recommended point is calculated at the same time. When the distance difference exceeds the first threshold, the test point is marked as an abnormal point; otherwise, it is marked as a normal point. The distance difference between the trajectory point and the recommended point is the difference between the endpoint distance corresponding to the test point of the test trajectory and the endpoint distance corresponding to the recommended point of the recommended trajectory at the same time. The reached trajectory is judged as abnormal based on the number of abnormal trajectory points, and a judgment result is generated. S45. For the third type of reached trajectory, after matching the road segment sequence of the reached trajectory with the SD pairs in the model set, the reached trajectory is divided into sub-trajectories, and the sub-trajectories are treated as different reached trajectories. According to S42, the different reached trajectories are re-judged for anomalies and judgment results are generated. When the reached trajectory is normal, perform anomaly judgment on the unreached trajectory and obtain the judgment result. When the unreached trajectory is an abnormal trajectory, mark the test trajectory as an abnormal trajectory. When the unreached trajectory is a normal trajectory, mark the test trajectory as a normal trajectory. When the reached trajectory is abnormal, the test trajectory will be marked as an abnormal trajectory; The process of determining anomalies in unreached trajectories and obtaining the determination result includes obtaining the start and end points of the test trajectory, generating a recommended trajectory for the entire journey based on the start and end points using a path planning algorithm, calculating the first completion time required to complete the recommended trajectory, generating an unreached recommended trajectory for the unreached trajectory based on the path planning algorithm, calculating the second completion time to complete the unreached recommended trajectory, obtaining the travel time of the reached trajectory, calculating the sum of the second completion time and travel time and representing it as the third completion time, and determining whether the unreached trajectory is abnormal based on the difference between the first completion time and the third completion time.
2. The real-time abnormal trajectory detection method for urban traffic data according to claim 1, characterized in that, S1 includes, Construct an urban traffic network, denoted by G(V,E,W), where V={v1,v2,...} is the vertex set representing road intersections, and E={e1,v2,...} is the vertex set representing road intersections. <v i ,v j >,e2 <v m ,v n >,...} represents the set of roads between two adjacent vertices, and W={w1,w2,...} is the set of road weights, representing the actual distance between two adjacent vertices. Each road in the urban traffic network is divided into a sequence of road segments, i.e., road e. i After division, the road segment sequence is obtained. This is called a road section. Obtain a traffic trajectory dataset containing GPS points. Map the GPS points in the traffic trajectory dataset to the urban traffic network using map matching. Extract the road segment sequence for each trajectory from the urban traffic network. That is, for any trajectory T... i ={p1,p2,...,p n In the urban traffic network, the corresponding road segment sequence is TL={L1,L2,...,L...} m }, where the starting segment L of the road segment sequence TL S =L1, Terminating segment L D =L m Trajectory T is constructed based on the starting and ending road segments in the road segment sequence. i The SD pairs are used to store all trajectories, the corresponding road segment sequences, and the corresponding SD pairs into the first set.
3. The real-time abnormal trajectory detection method for urban traffic data according to claim 1, characterized in that, S2 includes, S21. Initialize SD to empty index and initialize i = 1, obtain the number of trajectories in the first set and represent it as N, initialize the second set to empty. S22. When i > N, proceed to S3. When i ≤ N, obtain the i-th trajectory and its corresponding i-th SD pair from the first set. Determine if the SD pair index contains the i-th SD pair. If it does, let i = i + 1, and re-obtain the i-th trajectory and its corresponding i-th SD pair from the first set. If it does not, search for SD pairs from the first set whose starting segment is the same as the starting segment of the i-th SD pair and whose ending segment is the same as the ending segment of the i-th SD pair. Obtain the trajectory of the SD pair and represent it as the same trajectory. Add the same trajectory to the second set. Search for road segment sequences from the first set that contain the starting segment and ending segment of the i-th SD pair. Obtain the trajectory between the two road segments in the road segment sequence and represent it as the included trajectory. Add the included trajectory to the second set. S23. Calculate the travel distance and travel time for each trajectory in the second set. Calculate the median travel distance and median travel time in the second set. If the travel distance of a trajectory is greater than the median travel distance or the travel time is greater than the median travel time, delete the trajectory from the second set. S24. For each trajectory in the second set, calculate the travel time and destination distance for each GPS point in each trajectory and store them in the training set. Construct the i-th SD pair with respect to travel time and destination distance. The spatiotemporal model of point distance is obtained by training the spatiotemporal model using a training set. Store the SD pairs and the trained spatiotemporal model into the model set, let i = i + 1, and leave the second set empty. Return to S22.
Citation Information
Patent Citations
Taxi abnormal track real-time detection method based on time-space relationship
CN108710637A
Track anomaly detection method under double view angles of time and space
CN108804539A