An implementation method, device and equipment for searching for a same-line vehicle and a storage medium

By preprocessing checkpoint trajectory data and training neural networks, a trajectory model and vector database are generated, solving the problems of low efficiency and low accuracy in finding vehicles traveling in the same lane in existing technologies, and realizing efficient and accurate vehicle travel query.

CN116662402BActive Publication Date: 2026-07-31LINEWELL SOFTWARE
View PDF 4 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
LINEWELL SOFTWARE
Filing Date
2023-04-21
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing technologies are inefficient and susceptible to spam data when searching for vehicles in the same lane, resulting in low accuracy.

Method used

By preprocessing the vehicle trajectory data in the checkpoint trajectory database, positive samples with high trajectory similarity and negative samples with low trajectory similarity are generated. A neural network model is then used for training to generate a trajectory model, and the trajectory feature vectors are stored in a vector database for querying vehicles traveling in the same direction.

Benefits of technology

It improves the efficiency and accuracy of searching for vehicles in the same lane, effectively avoids the impact of junk data, and achieves an accuracy rate of over 90% for the trajectory model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116662402B_ABST
    Figure CN116662402B_ABST
Patent Text Reader

Abstract

This invention provides a method, apparatus, device, and storage medium for locating vehicles traveling in the same lane. The method includes acquiring vehicle trajectory data of each vehicle stored in a checkpoint trajectory database; processing the daily trajectory data of each vehicle into a complete trajectory sequence; preprocessing each complete trajectory sequence; inputting the generated sample data into a neural network model for training to obtain a trajectory model; inputting the vehicle trajectory data of each vehicle stored in the checkpoint trajectory database into the trajectory model, and storing the output trajectory feature vectors in a vector database; inputting the trajectory data of the vehicle to be queried into the trajectory model, and locating the vehicle traveling in the same lane from the vector database based on the output trajectory feature vectors to be queried. The advantages of this invention are: good generalization ability, high query efficiency, effective avoidance of the adverse effects of junk data, and high accuracy of the trajectory model, ensuring the accuracy of locating vehicles traveling in the same lane.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and in particular to a method, apparatus, device, and storage medium for locating vehicles traveling in the same lane. Background Technology

[0002] With the development of information technology and the construction of urban security, there are more and more checkpoint devices on the roads, the checkpoint capture and recognition rates are getting higher and higher, and the travel trajectories of each vehicle are being recorded more and more accurately. By analyzing the spatiotemporal similarity of vehicle trajectories, it is possible to uncover some spatiotemporal relationships or potential connections between two target vehicles. Since every city generates a large amount of checkpoint vehicle trajectory data every day, how to extract valuable data and data features from this data is a pressing problem that needs to be solved.

[0003] Currently, vehicle trajectory data generated daily at checkpoints is stored in MPP databases or data warehouses such as Hive. To find vehicles traveling together from this trajectory data, two common approaches are used: The first is to directly use SQL to find two vehicles that passed through the same checkpoint, with a passage time difference of at least one minute (the specific time can be modified as needed), and at least five (the specific number can be adjusted) checkpoints overlapping in their trajectories on the same day. However, this approach is inefficient, provides a poor user experience, and is easily affected by junk data (e.g., a checkpoint repeatedly capturing the same vehicles). The second approach involves offline analysis of the past month's vehicle trajectory data. Two vehicles with similar trajectories are grouped together if their license plates have at least three days (adjustable) of similar trajectories within the month, and each day has an estimated overlap. This indicates a spatiotemporal relationship between them. This approach is more user-friendly for front-end display due to pre-calculation, but it has poor generalization ability for new vehicle trajectories and is also affected by junk data.

[0004] Given the shortcomings of existing peer vehicle search methods, such as low efficiency and susceptibility to spam data, there is an urgent need to provide a method that can improve query efficiency, avoid being affected by spam data, and ensure accuracy. Summary of the Invention

[0005] The technical problem to be solved by the present invention is to provide a method, apparatus, device and storage medium for finding vehicles traveling together, thereby solving the problems of low efficiency and susceptibility to junk data in existing vehicle searching methods.

[0006] In a first aspect, the present invention provides a method for locating vehicles traveling in the same lane, the method comprising the following steps:

[0007] Obtain the vehicle trajectory data of each vehicle stored in the checkpoint trajectory database, and process the daily vehicle trajectory data of each vehicle into a complete trajectory sequence data.

[0008] For each row of complete trajectory sequence data, preprocessing is performed to find data with high trajectory similarity as positive samples and data with low trajectory similarity as negative samples.

[0009] After data preprocessing, the generated sample data is input into the neural network model for sample training to obtain the trajectory model;

[0010] The vehicle trajectory data of each vehicle stored in the checkpoint trajectory database is input into the trajectory model, the trajectory model outputs the trajectory feature vector, and the trajectory feature vector is stored in the vector database.

[0011] The vehicle trajectory data of the vehicle to be queried is input into the trajectory model, the trajectory model outputs the trajectory feature vector to be queried, and the vehicles traveling in the same direction are found from the vector database based on the trajectory feature vector to be queried.

[0012] Furthermore, the process of processing the daily vehicle trajectory data for each vehicle into a complete trajectory sequence includes:

[0013] Determine whether each vehicle contains vehicle trajectory data from at least N checkpoints on the same day. If so, retain the vehicle's vehicle trajectory data for that day; otherwise, delete the vehicle's vehicle trajectory data for that day. Wherein, N is a positive integer.

[0014] Create a first txt text file for each day, and use SQL statements to process the daily vehicle passage trajectory data of each vehicle into a complete trajectory sequence data line, and input the complete trajectory sequence data into the first txt text file of that day.

[0015] Furthermore, the complete trajectory sequence data includes an ID and a sequence of trajectory points, wherein the ID and the sequence of trajectory points are separated by a first delimiter;

[0016] The ID includes at least the license plate number; the trajectory point sequence includes multiple trajectory points, which are ordered in chronological order and are separated from each other by a second separator.

[0017] Each trajectory point includes three elements: time, longitude, and latitude, and adjacent elements are separated by a third separator.

[0018] Furthermore, the preprocessing of each complete trajectory sequence data to identify data with high trajectory similarity as positive samples and data with low trajectory similarity as negative samples specifically includes:

[0019] Create the pass_list array and the neg_list array, and also create a second txt text file to store the benchmark data, a third txt text file to store the positive sample data, and a fourth txt text file to store the negative sample data.

[0020] The algorithm iteratively retrieves each line of complete trajectory sequence data from the first txt text file. For each line of complete trajectory sequence data retrieved, it compares the retrieved complete trajectory sequence data with other complete trajectory sequence data in the first txt text file one by one to calculate the trajectory similarity score. If the calculated trajectory similarity score is greater than or equal to a first preset value, the other complete trajectory sequence data is stored in the pass_list array. At the same time, it is determined whether the data stored in the pass_list array exceeds M1. If it does, the data with the smallest trajectory similarity score is deleted; otherwise, no deletion is performed. In this way, the first M1 data with a trajectory similarity score greater than or equal to the first preset value are found and stored in the pass_list array.

[0021] If the calculated trajectory similarity score is less than or equal to the second preset value, it is determined whether the data stored in the neg_list array is equal to M2. If so, the other complete trajectory sequence data is not stored in the neg_list array; if not, the other complete trajectory sequence data is stored in the neg_list array and recorded in the fourth txt text file, thereby finding M2 data with trajectory similarity scores less than or equal to the second preset value and storing them in the neg_list array; wherein M1 and M2 are equal, and M1 and M2 are both positive integers;

[0022] For each complete trajectory sequence data obtained, after comparing the complete trajectory sequence data with other complete trajectory sequence data in the first txt text one by one, it is determined whether the length of the pass_list array is equal to M1 and whether the length of the neg_list array is equal to M2. If so, the obtained complete trajectory sequence data is recorded in the second txt text, and the data in the pass_list array is recorded in the third txt text; otherwise, the data recorded in the fourth txt text is deleted.

[0023] Specifically, in the second, third, and fourth txt texts, the time in the data is converted to seconds, and the latitude and longitude in the data are converted to Mercator projection coordinates.

[0024] Furthermore, the specific steps of comparing the acquired complete trajectory sequence data with other complete trajectory sequence data in the first txt text to calculate the trajectory similarity score are as follows:

[0025] The time in the two complete trajectory sequence data that need to be compared is processed into t1 and t2 containing only hour, minute and second attributes, and the time array is value[t1,t2]; longitude and latitude are used as keys, and one key represents one trajectory point;

[0026] The trajectory similarity score xsfs is calculated using the following formula:

[0027] xsfs=(dwchs / dwzs+xlchs / xlzs) / 2

[0028] Wherein, dwzs is the total number of points in the two complete trajectory sequence data; dwchs is the number of points overlapping in the two complete trajectory sequence data; xlzs is the total number of sequences in the two complete trajectory sequence data; and xlchs is the number of sequences overlapping in the two complete trajectory sequence data.

[0029] Furthermore, the specific steps of inputting the generated sample data into the neural network model for sample training are as follows:

[0030] The data recorded in the second txt text is used as the baseline data, the data recorded in the third txt text is used as the positive sample data, and the data recorded in the fourth txt text is used as the negative sample data.

[0031] During training, a baseline sequence is extracted from the second txt text, a positive sample sequence is extracted from the third txt text, and a negative sample sequence is extracted from the fourth txt text. The extracted baseline, positive, and negative sample sequences are input into the neural network model for training, so that the neural network model outputs the embeddings of the sequences. The loss function of the neural network model uses the TripletLoss function to make the embeddings space of the baseline data and the positive sample data as close as possible.

[0032] Furthermore, the step of inputting the vehicle trajectory data of each vehicle stored in the checkpoint trajectory database into the trajectory model, outputting trajectory feature vectors through the trajectory model, and storing the trajectory feature vectors in the vector database specifically includes:

[0033] Set a time range, and obtain the vehicle passage trajectory data of each vehicle from the checkpoint trajectory database according to the time range. Process the daily vehicle passage trajectory data of each vehicle into a complete trajectory sequence data.

[0034] The complete trajectory sequence data is converted into a data format that meets the requirements of the trajectory model, including: converting the time in the complete trajectory sequence data into seconds, and converting the latitude and longitude in the complete trajectory sequence data into Mercator projection coordinates; the converted data is then input into the trajectory model to obtain the gjvector, i.e., Embeddings, output by the trajectory model.

[0035] The IDs in the complete trajectory sequence data are converted into numeric hpids using a hash function, and the dates and times in the complete trajectory sequence data are converted into timestamps dtimes. The gjvector, hpid, and dtimes are then stored in a vector database.

[0036] Secondly, the present invention provides an apparatus for finding vehicles traveling in the same lane, the apparatus comprising a data acquisition module, a preprocessing module, a data training module, a feature storage module, and a data query module;

[0037] The data acquisition module is used to acquire the vehicle trajectory data of each vehicle stored in the checkpoint trajectory database, and process the daily vehicle trajectory data of each vehicle into a complete trajectory sequence data.

[0038] The preprocessing module is used to preprocess each row of complete trajectory sequence data, and to find data with high trajectory similarity as positive samples and data with low trajectory similarity as negative samples for each row of complete trajectory sequence data.

[0039] The data training module is used to input the generated sample data into the neural network model for sample training after data preprocessing, thereby obtaining the trajectory model.

[0040] The feature input module is used to input the vehicle trajectory data of each vehicle stored in the checkpoint trajectory database into the trajectory model, output the trajectory feature vector through the trajectory model, and store the trajectory feature vector into the vector database.

[0041] The data query module is used to input the vehicle trajectory data of the vehicle to be queried into the trajectory model, output the trajectory feature vector to be queried through the trajectory model, and find the vehicles traveling in the same direction from the vector database based on the trajectory feature vector to be queried.

[0042] Furthermore, the process of processing the daily vehicle trajectory data for each vehicle into a complete trajectory sequence includes:

[0043] Determine whether each vehicle contains vehicle trajectory data from at least N checkpoints on the same day. If so, retain the vehicle's vehicle trajectory data for that day; otherwise, delete the vehicle's vehicle trajectory data for that day. Wherein, N is a positive integer.

[0044] Create a first txt text file for each day, and use SQL statements to process the daily vehicle passage trajectory data of each vehicle into a complete trajectory sequence data line, and input the complete trajectory sequence data into the first txt text file of that day.

[0045] Furthermore, the complete trajectory sequence data includes an ID and a sequence of trajectory points, wherein the ID and the sequence of trajectory points are separated by a first delimiter;

[0046] The ID includes at least the license plate number; the trajectory point sequence includes multiple trajectory points, which are ordered in chronological order and are separated from each other by a second separator.

[0047] Each trajectory point includes three elements: time, longitude, and latitude, and adjacent elements are separated by a third separator.

[0048] Furthermore, the preprocessing of each complete trajectory sequence data to identify data with high trajectory similarity as positive samples and data with low trajectory similarity as negative samples specifically includes:

[0049] Create the pass_list array and the neg_list array, and also create a second txt text file to store the benchmark data, a third txt text file to store the positive sample data, and a fourth txt text file to store the negative sample data.

[0050] The algorithm iteratively retrieves each line of complete trajectory sequence data from the first txt text file. For each line of complete trajectory sequence data retrieved, it compares the retrieved complete trajectory sequence data with other complete trajectory sequence data in the first txt text file one by one to calculate the trajectory similarity score. If the calculated trajectory similarity score is greater than or equal to a first preset value, the other complete trajectory sequence data is stored in the pass_list array. At the same time, it is determined whether the data stored in the pass_list array exceeds M1. If it does, the data with the smallest trajectory similarity score is deleted; otherwise, no deletion is performed. In this way, the first M1 data with a trajectory similarity score greater than or equal to the first preset value are found and stored in the pass_list array.

[0051] If the calculated trajectory similarity score is less than or equal to the second preset value, it is determined whether the data stored in the neg_list array is equal to M2. If so, the other complete trajectory sequence data is not stored in the neg_list array; if not, the other complete trajectory sequence data is stored in the neg_list array and recorded in the fourth txt text file, thereby finding M2 data with trajectory similarity scores less than or equal to the second preset value and storing them in the neg_list array; wherein M1 and M2 are equal, and M1 and M2 are both positive integers;

[0052] For each complete trajectory sequence data obtained, after comparing the complete trajectory sequence data with other complete trajectory sequence data in the first txt text one by one, it is determined whether the length of the pass_list array is equal to M1 and whether the length of the neg_list array is equal to M2. If so, the obtained complete trajectory sequence data is recorded in the second txt text, and the data in the pass_list array is recorded in the third txt text; otherwise, the data recorded in the fourth txt text is deleted.

[0053] Specifically, in the second, third, and fourth txt texts, the time in the data is converted to seconds, and the latitude and longitude in the data are converted to Mercator projection coordinates.

[0054] Furthermore, the specific steps of comparing the acquired complete trajectory sequence data with other complete trajectory sequence data in the first txt text to calculate the trajectory similarity score are as follows:

[0055] The time in the two complete trajectory sequence data that need to be compared is processed into t1 and t2 containing only hour, minute and second attributes, and the time array is value[t1,t2]; longitude and latitude are used as keys, and one key represents one trajectory point;

[0056] The trajectory similarity score xsfs is calculated using the following formula:

[0057] xsfs=(dwchs / dwzs+xlchs / xlzs) / 2

[0058] Wherein, dwzs is the total number of points in the two complete trajectory sequence data; dwchs is the number of points overlapping in the two complete trajectory sequence data; xlzs is the total number of sequences in the two complete trajectory sequence data; and xlchs is the number of sequences overlapping in the two complete trajectory sequence data.

[0059] Furthermore, the specific steps of inputting the generated sample data into the neural network model for sample training are as follows:

[0060] The data recorded in the second txt text is used as the baseline data, the data recorded in the third txt text is used as the positive sample data, and the data recorded in the fourth txt text is used as the negative sample data.

[0061] During training, a baseline sequence is extracted from the second txt text, a positive sample sequence is extracted from the third txt text, and a negative sample sequence is extracted from the fourth txt text. The extracted baseline, positive, and negative sample sequences are input into the neural network model for training, so that the neural network model outputs the embeddings of the sequences. The loss function of the neural network model uses the TripletLoss function to make the embeddings space of the baseline data and the positive sample data as close as possible.

[0062] Furthermore, the step of inputting the vehicle trajectory data of each vehicle stored in the checkpoint trajectory database into the trajectory model, outputting trajectory feature vectors through the trajectory model, and storing the trajectory feature vectors in the vector database specifically includes:

[0063] Set a time range, and obtain the vehicle passage trajectory data of each vehicle from the checkpoint trajectory database according to the time range. Process the daily vehicle passage trajectory data of each vehicle into a complete trajectory sequence data.

[0064] The complete trajectory sequence data is converted into a data format that meets the requirements of the trajectory model, including: converting the time in the complete trajectory sequence data into seconds, and converting the latitude and longitude in the complete trajectory sequence data into Mercator projection coordinates; the converted data is then input into the trajectory model to obtain the gjvector, i.e., Embeddings, output by the trajectory model.

[0065] The IDs in the complete trajectory sequence data are converted into numeric hpids using a hash function, and the dates and times in the complete trajectory sequence data are converted into timestamps dtimes. The gjvector, hpid, and dtimes are then stored in a vector database.

[0066] Thirdly, the present invention provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method described in the first aspect.

[0067] Fourthly, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.

[0068] This invention preprocesses complete trajectory sequence data stored in a checkpoint trajectory database to identify a batch of data with high trajectory similarity as positive samples and a batch of data with different trajectory similarity as negative samples. The positive and negative samples are then used to train a neural network model, employing the triplet loss function as the training loss function to obtain the trajectory model. Simultaneously, the complete trajectory sequence data stored in the checkpoint trajectory database is input into the trained trajectory model to obtain trajectory feature vectors, which are then stored in a vector database. When searching for vehicles traveling in the same lane, the vehicle's passing trajectory data is input into the trained trajectory model, and the trajectory feature vectors output by the model are used to search the vector database. Therefore, by adopting the technical solution of this invention, at least the following beneficial effects are achieved:

[0069] 1. The trajectory generated by each vehicle every day is input into the trained trajectory model as a complete trajectory sequence data, and the obtained high-quality trajectory feature vectors are stored in the vector database. When a new vehicle trajectory needs to be queried and compared, it can be compared with the trajectory feature vectors stored in the vector database to find similar vehicle trajectories for display. It has good generalization ability and high query efficiency.

[0070] 2. The trajectory feature vectors stored in the vector database are all high-quality trajectory feature vectors processed by the trajectory model, which can effectively avoid the adverse effects of junk data.

[0071] 3. Using preprocessed positive and negative samples to train the neural network model can effectively improve the accuracy of the trajectory model. Actual testing has verified that the accuracy of the trajectory model can reach over 90%, which in turn ensures the accuracy of finding vehicles traveling in the same lane.

[0072] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and in order to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description

[0073] The present invention will be further described below with reference to the accompanying drawings and embodiments.

[0074] Figure 1 This is an execution flowchart of a method for finding vehicles traveling in the same lane according to Embodiment 1 of the present invention;

[0075] Figure 2 This is a schematic diagram of the training of the RNN neural network model in Embodiment 1 of the present invention;

[0076] Figure 3 This is a schematic diagram of the structure of a device for locating vehicles traveling in the same lane according to Embodiment 2 of the present invention;

[0077] Figure 4 This is a schematic diagram of the electronic device in Embodiment 3 of the present invention;

[0078] Figure 5 This is a schematic diagram of the structure of the medium in Embodiment 4 of the present invention. Detailed Implementation

[0079] Example 1

[0080] This embodiment provides a preferred embodiment of a method for finding vehicles traveling in the same lane, such as... Figure 1 As shown, the method includes the following steps:

[0081] Step S1: Obtain the vehicle trajectory data of each vehicle stored in the checkpoint trajectory database, and process the daily vehicle trajectory data of each vehicle into a complete trajectory sequence data. That is, process the vehicle trajectory data generated by each vehicle passing through the checkpoint each day into a single data line to prepare for subsequent data preprocessing. Since the vehicle trajectory data generated by vehicles passing through the checkpoint each day is currently stored in an MPP database or a data warehouse such as Hive, the checkpoint trajectory database can be an MPP database or a data warehouse such as Hive.

[0082] Step S2: Preprocess each row of complete trajectory sequence data, find data with high trajectory similarity as positive samples and data with low trajectory similarity as negative samples for each row of complete trajectory sequence data, so as to train the trajectory model using positive samples and negative samples.

[0083] Step S3: After the data preprocessing is completed, the generated sample data is input into the neural network model for sample training to obtain the trajectory model. In this way, the trajectory model can be used to output the trajectory feature vector.

[0084] Step S4: Input the vehicle trajectory data of each vehicle stored in the checkpoint trajectory database into the trajectory model, output the trajectory feature vector through the trajectory model, and store the trajectory feature vector in the vector database;

[0085] Step S5: Input the vehicle trajectory data of the vehicle to be queried into the trajectory model, output the trajectory feature vector to be queried through the trajectory model, and find the vehicles traveling in the same direction from the vector database based on the trajectory feature vector to be queried.

[0086] This invention preprocesses complete trajectory sequence data stored in a checkpoint trajectory database to identify a batch of data with high trajectory similarity as positive samples and a batch of data with different trajectory similarity as negative samples. The positive and negative samples are then used to train a neural network model, employing the triplet loss function as the training loss function to obtain the trajectory model. Simultaneously, the complete trajectory sequence data stored in the checkpoint trajectory database is input into the trained trajectory model to obtain trajectory feature vectors, which are then stored in a vector database. When searching for vehicles traveling in the same lane, the vehicle's passing trajectory data is input into the trained trajectory model, and the trajectory feature vectors output by the model are used to search the vector database. Therefore, by adopting the technical solution of this invention, at least the following beneficial effects are achieved:

[0087] 1. The trajectory generated by each vehicle every day is input into the trained trajectory model as a complete trajectory sequence data, and the obtained high-quality trajectory feature vectors are stored in the vector database. When a new vehicle trajectory needs to be queried and compared, it can be compared with the trajectory feature vectors stored in the vector database to find similar vehicle trajectories for display. It has good generalization ability and high query efficiency.

[0088] 2. The trajectory feature vectors stored in the vector database are all high-quality trajectory feature vectors processed by the trajectory model, which can effectively avoid the adverse effects of junk data.

[0089] 3. Using preprocessed positive and negative samples to train the neural network model can effectively improve the accuracy of the trajectory model. Actual testing has verified that the accuracy of the trajectory model can reach over 90%, which in turn ensures the accuracy of finding vehicles traveling in the same lane.

[0090] In a preferred embodiment of the present invention, the step of processing the daily vehicle trajectory data of each vehicle into a complete trajectory sequence data includes:

[0091] The system determines whether each vehicle has at least N checkpoints' trajectory data on the same day. If so, the vehicle's trajectory data for that day is retained; otherwise, it is deleted. Here, N is a positive integer, and in practice, N can be set according to actual needs. Preferably, N is greater than or equal to 4. This invention, after obtaining the vehicle trajectory data from the checkpoint trajectory database, deletes the trajectory data of vehicles recorded by fewer than N checkpoints on the same day. This approach allows for better sample data after preprocessing, thus improving the accuracy of the trained trajectory model. It also reduces the amount of data processing required for subsequent data preprocessing, improving data preprocessing efficiency.

[0092] A first txt file is created for each day. The daily vehicle passage trajectory data for each vehicle is processed into a complete trajectory sequence data line using SQL statements, and the complete trajectory sequence data is input into the first txt file of that day. The first txt file is named after the current date, i.e., date.txt. For example, if the vehicle passage trajectory data was generated on February 5, 2023, then the first txt file of that day will be named 20230205.txt.

[0093] Meanwhile, in step S1, obtaining the vehicle trajectory data of each vehicle from the checkpoint trajectory database is for data preprocessing to obtain sample data for training the trajectory model. Therefore, in specific implementation, K days of vehicle trajectory data can be exported from the checkpoint trajectory database. K can be set according to actual needs. For example, if K is set to 100, then nearly 100 days of vehicle trajectory data can be exported from the checkpoint trajectory database.

[0094] In a preferred embodiment of the present invention, the complete trajectory sequence data includes an ID and a trajectory point sequence, wherein the ID and the trajectory point sequence are separated by a first delimiter, for example, the first delimiter may be "|";

[0095] The ID includes at least the license plate number; the trajectory point sequence includes multiple trajectory points, which are ordered in chronological order, and adjacent trajectory points are separated by a second separator, such as a semicolon ";"; the ID may also include the license plate type and date;

[0096] Each trajectory point includes three elements: time, longitude, and latitude. Adjacent elements are separated by a third delimiter, such as a comma (,). The specific data format of the trajectory point sequence is: Time 1, Longitude 1, Latitude 1; Time 2, Longitude 2, Latitude 2; Time 3, Longitude 3, Latitude 3; Time 4, Longitude 4, Latitude 4; ...; Time n, Longitude n, Latitude n; where n is a positive integer. Specific example data is as follows:

[0097] 2021-01-01 11:11:12, 24.09888, 128.09898;...;2021-01-01 11:11:12, 24.09888, 128.09898.

[0098] In a preferred embodiment of the present invention, the preprocessing of each row of complete trajectory sequence data to find data with high trajectory similarity as positive samples and data with low trajectory similarity as negative samples specifically includes:

[0099] Create the `pass_list` array and the `neg_list` array, and also create a second `txt` text file for storing baseline data, a third `txt` text file for storing positive sample data, and a fourth `txt` text file for storing negative sample data; wherein, the second `txt` text file can be named `line_i.txt`, the third `txt` text file can be named `pass_i.txt`, and the fourth `txt` text file can be named `neg_i.txt`;

[0100] The algorithm iteratively retrieves each line of complete trajectory sequence data from the first txt text file (date.txt). For each line of complete trajectory sequence data retrieved, it compares the retrieved complete trajectory sequence data with all other complete trajectory sequence data in the first txt text file to calculate a trajectory similarity score. If the calculated trajectory similarity score is greater than or equal to a first preset value, the other complete trajectory sequence data is stored in the pass_list array. Simultaneously, it checks if the pass_list array contains more than M1 data entries. If so, the data entry with the lowest trajectory similarity score is deleted, increasing the similarity between the data in the pass_list array and the retrieved complete trajectory sequence data, thus ensuring the accuracy of the trained trajectory model. If not, no deletion is performed, thus identifying the first M1 data entries with a trajectory similarity score greater than or equal to the first preset value and storing them in the pass_list array.

[0101] If the calculated trajectory similarity score is less than or equal to the second preset value, it is determined whether the data stored in the `neg_list` array equals M2. If so, no further complete trajectory sequence data is stored in the `neg_list` array. In practice, this second preset value is usually set to 0%, so once the `neg_list` array contains M2 data, no more data needs to be added. If not, the other complete trajectory sequence data is stored in the `neg_list` array and recorded in the fourth `txt` file as negative sample data, thus identifying the complete trajectory similarity scores obtained from the previous analysis. M2 data points with trajectory similarity scores less than or equal to the second preset value are stored in the neg_list array; wherein M1 and M2 are equal, and both M1 and M2 are positive integers; of course, in specific implementation of the present invention, if the calculated trajectory similarity score is greater than the second preset value and less than the first preset value, the data is not saved; at the same time, after obtaining a complete line of trajectory sequence data and comparing it one by one, the program will automatically obtain the next complete line of trajectory sequence data and compare it one by one with other complete trajectory sequence data to calculate the trajectory similarity score, until every line of complete trajectory sequence data in the first txt text has been obtained and compared one by one before stopping;

[0102] For each complete trajectory sequence data obtained, after comparing the complete trajectory sequence data with other complete trajectory sequence data in the first txt text one by one, it is determined whether the length of the pass_list array is equal to M1 and the length of the neg_list array is equal to M2. If they are equal (i.e., the length of the pass_list array is equal to M1 and the length of the neg_list array is equal to M2), the obtained complete trajectory sequence data is recorded in the second txt text as the baseline data, and the data in the pass_list array is recorded in the third txt text as the positive sample data. If they are not equal (including the three cases where the length of the pass_list array is equal to M1 and the length of the neg_list array is less than M2, the length of the pass_list array is less than M1 and the length of the neg_list array is equal to M2, and the length of the pass_list array is less than M1 and the length of the neg_list array is less than M2), the data recorded in the fourth txt text is deleted.

[0103] In the second, third, and fourth TXT text files, the time data is converted to seconds, and the latitude and longitude data is converted to Mercator projection coordinates. Specifically, the latitude and longitude data are converted to x and y coordinates in the Mercator projection coordinate system, with the format: id1|time1,X1,Y1;time2,X2,Y2;time3,X3,Y3;time4,X4,Y4;......;timen,Xn,Yn; where n is a positive integer. A specific example is provided below to illustrate this:

[0104] CT011-01-2023-01-01|2376672,2400999.09888,12222338.09898;...;2376672,266554.09888,126668.09898. Here, id1 is CT011-01-2023-01-01, which uniquely identifies the trajectory ID of a vehicle on a specific day; CT011 represents the vehicle's license plate number; 01 represents the license plate type; 2023-01-01 represents the date the vehicle passed through the checkpoint; 2376672 represents the timestamp of the vehicle's passage time converted from hours, minutes, and seconds; 2400999.09888 and 12222338.09898 represent the x and y coordinates after conversion to Mercator projection coordinates.

[0105] In the data preprocessing of this invention, the complete trajectory sequence data in the first txt text is obtained line by line, and each obtained line of complete trajectory sequence data is compared with other complete trajectory sequence data in the first txt text to calculate the trajectory similarity score. This identifies the first M1 data points with a trajectory similarity score greater than or equal to a first preset value and stores them in the pass_list array. Simultaneously, it identifies the M2 data points with a trajectory similarity score less than or equal to a second preset value and stores them in the neg_list array. Furthermore, only when the length of the pass_list array is equal to M1 and the length of the neg_list array is equal to M2, is the obtained complete trajectory sequence data recorded as baseline data in the second txt text, the data in the pass_list array recorded as positive sample data in the third txt text, and the data in the neg_list array recorded as negative sample data in the fourth txt text. Therefore, by adopting the above technical solution of this invention, the reliability of the finally obtained sample data can be effectively ensured, thereby guaranteeing the accuracy of the trained trajectory model.

[0106] In one specific embodiment of the present invention, to ensure that the final sample data is of higher quality and more reliable, the first preset value is set to 80%, the second preset value is set to 0%, and the values ​​of M1 and M2 are both 10. Of course, the present invention is not limited to this; in specific implementations, the specific values ​​of the first preset value, the second preset value, M1, and M2 can be adjusted according to actual needs.

[0107] In a preferred embodiment of the present invention, the step of comparing the acquired complete trajectory sequence data with other complete trajectory sequence data in the first txt text one by one to calculate the trajectory similarity score specifically involves:

[0108] The time in the two complete trajectory sequence data that need to be compared is processed into t1 and t2 containing only hour, minute and second attributes, and the time array is value[t1,t2]; longitude and latitude are used as keys, and one key represents one trajectory point;

[0109] The trajectory similarity score xsfs is calculated using the following formula:

[0110] xsfs=(dwchs / dwzs+xlchs / xlzs) / 2

[0111] Wherein, dwzs is the total number of points in the two complete trajectory sequence data, that is, the total number of keys in the two complete trajectory sequence data after deduplication; dwchs is the number of points overlapping in the two complete trajectory sequence data, that is, the number of keys that exist in both complete trajectory sequence data, that is, the number of intersections of keys in the two complete trajectory sequence data; xlzs is the total number of sequences in the two complete trajectory sequence data, that is, the total array size of the two complete trajectory sequence data divided by the "second delimiter", that is, the total number of trajectory points recorded in the two complete trajectory sequence data; xlchs is the number of sequences overlapping in the two complete trajectory sequence data, that is, the time within the same key, and if a data point with a time difference of 5 minutes (the specific time difference can be adjusted according to actual needs) can be found in the array of the same key, then xlchs is incremented by 1.

[0112] This invention calculates trajectory similarity scores by considering two aspects: firstly, the role of the point overlap rate (dwchs / dwzs) in the similarity between two trajectory sequences; and secondly, the role of the sequence similarity (xlchs / xlzs) of the trajectory sequences themselves in the similarity between trajectory sequences. By considering the point overlap rate, it can prevent a large amount of duplicate data for a certain trajectory point within a certain period of time, which would increase the similarity between the two trajectory sequences.

[0113] The following is a specific example to illustrate this:

[0114] For example, sequence 1:

[0115] CT123-01-2023-01-01|11:11:12,24.0,128.1; 11:22:12,24.1,128.2; 11:29:12,24.3,128.4; 11:51:12,24.0,128.1

[0116] Sequence 2:

[0117] CT567-01-2023-01-01|11:13:12,24.0,128.1; 11:25:12,24.1,128.2; 11:31:12,24.3,128.4; 11:59:12,24.5,128.6

[0118] In the two sequences above, the total number of points dwzs = 4, specifically including [(24.0,128.1),(24.1,128.2),(24.3,128.4),(24.5,128.6)];

[0119] The number of overlapping points, dwchs, is 3, specifically including [(24.0, 128.1), (24.1, 128.2), (24.3, 128.4)];

[0120] The total number of sequences xlzs = 4 + 4 = 8, because sequence 1 has 4 arrays after being split by ";", and similarly sequence 2 has 4 arrays after being split by ";", therefore the total number of sequences xlzs = 8;

[0121] Sequence overlap number xlchs = 6:

[0122] After sequence 1 transformation

[0123] The location key 24.0, 128.1 has a value of [11:11:12, 11:51:12].

[0124] The key is 24.1,128.2 and the value is [11:22:12].

[0125] The key is 24.3, and the value is 128.4. The value is [11:29:12].

[0126] After sequence 2 transformation

[0127] The location key is 24.0, 128.1, and the value is [11:13:12].

[0128] The location key 24.1, 128.2 has a value of [11:25:12].

[0129] The key is 24.3, and the value is 128.4. The value is [11:31:12].

[0130] The location key is 24.5, 128.6, and the value is [11:59:12].

[0131] First, loop through the value of key24.0,128.1 in sequence 1, which is [11:11:12, 11:51:12]. Then, in the value of key24.0,128.1 in sequence 2, which is [11:13:12], check if there is any time data with a difference within 5 minutes. If so, xlchs + 1 = 1. Next, loop through the value of key24.0,128.1 in sequence 2, which is [11:13:12]. Then, in the value of key24.0,128.1 in sequence 1, which is [11:11:12, 11:51:12], check if there is any time data with a difference within 5 minutes. If so, xlchs + 1 = 2. Repeat this process until you finally get xlchs = 6.

[0132] Therefore, the trajectory similarity score xsfs = (3 / 4 + 6 / 8) / 2 = 3 / 4.

[0133] In a preferred embodiment of the present invention, the step of inputting the generated sample data into the neural network model for sample training specifically involves:

[0134] The data recorded in the second txt file is used as the baseline data, that is, the data stored in line_i.txt is the anchor, which is the baseline; the data recorded in the third txt file is used as the positive sample data, that is, the data stored in pass_i.txt is positive, which is a positive sample of the anchor and similar to the anchor; the data recorded in the fourth txt file is used as the negative sample data, that is, the data stored in neg_i.txt is negative, which is a negative sample of the anchor.

[0135] During training, such as Figure 2 As shown, the baseline sequence (i.e., ...) is extracted from the second txt text. Figure 2 Trajectory sequence 1), extracting positive sample sequences from the third txt text (i.e. Figure 2 Trajectory sequence 2), extracting negative sample sequences from the fourth txt text (i.e. Figure 2 The trajectory sequence 3) is used to train the neural network model RNN by inputting the three sequences: the baseline sequence, the positive sample sequence, and the negative sample sequence. Figure 2In this context, "shareweights" represents the weights that make the embeddings of the output sequence of the neural network model as close as possible to the embeddings of the baseline data anchor and the positive sample data, while maximizing the distance between the embeddings of the baseline data anchor and the negative sample data.

[0136] In a preferred embodiment of the present invention, the step of inputting the vehicle trajectory data of each vehicle stored in the checkpoint trajectory database into the trajectory model, outputting trajectory feature vectors through the trajectory model, and storing the trajectory feature vectors in the vector database specifically includes:

[0137] A time range is set, and vehicle trajectory data for each vehicle is retrieved from the checkpoint trajectory database based on this time range. The daily trajectory data for each vehicle is then processed into a complete trajectory sequence. The time range can be set according to actual needs; for example, trajectory data from the most recent month can be retrieved. In practice, it is necessary to retrieve the trajectory data of vehicles captured by at least N checkpoints on the same day from the checkpoint trajectory database. N is a positive integer and can be adjusted as needed to remove less valuable data. Simultaneously, each vehicle forms a complete trajectory sequence for each day, with the trajectory points arranged chronologically.

[0138] The complete trajectory sequence data is converted into a data format that meets the requirements of the trajectory model, including: converting the time in the complete trajectory sequence data into seconds, that is, keeping only the hours, minutes and seconds and converting them into seconds; converting the latitude and longitude in the complete trajectory sequence data into Mercator projection coordinates, that is, converting the latitude and longitude into the x and y coordinates of the Mercator projection coordinate system; and inputting the converted data into the trajectory model to obtain the gjvector, i.e., Embeddings, output by the trajectory model.

[0139] The IDs (which may include license plate number and license plate type) in the complete trajectory sequence data are converted into numeric hpids using a hash function. The date and time in the complete trajectory sequence data are converted into timestamps dtimes. The gjvector, hpid, and dtimes are stored in the Milvus vector database. The conversion of date and time in the complete trajectory sequence data into timestamps dtimes can be directly implemented using Python. For example, converting 2023-03-23 ​​into a timestamp allows Python to directly calculate the distance in seconds between 2023-03-23 ​​00:00:00 and 1970-01-01 00:00:00. The specific implementation code is as follows:

[0140] importtime

[0141] importdatetime date_string="2023-03-23"

[0142] timestamp=time.mktime(datetime.datetime.strptime(date_string,"%Y-%m-%d").timetuple()).

[0143] In a preferred embodiment of the present invention, since the trajectory feature vectors of each vehicle's passing trajectory data within a recent time range have already been stored in the vector database Milvus in step S4, a query interface for vehicles traveling together can be directly provided to the front end. In step S5, when a user needs to query similar trajectories of a certain license plate on a certain day, the complete trajectory sequence data of the license plate on that day needs to be input into the trajectory model at the front end according to the format requirements of the trajectory model to obtain the Embeddings (vectors) output by the trajectory model. The front end then inputs the vectors and the date of the same day into the vector database Milvus to query the trajectory data that is similar to that license plate within the same time period, that is, to obtain the vehicles traveling together on that day. Of course, if the front end inputs the vectors and a time range, it can query vehicles that are related in time and space within the time range.

[0144] Based on the same inventive concept, this application also provides an apparatus corresponding to the method in Embodiment 1, as detailed in Embodiment 2.

[0145] Example 2

[0146] This embodiment provides a device for locating vehicles traveling in the same lane, such as... Figure 3 As shown, the implementation device includes a data acquisition module, a preprocessing module, a data training module, a feature storage module, and a data query module;

[0147] The data acquisition module is used to acquire the vehicle trajectory data of each vehicle stored in the checkpoint trajectory database, and process the daily vehicle trajectory data of each vehicle into a complete trajectory sequence data. That is, the vehicle trajectory data generated by each vehicle passing through the checkpoint each day is processed into a single data line to prepare for subsequent data preprocessing. Since the vehicle trajectory data generated by vehicles passing through the checkpoint each day is currently stored in an MPP database or a data warehouse such as Hive, the checkpoint trajectory database can be an MPP database or a data warehouse such as Hive.

[0148] The preprocessing module is used to preprocess each row of complete trajectory sequence data, find data with high trajectory similarity as positive samples and data with low trajectory similarity as negative samples for each row of complete trajectory sequence data, so as to train the trajectory model using positive samples and negative samples.

[0149] The data training module is used to input the generated sample data into the neural network model for sample training after the data preprocessing is completed, so as to obtain the trajectory model. In this way, the trajectory model can be used to output the trajectory feature vector.

[0150] The feature input module is used to input the vehicle trajectory data of each vehicle stored in the checkpoint trajectory database into the trajectory model, output the trajectory feature vector through the trajectory model, and store the trajectory feature vector into the vector database.

[0151] The data query module is used to input the vehicle trajectory data of the vehicle to be queried into the trajectory model, output the trajectory feature vector to be queried through the trajectory model, and find the vehicles traveling in the same direction from the vector database based on the trajectory feature vector to be queried.

[0152] This invention preprocesses complete trajectory sequence data stored in a checkpoint trajectory database to identify a batch of data with high trajectory similarity as positive samples and a batch of data with different trajectory similarity as negative samples. The positive and negative samples are then used to train a neural network model, employing the triplet loss function as the training loss function to obtain the trajectory model. Simultaneously, the complete trajectory sequence data stored in the checkpoint trajectory database is input into the trained trajectory model to obtain trajectory feature vectors, which are then stored in a vector database. When searching for vehicles traveling in the same lane, the vehicle's passing trajectory data is input into the trained trajectory model, and the trajectory feature vectors output by the model are used to search the vector database. Therefore, by adopting the technical solution of this invention, at least the following beneficial effects are achieved:

[0153] 1. The trajectory generated by each vehicle every day is input into the trained trajectory model as a complete trajectory sequence data, and the obtained high-quality trajectory feature vectors are stored in the vector database. When a new vehicle trajectory needs to be queried and compared, it can be compared with the trajectory feature vectors stored in the vector database to find similar vehicle trajectories for display. It has good generalization ability and high query efficiency.

[0154] 2. The trajectory feature vectors stored in the vector database are all high-quality trajectory feature vectors processed by the trajectory model, which can effectively avoid the adverse effects of junk data.

[0155] 3. Using preprocessed positive and negative samples to train the neural network model can effectively improve the accuracy of the trajectory model. Actual testing has verified that the accuracy of the trajectory model can reach over 90%, which in turn ensures the accuracy of finding vehicles traveling in the same lane.

[0156] It should be noted that in this second embodiment, the functions implemented by the data acquisition module are exactly the same as those in step S1 of the first embodiment; the functions implemented by the preprocessing module are exactly the same as those in step S2 of the first embodiment; the functions implemented by the data training module are exactly the same as those in step S3 of the first embodiment; the functions implemented by the feature entry module are exactly the same as those in step S4 of the first embodiment; and the functions implemented by the data query module are exactly the same as those in step S5 of the first embodiment. Therefore, in this second embodiment, the specific functional implementations of the data acquisition module, preprocessing module, data training module, feature entry module, and data query module will not be described in detail. Please refer to the detailed description of the first embodiment for specific details.

[0157] Based on the same inventive concept, this application provides an electronic device embodiment corresponding to Embodiment 1, as detailed in Embodiment 3.

[0158] Example 3

[0159] This embodiment provides an electronic device, such as... Figure 4 As shown, it includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it can implement any of the embodiments in Example 1.

[0160] Since the electronic device described in this embodiment is the device used to implement the method in Embodiment 1 of this application, those skilled in the art can understand the specific implementation method and various variations of the electronic device in this embodiment based on the method described in Embodiment 1 of this application. Therefore, how the electronic device implements the method in the embodiment of this application will not be described in detail here. Any device used by those skilled in the art to implement the method in the embodiment of this application falls within the scope of protection of this application.

[0161] Based on the same inventive concept, this application provides a storage medium corresponding to Embodiment 1, as detailed in Embodiment 4.

[0162] Example 4

[0163] This embodiment provides a computer-readable storage medium, such as... Figure 5As shown, a computer program is stored thereon, which, when executed by a processor, can implement any of the embodiments in Example 1.

[0164] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0165] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus, and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0166] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0167] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0168] While specific embodiments of the present invention have been described above, those skilled in the art should understand that the specific embodiments described are merely illustrative and not intended to limit the scope of the present invention. Equivalent modifications and variations made by those skilled in the art in accordance with the spirit of the present invention should be covered within the scope of protection of the claims of the present invention.

Claims

1. An implementation method for finding a same-line vehicle, characterized in that: The method includes the following steps: Obtain the vehicle trajectory data of each vehicle stored in the checkpoint trajectory database, and process the daily vehicle trajectory data of each vehicle into a complete trajectory sequence data. For each row of complete trajectory sequence data, preprocessing is performed to identify data with high trajectory similarity as positive samples and data with low trajectory similarity as negative samples. Specifically, this includes: Create arrays `pass_list` and `neg_list`. Iterate through each line of complete trajectory sequence data in the first `txt` text file. For each line of complete trajectory sequence data retrieved, compare it one by one with other complete trajectory sequence data in the first `txt` text file to calculate the trajectory similarity score. Specifically: process the time in both complete trajectory sequence data to be compared into `t1` and `t2` containing only hour, minute, and second attributes, with the time array being `value[t1,t2]`; use longitude and latitude as keys, with one key representing one trajectory point; calculate the trajectory similarity score `xsfs` using the following formula: `xsfs=(dwchs / dwzs+xlchs / xlzs) / 2`; where `dw...` zs represents the total number of points in the two complete trajectory sequence data; dwchs represents the number of points overlapping in the two complete trajectory sequence data; xlzs represents the total number of sequences in the two complete trajectory sequence data; xlchs represents the number of sequences overlapping in the two complete trajectory sequence data; if the calculated trajectory similarity score is greater than or equal to the first preset value, then the other complete trajectory sequence data is stored in the pass_list array. At the same time, it is determined whether the data stored in the pass_list array exceeds M1. If so, the data with the smallest trajectory similarity score is deleted; if not, no deletion is performed. Thus, the first M1 data with a trajectory similarity score greater than or equal to the first preset value that are obtained from the complete trajectory sequence data are found and stored in the pass_list array. If the calculated trajectory similarity score is less than or equal to the second preset value, it is determined whether the data stored in the neg_list array is equal to M2. If yes, the other complete trajectory sequence data is not stored in the neg_list array; if no, the other complete trajectory sequence data is stored in the neg_list array, thereby finding M2 data with trajectory similarity scores less than or equal to the second preset value and storing them in the neg_list array; wherein M1 and M2 are equal, and M1 and M2 are both positive integers; After data preprocessing, the generated sample data is input into the neural network model for sample training to obtain the trajectory model; The vehicle trajectory data of each vehicle stored in the checkpoint trajectory database is input into the trajectory model, the trajectory model outputs the trajectory feature vector, and the trajectory feature vector is stored in the vector database. The vehicle trajectory data of the vehicle to be queried is input into the trajectory model, the trajectory model outputs the trajectory feature vector to be queried, and the vehicles traveling in the same direction are found from the vector database based on the trajectory feature vector to be queried.

2. The method for finding vehicles traveling in the same lane according to claim 1, characterized in that: The process of processing the daily vehicle trajectory data of each vehicle into a complete trajectory sequence includes: Determine whether each vehicle contains vehicle trajectory data from at least N checkpoints on the same day. If so, retain the vehicle's vehicle trajectory data for that day; otherwise, delete the vehicle's vehicle trajectory data for that day. Wherein, N is a positive integer. Create a first txt text file for each day, and use SQL statements to process the daily vehicle passage trajectory data of each vehicle into a complete trajectory sequence data line, and input the complete trajectory sequence data into the first txt text file of that day.

3. The method for finding vehicles traveling in the same lane according to claim 1, characterized in that: The complete trajectory sequence data includes an ID and a sequence of trajectory points, wherein the ID and the sequence of trajectory points are separated by a first delimiter; The ID includes at least the license plate number; the trajectory point sequence includes multiple trajectory points, which are ordered in chronological order and are separated from each other by a second separator. Each trajectory point includes three elements: time, longitude, and latitude, and adjacent elements are separated by a third separator.

4. The method for finding vehicles traveling in the same lane according to claim 2, characterized in that: The preprocessing of each complete trajectory sequence data, specifically identifying data with high trajectory similarity as positive samples and data with low trajectory similarity as negative samples, further includes: Create a second txt text file to store benchmark data, a third txt text file to store positive sample data, and a fourth txt text file to store negative sample data; When storing the other complete trajectory sequence data into the neg_list array, the other complete trajectory sequence data is also recorded into the fourth txt text file; For each complete trajectory sequence data obtained, after comparing the complete trajectory sequence data with other complete trajectory sequence data in the first txt text one by one, it is determined whether the length of the pass_list array is equal to M1 and whether the length of the neg_list array is equal to M2. If so, the obtained complete trajectory sequence data is recorded in the second txt text, and the data in the pass_list array is recorded in the third txt text; otherwise, the data recorded in the fourth txt text is deleted. Specifically, in the second, third, and fourth txt texts, the time in the data is converted to seconds, and the latitude and longitude in the data are converted to Mercator projection coordinates.

5. The method for finding vehicles traveling in the same lane according to claim 4, characterized in that: The specific steps for inputting the generated sample data into the neural network model for sample training are as follows: The data recorded in the second txt text is used as the baseline data, the data recorded in the third txt text is used as the positive sample data, and the data recorded in the fourth txt text is used as the negative sample data. During training, a baseline sequence is extracted from the second txt text, a positive sample sequence is extracted from the third txt text, and a negative sample sequence is extracted from the fourth txt text. The extracted baseline, positive, and negative sample sequences are input into the neural network model for training, so that the neural network model outputs the embeddings of the sequences. The loss function of the neural network model uses the Triplet Loss function to make the embeddings space of the baseline data and the positive sample data as close as possible.

6. The method for finding vehicles traveling in the same lane according to claim 1, characterized in that: The process of inputting the vehicle trajectory data stored in the checkpoint trajectory database into the trajectory model, outputting trajectory feature vectors through the trajectory model, and storing the trajectory feature vectors in the vector database specifically includes: Set a time range, and obtain the vehicle passage trajectory data of each vehicle from the checkpoint trajectory database according to the time range. Process the daily vehicle passage trajectory data of each vehicle into a complete trajectory sequence data. The complete trajectory sequence data is converted into a data format that meets the requirements of the trajectory model, including: converting the time in the complete trajectory sequence data into seconds, and converting the latitude and longitude in the complete trajectory sequence data into Mercator projection coordinates; the converted data is then input into the trajectory model to obtain the gjvector, i.e., Embeddings, output by the trajectory model. The IDs in the complete trajectory sequence data are converted into numeric hpids using a hash function, and the dates and times in the complete trajectory sequence data are converted into timestamps dtimes. The gjvector, hpid, and dtimes are then stored in a vector database.

7. A device for locating vehicles traveling in the same lane, characterized in that: The implementation device includes a data acquisition module, a preprocessing module, a data training module, a feature storage module, and a data query module; The data acquisition module is used to acquire the vehicle trajectory data of each vehicle stored in the checkpoint trajectory database, and process the daily vehicle trajectory data of each vehicle into a complete trajectory sequence data. The preprocessing module is used to preprocess each row of complete trajectory sequence data, identifying data with high trajectory similarity as positive samples and data with low trajectory similarity as negative samples for each row of complete trajectory sequence data. Specifically, it includes: Create arrays `pass_list` and `neg_list`. Iterate through each line of complete trajectory sequence data in the first `txt` text file. For each line of complete trajectory sequence data retrieved, compare it one by one with other complete trajectory sequence data in the first `txt` text file to calculate the trajectory similarity score. Specifically: process the time in both complete trajectory sequence data to be compared into `t1` and `t2` containing only hour, minute, and second attributes, with the time array being `value[t1,t2]`; use longitude and latitude as keys, with one key representing one trajectory point; calculate the trajectory similarity score `xsfs` using the following formula: `xsfs=(dwchs / dwzs+xlchs / xlzs) / 2`; where `dw...` zs represents the total number of points in the two complete trajectory sequence data; dwchs represents the number of points overlapping in the two complete trajectory sequence data; xlzs represents the total number of sequences in the two complete trajectory sequence data; xlchs represents the number of sequences overlapping in the two complete trajectory sequence data; if the calculated trajectory similarity score is greater than or equal to the first preset value, then the other complete trajectory sequence data is stored in the pass_list array. At the same time, it is determined whether the data stored in the pass_list array exceeds M1. If so, the data with the smallest trajectory similarity score is deleted; if not, no deletion is performed. Thus, the first M1 data with a trajectory similarity score greater than or equal to the first preset value that are obtained from the complete trajectory sequence data are found and stored in the pass_list array. If the calculated trajectory similarity score is less than or equal to the second preset value, it is determined whether the data stored in the neg_list array is equal to M2. If yes, the other complete trajectory sequence data is not stored in the neg_list array; if no, the other complete trajectory sequence data is stored in the neg_list array, thereby finding M2 data with trajectory similarity scores less than or equal to the second preset value and storing them in the neg_list array; wherein M1 and M2 are equal, and M1 and M2 are both positive integers; The data training module is used to input the generated sample data into the neural network model for sample training after data preprocessing, thereby obtaining the trajectory model. The feature input module is used to input the vehicle trajectory data of each vehicle stored in the checkpoint trajectory database into the trajectory model, output the trajectory feature vector through the trajectory model, and store the trajectory feature vector into the vector database. The data query module is used to input the vehicle trajectory data of the vehicle to be queried into the trajectory model, output the trajectory feature vector to be queried through the trajectory model, and find the vehicles traveling in the same direction from the vector database based on the trajectory feature vector to be queried.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method as described in any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1 to 6.