Track similarity determination method and device, electronic equipment and storage medium

By improving the LCSS algorithm, using the distance between trajectories instead of the distance between points, the problem of inaccurate trajectory similarity calculation in logistics scenarios is solved, the calculation accuracy and efficiency are improved, and the application availability in the field of logistics transportation is enhanced.

CN119005842APending Publication Date: 2024-11-22BEIJING JINGDONG QIANSHITECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310558577.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-05-17
Publication Date
2024-11-22

AI Technical Summary

Technical Problem

In logistics scenarios, traditional LCSS algorithms have lost track data and long time intervals due to signal interference and storage space limitations, resulting in low accuracy in trajectory similarity calculation.

Method used

By determining the distance between track segments instead of the distance between track points, the number of distances between track segments whose distances between track segments are smaller than the preset distance threshold is calculated as the longest common subsequence length, and the LCSS algorithm is improved to improve the calculation accuracy of track similarity.

Benefits of technology

It improves the accuracy and efficiency of trajectory similarity calculation, improves availability in the field of logistics and transportation, can more accurately identify similar trajectories and optimize logistics management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119005842A_ABST
    Figure CN119005842A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to a trajectory similarity determination method and device, electronic equipment and a storage medium, and relates to the field of data mining. The method comprises the following steps: acquiring a first track sequence and a second track sequence of to-be-analyzed track similarity; determining a first track segment formed by any two adjacent track points in the first track sequence, and determining a second track segment formed by any two adjacent track points in the second track sequence; determining a track segment distance corresponding to the first track segment and the second track segment; determining the number of the track segment distances smaller than a preset distance threshold, wherein the number is the longest common subsequence length of the first track sequence and the second track sequence; determining the trajectory similarity of the first trajectory sequence and the second trajectory sequence based on the longest common subsequence length; that is to say, the trajectory similarity is calculated by replacing the distance between trajectory points of a traditional LCSS algorithm with the distance between trajectory segments, and the calculation accuracy is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing, and in particular to a method, device, electronic device and storage medium for determining trajectory similarity. Background Art

[0002] In logistics scenarios, a large amount of trajectory data is generated every day, which contains a huge amount of information. Among them, applications such as transportation vehicle mileage accounting and terminal risk control usually require comparing the similarity of one or more trajectory data.

[0003] In related technologies, the most frequently used trajectory similarity algorithms include Dynamic Time Warping (DTW) and Longest Common Subsequence (LCSS). The output of the DTW algorithm is a cumulative distance, whose value will vary in magnitude with the length of the trajectory or different transportation scenarios, which is not conducive to determining trajectory similarity. The LCSS algorithm outputs a value in the range of [0,1], which represents the proportion of similar trajectories. It is not affected by the length of the trajectory and is widely used.

[0004] However, in logistics scenarios, due to problems such as signal interference, the acquired trajectory data is often seriously missing. At the same time, due to storage space limitations, the time interval between trajectory points sent back by mobile objects is relatively long, which may cause the distance between each two trajectory points to be far. In the above scenario, the trajectory similarity calculated by the traditional LCSS algorithm has a low accuracy rate. Summary of the invention

[0005] The present application provides a method, device, electronic device and storage medium for determining trajectory similarity to solve the technical problem that the trajectory similarity calculated by the traditional LCSS algorithm has a low accuracy.

[0006] In a first aspect, an embodiment of the present application provides a method for determining trajectory similarity, including: obtaining a first trajectory sequence and a second trajectory sequence for trajectory similarity to be analyzed; determining a first trajectory segment composed of any two adjacent trajectory points in the first trajectory sequence, and determining a second trajectory segment composed of any two adjacent trajectory points in the second trajectory sequence; determining an inter-trajectory segment distance corresponding to the first trajectory segment and the second trajectory segment, wherein the inter-trajectory segment distance is a smaller value of a first distance and a second distance, wherein the first distance is a distance between a starting trajectory point of the first trajectory segment and the second trajectory segment, and the second distance is a distance between a starting trajectory point of the second trajectory segment and the first trajectory segment; determining the number of segments whose inter-trajectory segment distances are less than a preset distance threshold, wherein the number is the longest common subsequence length of the first trajectory sequence and the second trajectory sequence; and determining the trajectory similarity of the first trajectory sequence and the second trajectory sequence based on the longest common subsequence length.

[0007] In some embodiments, the determining of a first track segment formed by any two adjacent track points in a first track sequence, determining a second track segment formed by any two adjacent track points in a second track sequence; determining the distance between track segments corresponding to the first track segment and the second track segment; and determining the number of times the distance between track segments is less than a preset distance threshold, the number being the longest common subsequence length of the first track sequence and the second track sequence, comprises: determining a first head track segment formed by a first track point and a second track point in the first track sequence, determining a second head track segment formed by a first track point and a second track point in the second track sequence; determining the distance between head track segments corresponding to the first head track segment and the second head track segment; when the distance between head track segments is less than a preset distance threshold, the longest common subsequence length is the first sub-length plus 1; wherein the first sub-length is the length of the longest common sub-sequence of the first remaining track sequence and the second remaining track sequence, the first remaining track sequence being a sequence formed by the remaining track points in the first track sequence except the first track point, and the second remaining track sequence being a sequence formed by the remaining track points in the second track sequence except the first track point.

[0008] In some embodiments, the method further includes: when the distance between the head trajectory segments is not less than a preset distance threshold, the longest common subsequence length is the larger value of the second sub-length and the third sub-length; wherein the second sub-length is the length of the longest common subsequence corresponding to the first trajectory sequence and the second remaining trajectory sequence, and the third sub-length is the length of the longest common subsequence corresponding to the first remaining trajectory sequence and the second trajectory sequence.

[0009] In some embodiments, the calculation formula of the longest common subsequence length is as follows:

[0010]

[0011] Wherein, A represents the first trajectory sequence, B represents the second trajectory sequence, LCSS′(A,B) represents the length of the longest common subsequence, n represents the length of the first trajectory sequence, m represents the length of the second trajectory sequence, a1 and a2 represent the first trajectory point and the second trajectory point in A respectively, b1 and b2 represent the first trajectory point and the second trajectory point in B respectively, Rest(A) represents the first remaining trajectory sequence, B represents the second remaining trajectory sequence, represents the distance between head track segments, and ε represents the preset distance threshold.

[0012] In some embodiments, the calculation formula of the trajectory similarity is as follows:

[0013]

[0014] Among them, S′(A, B) represents the trajectory similarity between the first trajectory sequence and the second trajectory sequence.

[0015] In some embodiments, after obtaining the first trajectory sequence and the second trajectory sequence of the trajectory similarity to be analyzed, the method further includes: based on the variance of the trajectory points in the window and the relationship with a preset threshold, detecting the stay points in the first trajectory sequence or the second trajectory sequence, and extracting the stay points.

[0016] In some embodiments, based on the relationship between the sum of variances of trajectory points in the window and a preset threshold, detecting the stay points in the first trajectory sequence or the second trajectory sequence, and extracting the stay points, includes: for the current trajectory point of the first trajectory sequence or the second trajectory sequence, determining the target window by adjusting the window length, and the sum of variances of trajectory points in the target window is closest to and greater than the preset threshold; determining the trajectory point in the target window as a stay point, and eliminating other stay points in the target window except the first stay point and the tail stay point; for the next trajectory point of the tail stay point in the first trajectory sequence or the second trajectory sequence, repeating the step of determining the target window by adjusting the window length until the next trajectory point is empty.

[0017] In some embodiments, determining the target window by adjusting the window length includes: setting a window with a window length of 1, and calculating the sum of variances of the trajectory points in the window; when the sum of variances is less than or equal to a preset threshold, the window length is increased by 1, and the step of calculating the sum of variances of the trajectory points in the window is repeated until the sum of variances is greater than the preset threshold, thereby obtaining the target window.

[0018] In some embodiments, after obtaining the first trajectory sequence and the second trajectory sequence for trajectory similarity to be analyzed, the method further includes: performing denoising processing on the first trajectory sequence or the second trajectory sequence based on a preset denoising algorithm.

[0019] In a second aspect, an embodiment of the present application provides a device for determining trajectory similarity, comprising: a trajectory acquisition module, used to acquire a first trajectory sequence and a second trajectory sequence for trajectory similarity to be analyzed; a first determination module, used to determine a first trajectory segment composed of any two adjacent trajectory points in the first trajectory sequence, and determine a second trajectory segment composed of any two adjacent trajectory points in the second trajectory sequence; a second determination module, used to determine an inter-trajectory segment distance corresponding to the first trajectory segment and the second trajectory segment, wherein the inter-trajectory segment distance is a smaller value of a first distance and a second distance, wherein the first distance is a distance between a starting trajectory point of the first trajectory segment and the second trajectory segment, and the second distance is a distance between a starting trajectory point of the second trajectory segment and the first trajectory segment; a third determination module, used to determine the number of segments whose inter-trajectory segment distance is less than a preset distance threshold, wherein the number is the longest common subsequence length of the first trajectory sequence and the second trajectory sequence; and a fourth determination module, used to determine the trajectory similarity of the first trajectory sequence and the second trajectory sequence based on the longest common subsequence length.

[0020] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; the memory is used to store computer programs; and the processor is used to implement the steps of the method for determining trajectory similarity described in any one of the first aspects when executing the program stored in the memory.

[0021] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the method for determining trajectory similarity as described in any one of the first aspects are implemented.

[0022] The method, device, electronic device and storage medium for determining trajectory similarity provided by the embodiments of the present application are as follows: obtaining a first trajectory sequence and a second trajectory sequence of trajectory similarity to be analyzed; determining a first trajectory segment composed of any two adjacent trajectory points in the first trajectory sequence, and determining a second trajectory segment composed of any two adjacent trajectory points in the second trajectory sequence; determining an inter-trajectory segment distance corresponding to the first trajectory segment and the second trajectory segment, wherein the inter-trajectory segment distance is a smaller value of a first distance and a second distance, wherein the first distance is the distance between a starting trajectory point of the first trajectory segment and the second trajectory segment, and the second distance is the distance between a starting trajectory point of the second trajectory segment and the first trajectory segment; determining the number of segments whose inter-trajectory segment distances are less than a preset distance threshold, wherein the number is the longest common subsequence length of the first trajectory sequence and the second trajectory sequence; and determining the trajectory similarity of the first trajectory sequence and the second trajectory sequence based on the longest common subsequence length. The traditional trajectory similarity algorithm compares the distance between two trajectory points of two trajectory sequences. If the distance between two trajectory points is close, they are determined to be a similar point. The more similar points there are, the more similar the two trajectories are. However, when faced with two actually similar trajectories, but due to the reporting time difference, the distance between the two trajectory points of the two reported trajectories is far apart, the use of the traditional algorithm may lead to the erroneous conclusion that the two trajectories are not similar. The present application determines the trajectory similarity by comparing the distance between the two trajectory segments of the two trajectories, which improves the calculation accuracy of the trajectory similarity and improves the usability of the algorithm in the field of logistics and transportation. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0024] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0025] Figure 1 A schematic diagram of an application scenario provided for an embodiment of the present application;

[0026] Figure 2 A schematic diagram of a flow chart of a method for determining trajectory similarity provided in an embodiment of the present application;

[0027] Figure 3a A schematic diagram of the distance between trajectory points in the traditional longest common subsequence algorithm;

[0028] Figure 3b A schematic diagram of the distance between track segments provided in an embodiment of the present application;

[0029] Figure 4 A flowchart of another method for determining trajectory similarity provided in an embodiment of the present application;

[0030] Figure 5 A schematic diagram of a flow chart of another method for determining trajectory similarity provided in an embodiment of the present application;

[0031] Figure 6 A schematic diagram of a track stop point provided in an embodiment of the present application;

[0032] Figure 7 A schematic diagram of a trajectory compression process provided in an embodiment of the present application;

[0033] Figure 8 A schematic diagram of a noise point provided by an embodiment of the present invention;

[0034] Fig. 9 A schematic diagram of a flow chart of another method for determining trajectory similarity provided in an embodiment of the present application;

[0035] Fig.10 A schematic diagram of an application scenario of another method for determining trajectory similarity provided by an embodiment of the present invention;

[0036] Fig.11 A schematic diagram of another application scenario of a method for determining trajectory similarity provided by an embodiment of the present invention;

[0037] Fig.12a A schematic diagram of matching data on some long straight tracks based on the traditional LCSS algorithm;

[0038] Figure 12b A schematic diagram of matching data on a portion of a long straight track based on an embodiment of the present application;

[0039] Fig.13 A schematic diagram of the structure of a device for determining trajectory similarity provided in an embodiment of the present application;

[0040] Fig.14 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0041] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0042] In logistics scenarios, a large amount of Global Positioning System (GPS) trajectory data is generated every day, mainly including the trajectory data of delivery personnel and trucks. Business personnel can mine a huge amount of information from these trajectory data. In daily business, applications such as mileage accounting of transportation vehicles and terminal risk control usually require comparing the similarity of one or more trajectory data. The accuracy and efficiency of the similarity algorithm are particularly important.

[0043] The most frequently used trajectory similarity algorithms are DTW, LCSS and other algorithms. Among them, the DTW algorithm outputs a cumulative distance, and its value will vary in magnitude with the trajectory length or different transportation scenarios. Therefore, it is not easy to determine the similarity threshold range in specific business. The LCSS algorithm outputs a value in the range of [0,1], which indicates the proportion of similar trajectory segments. It is not affected by the trajectory length and is widely used.

[0044] Now let's take an example to illustrate the LCSS algorithm: Assume there are two trajectories A = {a1, a2, ..., a n}and

[0045] B={b1,b2,…,b m}, the formula for calculating trajectory similarity S using the LCSS algorithm is as follows:

[0046]

[0047]

[0048] Where A and B are two trajectories with n and m trajectory points respectively, ε represents the distance threshold. If two trajectory points are within the distance threshold, they are considered to be close or the same trajectory point. Head(A) represents the first trajectory point of trajectory A (also called head trajectory point or head node), Head(B) represents the first trajectory point of trajectory B, and Rest(A) represents the remaining trajectory after excluding the head node of trajectory A, that is, Rest(A) = {a2,…,a n}, Rest(B) represents the remaining trajectory after excluding the head node of trajectory B, that is, Rest(B)={b2,…,b m}, d(a1,b1) represents the distance between the head nodes of trajectory A and B, which is usually the Euclidean distance.

[0049] However, in transportation scenarios, due to problems such as GPS signal interference, the acquired trajectory data is often seriously missing. At the same time, due to storage space limitations, the time interval between mobile objects transmitted back through the terminal is relatively long, and it is possible that the distance between each two trajectory points in the two trajectories is relatively far. Figure 1 A schematic diagram of an application scenario provided in an embodiment of the present application, such as Figure 1 As shown in the figure, both trajectories (solid line and dotted line) are traveling along the highway. However, due to the time difference of trajectory point reporting, the distance between every two trajectory points (circular black solid points and triangular blank points in the figure) in the two trajectories is greater than 100 meters. When the traditional LCSS algorithm is used to calculate the trajectory similarity, and ε=100m is taken, because the distance between any two trajectory points on the two trajectories is greater than the threshold ε, the trajectories will be judged to be dissimilar. However, in reality, the similarity between the two trajectories is very high. It can be seen that the accuracy of trajectory similarity calculated by the traditional LSCC algorithm is not high, especially when facing Figure 1 The extreme scenario shown.

[0050] In response to the above technical problems, the technical concept of the present application is: by improving the traditional LSCC algorithm and using the distance between trajectory segments instead of the original distance between trajectory points, the problem of inaccurate trajectory similarity calculation in extreme cases can be solved, and its usability in the field of logistics and transportation can be improved. For example, by calculating the trajectory similarity, freight items carried by similar trajectories can be merged for distribution, thereby increasing the full load rate and reducing the manpower and time costs of logistics.

[0051] In addition, trajectory similarity can also be applied in the field of traffic management. Clustering is performed according to the similarity of each trajectory to effectively identify prevailing traffic flows and abnormal trajectories, etc., providing technical support for traffic route optimization and intelligent traffic management. It can also be applied in travel route planning. By comparing the similarities between different trajectories, the optimal travel route can be found for users. It can also be applied in commercial advertising recommendations. By comparing the similarity between user trajectories and advertiser trajectories, advertisements that best suit user interests can be recommended. It can also be applied in epidemic prevention and control. By calculating the trajectory similarity of the crowd, relevant personnel can be accurately screened, and so on.

[0052] Figure 2 The present invention provides a flow chart of a method for determining trajectory similarity, wherein the execution subject is a device for determining trajectory similarity, or an electronic device equipped with the device for determining trajectory similarity. Figure 2 As shown, the method for determining the trajectory similarity includes:

[0053] Step S210: Obtain a first trajectory sequence and a second trajectory sequence whose trajectory similarity is to be analyzed.

[0054] Specifically, the trajectory sequence is composed of trajectory points sorted by time, such as trajectory A = {a1, a2, ..., a n}, trajectory B = {b1, b2, ..., b m}. Each track point includes longitude and latitude information.

[0055] Step S220: determine a first trajectory segment formed by any two adjacent trajectory points in the first trajectory sequence, and determine a second trajectory segment formed by any two adjacent trajectory points in the second trajectory sequence.

[0056] Specifically, each trajectory sequence can be regarded as composed of multiple trajectory segments, and the starting trajectory point and the terminal trajectory point of each trajectory segment are adjacent trajectory points in the trajectory sequence. For example, for trajectory A, it includes trajectory segments a1a2, trajectory segments a2a3, ...a n-1 a n , for trajectory B, including trajectory segments b1b2, b2b3, ...b m-1 b m .

[0057] Step S230: Determine the inter-segment distance corresponding to the first trajectory segment and the second trajectory segment, wherein the inter-segment distance is the smaller value of the first distance and the second distance.

[0058] The first distance is the distance between the starting point of the first track segment and the second track segment, and the second distance is the distance between the starting point of the second track segment and the first track segment.

[0059] Specifically, define trajectory segment a i a i+1 With b i b i+1 The distance d′ between them is shown in formula (3):

[0060]

[0061] in, Point b i To track segment a i a i+1 The distance, similar to Point a i To track segment b i b i+1 distance. Figure 3a It is a schematic diagram of the distance between trajectory points in the traditional LCSS algorithm. Figure 3b A schematic diagram of the distance between track segments provided in an embodiment of the present application. Figure 3a As shown, the traditional LCSS algorithm directly calculates the distance between two trajectory points, such as d(a1,b1), d(a2,b1), etc., but different from it, the embodiment of the present application calculates the distance between trajectory segments, such as Figure 3b The distance between the track segments a1a2 and b1b2 shown is The smaller value of Represents the distance between trajectory point a1 and trajectory segment b1b2, a1 is projected onto trajectory segment b1b2, The value is the vertical distance of the projection, Represents the distance between trajectory point b1 and trajectory segment a1a2, b1 is projected outside trajectory segment a1a2, The value is the point distance between a1 and a2; for example, the distance between trajectory segment a2a3 and trajectory segment b2b3 is The smaller value of Represents the distance between trajectory point a2 and trajectory segment b2b3, where a2 is projected outside trajectory segment b2b3. The value is the point distance between a2 and a3, Represents the distance between trajectory point b2 and trajectory segment a2a3, b2 is projected onto trajectory segment a2a3, The value is the projected vertical distance. In summary, the distance between the trajectory point and the trajectory segment defined in the embodiment of the present application is: if the trajectory point is projected onto the trajectory segment, the value is the projected vertical distance, otherwise it is the smaller value of the third distance and the fourth distance, wherein the third distance is the distance between the trajectory point and the starting trajectory point of the trajectory segment, and the fourth distance is the distance between the trajectory point and the terminal trajectory point of the trajectory segment.

[0062] Step S240: Determine the number of the track segments whose distances are less than a preset distance threshold, where the number is the longest common subsequence length of the first track sequence and the second track sequence.

[0063] Specifically, if the distance between trajectory segments is less than the preset distance threshold, it means that the starting trajectory point of one trajectory segment is relatively close to the point on another trajectory segment, and it can be considered that there is a pair of similar trajectory points. In other words, it can be determined how many distances between trajectory segments are less than the preset distance threshold, and how many pairs of similar trajectory points there are accordingly, and the longest common subsequence length of the two trajectory sequences can be determined.

[0064] Step S250: Determine the trajectory similarity between the first trajectory sequence and the second trajectory sequence based on the longest common subsequence length.

[0065] Specifically, the length of the longest common subsequence can be normalized to obtain the trajectory similarity in the range of [0,1].

[0066] The method for determining trajectory similarity provided in the embodiment of the present application is as follows: obtaining a first trajectory sequence and a second trajectory sequence of trajectory similarity to be analyzed; determining a first trajectory segment composed of any two adjacent trajectory points in the first trajectory sequence, and determining a second trajectory segment composed of any two adjacent trajectory points in the second trajectory sequence; determining the inter-segment distance corresponding to the first trajectory segment and the second trajectory segment, wherein the inter-segment distance is the smaller value of the first distance and the second distance, wherein the first distance is the distance between the starting trajectory point of the first trajectory segment and the second trajectory segment, and the second distance is the distance between the starting trajectory point of the second trajectory segment and the first trajectory segment; determining the number of the inter-segment distances less than a preset distance threshold, wherein the number is the longest common subsequence length of the first trajectory sequence and the second trajectory sequence; and determining the trajectory similarity of the first trajectory sequence and the second trajectory sequence based on the longest common subsequence length; that is, the embodiment of the present application improves the traditional LCSS similarity algorithm, and uses the inter-segment distance to replace the inter-point distance in the original algorithm, thereby solving the problem of inaccurate trajectory similarity calculation in extreme cases and improving the usability of the algorithm in the field of logistics and transportation.

[0067] Based on the above embodiments, Figure 4 A flow chart of another method for determining trajectory similarity provided in an embodiment of the present application is shown as follows: Figure 4 As shown, the method for determining the trajectory similarity includes:

[0068] Step S410: Obtain a first trajectory sequence and a second trajectory sequence whose trajectory similarity is to be analyzed.

[0069] Step S420: determine a first head track segment consisting of a first track point and a second track point in the first track sequence, and determine a second head track segment consisting of a first track point and a second track point in the second track sequence.

[0070] Step S430: Determine the head track segment distance corresponding to the first head track segment and the second head track segment.

[0071] Step S440: Determine whether the distance between the head track segments is less than a preset distance threshold.

[0072] If yes, execute step S450; if no, execute step S460.

[0073] Step S450: The longest common subsequence length is the first subsequence length plus 1.

[0074] Among them, the first sub-length is the length of the longest common subsequence of the first remaining trajectory sequence and the second remaining trajectory sequence, the first remaining trajectory sequence is a sequence composed of the remaining trajectory points in the first trajectory sequence except the first trajectory point, and the second remaining trajectory sequence is a sequence composed of the remaining trajectory points in the second trajectory sequence except the first trajectory point.

[0075] Step S460: The longest common subsequence length is a larger value between the second sub-length and the third sub-length.

[0076] The second sub-length is the length of the longest common sub-sequence corresponding to the first trajectory sequence and the second remaining trajectory sequence, and the third sub-length is the length of the longest common sub-sequence corresponding to the first remaining trajectory sequence and the second trajectory sequence.

[0077] Step S470: Determine the trajectory similarity between the first trajectory sequence and the second trajectory sequence based on the longest common subsequence length.

[0078] The implementation of steps S410 and S470 in the embodiment of the present application is similar to the implementation of steps S210 and S250 in the above embodiment, and will not be repeated here.

[0079] The difference from the above embodiment is that this embodiment further defines the specific implementation method of calculating the longest common subsequence length. In this embodiment, a first head track segment consisting of the first track point and the second track point in the first track sequence is determined, and a second head track segment consisting of the first track point and the second track point in the second track sequence is determined; when the distance between the head track segments is less than the preset distance threshold, the longest common subsequence length is the first sub-length plus 1; wherein the first sub-length is the length of the longest common subsequence of the first remaining track sequence and the second remaining track sequence, the first remaining track sequence is a sequence consisting of the remaining track points in the first track sequence except the first track point, and the second remaining track sequence is a sequence consisting of the remaining track points in the second track sequence except the first track point; when the distance between the head track segments is not less than the preset distance threshold, the longest common subsequence length is the larger value of the second sub-length and the third sub-length; wherein the second sub-length is the length of the longest common subsequence corresponding to the first track sequence and the second remaining track sequence, and the third sub-length is the length of the longest common subsequence corresponding to the first remaining track sequence and the second track sequence.

[0080] The calculation of the longest common subsequence length of trajectory sequences A and B is used as an example for explanation. First, the head trajectory segment a1a2 of trajectory sequence A is determined, and the head trajectory segment b1b2 of trajectory sequence B is determined; then, the head trajectory segment distance between the head trajectory segment a1a2 and the head trajectory segment b1b2 is determined based on formula (3); if the head trajectory segment distance is less than the preset distance threshold, then LCSS′(A, B)=1+LCSS′(Rest(A), Rest(B)); if the head trajectory segment distance is not less than the preset distance threshold, then LCSS′(A, B)=max(LCSS′(Rest(A), B), LCSS′(A, Rest(B))).

[0081] Among them, Rest(A) and Rest(B) respectively represent the sequences composed of the remaining trajectory points except the head trajectory point in the two trajectory sequences A and B. In addition, it should be noted that when calculating LCSS′(Rest(A), Rest(B)), LCSS′(Rest(A), B), or LCSS′(A, Rest(B)), they can be regarded as the new first trajectory sequence and the second trajectory sequence, and the corresponding longest common subsequence length is calculated by repeatedly executing steps S220-S240 or steps S420-S460.

[0082] In some embodiments, the calculation formula for the longest common subsequence length is shown in (4):

[0083]

[0084] Wherein, A represents the first trajectory sequence, B represents the second trajectory sequence, LCSS′(A,B) represents the length of the longest common subsequence, n represents the length of the first trajectory sequence, m represents the length of the second trajectory sequence, a1 and a2 represent the first trajectory point and the second trajectory point in A respectively, b1 and b2 represent the first trajectory point and the second trajectory point in B respectively, Rest(A) represents the first remaining trajectory sequence, B represents the second remaining trajectory sequence, represents the distance between head track segments, and ε represents the preset distance threshold.

[0085] Specifically, when the length of the first trajectory sequence or the second trajectory sequence is 1, since there is only one trajectory point in the trajectory sequence, a trajectory segment cannot be formed. At this time, LCSS′(A, B) takes the value of 0; when the head trajectory segment spacing is less than the preset distance threshold ε, the value is 1+LCSS′(Rest(A), Rest(B)); otherwise, the larger value of LCSS′(Rest(A), B) and LCSS′(A, Rest(B) is taken.

[0086] In some embodiments, the calculation formula of the trajectory similarity is as follows:

[0087]

[0088] Among them, S′(A, B) represents the trajectory similarity between the first trajectory sequence and the second trajectory sequence.

[0089] Specifically, the normalization of the longest common subsequence is achieved through the above formula, ensuring that the output trajectory similarity is a value in the range of [0,1].

[0090] On the basis of the above-mentioned embodiment, when the distance between the head trajectory segments is less than the preset distance threshold, the longest common subsequence length is the first sub-length plus 1; when the distance between the head trajectory segments is not less than the preset distance threshold, the longest common subsequence length is the larger value of the second sub-length and the third sub-length, that is, the longest common subsequence length of the original trajectory sequence is calculated based on the recursive principle, and then the trajectory similarity is calculated.

[0091] Based on the above embodiments, Figure 5 A flow chart of another method for determining trajectory similarity provided in an embodiment of the present application is shown as follows: Figure 5 As shown, the method for determining the trajectory similarity includes:

[0092] Step S510: Obtain a first trajectory sequence and a second trajectory sequence whose trajectory similarity is to be analyzed.

[0093] Step S520: Based on the variance of the trajectory points in the window and the relationship with the preset threshold, detect the stay points in the first trajectory sequence or the second trajectory sequence, and extract the stay points.

[0094] Step S530, determining a first track segment formed by any two adjacent track points in the first track sequence, and determining a second track segment formed by any two adjacent track points in the second track sequence;

[0095] Step S540: Determine the inter-segment distance corresponding to the first trajectory segment and the second trajectory segment, where the inter-segment distance is the smaller value of the first distance and the second distance.

[0096] The first distance is the distance between the starting point of the first track segment and the second track segment, and the second distance is the distance between the starting point of the second track segment and the first track segment.

[0097] Step S550: Determine the number of the trajectory segments whose distances are less than a preset distance threshold, where the number is the longest common subsequence length of the first trajectory sequence and the second trajectory sequence.

[0098] Step S560: Determine the trajectory similarity between the first trajectory sequence and the second trajectory sequence based on the longest common subsequence length.

[0099] The implementation of steps S510, S530-S560 in the embodiment of the present application is similar to the implementation of steps S210-S250 in the above embodiment, and will not be repeated here.

[0100] The difference from the above embodiment is that, in order to further improve the calculation performance of trajectory similarity, in this embodiment, based on the variance of the trajectory points in the window and the relationship with the preset threshold, the stay points in the first trajectory sequence or the second trajectory sequence are detected and the stay points are extracted.

[0101] Before calculating the trajectory similarity, it is necessary to explore the stop points in the trajectory data. Figure 6 A schematic diagram of a stop point provided in an embodiment of the present application. Trucks may experience red light stops, traffic jams, refueling, loading and unloading at stations, etc. during their journey. These events will cause stops of varying lengths. Too many stop points will reduce the proportion of trajectory points that truly contain information, seriously affecting the calculation efficiency. Therefore, it is necessary to pre-identify the stop points in the trajectory sequence and simplify and compress them.

[0102] In statistical description, variance is used to calculate the difference between each variable (observation value) and the overall mean. If the variance is small, it means that the offset between elements in the set is small. Therefore, in this embodiment, the variance of the trajectory points in the window and the relationship with the preset threshold can be used to detect the stay points, and the stay points are extracted to achieve trajectory compression, thereby improving the performance of subsequent calculation of trajectory similarity.

[0103] In some embodiments, the step S520 includes: for the current trajectory point of the first trajectory sequence or the second trajectory sequence, determining the target window by adjusting the window length, and the variance sum of the trajectory points in the target window is closest to and greater than a preset threshold; determining the trajectory point in the target window as a stay point, and removing other stay points in the target window except the first stay point and the tail stay point; for the next trajectory point of the tail stay point in the first trajectory sequence or the second trajectory sequence, repeating the step of determining the target window by adjusting the window length until the next trajectory point is empty.

[0104] Specifically, starting from the current node of the trajectory sequence, the length of the window is adjusted so that different numbers of trajectory points are included in the window. When the sum of the variances of the trajectory points in the window is adjusted to be closest to and greater than the preset threshold, it can be determined that all trajectory points in the window are stay points, and only the first and last points are retained. Repeat the above steps until the stay point identification and extraction of the entire trajectory sequence is completed.

[0105] In some embodiments, determining the target window by adjusting the window length includes: setting a window with a window length of 1, and calculating the sum of variances of the trajectory points in the window; when the sum of variances is less than or equal to a preset threshold, the window length is increased by 1, and the step of calculating the sum of variances of the trajectory points in the window is repeated until the sum of variances is greater than the preset threshold, thereby obtaining the target window.

[0106] Figure 7 A schematic diagram of a trajectory compression process provided by an embodiment of the present application, such as Figure 7 Said, comprising the following steps:

[0107] Step 1: Starting from the current node, select a window T(i,1)={(x i ,y i ),(x i+1 ,y i+1 )}.

[0108] Among them, x and y represent the latitude and longitude values ​​corresponding to the trajectory point respectively.

[0109] Step 2: Calculate the variance and S of the longitude and latitude of the trajectory points within the window T T , the formula is as follows:

[0110]

[0111] in, represents the average longitude of all trajectory points in window T, represents the average latitude of all trajectory points in window T, and z represents the total number of trajectory points in window T.

[0112] Step 3: If S T ≤δ, then the window length increases by 1, and step 2 is repeated until S T >δ.

[0113] Here, δ is a preset threshold value, which is set by those skilled in the art based on experience, and is not limited in this application.

[0114] Step 4: If the window length l T >1, then window T(i,n)={(x i ,y i ),…,(x i+n ,y i+n )} are all stop points, and only the first and last points of the window are retained, that is, (x i ,y i ) and (x i+n ,y i+n )

[0115] Step 5: Window T moves to the end of the current window, i.e. let i=i+n+1, and repeat step 1 until the last node is calculated.

[0116] Through the above steps, all the stay points in the stay point interval are compressed to two points, which maximizes the retention of trajectory information while compressing the data, thereby improving the performance of subsequent calculation of trajectory similarity.

[0117] In some embodiments, continue to refer to Figure 5 As shown, the step S510 further includes a step S570: performing denoising processing on the first trajectory sequence or the second trajectory sequence based on a preset denoising algorithm.

[0118] Before calculating the trajectory similarity, in addition to considering the stop point problem in the trajectory data, the noise problem also needs to be considered. Because GPS positioning has errors, especially in areas with poor signals such as mountainous areas and tunnels, the error of the positioning point may be large. Figure 8 A schematic diagram of noise points provided in an embodiment of the present application. In this embodiment, a denoising algorithm is used to perform denoising on the trajectory data to remove some noise points with large offsets. The denoising algorithm includes median filtering, Kalman filtering, particle filtering, etc.

[0119] On the basis of the above-mentioned embodiment, some preprocessing is performed on the trajectory data after the trajectory data is acquired, including eliminating some noise points that may interfere with the similarity calculation and compressing the trajectory data by extracting the stay points, thereby improving the calculation performance of the subsequent trajectory similarity.

[0120] In order to understand the embodiments of the present application in more detail, Fig. 9 A flowchart of another method for determining trajectory similarity provided in an embodiment of the present application is shown below. Fig. 9 As shown, first obtain the trajectory data, and then preprocess the trajectory data, including denoising, trajectory compression, etc., which can be referred to Figure 5 Steps S570 and S520 of the illustrated embodiment; then the improved longest common subsequence algorithm is used to calculate the longest common subsequence LCSS of the trajectory data, which can be referred to as formula (4); finally, the longest common string is normalized to calculate the trajectory similarity, which can be referred to as formula (5).

[0121] Fig.10 A schematic diagram of an application scenario of another method for determining trajectory similarity provided by an embodiment of the present invention, such as Fig.10As shown in the figure, assume that there are two trajectory sequences A = {(0,0), (1,1), (3,3), (5,5), (6,6)}, B = {(0,0), (2,2), (4,4), (6,6)}. It can be seen from the figure that the pair of trajectories are collinear, that is, the similarity of the pair of trajectories should be close to 1 or take the value of 1. When using the traditional LCSS algorithm to calculate the similarity of the two trajectories, when ε = 1, it can be seen from the figure that the distance between (0,0), (1,1), (1,1), (2,2) is are all greater than ε, and the calculated trajectory similarity S(1,A,B)=0.5. When the improved LCSS algorithm of this embodiment is used to calculate the similarity, since each iteration calculates not two trajectory points but trajectory segments, the result S′(1,A,B)=1. It can be seen that this embodiment has a more accurate calculation result in extreme cases.

[0122] Fig.11 A schematic diagram of another application scenario of a method for determining trajectory similarity provided by an embodiment of the present invention. Fig.11 As shown in the figure, two actual running truck trajectories are intercepted. It can be seen from the figure that most sections of the two trajectories are collinear, that is, the similarity value of the two trajectories is relatively large. The similarity of the two trajectories calculated by the traditional method is 0.63, while the present embodiment, that is, the trajectory denoising and stop point extraction compression algorithm is used to pre-process the trajectory, and then the trajectory similarity is calculated based on the improved LCSS algorithm, and the result is 0.69. Fig.12a This is a schematic diagram of matching data on some long straight tracks based on the traditional LCSS algorithm. Figure 12b This is a schematic diagram of matching data on a portion of a long straight track based on an embodiment of the present application. By comparing Fig.12a As shown in Figure 12b, on a long straight track, the traditional method will generate many unmatched point pairs, which will be judged as dissimilar, but in fact the two tracks are collinear in this section. This embodiment can avoid this situation very well, so a higher similarity can be obtained, which is more in line with the actual truck transportation business scenario.

[0123] It can be seen that the LCSS algorithm calculates the distance of individual point pairs during the calculation process, but if the time interval reported by the device is long, errors may occur because the points on different trajectories are far apart. Therefore, this application improves the original distance between trajectory points to the distance between trajectory segments. When the trajectory points are sparsely distributed, the distance between the point and the line segment will not change with the sparsity of the trajectory points, so it can better measure the similarity between sparse trajectories.

[0124] In summary, the embodiment of the present application uses a denoising algorithm to preprocess the trajectory, and detects and extracts the stay points through a variance sum-based method to achieve trajectory compression, thereby improving the calculation performance of subsequent trajectory similarity. After preprocessing, an improved LCSS algorithm is used, that is, the distance between trajectory segments is used instead of the distance between trajectory points in the original method, to solve the problem of inaccurate trajectory similarity calculation in extreme cases, greatly improve the accuracy and efficiency of similarity calculation, and improve the usability of the algorithm in the field of truck transportation.

[0125] In a second aspect, an embodiment of the present application provides a device for determining trajectory similarity. Fig.13 A schematic diagram of a structure of a device for determining trajectory similarity provided in an embodiment of the present application is shown in FIG. Fig.13 As shown, the apparatus for determining trajectory similarity includes a trajectory acquisition module 1310, a first determination module 1320, a second determination module 1330, a third determination module 1340 and a fourth determination module 1350;

[0126] The trajectory acquisition module 1310 is used to acquire the first trajectory sequence and the second trajectory sequence of the trajectory similarity to be analyzed; the first determination module 1320 is used to determine the first trajectory segment formed by any two adjacent trajectory points in the first trajectory sequence, and determine the second trajectory segment formed by any two adjacent trajectory points in the second trajectory sequence;

[0127] A second determination module 1330 is used to determine an inter-segment distance corresponding to a first trajectory segment and a second trajectory segment, wherein the inter-segment distance is a smaller value of a first distance and a second distance, wherein the first distance is a distance between a starting trajectory point of the first trajectory segment and the second trajectory segment, and the second distance is a distance between a starting trajectory point of the second trajectory segment and the first trajectory segment;

[0128] A third determining module 1340 is used to determine the number of the track segments whose distances are less than a preset distance threshold, where the number is the longest common subsequence length of the first track sequence and the second track sequence;

[0129] The fourth determination module 1350 is used to determine the trajectory similarity between the first trajectory sequence and the second trajectory sequence based on the longest common subsequence length.

[0130] In some embodiments, the first determination module 1320 is specifically used to: determine a first head track segment composed of a first track point and a second track point in a first track sequence, and determine a second head track segment composed of a first track point and a second track point in a second track sequence; the second determination module 1330 is specifically used to: determine the head track segment distance corresponding to the first head track segment and the second head track segment; the third determination module 1340 is specifically used to: when the head track segment distance is less than a preset distance threshold, the longest common subsequence length is the first sub-length plus 1; wherein the first sub-length is the length of the longest common subsequence of the first remaining track sequence and the second remaining track sequence, the first remaining track sequence is a sequence composed of the remaining track points in the first track sequence except the first track point, and the second remaining track sequence is a sequence composed of the remaining track points in the second track sequence except the first track point.

[0131] In some embodiments, the third determination module 1340 is further used to: when the distance between the head trajectory segments is not less than a preset distance threshold, the longest common subsequence length is the larger value of the second sub-length and the third sub-length; wherein the second sub-length is the length of the longest common subsequence corresponding to the first trajectory sequence and the second remaining trajectory sequence, and the third sub-length is the length of the longest common subsequence corresponding to the first remaining trajectory sequence and the second trajectory sequence.

[0132] In some embodiments, the calculation formula of the longest common subsequence length is as follows:

[0133]

[0134] Wherein, A represents the first trajectory sequence, B represents the second trajectory sequence, LCSS′(A,B) represents the length of the longest common subsequence, n represents the length of the first trajectory sequence, m represents the length of the second trajectory sequence, a1 and a2 represent the first trajectory point and the second trajectory point in A respectively, b1 and b2 represent the first trajectory point and the second trajectory point in B respectively, Rest(A) represents the first remaining trajectory sequence, B represents the second remaining trajectory sequence, represents the distance between head track segments, and ε represents the preset distance threshold.

[0135] In some embodiments, the calculation formula of the trajectory similarity is as follows:

[0136]

[0137] Among them, S′(A, B) represents the trajectory similarity between the first trajectory sequence and the second trajectory sequence.

[0138] In some embodiments, the device further includes a preprocessing module 1360, and the preprocessing module 1360 is used to: detect the stay points in the first trajectory sequence or the second trajectory sequence based on the variance of the trajectory points in the window and the relationship with a preset threshold, and extract the stay points.

[0139] In some embodiments, the preprocessing module 1360 is specifically used to: determine the target window by adjusting the window length for the current trajectory point of the first trajectory sequence or the second trajectory sequence, and the sum of the variances of the trajectory points in the target window is closest to and greater than a preset threshold; determine the trajectory point in the target window as a stay point, and remove other stay points in the target window except the first stay point and the tail stay point; for the next trajectory point of the tail stay point in the first trajectory sequence or the second trajectory sequence, repeat the step of determining the target window by adjusting the window length until the next trajectory point is empty.

[0140] In some embodiments, the preprocessing module 1360 is specifically used to: set a window with a window length of 1, and calculate the sum of variances of the trajectory points in the window; when the sum of variances is less than or equal to a preset threshold, the window length is increased by 1, and the step of calculating the sum of variances of the trajectory points in the window is repeated until the sum of variances is greater than the preset threshold, thereby obtaining a target window.

[0141] In some embodiments, the pre-processing module 1360 is further configured to: perform denoising processing on the first trajectory sequence or the second trajectory sequence based on a preset denoising algorithm.

[0142] The implementation principle and technical effect of the device for determining trajectory similarity provided in this embodiment are similar to those of the above embodiment, and will not be described in detail here.

[0143] like Fig.14 As shown, an embodiment of the present application provides an electronic device, including a processor 1410, a communication interface 1420, a memory 1430 and a communication bus 1440, wherein the processor 1410, the communication interface 1420, and the memory 1430 communicate with each other through the communication bus 1440.

[0144] Memory 1430, for storing computer programs;

[0145] In one embodiment of the present application, the processor 1410 is configured to implement the steps of the method for determining trajectory similarity provided in any one of the aforementioned method embodiments when executing the program stored in the memory 1430 .

[0146] The implementation principle and technical effects of the electronic device provided in the embodiment of the present application are similar to those of the above embodiment and will not be repeated here.

[0147] The above-mentioned memory 1430 can be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk or a ROM. The memory 1430 has a storage space for program codes for executing any method steps in the above-mentioned method. For example, the storage space for program codes may include various program codes for implementing the various steps in the above method respectively. These program codes can be read from or written into one or more computer program products. These computer program products include program code carriers such as hard disks, compact disks (CDs), memory cards or floppy disks. Such computer program products are usually portable or fixed storage units. The storage unit may have a storage segment or storage space arranged similarly to the memory 1430 in the above-mentioned electronic device. The program code can be compressed, for example, in an appropriate form. Generally, the storage unit includes a program for executing the method steps according to an embodiment of the present application, that is, a code that can be read by a processor such as 1410, which, when run by an electronic device, causes the electronic device to execute the various steps in the method described above.

[0148] The embodiment of the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for determining trajectory similarity as described above are implemented.

[0149] The computer-readable storage medium may be included in the device / apparatus described in the above embodiment; or it may exist independently without being assembled into the device / apparatus. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present application is implemented.

[0150] According to an embodiment of the present application, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.

[0151] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0152] The above description is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest range consistent with the principles and novel features applied for herein.

Claims

1. A method for determining trajectory similarity, It is characterized in that include: Obtaining a first trajectory sequence and a second trajectory sequence of trajectory similarity to be analyzed; Determine a first track segment formed by any two adjacent track points in the first track sequence, and determine a second track segment formed by any two adjacent track points in the second track sequence; Determine an inter-segment distance corresponding to a first trajectory segment and a second trajectory segment, wherein the inter-segment distance is a smaller value of a first distance and a second distance, wherein the first distance is a distance between a starting trajectory point of the first trajectory segment and the second trajectory segment, and the second distance is a distance between a starting trajectory point of the second trajectory segment and the first trajectory segment; Determine the number of the track segments whose distances are less than a preset distance threshold, where the number is the longest common subsequence length of the first track sequence and the second track sequence; Based on the longest common subsequence length, the trajectory similarity between the first trajectory sequence and the second trajectory sequence is determined.

2. The method according to claim 1, It is characterized in that The method comprises determining a first track segment formed by any two adjacent track points in the first track sequence, determining a second track segment formed by any two adjacent track points in the second track sequence; and determining a distance between track segments corresponding to the first track segment and the second track segment; Determining the number of the track segments whose distances are less than a preset distance threshold, where the number is the longest common subsequence length of the first track sequence and the second track sequence, comprises: Determine a first head track segment consisting of a first track point and a second track point in the first track sequence, and determine a second head track segment consisting of a first track point and a second track point in the second track sequence; determining an inter-head track segment distance corresponding to the first head track segment and the second head track segment; When the distance between the head track segments is less than a preset distance threshold, the longest common subsequence length is the first subsequence length plus 1; Among them, the first sub-length is the length of the longest common sub-sequence corresponding to the first remaining trajectory sequence and the second remaining trajectory sequence, the first remaining trajectory sequence is a sequence composed of the remaining trajectory points in the first trajectory sequence except the first trajectory point, and the second remaining trajectory sequence is a sequence composed of the remaining trajectory points in the second trajectory sequence except the first trajectory point.

3. The method according to claim 2, It is characterized in that The method further comprises: In the case where the distance between the head track segments is not less than a preset distance threshold, the longest common subsequence length is a larger value between the second sub-length and the third sub-length; The second sub-length is the length of the longest common sub-sequence corresponding to the first trajectory sequence and the second remaining trajectory sequence, and the third sub-length is the length of the longest common sub-sequence corresponding to the first remaining trajectory sequence and the second trajectory sequence.

4. The method according to claim 3, It is characterized in that The calculation formula of the longest common subsequence length is as follows: Where A represents the first trajectory sequence, B represents the second trajectory sequence, and LCSS ′ (A, B) represents the length of the longest common subsequence, n represents the length of the first trajectory sequence, m represents the length of the second trajectory sequence, a 1 、a 2 Respectively represent the first and second trajectory points in A, b 1 、b 2 Represent the first and second trajectory points in B respectively, Rest(A) represents the first remaining trajectory sequence, B represents the second remaining trajectory sequence, represents the distance between head track segments, and ε represents the preset distance threshold.

5. The method according to claim 4, It is characterized in that The calculation formula of the trajectory similarity is as follows: Among them, S ′ (A, B) represents the trajectory similarity between the first trajectory sequence and the second trajectory sequence.

6. The method according to any one of claims 1 to 5, It is characterized in that After obtaining the first trajectory sequence and the second trajectory sequence of the trajectory similarity to be analyzed, the method further includes: Based on the variance of the trajectory points in the window and the relationship with the preset threshold, the stay points in the first trajectory sequence or the second trajectory sequence are detected, and the stay points are extracted.

7. The method according to claim 6, It is characterized in that The detecting of the stay points in the first trajectory sequence or the second trajectory sequence based on the variance of the trajectory points in the window and the relationship with the preset threshold, and extracting the stay points includes: For the current trajectory point of the first trajectory sequence or the second trajectory sequence, a target window is determined by adjusting the window length, and the sum of variances of the trajectory points in the target window is closest to and greater than a preset threshold; Determine the trajectory points in the target window as the stay points, and remove the other stay points except the first stay point and the last stay point in the target window; For the next trajectory point of the tail stop point in the first trajectory sequence or the second trajectory sequence, the step of determining the target window by adjusting the window length is repeatedly performed until the next trajectory point is empty.

8. The method according to claim 7, It is characterized in that The step of determining the target window by adjusting the window length includes: Set the window length to 1 and calculate the sum of the variances of the trajectory points within the window; When the sum of the variances is less than or equal to the preset threshold, the window length is increased by 1, and the step of calculating the sum of the variances of the trajectory points in the window is repeated until the sum of the variances is greater than the preset threshold, thereby obtaining a target window.

9. The method according to any one of claims 1 to 5, It is characterized in that After obtaining the first trajectory sequence and the second trajectory sequence of the trajectory similarity to be analyzed, the method further includes: The first trajectory sequence or the second trajectory sequence is subjected to denoising processing based on a preset denoising algorithm.

10. A device for determining trajectory similarity, It is characterized in that include: A trajectory acquisition module, used to acquire a first trajectory sequence and a second trajectory sequence of trajectory similarities to be analyzed; A first determination module is used to determine a first track segment formed by any two adjacent track points in the first track sequence, and to determine a second track segment formed by any two adjacent track points in the second track sequence; A second determination module is used to determine the inter-segment distance corresponding to the first trajectory segment and the second trajectory segment, wherein the inter-segment distance is the smaller value of the first distance and the second distance, wherein the first distance is the distance between the starting trajectory point of the first trajectory segment and the second trajectory segment, and the second distance is the distance between the starting trajectory point of the second trajectory segment and the first trajectory segment; A third determination module is used to determine the number of the track segments whose distances are less than a preset distance threshold, where the number is the longest common subsequence length of the first track sequence and the second track sequence; The fourth determining module is configured to determine the trajectory similarity between the first trajectory sequence and the second trajectory sequence based on the longest common subsequence length.

11. An electronic device, It is characterized in that It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; The processor is used to implement the steps of the method for determining trajectory similarity according to any one of claims 1 to 9 when executing the program stored in the memory.

12. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method for determining trajectory similarity according to any one of claims 1 to 9 are implemented.