CN115982592A - Trajectory similarity calculation method, trajectory similarity calculation device, and storage medium - Google Patents

Trajectory similarity calculation method, trajectory similarity calculation device, and storage medium Download PDF

Info

Publication number
CN115982592A
CN115982592A CN202211328457.6A CN202211328457A CN115982592A CN 115982592 A CN115982592 A CN 115982592A CN 202211328457 A CN202211328457 A CN 202211328457A CN 115982592 A CN115982592 A CN 115982592A
Authority
CN
China
Prior art keywords
track
distance
value
point
similarity calculation
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211328457.6A
Other languages
Chinese (zh)
Inventor
王贺松
王龙
陈立力
周明伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Dahua Technology Co Ltd
Original Assignee
Zhejiang Dahua Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Dahua Technology Co Ltd filed Critical Zhejiang Dahua Technology Co Ltd
Priority to CN202211328457.6A priority Critical patent/CN115982592A/en
Publication of CN115982592A publication Critical patent/CN115982592A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Image Analysis (AREA)

Abstract

The application discloses a trajectory similarity calculation method, a trajectory similarity calculation device and a computer storage medium, wherein the trajectory similarity calculation method comprises the following steps: acquiring at least two tracks; calculating a distance matrix between the tracks based on the first track and the second track, wherein the distance matrix comprises a plurality of track point distances; traversing the trace point distances in the distance matrix, and acquiring a position lower bound value of each trace point distance; judging whether the lower limit value of the position with any track point distance is larger than or equal to a preset threshold value; and if so, setting the track similarity of the first track and the second track as a preset distance. Through the mode, the distance matrix based on the first track and the second track is subjected to threshold processing by using the preset threshold, and the position lower bound value of each point in the distance matrix is compared with the preset threshold, so that the track similarity calculation of which the position lower bound value is greater than or equal to the preset threshold is directly excluded, and the time for calculating the track similarity is reduced.

Description

Trajectory similarity calculation method, trajectory similarity calculation device, and storage medium
Technical Field
The present application relates to the field of data mining, and in particular, to a trajectory similarity calculation method, a trajectory similarity calculation apparatus, and a computer storage medium.
Background
With the continuous development of science and technology, more and more people choose to use the car to go out in the aspect of going out. The analysis of the travel trajectory of a vehicle for mining the spatiotemporal information data of the vehicle has become a hot issue of current academic and industrial concerns. Among them, the similarity measure to the travel trajectory of the vehicle is one of the most core problems.
In an application scenario, for the measurement of the similarity of vehicle tracks, an intuitive solution is to calculate the distance between the vehicle tracks. There are many methods for measuring the distance between tracks, such as maximum distance, minimum distance, average distance, and Hausdorff distance, among others. However, these calculation methods may have distortion and other problems for the measurement of the similarity of the trajectories when the trajectories have backspacing, looping and interleaving. The discrete Frechet distance includes a time sequence relation between track points, and the calculation process considers a node structure inside the track and can more accurately consider the similarity degree between the tracks, so that the description capability of the discrete Frechet distance is stronger, and the discrete Frechet distance is most suitable for being used as the measurement of the similarity between the tracks.
Disclosure of Invention
The method and the device mainly solve the technical problem that the current discrete Frechet distance is low in calculation efficiency, and accordingly the method and the device for calculating the track similarity are provided.
In order to solve the technical problem, the application adopts a technical scheme that: provided is a trajectory similarity calculation method, including: acquiring at least two tracks, wherein the at least two tracks comprise a first track and a second track; calculating a distance matrix between the tracks based on the first track and the second track, wherein the distance matrix comprises a plurality of track point distances, and each track point distance is obtained by calculating the coordinate of one first track point in the first track and the coordinate of one second track point in the second track; traversing the track point distance in the distance matrix, and acquiring a position lower bound value of each track point distance, wherein the position lower bound value of the track point distance is the minimum value of the track point distance and the distance between the transverse adjacent track points and the distance between the longitudinal adjacent track points; judging whether the lower limit value of the position with any track point distance is larger than or equal to a preset threshold value; if so, setting the track similarity of the first track and the second track as a preset distance; the transverse coordinates of the transversely adjacent track points are the same as the transverse coordinates of the distance between the track points, and the longitudinal coordinates of the transversely adjacent track points are smaller than the longitudinal coordinates of the distance between the track points; the longitudinal coordinate of the longitudinal adjacent track point is the same as the longitudinal coordinate of the distance of the track point, and the transverse coordinate of the longitudinal adjacent track point is smaller than the transverse coordinate of the distance of the track point.
After calculating a distance matrix between the trajectories based on the first trajectory and the second trajectory, the trajectory similarity calculation method includes: and updating the distance matrix based on a preset threshold value, and setting the track point distance with the numerical value greater than or equal to the preset threshold value in the distance matrix as a preset distance so as to obtain a threshold value constraint distance matrix.
The track similarity calculation method further comprises the following steps: under the condition that the lower bound value of the position without the track point distance is larger than or equal to a preset threshold value, a two-dimensional dynamic array is created on the basis of the first track and the second track; calculating element values of the two-dimensional dynamic array according to the path planning conditions based on the threshold constraint distance matrix; and determining the track similarity of the first track and the second track according to the element values of the two-dimensional dynamic array.
The method for calculating the element values of the two-dimensional dynamic array based on the threshold constraint distance matrix according to the path planning condition comprises the following steps: and responding to the condition that the distance of any point track point in the threshold constraint distance matrix is a preset distance, and setting the numerical value of the element value of the two-dimensional dynamic array corresponding to the distance of any point track point as the numerical value of the preset distance.
Wherein, based on the distance matrix according to the path planning condition, calculating the element value of the two-dimensional dynamic array, including: determining adjacent elements of the current element in the two-dimensional dynamic array according to the path planning condition; and acquiring the element value of the current element based on the distance matrix and the adjacent elements of the current element.
Wherein obtaining the element value of the current element based on the distance matrix and the neighboring elements of the current element comprises: obtaining a current track point distance corresponding to a current element based on the distance matrix; acquiring element values of adjacent elements of the current element, and determining the minimum element value of the adjacent elements of the current element; and taking the maximum value in the distance between the minimum element value and the current track point as the element value of the current element.
Before determining the adjacent elements of the current element in the two-dimensional dynamic array according to the path planning condition, the trajectory similarity calculation method further includes: according to the starting point of the first track and the starting point of the second track, positioning the starting point distance of the distance matrix and the starting point element of the two-dimensional dynamic array; and determining the value of the starting point distance as the element value of the starting point element.
The path planning conditions are as follows: the coordinate value of the current element is larger than the coordinate value of the adjacent element; wherein the coordinate values include a first coordinate value and/or a second coordinate value.
Determining the track similarity of the first track and the second track according to the element values of the two-dimensional dynamic array, wherein the determining comprises the following steps: positioning an end point element of the two-dimensional dynamic array according to the end point of the first track and the end point of the second track; and determining the track similarity of the first track and the second track by using the element value of the end point element of the two-dimensional dynamic array.
In order to solve the above technical problem, another technical solution adopted by the present application is: there is provided a trajectory similarity calculation apparatus comprising a processor and a memory, the memory being coupled to the processor, the memory storing program data, the processor being configured to execute the program data to implement the trajectory similarity calculation method as described above.
In order to solve the technical problem, the other technical scheme adopted by the application is as follows: there is provided a computer-readable storage medium storing program data for implementing the above-described trajectory similarity calculation method when the program data is executed.
The beneficial effect of this application is: different from the situation of the prior art, the trajectory similarity calculation method provided by the application is applied to a trajectory similarity calculation device, and the trajectory similarity calculation device acquires at least two trajectories, wherein the at least two trajectories include a first trajectory and a second trajectory; calculating a distance matrix between the tracks based on the first track and the second track, wherein the distance matrix comprises a plurality of track point distances, and each track point distance is calculated by the coordinate of one first track point in the first track and the coordinate of one second track point in the second track; traversing the track point distances in the distance matrix, and acquiring a position lower bound value of each track point distance, wherein the position lower bound value of each track point distance is the minimum value of the track point distance and the transverse adjacent track point distance and the longitudinal adjacent track point distance thereof; judging whether the lower limit value of the position with any track point distance is larger than or equal to a preset threshold value; if so, setting the track similarity of the first track and the second track as a preset distance; the transverse coordinates of the transversely adjacent track points are the same as the transverse coordinates of the distance between the track points, and the longitudinal coordinates of the transversely adjacent track points are smaller than the longitudinal coordinates of the distance between the track points; the longitudinal coordinate of the longitudinal adjacent track point is the same as the longitudinal coordinate of the distance of the track point, and the transverse coordinate of the longitudinal adjacent track point is smaller than the transverse coordinate of the distance of the track point. Through the mode, compared with a conventional track similarity calculation method, the method for calculating the track similarity of the two tracks can effectively reduce the occurrence of invalid calculation and greatly improve the calculation efficiency by adopting the distance threshold value to constrain the distance matrix of the two tracks when calculating the distance matrix and judging the position lower bound value of the distance between the two track points on the track through the distance threshold value so as to directly eliminate the condition that the position lower bound value is greater than or equal to the preset threshold value. The track similarity calculation method can save the calculation cost of the track distance in a threshold value constraint mode, and can reduce the calculation complexity through the judgment of the lower bound value of the position, thereby avoiding the occurrence of invalid calculation.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Wherein:
FIG. 1 is a schematic flowchart of an embodiment of a trajectory similarity calculation method provided in the present application;
fig. 2 is a schematic flow chart of a trajectory similarity calculation method executed by the trajectory similarity calculation apparatus provided in the present application;
FIG. 3 is a schematic diagram of an embodiment of a first trace and a second trace provided herein;
fig. 4 is a schematic structural diagram of a first embodiment of a trajectory similarity calculation apparatus provided in the present application;
fig. 5 is a schematic structural diagram of a second embodiment of a trajectory similarity calculation device provided in the present application;
FIG. 6 is a schematic diagram of an embodiment of a computer-readable storage medium provided herein;
fig. 7 is a geometric schematic diagram of a lower bound value of a position (4,3) in the trajectory similarity method provided by the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described clearly and completely with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only some embodiments of the present application, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
With the continuous development of society, particularly in urban areas, various types of vehicle capturing equipment are installed on more and more roads and intersections. The snapshot device plays a great role in the aspects of vehicle overspeed snapshot management and control and investigation, mobile phone snapshot and red light running and other traffic violation behaviors. Meanwhile, the snapshot devices can effectively record the travel tracks of all vehicles running on urban roads. As the spatiotemporal information data of the vehicle, the vehicle travel track includes various travel modes of the vehicle which are abundant and have great value, and how to mine the vehicle travel track by using a data mining technology has increasingly become a hot problem concerned by academic circles and industrial circles.
In the process of mining the vehicle travel track by using a data mining technology, similarity calculation of the vehicle travel track is one of the most core problems. Through similarity calculation among the tracks, a travel mode of a city can be excavated, and the urban travel mode has immeasurable value for relieving traffic jam of the city and improving traffic efficiency.
Currently, for the calculation of the similarity of vehicle tracks, an intuitive solution idea is to calculate the distance between the vehicle tracks; it is clear that the smaller the distance between the trajectories, the higher their similarity, and vice versa. There are many ways to calculate the distance between the trajectories, such as calculating the maximum distance, the minimum distance, the average distance, the hausdov distance, and the discrete frechet distance between the trajectories, etc. But subsequent studies show that the discrete frechet distance is best suited for the computation of trajectory similarity. The discrete Frechet distance contains the time sequence relation between track points, the calculation process considers the node structure inside the track, the similarity degree between the tracks can be more accurately considered, and measurement distortion cannot occur when the track has the conditions of backspacing, looping, staggering and the like, so that the description capacity of the discrete Frechet distance on the track similarity degree is stronger.
However, in the prior art, when the trajectory similarity is described by using the discrete frechet distance, the discrete frechet distance between two trajectories can be calculated by using a dynamic programming algorithm, specifically including firstly calculating a distance matrix of the two trajectories, that is, a distance between each node on the two trajectories; and then calculating the discrete Frechet distance from the starting point to the position on each position on the distance matrix according to a dynamic transfer equation, and obtaining the final discrete Frechet distance through traversing and converting the distance matrix, wherein the actual calculation efficiency of the calculation method is not high enough.
Before explaining that the computational efficiency is not high enough, the present application first explains the definition of the discrete frechet distance.
In the art, a trajectory may represent a set of chronologically sampled coordinate points, in the example of trajectory P, P = { P (1), …, P (m) }; wherein P (i) = (x) i ,y i ),x i And y i Respectively, the longitude and latitude of the ith sampling point P (i) or the abscissa or ordinate of the sampling point P (i), and m is referred to as the length of the trajectory P.
The discrete Frechet distance is defined as:
given two trajectories P = { P (1), …, P (m) } and Q = { Q (1), …, Q (n) }, the term
Figure SMS_1
Is the discrete Frechet distance of trace P and trace Q, where Ω is the set of mapping sequences for trace P and trace Q, | P (a) i )-Q(b i ) | | is node P (a) i ) And Q (b) i ) The distance of (c).
Wherein, the definition of the distance matrix is:
given two trajectories P = { P (1), …, P (m) } and Q = { Q (1), …, Q (n) }, we refer to the following matrix D as the distance matrix for trajectory P and trajectory Q:
Figure SMS_2
wherein d is i,j =||P(a i )-Q(b j )||,i=1,…,m,j=1,…,n。
In the prior art, if two tracks P = { P (1), …, P (m) } and Q = { Q (1), …, Q (n) } are given, in order to calculate the discrete frechet distance and obtain the similarity between the two, the calculation problem of the discrete frechet distance between the two tracks can be converted into a method for searching a distance matrix of the two tracks from d 1,1 To d m,n And this path satisfies: a) The moving direction of the path from the previous position to the next position can be only one of upward, rightward or upward and 3 corners to the right; b) Maximum element in this pathThe element is the smallest among all paths that satisfy condition a). Thus, the idea of dynamic programming can be used to calculate: let dp be a 2-dimensional array of dynamic variables of shape mxn, where the dynamic variables dp [ i, j]Is represented on the distance matrix from d 1,1 The paths to j that satisfy the discrete Frechet distance equivalence problem, i.e., the discrete Frechet distances for trajectories { P (1), …, P (i) } and trajectories { Q (1), …, Q (j) }. The state transition equation at this time is: a) If j =1, dp [ i, 1%]=max(dp[i-1,1],d i,1 ) (ii) a b) If i =1, dp [1,j]=max(dp[1,j-1],d 1,j ) (ii) a c) If j > 1 and i > 1, then dp [ i, j]=max(min(dp[i-1,j],dp[i,j-1],dp[i-1,j-1]),d i,j ). Therefore, the discrete Frchet distance between the tracks is converted into a dynamic planning problem.
If the discrete Frechet distance is calculated according to the dynamic planning idea, the calculation complexity is O (m.n), and the calculation efficiency is not high enough.
In order to solve the above problem and improve the calculation efficiency of the discrete frechet distance, so as to improve the calculation efficiency of the track similarity, the present application provides a track similarity calculation method, please refer to fig. 1, where fig. 1 is a flowchart of an embodiment of the track similarity calculation method provided in the present application.
Step 11: at least two tracks are acquired, wherein the at least two tracks comprise a first track and a second track.
Specifically, the trajectory similarity calculation means first acquires at least two trajectories. Wherein, the at least two tracks comprise a first track and a second track. In the present embodiment, the first trajectory is defined as P = { P (1), …, P (m) }, and the second trajectory is defined as Q = { Q (1), …, Q (n) }.
Step 12: a distance matrix between the trajectories is calculated based on the first trajectory and the second trajectory, wherein the distance matrix comprises a number of trajectory point distances.
Specifically, each track point distance is calculated by the coordinates of one first track point in the first track and the coordinates of one second track point in the second track;
after the trajectory similarity calculation device acquires the first trajectory P and the second trajectory Q, the trajectory point distance between the coordinates of each first trajectory point and each second trajectory point can be calculated, so that a distance matrix between the first trajectory and the second trajectory is acquired.
The distance matrix calculation formula is as follows:
Figure SMS_3
wherein d is i,j =||P(a i )-Q(b j )||,i=1,…,m,j=1,…,n。
Specifically, after the distance matrix is obtained, the trajectory similarity calculation device further updates the distance matrix based on a preset threshold θ, and sets the distance of the trajectory point having a value greater than or equal to the preset threshold in the distance matrix to a preset distance ∞, so as to obtain a threshold constraint distance matrix. And the threshold value constraint distance matrix is used for replacing the distance matrix, so that a large amount of discrete Frechet distance calculation cost can be saved.
Step 13: and traversing the trace point distances in the distance matrix, and acquiring a position lower bound value of each trace point distance.
Specifically, a lower bound on position value
Figure SMS_4
Is defined as follows: given two trajectories P = { P (1), …, P (m) } and Q = { Q (1), …, Q (n) }, the position lower bound value defined by P (i) and Q (j = +>
Figure SMS_5
Is defined as min { min } k∈[1,j ]||P(i)-Q(k)||,min k∈[1,i] ||P(k)-Q(j)||}。
Namely, the position lower bound value of the track point distance is the minimum value of the track point distance and the distance between the transverse adjacent track points and the distance between the longitudinal adjacent track points. The transverse coordinates of the transversely adjacent track points are the same as the transverse coordinates of the distance between the track points, and the longitudinal coordinates of the transversely adjacent track points are smaller than the longitudinal coordinates of the distance between the track points; the longitudinal coordinate of the longitudinal adjacent track point is the same as the longitudinal coordinate of the distance of the track point, and the transverse coordinate of the longitudinal adjacent track point is smaller than the transverse coordinate of the distance of the track point.
Referring to fig. 7, fig. 7 is a geometric schematic diagram of a lower bound value of a position (4,3) in the trajectory similarity method provided in the present application. The principle of the lower bound value of the position (4,3) is illustrated
Figure SMS_6
Is the smallest of all the shaded distance values in the graph.
Due to any slave d 1,1 To d 5,5 And the maximum distance thereon is equal to the discrete Frechet distance d F Must pass through a grid (i, j) of shaded portions, apparently, in unequal relation
Figure SMS_7
Thus if there is a->
Figure SMS_8
Then there must be d F Theta. Therefore, elements of the remaining positions do not need to be judged again, and the infinity is directly returned as the discrete Frechet distance, namely the difference between the two tracks is considered to be too large, which is the principle of pruning by using the position lower boundary value.
Specifically, the track similarity calculation device calculates the position lower bound values of all track point distances in the threshold constraint distance matrix, and if the position lower bound value of one track point distance is greater than a preset threshold θ, information that the difference between the two tracks is too large is directly output. The pruning processing is carried out by utilizing the position lower bound value, so that the occurrence of invalid calculation can be avoided, and the calculation efficiency of the track similarity is improved.
Step 14: and judging whether the lower limit value of the position with any track point distance is larger than or equal to a preset threshold value.
Specifically, if the trajectory similarity calculation device determines that the lower limit value of the position of the distance of one trajectory point in the threshold constraint distance matrix is greater than or equal to the preset threshold, the process proceeds to step 15.
If the track similarity calculation device judges that the situation that the position lower bound value of one track point distance is not greater than or equal to the preset threshold value exists in the threshold value constraint distance matrix, a two-dimensional dynamic array dp is created based on the first track P and the second track Q; calculating element values of the two-dimensional dynamic array according to path planning conditions based on the threshold constraint distance matrix; and determining the track similarity of the first track and the second track according to the element values of the two-dimensional dynamic array.
The size of the created two-dimensional dynamic array dp is determined by the lengths of the first track P and the second track Q, and taking the length of the first track P as m and the length of the second track Q as n as an example, the created two-dimensional dynamic array dp is a two-dimensional array with m rows and n columns. Each element value dp [ i, j ] in the two-dimensional dynamic array dp is initialized to-1 during creation, where dp [ i, j ] represents a discrete Fr echet distance for trajectories P = { P (1), …, P (m) } and Q = { Q (1), …, Q (n) }.
If m =5,n =6, the initialized two-dimensional dynamic array dp is as follows:
Figure SMS_9
specifically, after the initial two-dimensional dynamic array dp is created, the trajectory similarity calculation device sets a value of an element value corresponding to an arbitrary trajectory point in the two-dimensional dynamic array to a value of a preset distance ∞ according to a point where the distance between the arbitrary trajectory point in the threshold constraint distance matrix is the preset distance ∞.
Specifically, the trajectory similarity calculation device further determines an adjacent element of the current element in the two-dimensional dynamic array according to a path planning condition, where the path planning condition is: the coordinate value of the current element is larger than the coordinate value of the adjacent element; wherein the coordinate values include a first coordinate value and/or a second coordinate value.
I.e. the first coordinate value (first index) and/or the second coordinate value (second index) of the adjacent element is smaller than the current element.
For example, if the current element in the two-dimensional dynamic array dp is dp [2,1], the neighboring element of the current element dp [2,1] is dp [1,1], the current element is dp [1,2], the neighboring element of the current element dp [1,2] is dp [1,1], the current element is dp [2,3], and the neighboring element of dp [2,3] is dp [1,3], dp [2,2] and dp [1,2].
After the adjacent elements of each current element of the two-dimensional dynamic array dp are confirmed, the element value of the two-dimensional dynamic array dp is calculated based on the distance matrix d and the adjacent elements.
Two-dimensional dynamic array dp [1,1]Then d is the corresponding corner mark in the distance matrix 1,1 (ii) a And calculating other current elements of the two-dimensional dynamic array dp by acquiring element values of adjacent elements of the current element, determining the minimum element value of the adjacent element of the current element, and taking the maximum value of the distance between the minimum element value of the adjacent element and the current track point as the element value of the current element in the two-dimensional dynamic array dp.
Optionally, before determining the adjacent elements of the current element in the two-dimensional dynamic array, the track similarity calculation device may further position the starting point distance of the distance matrix and the starting point element of the two-dimensional dynamic array according to the starting point of the first track and the starting point of the second track; and determining the value of the starting point distance as the element value of the starting point element.
When determining the starting point element of the two-dimensional dynamic array, the track similarity calculation device needs to locate the starting point distance D of the distance matrix D based on the starting point P (1) of the first track and the starting point Q (1) of the second track 1,1 Distance d from the starting point 1,1 Is determined as the element value dp [1,1] of the origin element]. I.e. dp of two-dimensional dynamic array [1,1]=d 1,1
In a specific application scenario of calculating the two-dimensional dynamic array dp, the calculation method is as follows:
1. inputting two tracks P = { P (1), …, P (m) } and Q = { Q (1), …, Q (n) };
2. calculating a distance matrix D of the trajectory P and the trajectory Q θ =[d i,j ] m×n
3. Creating a two-dimensional dynamic array dp, wherein the row number is m, the column number is n, and the elements dp [ i, j ] are initialized to be-1;
4. let dp [1,1]=d 1,1 (ii) a Let dp [ I,1]=max(dp[i-1,1],d i,1 ) I is more than or equal to 2 and less than or equal to m; let dp [1,j]=max(dp[1,j-1],d 1,j ) J is more than or equal to 2 and less than or equal to n; let dp [ i, j ]]=max(min(dp[i-1,j],Dp[i,j-1],dp[i-1,j-1]),d i,j ),2≤i≤m,2≤j≤n。
After the track similarity calculation device updates the two-dimensional dynamic array dp, positioning an end point element dp [ m, n ] of the two-dimensional dynamic array according to an end point of the first track P and an end point of the second track Q; and determining the track similarity of the first track P and the second track Q, namely the discrete Frechet distance of the first track P and the second track Q by using the element value of the end point element of the two-dimensional dynamic array.
In an application scenario, please refer to fig. 3, where fig. 3 is a schematic diagram of an embodiment of a first track and a second track provided in the present application. Obtaining a first trajectory P = { P (1), …, P (4) } and a second trajectory Q = { Q (1), …, Q (5) }, in which, as shown in fig. 3, P (1) = (0,3), P (2) = (1,4), P (3) = (3,2), P (4) = (4,2), P (5) = (5,3), Q (1) = (0,2), Q (2) = (1,1), Q (3) = (2,2), Q (4) = (3,1.5),
Q(5)=(4,0),Q(6)=(5,1);
let distance threshold θ =3.0.
Calculating a distance matrix D between the first track P and the second track Q based on the first track P and the second track Q, and obtaining a threshold value constraint distance matrix D through a distance threshold value theta θ As follows:
Figure SMS_10
at this time, a two-dimensional dynamic array dp with the shape of 5 × 6 is created based on the length of the first track P and the length of the second track Q, and the elements dp [ i, j ] are initialized to-1, as follows:
Figure SMS_11
dp [1,1]Set as the starting distance d in the distance matrix 1,1 At this time, the two-dimensional dynamic array is updated as follows:
Figure SMS_12
according to the formula dp [ i,1]=max(dp[i-1,1],d i,1 ) And i is more than or equal to 2 and less than or equal to m, updating the element value of the 1 st column of the dynamic array dp, and then updating the two-dimensional dynamic array dp into:
Figure SMS_13
according to the formula dp [1,j]=max(dp[1,j],d i,1 ) And j is more than or equal to 2 and less than or equal to n, updating the element value of the 1 st column of the two-dimensional dynamic array dp, and then updating the dynamic array dp as follows:
Figure SMS_14
according to the formula dp [ i, j]=max(min(dp[i-1,j],Dp[i,j-1],dp[i-1,j-1]),d i,j ) I is more than or equal to 2 and less than or equal to m, j is more than or equal to 2 and less than or equal to n, and other element values of the two-dimensional dynamic array dp are updated, wherein the two-dimensional dynamic array dp is updated as follows:
Figure SMS_15
finally, an end point element dp [5,6] =2.236 of the two-dimensional dynamic array dp is located, and the end point element dp [5,6] =2.236 is the discrete frichet distance between the first track P and the second track Q.
In the above example, the threshold constrains the distance matrix D θ Has 12 element values assigned directly to infinity, so the threshold-constrained distance matrix D θ Is introduced to save more than
Figure SMS_16
The distance calculation cost of (2) improves the calculation efficiency for the calculation of the size of the trajectory similarity.
Step 15: and setting the track similarity of the first track and the second track as a preset distance.
Referring to fig. 2, if the track similarity calculation device determines that the lower bound value of the position where there is a track point distance is greater than or equal to the preset threshold in step 14, the track similarity is directly set as the preset distance, i.e., the difference between the first track and the second track is considered to be too large.
Specifically, if the preset threshold is 3 and the lower bound value of the distance position of a certain track point is greater than 3, the track similarity of the two tracks subjected to the track similarity calculation is directly set to ∞, so as to avoid subsequent invalid calculation.
Different from the situation of the prior art, the trajectory similarity calculation method provided by the application is applied to a trajectory similarity calculation device, and the trajectory similarity calculation device acquires at least two trajectories, wherein the at least two trajectories include a first trajectory and a second trajectory; calculating a distance matrix between the tracks based on the first track and the second track, wherein the distance matrix comprises a plurality of track point distances, and each track point distance is calculated by the coordinate of one first track point in the first track and the coordinate of one second track point in the second track; traversing the track point distance in the distance matrix, and acquiring a position lower bound value of each track point distance, wherein the position lower bound value of the track point distance is the minimum value of the track point distance and the distance between the transverse adjacent track points and the distance between the longitudinal adjacent track points; judging whether the lower limit value of the position with any track point distance is larger than or equal to a preset threshold value; if so, setting the track similarity of the first track and the second track as a preset distance; the transverse coordinates of the transversely adjacent track points are the same as the transverse coordinates of the distance between the track points, and the longitudinal coordinates of the transversely adjacent track points are smaller than the longitudinal coordinates of the distance between the track points; the longitudinal coordinate of the longitudinal adjacent track points is the same as the longitudinal coordinate of the distance between the track points, and the transverse coordinate of the longitudinal adjacent track points is smaller than the transverse coordinate of the distance between the track points. Through the mode, compared with a conventional track similarity calculation method, the method for calculating the track similarity is characterized in that the distance matrix of the two tracks is calculated by adopting the distance threshold value to constrain the distance matrix, and the position lower bound value of the distance between the two track points on the track is judged through the distance threshold value, so that the track similarity calculation method of which the position lower bound value is more than or equal to the preset threshold value is directly eliminated, the invalid calculation condition can be effectively reduced, and the calculation efficiency is greatly improved. The track similarity calculation method can save the calculation cost of the track distance in a threshold value constraint mode, and can reduce the calculation complexity through the judgment of the lower bound value of the position, thereby avoiding the occurrence of invalid calculation.
The method of the foregoing embodiment may be implemented by using a trajectory similarity calculation apparatus, which is described below with reference to fig. 4, where fig. 4 is a schematic structural diagram of a first embodiment of the trajectory similarity calculation apparatus provided in this application.
As shown in fig. 4, the trajectory similarity calculation apparatus 40 according to the embodiment of the present application includes an acquisition module 41, a matrix generation module 42, a calculation module 43, a determination module 44, and a setting module 45.
The obtaining module 41 is configured to obtain at least two tracks.
A matrix generation module 42 for calculating a distance matrix between the trajectories based on the first trajectory and the second trajectory.
And the calculating module 43 is configured to traverse the trace point distances in the distance matrix, and obtain a position lower bound value of each trace point distance.
And the judging module 44 is configured to judge whether the lower limit value of the position where any one trace point distance exists is greater than or equal to a preset threshold.
And the setting module 45 is used for setting the track similarity of the first track and the second track as a preset distance when the position lower bound value of any track point distance is greater than or equal to a preset threshold value.
The method of the foregoing embodiment may be implemented by using a trajectory similarity calculation apparatus, and referring to fig. 5 below, fig. 5 is a schematic structural diagram of a second embodiment of the trajectory similarity calculation apparatus provided in this application, where the trajectory similarity calculation apparatus 50 includes a memory 51 and a processor 52, the memory 51 is used for storing program data, and the processor 52 is used for executing the program data to implement the following method:
acquiring at least two tracks, wherein the at least two tracks comprise a first track and a second track; calculating a distance matrix between the tracks based on the first track and the second track, wherein the distance matrix comprises a plurality of track point distances, and each track point distance is calculated by the coordinate of one first track point in the first track and the coordinate of one second track point in the second track; traversing the track point distances in the distance matrix, and acquiring a position lower bound value of each track point distance, wherein the position lower bound value of each track point distance is the minimum value of the track point distance and the transverse adjacent track point distance and the longitudinal adjacent track point distance thereof; judging whether the lower limit value of the position with any track point distance is larger than or equal to a preset threshold value; if so, setting the track similarity of the first track and the second track as a preset distance; the transverse coordinates of the transversely adjacent track points are the same as the transverse coordinates of the distance between the track points, and the longitudinal coordinates of the transversely adjacent track points are smaller than the longitudinal coordinates of the distance between the track points; the longitudinal coordinate of the longitudinal adjacent track point is the same as the longitudinal coordinate of the distance of the track point, and the transverse coordinate of the longitudinal adjacent track point is smaller than the transverse coordinate of the distance of the track point.
Referring to fig. 6, fig. 6 is a schematic structural diagram of an embodiment of a computer-readable storage medium 60 provided in the present application, where the computer-readable storage medium 60 stores program data 61, and when the program data 61 is executed by a processor, the method is implemented as follows:
acquiring at least two tracks, wherein the at least two tracks comprise a first track and a second track; calculating a distance matrix between the tracks based on the first track and the second track, wherein the distance matrix comprises a plurality of track point distances, and each track point distance is calculated by the coordinate of one first track point in the first track and the coordinate of one second track point in the second track; traversing the track point distances in the distance matrix, and acquiring a position lower bound value of each track point distance, wherein the position lower bound value of each track point distance is the minimum value of the track point distance and the transverse adjacent track point distance and the longitudinal adjacent track point distance thereof; judging whether the lower limit value of the position with any track point distance is larger than or equal to a preset threshold value; if so, setting the track similarity of the first track and the second track as a preset distance; the transverse coordinates of the transversely adjacent track points are the same as the transverse coordinates of the distance between the track points, and the longitudinal coordinates of the transversely adjacent track points are smaller than the longitudinal coordinates of the distance between the track points; the longitudinal coordinate of the longitudinal adjacent track point is the same as the longitudinal coordinate of the distance of the track point, and the transverse coordinate of the longitudinal adjacent track point is smaller than the transverse coordinate of the distance of the track point.
Embodiments of the present application may be implemented in software functional units and may be stored in a computer readable storage medium when sold or used as a stand-alone product. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, a network device, or the like) or a processor (processor) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only an embodiment of the present application, and is not intended to limit the scope of the present application, and all equivalent structures or equivalent processes performed by the present application and the contents of the attached drawings, which are directly or indirectly applied to other related technical fields, are also included in the scope of the present application.

Claims (11)

1. A trajectory similarity calculation method, characterized by comprising:
acquiring at least two tracks, wherein the at least two tracks comprise a first track and a second track;
calculating a distance matrix between the tracks based on the first track and the second track, wherein the distance matrix comprises a plurality of track point distances, and each track point distance is calculated by the coordinate of one first track point in the first track and the coordinate of one second track point in the second track;
traversing the track point distance in the distance matrix, and acquiring a position lower bound value of each track point distance, wherein the position lower bound value of the track point distance is the minimum value of the track point distance and the transverse adjacent track point distance and the longitudinal adjacent track point distance thereof;
judging whether the lower limit value of the position with any track point distance is larger than or equal to a preset threshold value;
if so, setting the track similarity of the first track and the second track as a preset distance;
the transverse coordinates of the transversely adjacent track points are the same as the transverse coordinates of the distance between the track points, and the longitudinal coordinates of the transversely adjacent track points are smaller than the longitudinal coordinates of the distance between the track points; the longitudinal coordinate of the longitudinal adjacent track point is the same as the longitudinal coordinate of the distance of the track point, and the transverse coordinate of the longitudinal adjacent track point is smaller than the transverse coordinate of the distance of the track point.
2. The trajectory similarity calculation method according to claim 1,
after calculating the distance matrix between the trajectories based on the first trajectory and the second trajectory, the trajectory similarity calculation method includes:
and updating the distance matrix based on the preset threshold value, and setting the track point distance of which the value is greater than or equal to the preset threshold value in the distance matrix as a preset distance so as to obtain a threshold value constraint distance matrix.
3. The trajectory similarity calculation method according to claim 2,
the trajectory similarity calculation method further includes:
under the condition that the lower bound value of the position without the track point distance is larger than or equal to the preset threshold value, creating a two-dimensional dynamic array based on the first track and the second track;
calculating element values of the two-dimensional dynamic array according to path planning conditions based on the threshold constraint distance matrix;
and determining the track similarity of the first track and the second track according to the element values of the two-dimensional dynamic array.
4. The trajectory similarity calculation method according to claim 3,
calculating element values of the two-dimensional dynamic array according to path planning conditions based on the threshold constraint distance matrix, wherein the calculation comprises the following steps:
responding to the preset distance of any one point track point distance in the threshold value constraint distance matrix, and setting the numerical value of the element value of the two-dimensional dynamic array corresponding to the any one point track point distance as the numerical value of the preset distance.
5. The trajectory similarity calculation method according to claim 3,
the calculating the element values of the two-dimensional dynamic array based on the distance matrix according to the path planning condition includes:
determining the adjacent elements of the current element in the two-dimensional dynamic array according to the path planning condition;
and acquiring the element value of the current element based on the distance matrix and the adjacent elements of the current element.
6. The trajectory similarity calculation method according to claim 5,
the obtaining an element value of the current element based on the distance matrix and the neighboring elements of the current element includes:
obtaining a current track point distance corresponding to the current element based on the distance matrix;
acquiring element values of adjacent elements of the current element, and determining the minimum element value of the adjacent elements of the current element;
and taking the maximum value in the distance between the minimum element value and the current track point as the element value of the current element.
7. The trajectory similarity calculation method according to claim 6,
before determining the adjacent elements of the current element in the two-dimensional dynamic array according to the path planning condition, the trajectory similarity calculation method further includes:
according to the starting point of the first track and the starting point of the second track, positioning the starting point distance of the distance matrix and the starting point element of the two-dimensional dynamic array;
and determining the value of the starting point distance as the element value of the starting point element.
8. The trajectory similarity calculation method according to claim 3,
the path planning conditions are as follows: the coordinate value of the current element is larger than the coordinate value of the adjacent element; wherein the coordinate values include a first coordinate value and/or a second coordinate value.
9. The trajectory similarity calculation method according to claim 3, characterized in that;
determining the track similarity of the first track and the second track according to the element values of the two-dimensional dynamic array comprises the following steps:
positioning an end point element of the two-dimensional dynamic array according to the end point of the first track and the end point of the second track;
and determining the track similarity of the first track and the second track by using the element value of the end point element of the two-dimensional dynamic array.
10. A trajectory similarity calculation device, comprising a memory and a processor coupled to the memory;
wherein the memory is configured to store program data, and the processor is configured to execute the program data to implement the trajectory similarity calculation method according to any one of claims 1 to 9.
11. A computer storage medium for storing program data for implementing the trajectory similarity calculation method according to any one of claims 1 to 9 when executed by a computer.
CN202211328457.6A 2022-10-27 2022-10-27 Trajectory similarity calculation method, trajectory similarity calculation device, and storage medium Pending CN115982592A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211328457.6A CN115982592A (en) 2022-10-27 2022-10-27 Trajectory similarity calculation method, trajectory similarity calculation device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211328457.6A CN115982592A (en) 2022-10-27 2022-10-27 Trajectory similarity calculation method, trajectory similarity calculation device, and storage medium

Publications (1)

Publication Number Publication Date
CN115982592A true CN115982592A (en) 2023-04-18

Family

ID=85960084

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211328457.6A Pending CN115982592A (en) 2022-10-27 2022-10-27 Trajectory similarity calculation method, trajectory similarity calculation device, and storage medium

Country Status (1)

Country Link
CN (1) CN115982592A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116703430A (en) * 2023-08-09 2023-09-05 山东未来网络研究院(紫金山实验室工业互联网创新应用基地) Commodity channeling early warning method and system based on identification analysis

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116703430A (en) * 2023-08-09 2023-09-05 山东未来网络研究院(紫金山实验室工业互联网创新应用基地) Commodity channeling early warning method and system based on identification analysis
CN116703430B (en) * 2023-08-09 2024-02-06 山东未来网络研究院(紫金山实验室工业互联网创新应用基地) Commodity channeling early warning method and system based on identification analysis

Similar Documents

Publication Publication Date Title
CN107103754B (en) Road traffic condition prediction method and system
CN108519094B (en) Local path planning method and cloud processing terminal
CN106840176B (en) GPS time-space data increment road network real-time updating and track matching system
CN101630463B (en) Method for automatic vectorization of road network digital raster map
CN110400332A (en) A kind of target detection tracking method, device and computer equipment
CN109214422B (en) Parking data repairing method, device, equipment and storage medium based on DCGAN
CN103761229B (en) Data processing method and device
CN111427904B (en) High-precision map data updating method and device and electronic equipment
CN112184736A (en) Multi-plane extraction method based on European clustering
CN115982592A (en) Trajectory similarity calculation method, trajectory similarity calculation device, and storage medium
CN115077540A (en) Map construction method and device
Chen et al. Improving lane detection with adaptive homography prediction
KR20210018493A (en) Lane property detection
CN111738040A (en) Deceleration strip identification method and system
CN111460866A (en) Lane line detection and driving control method and device and electronic equipment
CN117689693A (en) Abnormal local track detection method and device based on graph comparison self-supervision learning
CN113257005A (en) Traffic flow statistical method based on correlation measurement
CN114705180B (en) Data correction method, device and equipment for high-precision map and storage medium
CN116563341A (en) Visual positioning and mapping method for processing dynamic object in complex environment
CN113447039A (en) High-precision road shortest path calculation method based on mapping information
CN113609947A (en) Motion trajectory prediction method, motion trajectory prediction device, computer equipment and storage medium
WO2020024206A1 (en) Dcgan-based parking data repairing method and apparatus, and device and storage medium
CN117292562B (en) Signal control time period division method based on intersection accurate flow direction identification
CN114485689B (en) Road segment segmentation method and device for constructing high-precision map by utilizing crowdsourcing data
CN114841084B (en) Aerial image-based personnel evacuation simulation method, system and equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination