Abnormal trajectory detection method based on popular paths
By using the abnormal trajectory detection method based on popular paths, gridding the city map and calculating the abnormal score of the trajectory according to the traffic flow period, it solves the problems of large calculation amount and neglect of time attributes in the existing technology, and improves the detection accuracy and efficiency of the taxi system. .
Patent Information
- Application Number
- CN202211413776.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-11
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2042-11-11
AI Technical Summary
Existing abnormal trajectory detection methods in urban taxi systems have detection accuracy and time consumption problems caused by large amounts of data calculation and neglect of time attributes, making it difficult to effectively detect abnormal driving behaviors of taxi drivers.
Using an abnormal trajectory detection method based on popular paths, the trajectory is divided into grid unit sequences through a gridded city map, and popular paths are calculated based on peak and off-peak traffic hours and path node frequencies, and anomaly scores are generated to identify abnormal trajectories. .
It improves the accuracy and efficiency of abnormal trajectory detection, combines time attributes to make detection more accurate, reduces the amount of calculation, and can effectively identify abnormal taxi behavior.
Smart Images

Figure CN115798245B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of abnormal trajectory detection, and more specifically, the present invention relates to an abnormal trajectory detection method based on popular paths. Background Art
[0002] With the rapid development of GPS positioning and wireless communication technology, more and more trajectory data are collected by people. How to detect abnormal trajectories from a large amount of collected trajectory data has also become a hot issue for people to study. Among them, abnormal trajectory detection is particularly important in urban taxi systems. When people go to an unfamiliar city, most people will use taxis as the primary means of travel, and some taxi drivers often take advantage of the fact that passengers are unfamiliar with the current environment to defraud them. Therefore, discovering such abnormal behavior is of great significance for ensuring high-quality taxi services and creating a good urban traffic environment. Therefore, the present invention mainly focuses on abnormal driving trajectories hidden in urban taxi trajectories.
[0003] At present, in order to meet the needs of practical applications in this field, researchers have conducted in-depth research on the spatial position of trajectory points and proposed many trajectory anomaly detection methods based on distance detection, density detection, etc. These methods can quantitatively determine meaningful similarity metrics between trajectories. However, they require more distance calculation steps and have the problem of large data calculation volume. In addition, most existing detection methods tend to ignore the anomalies caused by the dynamic changes of the path caused by the time attribute during the detection process, which has an adverse effect on the detection accuracy and time consumption of the taxi detection system. Summary of the invention
[0004] The present invention provides an abnormal trajectory detection method based on popular paths, aiming to improve the above problems.
[0005] The present invention is implemented as follows: a method for detecting abnormal trajectories based on popular paths, the method specifically comprising the following steps:
[0006] S1, gridding the city map, putting the driving trajectory from the starting point to the end point into the trajectory set TS;
[0007] S2, the driving trajectory T in the trajectory set TS i Gridding to form a driving trajectory T i The grid cell sequence MT i ;
[0008] S3, divide the time into peak hours and non-peak hours of traffic flow, combined with the grid unit sequence MT i The time period and the path node probability between the starting point and the end point are used to find the popular paths during peak and non-peak hours;
[0009] S4. Generate an abnormality score for the driving trajectory to be detected based on the distance between the driving trajectory to be detected and the popular path in the corresponding time period. If the abnormality score is greater than a set abnormality score threshold, the corresponding driving trajectory to be detected is determined to be an abnormal trajectory.
[0010] Furthermore, after step S1, the method further includes:
[0011] The valid driving trajectories in the trajectory set TS are retained, and the driving trajectories when the taxi is occupied are regarded as valid driving trajectories.
[0012] Furthermore, the grid cell sequence MT i The formation method is as follows:
[0013] Calculate the grid number P of the i-th trajectory point i , get the trajectory T i The grid numbers of all trajectory points are put into the grid unit sequence MT in sequence. i In which, the grid number P i The calculation formula is as follows:
[0014]
[0015] Among them, Lon max , Lon min , Lat max Respectively represent the maximum longitude, minimum longitude, and maximum latitude of the city map range, lon i ,lat i They represent the longitude and latitude of the i-th track point to be measured, respectively, and m represents the set grid size.
[0016] Furthermore, a day is divided into four periods, including three peak periods and one non-peak period, namely, the morning peak period, the afternoon peak period, the evening peak period and the non-peak period.
[0017] Furthermore, the grid cell sequence MT of all driving trajectories in the trajectory set TS is i Classify by time period and find the popular paths in the grid unit sequence of different time periods. There are k popular paths.
[0018] Furthermore, the popular path finding methods in different time periods are as follows:
[0019] According to the gridded city map, all paths between the fixed starting point and the end point are obtained, the nodes in all paths are numbered in sequence, and the frequency values of all nodes in the corresponding time period are obtained; starting from the starting point, each driving trajectory T is compared in sequence jThe frequency values of the nodes with the same number are calculated, and the driving paths of the k nodes with the largest frequency values are retained. Among them, the driving trajectory T j Belongs to time period t.
[0020] Furthermore, the method for obtaining the abnormality score of the driving trajectory to be detected is as follows:
[0021] Calculate the trajectory to be detected T i PR with various popular paths p The grid difference distance GDDis(MT i ,PR p );
[0022] Based on popular path PR p The proportion of the node frequency on the corresponding popular path PR is calculated p The popularity weight of
[0023] The driving trajectory to be detected T i Distance from each popular path PR p The sum of the product of the grid differential distance and the popularity weight of the corresponding popular path is the driving trajectory to be detected T i Anomaly score Anomaly Scoring The calculation formula is as follows:
[0024]
[0025] Where k represents the total number of popular paths.
[0026] Furthermore, the grid difference distance GDDis (MT i ,PR p ) is calculated as follows:
[0027]
[0028] Among them, MT i \PR p Represents the driving trajectory T i The grid cell sequence MT i With popular path PR p The difference set, that is, the grid cell sequence MT i Not in popular path PR p The collection of grid cells in |MT i \PR p | represents the total number of grid cells in the difference set, |MT i | represents the grid cell sequence MT i The total number of grid cells in .
[0029] Further, popular path PR p The popularity weight of The calculation formula is as follows:
[0030]
[0031] Where k represents the total number of popular paths, PR q .v i .f i represents the i-th node v in the q-th popular path i The frequency value, PR p .v i .f i represents the i-th node v in the popular path p i Frequency value, m q Represents the popular path PR q The number of nodes on .
[0032] The abnormal trajectory detection method based on popular paths provided by the present invention has the following beneficial effects: according to the traffic flow situation in a day, a day is divided into several time periods. The abnormal detection of each trajectory is divided into several blocks and performed separately according to the different time periods of the trajectory, so that different trajectories correspond to different popular paths by combining the time attribute, and the detection accuracy of abnormal trajectories is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 This is a flow chart of an abnormal trajectory detection method based on popular paths according to an embodiment of the present invention;
[0034] Figure 2 An example of a trajectory between a fixed starting point and an end point provided in an embodiment of the present invention:
[0035] Figure 3 A schematic diagram of a real road network gridded with a road network map provided by an embodiment of the present invention:
[0036] Figure 4 A schematic diagram of an urban road network and a track provided in an embodiment of the present invention after being processed in the same gridding manner:
[0037] Figure 5 The road network subgraphs for each time period provided by the embodiment of the present invention are: DETAILED DESCRIPTION
[0038] The specific implementation modes of the present invention are further explained in detail below by describing the embodiments with reference to the accompanying drawings, so as to help those skilled in the art to have a more complete, accurate and in-depth understanding of the inventive concept and technical solution of the present invention.
[0039] Related definitions
[0040] 1) Trajectory: Trajectory point p i =(x i ,y i ,t i ), where (x i ,y i ) represents the longitude and latitude of the i-th trajectory point, t i represents the timestamp of the ith trajectory point, and the trajectory T i is the composition of the trajectory point sequence, T i =(p1,p2,...,p n ).
[0041] 2) Road network: The road network is denoted as G = (V, E), which is a directed graph; V represents the node, i.e. the starting point and end point of the road segment, E is the edge set, i.e. the road segment, and the trajectory is formed by connecting several road segments. i and node v j are the two endpoints of a road segment, which are expressed as follows: φ(v i ,v j )=0, where the direction of the edge is v i →v j , and denote this edge as Otherwise, record the edge as
[0042] 3) Path popularity: When considering the popularity of a path, each path T i As an ordered frequency sequence, there exists R i =( <v s ,8:00am,33>,<v1,8:12am,27> ,<v2,8:20am,22> , <v D ,8:30am,15>), the popularity of the node is quantified specifically through its frequency value.
[0043] 4) Path popularity comparison: For two paths R and R′, assume that the two paths are represented by ordered frequency sequences, that is, Indicates the path R m R The frequency value of the node (the last node); Represents the mth path R′ R′ The frequency value of the node (the last node), when f x =f′ x ,x∈{1,2,3,...,l-1}, where l>2, if f l =f′ l , then path R is more popular than path R′.
[0044] Figure 1 The flowchart of the abnormal trajectory detection method based on the popular path in the embodiment of the present invention is as follows:
[0045] S1, grid the city map and put the driving trajectory from the starting point S to the end point D into the trajectory set TS;
[0046] First, grid the city map, determine the starting point S and the end point D in the city map, and construct the starting area and the ending area with the starting point S and the end point D as the center line respectively. Both areas are defined as a grid of 1000m*1000m in size. Obtain all trajectories between the ranges and put them into the trajectory set TS. Figure 3 The gridded state of some urban road networks is shown in Figure 2. At the same time, in order to facilitate the calculation of the distance between the trajectory and the popular path, the grid cells are sorted in chronological order.
[0047] Before performing trajectory anomaly detection, the trajectory set TS is preprocessed to remove invalid trajectories. Invalid and redundant trajectories in the trajectory set TS often consume too much detection time and affect the accuracy of detection. In the detection of taxi trajectories, anomalies often occur when there are passengers on board. Therefore, when extracting trajectories, the trajectories when the taxi is occupied (i.e., carrying passengers) are regarded as valid trajectories. Figure 2 In the figure, t1-t8 is a valid trajectory between a fixed position S and a fixed position D, that is, a valid detection trajectory specified in the present invention. In addition, the gridding method of the city map is the same as the following driving trajectory gridding method.
[0048] S2, the driving trajectory T in the trajectory set TS i Gridding to form a driving trajectory T i The grid cell sequence MT i ;
[0049] In the embodiment of the present invention, after the urban road network is gridded, in order to ensure that the grid number sequence P of the trajectories and paths of the same nature is obtained, i , the trajectory data is gridded using the same gridding method, and the results are as follows Figure 4 According to the longitude and latitude data of the city map and the set grid size, the following formula (1) is used to obtain the grid number P of the i-th track point: i :
[0050]
[0051] Among them, Lon max , Lon min , Lat max Respectively represent the maximum longitude, minimum longitude, and maximum latitude of the city map range, loni ,lat i They represent the longitude and latitude of the i-th track point to be measured, and m represents the size of the grid.
[0052] Get trajectory T i The grid numbers of all trajectory points are put into the grid unit sequence MT in sequence. i Medium, namely MT i = {P i1 ,P i2 ,...,P im}, where P im Represents the trajectory T i The grid number of the mth (last) trajectory point.
[0053] S3, divide the time into peak hours and non-peak hours of traffic flow, combined with the grid unit sequence MT i The time period and the path node probability between the starting point and the end point are used to obtain the popular paths during peak and non-peak hours;
[0054] In the embodiment of the present invention, a day is divided into four time periods, including three peak time periods and one non-peak time period, namely, the morning peak time period (7:00-9:00), the afternoon peak time period (11:00-13:00), the evening peak time period (17:00-19:00) and the non-peak time period. The popular path acquisition method of the above four time periods is as follows:
[0055] The grid cell sequence MT of all driving trajectories in the trajectory set TS i Classify by time period and find popular trajectories in the grid unit sequence of different time periods. The popular trajectories can be k. The popular trajectory search process of time period t is as follows:
[0056] According to the gridded city map, all paths between the fixed starting point S and the end point D are obtained, the nodes (i.e., intersections) in all paths are obtained, the nodes of each path are numbered in sequence, and the frequency values of all nodes in the corresponding time period are obtained; starting from the starting point, each driving trajectory T is compared in sequence j The frequency values of nodes with the same number are calculated, and the paths where the k nodes with the largest frequency values are located are retained. Among them, the driving trajectory T j Belongs to time period t, where t takes values from 1 to 4.
[0057] If the current numbered node has r (r>k) maximum frequency values with the same value at the same time, then keep all the maximum frequency values, obtain the frequency value of the next numbered node in all paths, and select the path where the k nodes with the largest frequency value are located. The node frequency refers to the number of trajectories passing through the node within a specified time.
[0058] When obtaining the popular path (i.e., the optimal path) of the driving trajectory to be detected, the present invention abandons the viewpoint of regarding the shortest path as the optimal path, but instead maps the trajectory set TS to its corresponding urban road network by dividing the time to obtain a subgraph of the road network (which contains the frequency values of each node of each path in four different time periods). Figure 5 This follows from the fact that the optimal path is not a static pattern, but a dynamic pattern that changes over time.
[0059] The acquisition of popular paths and the calculation of popular path weights are shown in Algorithm 1, which is as follows:
[0060]
[0061]
[0062] The urban road network map is gridded into a series of grid unit sequences (row 1). Then, according to the gridded road network data, the starting and ending grid numbers of each trajectory are traversed in turn, so that the trajectories with the starting and ending points in the same grid are divided into the same cluster (rows 3-7). All trajectories between the fixed starting and ending positions are gridded using the same gridding method (row 8). The trajectories are traversed to obtain the frequency values of each path node in different time periods, and finally the node frequency graph NFG is obtained (row 11). The node frequency graph NFG is shown in the figure. Figure 5 As shown in the figure, according to the frequency value of each node in NFG, the popular path corresponding to the trajectory to be tested can be obtained (line 12). Finally, the popular weight of each popular trajectory is calculated by formula (3) (line 15) and put into the WeightList list (line 16).
[0063] S4. Generate an abnormality score for the driving trajectory to be detected based on the distance between the driving trajectory to be detected and the popular path in the corresponding time period. If the abnormality score is greater than a set abnormality score threshold, the corresponding driving trajectory to be detected is determined to be an abnormal trajectory; otherwise, the corresponding driving trajectory to be detected is determined to be a normal trajectory.
[0064] In the embodiment of the present invention, the driving trajectory to be detected T i With popular path PR p The grid difference distance GDDis(MT i ,PR p ) is calculated as follows:
[0065]
[0066] Among them, MT i \PR p Represents the driving trajectory T iThe grid cell sequence MT i With popular path PR p The difference set, that is, the grid cell sequence MT i Not in popular path PR p The grid cells in the difference set are in the grid cell sequence MT i Medium, but not in the popular path PR p Medium;|MT i \PR p | represents the total number of grid cells in the difference set, |MT i | represents the grid cell sequence MT i The total number of grid cells in .
[0067] Since the frequency values of each node on each popular path are different, the popularity weight of the optimal path is also different. Therefore, the popularity path PR can be obtained by the proportion of each node on the popular path. p The popularity weight of The calculation formula is as follows:
[0068]
[0069] Where k represents the total number of popular paths, PR q .v i .f i represents the i-th node v in the q-th popular path i The frequency value, PR p .v i .f i represents the i-th node v in the popular path p i Frequency value, m q Represents the popular path PR q The number of nodes on .
[0070] Calculate the driving trajectory T to be detected i Distance from each popular path PR p The sum of the grid differential distance and the weight of the corresponding popular path is the driving trajectory to be detected T i Anomaly score Anomaly Scoring The calculation formula is as follows:
[0071]
[0072] The abnormal driving trajectory detection method based on time period is shown in Algorithm 2. The details of Algorithm 2 are as follows:
[0073]
[0074] Initialize the anomaly score (line 1); then, traverse the time period of each trajectory in turn to obtain the popular path of the corresponding time period and use it as the reference path of the trajectory to be tested (lines 2-5); then, traverse k popular paths in turn to calculate the GDDis distance between the trajectory to be tested and the popular path, and then get the final anomaly score value by accumulation (lines 6-11); finally, compare the obtained anomaly score anomal score with the given anomaly score threshold. If the anomaly score is greater than the given threshold, it will be regarded as an abnormal driving trajectory, otherwise it will be regarded as a normal driving trajectory (lines 12-15); so far, the whole process accurately detects abnormal driving trajectories by quantifying the similarity between the driving trajectory and the popular path.
[0075] The abnormal trajectory detection method based on popular paths provided by the present invention has the following beneficial effects:
[0076] (1) Obtain all paths between fixed starting locations based on the city road network data and divide the city map into grid cells of the same size. Obtain the trajectories between the determined locations and extract the trajectories when the taxi is occupied as valid trajectories, thus avoiding invalid and redundant trajectory interference.
[0077] (2) According to the traffic flow in a day, the day is divided into four time periods. The anomaly detection of each trajectory is divided into four modules according to the different time periods of the trajectory. In this way, the time attribute is combined to make different trajectories correspond to different popular paths, which improves the detection accuracy of abnormal trajectories.
[0078] (3) When selecting the best path, we abandon the traditional idea of selecting the shortest path as the best path. Instead, we combine the time period of the trajectory and the probability of each path node to obtain the node frequency graph NFG, and finally get the final optimal path by arranging the frequency values of each node in descending order.
[0079] (4) A new distance metric is proposed, namely, the differential distance between the trajectory and the optimal path after gridding. By gridding the trajectory, all trajectories are replaced by grid numbers.
[0080] The present invention has been described exemplarily. Obviously, the specific implementation of the present invention is not limited to the above-mentioned method. As long as various non-substantial improvements are made using the method concept and technical solution of the present invention, or the concept and technical solution of the present invention are directly applied to other occasions without improvement, they are all within the protection scope of the present invention.
Claims
1. A method for detecting abnormal trajectories based on popular paths, characterized in that: The method specifically comprises the following steps: S1, gridding the city map, putting the driving trajectory from the starting point to the end point into the trajectory set TS; S2, the driving trajectory T in the trajectory set TS i Gridding to form a driving trajectory T i The grid cell sequence MT i ; S3, divide the time into peak hours and non-peak hours of traffic flow, combined with the grid unit sequence MT i The time period and the path node probability between the starting point and the end point are used to find the popular paths during peak and non-peak hours; S4, generating an abnormality score of the driving trajectory to be detected based on the distance between the driving trajectory to be detected and the popular path in the corresponding time period, and if the abnormality score is greater than a set abnormality score threshold, the corresponding driving trajectory to be detected is determined to be an abnormal trajectory; The method for obtaining the abnormal score of the driving trajectory to be detected is as follows: Calculate the trajectory to be detected T i PR with various popular paths p The grid difference distance GDDis(MT i ,PR p ); Based on popular path PR p The proportion of the node frequency on the corresponding popular path PR is calculated p The popularity weight of The driving trajectory to be detected T i Distance from each popular path PR p The sum of the product of the grid differential distance and the popularity weight of the corresponding popular path is the driving trajectory to be detected T i Anomaly score Anomaly Scoring The calculation formula is as follows: Where k represents the total number of popular paths; Grid difference distance GDDis(MT i ,PR p ) is calculated as follows: Among them, MT i \PR p Represents the driving trajectory T i The grid cell sequence MT i With popular path PR p The difference set, that is, the grid unit sequence MT i Not in popular path PR p The collection of grid cells in |MT i \PR p | represents the total number of grid cells in the difference set, |MT i | represents the grid cell sequence MT i The total number of grid cells in ; Popular Path PR p The popularity weight of The calculation formula is as follows: Where k represents the total number of popular paths, PR q .v i .f i represents the i-th node v in the q-th popular path i The frequency value, PR p .v i .f i represents the i-th node v in the popular path p i Frequency value, m q Represents the popular path PR q The number of nodes on .
2. The abnormal trajectory detection method based on popular paths as claimed in claim 1, characterized in that: After step S1, the method further includes: The valid driving trajectories in the trajectory set TS are retained, and the driving trajectories when the taxi is occupied are regarded as valid driving trajectories.
3. The abnormal trajectory detection method based on popular paths as claimed in claim 1, characterized in that: Grid cell sequence MT i The formation method is as follows: Calculate the grid number P of the i-th trajectory point i , get the trajectory T i The grid numbers of all trajectory points are put into the grid unit sequence MT in sequence. i middle, Among them, the grid number P i The calculation formula is as follows: Among them, Lon max , Lon min , Lat max Respectively represent the maximum longitude, minimum longitude, and maximum latitude of the city map range, lon i ,lat i They represent the longitude and latitude of the i-th track point to be measured, respectively, and m represents the set grid size.
4. The abnormal trajectory detection method based on popular paths as claimed in claim 1, characterized in that: The day is divided into four periods, including three peak periods and one off-peak period, namely the morning peak period, the afternoon peak period, the evening peak period and the off-peak period.
5. The abnormal trajectory detection method based on popular paths as claimed in claim 4, characterized in that: The grid cell sequence MT of all driving trajectories in the trajectory set TS i Classify by time period and find the popular paths in the grid unit sequence of different time periods. There are k popular paths.
6. The abnormal trajectory detection method based on popular paths as claimed in claim 4, characterized in that: The popular path finding methods in different time periods are as follows: According to the gridded city map, all paths between the fixed starting point and the end point are obtained, the nodes in all paths are numbered in sequence, and the frequency values of all nodes in the corresponding time period are obtained; Starting from the starting point, compare each driving trajectory T in turn j The frequency values of the nodes with the same number are calculated, and the driving paths of the k nodes with the largest frequency values are retained. Among them, the driving trajectory T j Belongs to time period t.
