A clustering method for vehicle urban driving trajectories and driving behaviors
By simplifying the vehicle trajectory and corner point extraction, combining the optimization of space-time index and editing distance algorithm, the problems of low computing efficiency and difficulty in extracting driving features in the existing technology are solved, and efficient trajectory clustering and feature extraction are achieved.
Patent Information
- Application Number
- CN202210345673.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-02
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2042-04-02
AI Technical Summary
The prior art has low computing efficiency and is difficult to effectively extract driving characteristics in the clustering of vehicle city driving trajectories and driving behaviors, especially when processing massive trajectory data.
By simplifying the trajectory, extracting corner points, and building spatiotemporal indexes, optimizing the editing distance algorithm, clustering analysis is performed using density-based clustering methods and quadtree methods.
Improve computing efficiency, extract more trajectory features, and achieve the accuracy of distance calculation in specific scenarios.
Smart Images

Figure CN114781493B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data mining, and in particular to a clustering method for vehicle urban driving trajectories and driving behaviors. Background Art
[0002] With the popularization of vehicle-mounted positioning terminals and the installation of data collection equipment on the road, it has become possible to manage different types of vehicles in the city and refine the optimization methods of traffic. The trajectory data of vehicle-mounted positioning is a spatial point with attached time and motion characteristics, and the trajectory data of road data collection equipment is a fixed spatial point with attached time and graphic characteristics. The combination of the two types of information can basically describe all the states of the vehicle, and can analyze and infer a large amount of relevant behavior information and personnel information.
[0003] Mining vehicle trajectories helps to classify urban traffic so that it can be guided and managed according to different categories. At the same time, it can timely alarm and lock specific driving characteristics to ensure road safety. It has extremely high value for the planning and management of the traffic system and the early warning and tracking of the public security system.
[0004] In traditional clustering methods for trajectory data, more attention is paid to the spatial distribution characteristics of the start and end points of the entire trajectory. The start and end points are simply divided into units of days or single travel, which cannot reasonably highlight the characteristics of a certain behavior. The spatial distribution characteristics of concern are mostly measured by Euclidean distance, and the massive amount of trajectories leads to a huge amount of calculation and does not take into account time and motion characteristics. Therefore, it is difficult to efficiently extract driving characteristics. Summary of the invention
[0005] In view of the above-mentioned defects of the prior art, the technical problem to be solved by the present invention is to provide a clustering method for vehicle urban driving trajectories and driving behaviors. In terms of practicality, the method simplifies the trajectories according to the characteristics of urban roads, thereby greatly improving the calculation efficiency, and at the same time reasonably decomposes the traditional length trajectory data analysis problem to obtain more trajectory features. The method optimizes the edit distance algorithm in calculation, making the distance calculation more accurate in specific scenarios.
[0006] To achieve the above object, the present invention provides a clustering method for vehicle urban driving trajectories and driving behaviors, comprising the following steps:
[0007] Step 1: Simplify the trajectory and then extract the corner points;
[0008] Step 2: Cluster the corner points and build a spatiotemporal index;
[0009] Step 3: Use the index obtained in step 2 to compile the trajectory sample to obtain the trajectory code;
[0010] Step 4: Define the distance parameters of trajectory encoding;
[0011] Step 5: Cluster analysis of trajectories in different dimensions.
[0012] Furthermore, the simplification of the trajectory and the extraction of the corner points specifically include:
[0013] S11. Connect the daily driving trajectories of the sample vehicles in chronological order so that the point data are converted into line data, and then use the Douglas Peucker method to simplify the trajectory; the Douglas Peucker method connects the first and last points of the curve to be processed with a straight line, calculates the distance between all the middle points and the straight line, and finds the maximum distance value D max , use D max and the thinning threshold T dp In comparison: if D max Less than T dp , all the middle points on this curve are discarded; if D max Greater than or equal to T dp , then the curve is divided into two parts with this point as the boundary; repeat the above process for these two parts of the curve until all points are processed;
[0014] S12: For the simplified trajectory points, calculate the direction angle of the line segment formed by the checkpoint and the next checkpoint in chronological order, and calculate the difference between the direction angles of the previous checkpoint and the checkpoint. If the direction angle difference is greater than the turning angle threshold T turn It is considered to be a corner point and saved as the corner point set X turn ;
[0015] S13. For the unsimplified trajectory points, check each point in chronological order, accumulate the speed change difference feature, direction change difference feature, and distance feature between each point and the previous point, and when encountering a simplified result point, store the accumulated data in the corner point set X. turn field, and the accumulated value is reset to zero and accumulated again, and this operation is repeated until the last point is checked.
[0016] Furthermore, the corner points are clustered and a spatiotemporal index is constructed, specifically:
[0017] S21. Define the scanning radius R suitable for urban roads and define the minimum number of included points Pt min =2, for the corner point set X turn Use the density-based clustering method DBSCAN to cluster the cluster C turn , calculate the center point of each cluster based on the mean value, and get the corner point cluster set P turn , and clear the corner point set X turn ;
[0018] S22, use the quadtree method to cluster the corner points Pturn Build Index I turn Until each point in the point set exists on a separate leaf node, record the minimum spatial resolution T dis , respectively, for the corner point cluster set P turn The longitude and latitude of the midpoints are sorted from low to high, and the point numbers P are formed according to the sorting order. i =[a,b].
[0019] Furthermore, the index obtained in step 2 is used to compile the trajectory sample to obtain the trajectory code, specifically:
[0020] S31, perform the same step 1 corner point extraction on a single track, and extract the obtained corner points according to the spatial index I turn Get the corner points in the corner point cluster set P turn If the distance between the closest point and the nearest point is less than or equal to the minimum spatial resolution T of the index dis Then take the number of the nearest point as the corner number. If it is greater than, record the corner point to point set N. turn At the same time, the number of the nearest point is taken as the corner number, and the numbers are calculated and connected in chronological order, and the trajectory is abstracted into a number string;
[0021] S32, when point set N turn The value is greater than the update threshold N update Repeat step 2.
[0022] Furthermore, the distance parameter defining the trajectory encoding is specifically:
[0023] S41. Calculate the edit distance between tracks and the edit distance between two strings according to the number string of each track obtained in S31. a,b The method is:
[0024]
[0025] Where i and j are the first i and j characters of string a and string b respectively, and the expression of t is:
[0026]
[0027] S42, according to the numbered string of each track obtained in S31, calculate the longest common substring LCS, and the method for calculating the longest common substring LCS of the edit distance between two strings is:
[0028]
[0029] LCS a,b =Max(LCS a,b(i,j))
[0030] Where i and j are the i-th and j-th characters of string a and string b respectively;
[0031] S43, the calculated longest common substring is split into a separate trajectory number string, and the motion feature obtained in S13 is obtained according to the number of the longest common substring, and the speed distance D is calculated. v =|D va -D vb |、Direction distance D d =|D da -D db |、Spatial distance D s =|D sa -D sb |;
[0032] S44, normalizing all distances obtained in step 4;
[0033]
[0034] Furthermore, the cluster analysis of the trajectories in different dimensions is specifically as follows:
[0035] S51, in the scenario of simply calculating trajectory clusters, using the edit distance obtained in steps S41 and S42 to perform density-based clustering;
[0036] S52: In the scenario of identifying driver clusters, calculate the comprehensive distance to perform density-based clustering, wherein the comprehensive distance calculation method is:
[0037] The variances of speed distance, direction distance, and spatial distance are:
[0038]
[0039] The calculated comprehensive distance weight is:
[0040]
[0041] The comprehensive distance is calculated as follows:
[0042] D=[Edit a,b D v D d D s ]*W.
[0043] The beneficial effects of the present invention are:
[0044] In terms of practicality, the method of the present invention simplifies the trajectory according to the characteristics of urban roads, thereby greatly improving the calculation efficiency, and at the same time reasonably decomposes the traditional length trajectory data analysis problem to obtain more trajectory features. In terms of calculation, the method optimizes the edit distance algorithm to make the distance calculation more accurate in specific scenarios.
[0045] The concept, specific structure and technical effects of the present invention will be further described below in conjunction with the accompanying drawings to fully understand the purpose, characteristics and effects of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 is a schematic method flow chart of the present invention;
[0047] Figure 2 It is a specific method flow chart of the present invention. DETAILED DESCRIPTION
[0048] like Figure 1 , 2 As shown, the present invention provides a clustering method for vehicle urban driving trajectories and driving behaviors, comprising the following steps:
[0049] Step 1: Simplify the trajectory and then extract the corner points;
[0050] Step 2: Cluster the corner points and build a spatiotemporal index;
[0051] Step 3: Use the index obtained in step 2 to compile the trajectory sample to obtain the trajectory code;
[0052] Step 4: Define the distance parameters of trajectory encoding;
[0053] Step 5: Cluster analysis of trajectories in different dimensions.
[0054] In this embodiment, the trajectory is simplified and then the corner points are extracted, which specifically includes:
[0055] S11. Connect the daily driving trajectories of the sample vehicles in chronological order to convert the point data into line data, and then use the Douglas Peuker method to simplify the trajectory; the Douglas Peuker method connects the first and last points of the curve to be processed with a straight line, calculates the distance between all the middle points and the straight line, and finds the maximum distance value D max , use D max and the thinning threshold T dp In comparison: if D max Less than T dp , all the middle points on this curve are discarded; if D max Greater than or equal to T dp , then the curve is divided into two parts with this point as the boundary; repeat the above process for these two parts of the curve until all points are processed;
[0056] S12: For the simplified trajectory points, calculate the direction angle of the line segment formed by the checkpoint and the next checkpoint in chronological order, and calculate the difference between the direction angles of the previous checkpoint and the checkpoint. If the direction angle difference is greater than the turning angle threshold T turn It is considered to be a corner point and saved as the corner point set X turn ;
[0057] S13. For the unsimplified trajectory points, check each point in chronological order, accumulate the speed change difference feature, direction change difference feature, and distance feature between each point and the previous point, and when encountering a simplified result point, store the accumulated data in the corner point set X. turn The accumulated value is reset to zero and accumulated again, and this operation is repeated until the last point is checked;
[0058] In this embodiment, the corner points are clustered and a spatiotemporal index is constructed, specifically:
[0059] S21. Define the scanning radius R suitable for urban roads and define the minimum number of included points Pt min =2, for the corner point set X turn Use the density-based clustering method DBSCAN to cluster the cluster C turn , calculate the center point of each cluster based on the mean value, and get the corner point cluster set P turn , and clear the corner point set X turn ;
[0060] S22, use the quadtree method to cluster the corner points P turn Build Index I turn Until each point in the point set exists on a separate leaf node, record the minimum spatial resolution T dis , respectively, for the corner point cluster set P turn The longitude and latitude of the midpoints are sorted from low to high, and the point numbers P are formed according to the sorting order. i =[a,b].
[0061] In this embodiment, the index obtained in step 2 is used to compile the trajectory sample to obtain the trajectory code, specifically:
[0062] S31, perform the same step 1 corner point extraction on a single track, and extract the obtained corner points according to the spatial index I turn Get the corner points in the corner point cluster set P turn If the distance between the closest point and the nearest point is less than or equal to the minimum spatial resolution T of the index dis Then take the number of the nearest point as the corner number. If it is greater than, record the corner point to point set N. turnAt the same time, the number of the nearest point is taken as the corner number, and the numbers are calculated and connected in chronological order, and the trajectory is abstracted into a number string;
[0063] S32, when point set N turn The value is greater than the update threshold N update Repeat step 2.
[0064] In this embodiment, the distance parameter of the trajectory encoding is defined as:
[0065] S41. Calculate the edit distance between tracks and the edit distance between two strings according to the number string of each track obtained in S31. a,b The method is:
[0066]
[0067] Where i and j are the first i and j characters of string a and string b respectively, and the expression of t is:
[0068]
[0069] S42, according to the numbered string of each track obtained in S31, calculate the longest common substring LCS, and the method for calculating the longest common substring LCS of the edit distance between two strings is:
[0070]
[0071] LCS a,b =Max(LCS a,b (i,j))
[0072] Where i and j are the i-th and j-th characters of string a and string b respectively;
[0073] S43, the calculated longest common substring is split into a separate trajectory number string, and the motion feature obtained in S13 is obtained according to the number of the longest common substring, and the speed distance D is calculated. v =|D va -D vb |、Direction distance D d =|D da -D db |、Spatial distance D s =|D sa -D sb |;
[0074] S44, normalizing all distances obtained in step 4;
[0075]
[0076] In this embodiment, cluster analysis is performed on the trajectories in different dimensions, specifically:
[0077] S51, in the scenario of simply calculating trajectory clusters, using the edit distance obtained in steps S41 and S42 to perform density-based clustering;
[0078] S52: In the scenario of identifying driver clusters, calculate the comprehensive distance to perform density-based clustering, wherein the comprehensive distance calculation method is:
[0079] The variances of speed distance, direction distance, and spatial distance are:
[0080]
[0081] The calculated comprehensive distance weight is:
[0082]
[0083] The comprehensive distance is calculated as follows:
[0084] D=[Edit a,b D v D d D s ]*W.
[0085] The preferred specific embodiments of the present invention are described in detail above. It should be understood that a person skilled in the art can make many modifications and changes based on the concept of the present invention without creative work. Therefore, any technical solution that can be obtained by a person skilled in the art through logical analysis, reasoning or limited experiments based on the concept of the present invention on the basis of the prior art should be within the scope of protection determined by the claims.
Claims
1. A clustering method for vehicle urban driving trajectories and driving behaviors, characterized in that: The following steps are involved: Step 1: Simplify the trajectory and then extract the corner points; Step 2: Cluster the corner points and build a spatiotemporal index; Step 3: Use the index obtained in step 2 to compile the trajectory sample to obtain the trajectory code; Step 4: Define the distance parameters of trajectory encoding; Step 5: Cluster analysis of trajectories in different dimensions; The simplification of the trajectory and then extraction of the corner points specifically include: S11. Connect the daily driving trajectories of the sample vehicles in chronological order so that the point data are converted into line data, and then use the Douglas Peucker method to simplify the trajectory; the Douglas Peucker method connects the first and last points of the curve to be processed with a straight line, calculates the distance between all the middle points and the straight line, and finds the maximum distance value D max , use D max and the thinning threshold T dp In comparison: if D max Less than T dp , all the middle points on this curve are discarded; if D max Greater than or equal to T dp , then the curve is divided into two parts with this point as the boundary; repeat the above process for these two parts of the curve until all points are processed; S12: For the simplified trajectory points, calculate the direction angle of the line segment formed by the checkpoint and the next checkpoint in chronological order, and calculate the difference between the direction angles of the previous checkpoint and the checkpoint. If the direction angle difference is greater than the turning angle threshold T turn It is considered to be a corner point and saved as the corner point set X turn ; S13. For the unsimplified trajectory points, check each point in chronological order, accumulate the speed change difference feature, direction change difference feature, and distance feature between each point and the previous point, and when encountering a simplified result point, store the accumulated data in the corner point set X. turn The accumulated value is reset to zero and accumulated again, and this operation is repeated until the last point is checked; The index obtained in step 2 is used to compile the trajectory sample to obtain the trajectory code, specifically: S31, perform the same step 1 corner point extraction on a single track, and extract the obtained corner points according to the spatial index I turn Get the corner points in the corner point cluster set P turn If the distance between the closest point and the nearest point is less than or equal to the minimum spatial resolution T of the index dis Then take the number of the nearest point as the corner number. If it is greater than, record the corner point to point set N. turn At the same time, the number of the nearest point is taken as the corner number, and the numbers are calculated and connected in chronological order, and the trajectory is abstracted into a number string; S32, when point set N turn The value is greater than the update threshold N update Repeat step 2; The distance parameters for defining trajectory encoding are specifically: S41. Calculate the edit distance between tracks and the edit distance between two strings according to the number string of each track obtained in S31. a,b The method is: Where i and j are the first i and j characters of string a and string b respectively, and the expression of t is: S42, according to the numbered string of each track obtained in S31, calculate the longest common substring LCS, and the method for calculating the longest common substring LCS of the edit distance between two strings is: LCS a,b =Max(LCS a,b (i,j)) Where i and j are the i-th and j-th characters of string a and string b respectively; S43, the calculated longest common substring is split into a separate trajectory number string, and the motion feature obtained in S13 is obtained according to the number of the longest common substring, and the speed distance D is calculated. v =|D va -D vb |、Direction distance D d =|D da -D db |、Spatial distance D s =|D sa -D sb |; S44, normalizing all distances obtained in step 4; 2. The clustering method of vehicle urban driving trajectory and driving behavior according to claim 1, characterized in that: The clustering of corner points and the construction of spatiotemporal index are specifically as follows: S21. Define the scanning radius R suitable for urban roads and define the minimum number of included points Pt min =2, for the corner point set X turn Use the density-based clustering method DBSCAN to cluster the cluster C turn , calculate the center point of each cluster based on the mean value, and get the corner point cluster set P turn , and clear the corner point set X turn ; S22, use the quadtree method to cluster the corner points P turn Build Index I turn , until the corner point cluster set P turn Each point in the tree exists on a separate leaf node, recording the minimum spatial resolution T dis , respectively, for the corner point cluster set P turn The longitude and latitude of the midpoints are sorted from low to high, and the point numbers P are formed according to the sorting order. i =[a,b].
3. The clustering method of vehicle urban driving trajectory and driving behavior as claimed in claim 1, characterized in that: The cluster analysis of trajectories in different dimensions is specifically as follows: S51, in the scenario of simply calculating trajectory clusters, using the edit distance obtained in steps S41 and S42 to perform density-based clustering; S52: In the scenario of identifying driver clusters, calculate the comprehensive distance to perform density-based clustering, wherein the comprehensive distance calculation method is: The variances of speed distance, direction distance, and spatial distance are: The calculated comprehensive distance weight is: The comprehensive distance is calculated as follows: D=[Edit a,b D v D d D s ]*W。
Citation Information
Patent Citations
Sign-in data based user behavior trajectory clustering method
CN105243128A
Urban intersection lane-level structure extraction method based on time-space trajectory big data
CN105788274A