A Map Anomaly Trajectory Detection Method and System Based on Self-Attention and Unsupervised Learning

By employing a self-attention model and unsupervised learning, this method addresses the problem that traditional GPS trajectory detection methods struggle to cover real-world scenarios, achieving efficient and automated anomaly trajectory detection, reducing manual costs, and improving detection accuracy.

CN115760918BActive Publication Date: 2025-10-28WUHAN ZHONGHAITING DATA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211436907.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-16
Publication Date
2025-10-28
Estimated Expiration
2042-11-16

AI Technical Summary

Technical Problem

In existing technologies, traditional abnormal trajectory detection methods are difficult to cover real-world situations and have high labor costs. In particular, when there are errors in GPS trajectory data, it is difficult to effectively remove abnormal trajectories.

Method used

A self-attention and unsupervised learning-based approach is adopted to convert GPS trajectory points into grid-based horizontal and vertical coordinates. Encoding and decoding are performed using a self-attention model, and a trajectory encoder is trained using mean square error and divergence loss functions to generate trajectory anomaly probabilities.

Benefits of technology

It achieves efficient and automated abnormal trajectory detection, reduces manual labeling costs, better adapts to complex real-world situations, and improves detection accuracy and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115760918B_ABST
    Figure CN115760918B_ABST
Patent Text Reader

Abstract

This invention belongs to the field of map production technology, specifically providing a method and system for detecting abnormal map trajectories based on self-attention and unsupervised learning. The method includes: converting continuous vector trajectories into raw data through a gridded map; then, obtaining a raw discrete trajectory sequence through fully connected dimensionality transformation; finally, obtaining the trajectory mapping in the latent space through attention encoding; and training this process to obtain a trajectory encoder. Then, anomaly probability estimation is performed on the trajectory to be tested to obtain the trajectory anomaly probability. This data-driven approach solves the problem of abnormal trajectory detection, avoiding the difficulty of rule-based methods in covering real-world situations. Furthermore, by using a more efficient trajectory encoding method—a self-attention model—it learns trajectory features that better express the data. In addition, unsupervised learning replaces the binary classification model, saving the cost of manual labeling and offering better real-world usability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of map production technology, and more specifically, to a method and system for detecting abnormal map trajectories based on self-attention and unsupervised learning. Background Technology

[0002] In map production, a large amount of GPS trajectory data is often input. However, due to varying degrees of interference in different environments, GPS signals can cause significant discrepancies between the trajectory and the actual location in some areas, rendering them unusable. Before using the trajectory, these abnormal trajectories need to be removed to eliminate errors in the input data. This problem is known as abnormal trajectory detection. Currently, abnormal trajectory detection mainly includes manual inspection methods, rule-based detection methods, and data-driven detection methods.

[0003] (1) Manual inspection method: After visualizing the trajectory, perform manual inspection to manually remove out-of-group trajectories. This method is inefficient, has high labor costs, and is not suitable for batch big data processing.

[0004] (2) Rule-based detection method: Based on the observed characteristics of abnormal and normal trajectories, some features of abnormal trajectories are summarized, such as changes in the angles of preceding and following points, changes in the angles of consecutive points, point spacing, etc. This method requires continuous summarization of new rules because abnormal situations often exceed the scope of the design rules, making the rules and implementation code increasingly difficult to maintain as the number of situations increases. The drawback of this method is that the rules cannot fully encompass complex real-world situations, and adapting to reality makes the rules difficult to maintain and consistent.

[0005] (3) Data-driven detection methods: With the rise of machine learning and deep learning, it has become possible to generate models that can detect anomalies through training data. The idea is to learn the feature distribution of normal trajectories through the model, and then determine whether a new trajectory conforms to the distribution of these features, thereby calculating the probability that the new trajectory is normal, which in turn yields the probability of an anomaly. First, this method requires encoding the trajectory sequence. Existing trajectory encoding methods such as using LSTM (Long Short-Term Memory) models or LSTM+Attention models have achieved certain results. However, LSTM-based models have some drawbacks, such as the more information is lost as the sequence length increases, the difficulty in improving performance through serial computation, the difficulty in using multi-layer networks (rarely exceeding 2 layers), and limited expressive power. Second, because anomalous trajectories are very rare, and most trajectories are normal, many previous methods used binary classification models for detection. However, binary classification models require more than 10% negative samples. If there are too few negative samples, it is difficult to achieve good results. In reality, there are not enough negative samples, and these negative samples often need to be manually verified, resulting in excessive costs. Summary of the Invention

[0006] This invention addresses the technical problems of traditional abnormal trajectory detection methods in the prior art, which are difficult to cover real-world situations and have high labor costs.

[0007] This invention provides an anomaly trajectory detection method based on self-attention and unsupervised learning, comprising the following steps:

[0008] S1 converts the latitude and longitude coordinate sequence corresponding to the map trajectory points into raw data in the form of grid horizontal and vertical coordinates;

[0009] S2 transforms the original data into the dimensions required by the self-attention model through a fully connected layer, resulting in the original discrete trajectory sequence;

[0010] S3 encodes discrete trajectory sequences using a self-attention model;

[0011] S4, perform latent space resampling based on the encoding result to obtain the resampling result z;

[0012] S5, the training method of sampling from attention decoding decodes the resampling result z;

[0013] S6, by converting the fully connected dimension into the dimension of the grid's horizontal and vertical coordinates, obtains the decoded discrete trajectory sequence;

[0014] S7. The mean squared error is obtained by calculating the mean squared error loss function between the decoded discrete trajectory sequence and the original discrete trajectory sequence. The divergence loss function and the mean squared error are added together to obtain the complete loss function result during training. When the loss function result is small enough to be within a preset range, the trajectory encoder training is complete.

[0015] S8. After inputting normal map trajectory data into the trajectory encoder, continuous latent space data is obtained. The probability density of the latent space data is estimated to obtain the probability density function.

[0016] S9. Input the trajectory of the map to be tested into the trajectory encoder to obtain the mean of the latent space. Substitute the mean into the probability density function to obtain the trajectory anomaly probability.

[0017] Preferably, S1 specifically includes:

[0018] S11: Obtain continuous floating-point map trajectory points to form a latitude and longitude coordinate sequence;

[0019] S12 assigns map trajectory points to discrete grids, and replaces the original latitude and longitude coordinate sequences with the horizontal and vertical integer indices of the grids to obtain the original data of the two-dimensional attributes corresponding to the latitude and longitude coordinate sequences.

[0020] Preferably, S3 specifically includes:

[0021] First, the information of the entire discrete trajectory sequence is incorporated into each item of the encoding result through a self-attention model;

[0022] Then, the first and second terms of the encoded result sequence are selected as the mean and variance var of the latent space.

[0023] Preferably, S3 further includes:

[0024] During the encoding process, the divergence loss function is used to make the encoded mean and variance approximate a standard normal distribution to a preset baseline.

[0025] Preferably, S4 specifically includes:

[0026] The reparameterization method is used to introduce the sampling results of the standard normal distribution from the outside, multiply them by the variance, and add the mean to obtain the resampling result z.

[0027] Preferably, S5 includes:

[0028] During the decoding process, the input data includes not only the resampled result z, but also the discrete trajectory sequence after dimension adjustment.

[0029] Preferably, the function model for the trajectory encoder training process in S7 specifically includes:

[0030] MSE_Loss = ||X-decode(z)|| 2 ;

[0031] Total_Loss=weight*KL_Loss+MSE_Loss;

[0032] Where MSE_Loss is the mean squared error, decode is the decoding process, X is the original discrete trajectory sequence, z is the result of encoding resampling and transformation in the latent space, i.e., the decoded discrete trajectory sequence, Total_Loss is the complete loss function result, and weight is the weight of KL_Loss.

[0033] The optimization directions of KL_Loss and MSE_Loss are not quite the same. During training, it is necessary to skillfully increase the weight of KL_Loss with the number of iterations, gradually adjusting it from 0 to 1. When the result of the loss function is less than the preset value, a reliable trajectory encoder is obtained, and the training process is completed.

[0034] This invention also provides an anomaly trajectory detection system based on self-attention and unsupervised learning. The system is used to implement an anomaly trajectory detection method based on self-attention and unsupervised learning, comprising:

[0035] The training module is used to convert the latitude and longitude coordinate sequence corresponding to the map trajectory points into raw data in the form of grid horizontal and vertical coordinates; the raw data is converted into the dimensions required by the self-attention model through a fully connected layer to obtain the original discrete trajectory sequence; the discrete trajectory sequence is encoded through the self-attention model; the latent space is resampled based on the encoding result to obtain the resampled result z; the resampled result z is decoded by the sampling self-attention decoding training method; the fully connected dimension is converted into the grid horizontal and vertical coordinate dimension to obtain the decoded discrete trajectory sequence; the mean squared error is calculated by applying the mean squared error loss function to the decoded discrete trajectory sequence and the original discrete trajectory sequence; the divergence loss function and the mean squared error are added together to obtain the complete loss function result during training; when the loss function result is small enough to fall within a preset range, the trajectory encoder training is complete.

[0036] The inference module is used to input normal map trajectory data into the trajectory encoder to obtain continuous latent space data, perform probability density estimation on the latent space data to obtain a probability density function; input the map trajectory to be tested into the trajectory encoder to obtain the mean of the latent space, and substitute the mean into the probability density function to obtain the trajectory anomaly probability.

[0037] The present invention also provides an electronic device, including a memory and a processor, wherein the processor is used to implement the steps of an abnormal trajectory detection method based on self-attention and unsupervised learning when executing a computer management program stored in the memory.

[0038] The present invention also provides a computer-readable storage medium having a computer management program stored thereon, wherein the computer management program, when executed by a processor, implements the steps of an abnormal trajectory detection method based on self-attention and unsupervised learning.

[0039] Beneficial Effects: This invention provides a map anomaly trajectory detection method and system based on self-attention and unsupervised learning. The method includes: converting continuous vector trajectories into raw data through a gridded map, then obtaining a raw discrete trajectory sequence through fully connected dimensionality transformation, and then obtaining the trajectory mapping in the latent space through attention encoding. This process trains a trajectory encoder, which is then used to estimate the anomaly probability of the target trajectory. This data-driven approach solves the problem of anomaly trajectory detection, avoiding the difficulty of rule-based methods in covering real-world situations. Furthermore, by using a more efficient trajectory encoding method—a self-attention model—it learns trajectory features that better express the target trajectory. In addition, by replacing the binary classification model with unsupervised learning, it saves on manual labeling costs and offers better real-world usability. Attached Figure Description

[0040] Figure 1 A flowchart of the abnormal trajectory detection method based on self-attention and unsupervised learning provided by the present invention;

[0041] Figure 2 A schematic diagram of the hardware structure of a possible electronic device provided by the present invention;

[0042] Figure 3 A schematic diagram of the hardware structure of a possible computer-readable storage medium provided by the present invention. Detailed Implementation

[0043] The specific embodiments of the present invention will be described in further detail below with reference to the accompanying drawings and examples. The following examples are for illustrative purposes only and are not intended to limit the scope of the invention.

[0044] Figure 1 The abnormal trajectory detection method based on self-attention and unsupervised learning provided by this invention includes the following steps:

[0045] S1, Gridded Map: Converting the latitude and longitude coordinate sequence corresponding to map trajectory points into raw data in the form of grid horizontal and vertical coordinates; The first step in map production is to collect map trajectory points. The original form of map trajectory points is a latitude and longitude coordinate sequence with latitude and longitude. This continuous floating-point space is too large and not conducive to model calculation. Therefore, gridding is performed first to assign map trajectory points to discrete grids and use the horizontal and vertical integer indices of the grid to replace the original latitude and longitude coordinate sequence. This process of converting latitude and longitude into grid horizontal and vertical coordinates is called map gridding.

[0046] After gridding, the trajectory coordinates are all transformed into relative coordinates in integer form. Depending on business needs, such as rotation invariance, the starting point of the trajectory can be moved to the origin, and the direction of the first point can be turned to due north and upward.

[0047] S2, Fully Connected Dimension Transformation: The original data is transformed into the dimensions required by the self-attention model through a fully connected layer, resulting in the original discrete trajectory sequence. Since the self-attention model has a common dimension, the input data needs to be transformed into the same dimension. This process transforms the 2D attributes (x, y) of the original trajectory into the dimensions required by the self-attention model (e.g., 256 dimensions), resulting in transformed data. The transformation method uses a fully connected layer. The transformed data is the original discrete trajectory sequence.

[0048] S3, Self-attention coding: Encoding discrete trajectory sequences through a self-attention model; self-attention coding includes four parts: self-attention, multi-head self-attention, position coding, and feedforward network. The encoded result is obtained by encoding the transformed data through a general self-attention model.

[0049] The selection of the encoding result is problematic because the encoded result is a sequence with the same length as the input trajectory, which has a considerably large dimension. Since the purpose of self-attention encoding in this scheme is to map the trajectory to a low-dimensional latent space, the entire encoded result cannot be used directly. Considering that the self-attention mechanism has already incorporated the information of the entire sequence into each item of the encoded result, the first and second items of the encoded result sequence are taken as the mean and variance of the latent space. This solves the problem of the excessively large dimension of the encoded result sequence.

[0050] This scheme does not directly use the encoding result as the latent space, but instead uses the mean and variance (var) to indirectly represent it. This is to construct a data space that conforms to a certain continuous probability distribution, and the probability distribution of this space can be approximated by a probability density function. Thus, the probability of the trajectory in the latent space can be used to indirectly represent the probability of the trajectory in the original data space. This idea comes from VAE (Variational Autoencoder).

[0051] To make the mean and variance of the encoded trajectory approximate a normal distribution, the KL divergence loss function is used during the training and encoding process to make the current distribution approximate the standard normal distribution to a predetermined degree. The simplified KL divergence loss function for the encoding process is as follows:

[0052] encode_out = Encode(X);

[0053] mean = encode_out[0];

[0054] log_var = encode_out[1];

[0055] KL_Loss=KL[N(mean,var)||N(0,I)];

[0056] X represents the discrete trajectory, Encode represents the encoding process, encode_out represents the encoding result, encode_out[0] represents the first term assigned to the mean, encode_out[1] represents the second term assigned to the natural logarithm of the variance var log_var. The natural logarithm of the variance is used for ease of calculation, N represents the probability density function of the normal distribution, KL represents the KL divergence calculation formula, which is used to measure the distance between two probability distributions. The part before "||" represents the distribution of the current trajectory in the latent space, and the following N(0,I) represents the standard normal distribution function. KL_Loss represents the result of the KL loss function.

[0057] S4, Latent Space Resampling: Latent space resampling is performed based on the encoding result to obtain the resampled result z. Resampling is based on the mean and variance var of the encoding result. To avoid gradient loss, a reparameterization technique is used, that is, the sampling result of a standard normal distribution is introduced from the outside, multiplied by the variance, and then added to the mean to obtain an effect similar to direct sampling. This resampled result z is regarded as the final latent space mapping result and also the input for subsequent decoding.

[0058] S5, the training method of self-attention decoding decodes the resampled result z; the self-attention decoding process only occurs during training and does not need to be performed during inference. According to the training method of self-attention decoding, in addition to the resampled result z, the input data can also include the discrete trajectory sequence after dimensional adjustment, i.e., transformed data. This technique is called teaching force, which forces the correction of the model's prediction results, which can speed up the model's convergence and make the training process more stable.

[0059] S6, by converting the fully connected dimension to the grid horizontal and vertical coordinate dimensions, obtains the decoded discrete trajectory sequence; the output decoding result dimension is still 256, and needs to be fully connected dimension converted back to (x,y) grid horizontal and vertical coordinates, that is, the grid horizontal and vertical coordinate form dimension, to obtain the decoded discrete trajectory sequence.

[0060] S7. The mean squared error is calculated by performing a mean squared error loss function on the decoded discrete trajectory sequence and the original discrete trajectory sequence. The divergence loss function and the mean squared error are added together to obtain the complete loss function result during training. When the loss function result is small enough to be within a preset range, the trajectory encoder training is complete.

[0061] After obtaining the decoded discrete trajectory sequence after decoding and dimensionality transformation, the mean squared error (MSE) loss function is calculated by comparing it with the original discrete trajectory sequence, thus revealing the differences between the decoded trajectories. Adding the divergence loss function (KL Loss) and the MSE loss gives the complete loss function result for training. As long as the loss function result is small and stable, a reliable trajectory encoder can be considered obtained, and the training process is now complete.

[0062] MSE_Loss = ||X-decode(z)|| 2 ;

[0063] Total_Loss=weight*KL_Loss+MSE_Loss;

[0064] MSE_Loss is the mean squared error, decode is the decoding process, X is the original discrete trajectory sequence, z is the result of encoding resampling and transformation in the latent space, i.e., the decoded discrete trajectory sequence, Total_Loss is the complete loss function result, and weight is the weight of KL_Loss.

[0065] Since the optimization directions of KL_Loss and MSE_Loss are not quite the same, during training, it is necessary to skillfully increase the weight of KL_Loss with each iteration, gradually adjusting it from 0 to 1. As long as the result of the loss function is small and stable, a reliable trajectory encoder can be considered obtained, and the training process is now complete.

[0066] S8: Normal map trajectory data is input into the trajectory encoder to obtain continuous latent space data. The probability density of this latent space data is estimated to obtain the probability density function. A large amount of normal map trajectory data can be mapped to a continuous latent space after passing through the encoder. The probability density of this latent space data can be estimated to obtain the probability density function.

[0067] S9. After inputting the trajectory to be tested into the trajectory encoder, the mean of the latent space is obtained. Substituting this mean into the probability density function, the trajectory anomaly probability is obtained. When a new trajectory to be tested is input, the encoder obtains the mean of the latent space. According to the normal distribution, this mean is the maximum probability of it in the latent space, so no further sampling is needed. Substituting this mean into the probability density function, the probability of the trajectory in the latent space can be obtained, indirectly representing the probability of the trajectory in the original trajectory space. The more the trajectory conforms to the probability distribution of known normal trajectories, the lower the anomaly probability; conversely, the less conforms to the probability distribution, the higher the anomaly probability. This completes the trajectory anomaly detection.

[0068] Among them, the self-attention model Transformer is a sequence-to-sequence model that includes four parts: self-attention, multi-head self-attention, positional encoding, and feedforward network. Since the self-attention mechanism is the main feature of this model, this paper also refers to Transformer as the self-attention model in Chinese.

[0069] Please see Figure 2 This is a schematic diagram illustrating an embodiment of the electronic device provided in this invention. For example... Figure 2 As shown, the present invention provides an electronic device, including a memory 1310, a processor 1320, and a computer program 1311 stored in the memory 1310 and executable on the processor 1320. When the processor 1320 executes the computer program 1311, it performs the following steps: S1, converting the latitude and longitude coordinate sequence corresponding to the map trajectory points into raw data in the form of grid horizontal and vertical coordinates.

[0070] S2 transforms the original data into the dimensions required by the self-attention model through a fully connected layer, resulting in the original discrete trajectory sequence;

[0071] S3 encodes discrete trajectory sequences using a self-attention model;

[0072] S4, perform latent space resampling based on the encoding result to obtain the resampling result z;

[0073] S5, the training method of sampling from attention decoding decodes the resampling result z;

[0074] S6, by converting the fully connected dimension into the dimension of the grid's horizontal and vertical coordinates, obtains the decoded discrete trajectory sequence;

[0075] S7. The mean squared error is obtained by calculating the mean squared error loss function between the decoded discrete trajectory sequence and the original discrete trajectory sequence. The divergence loss function and the mean squared error are added together to obtain the complete loss function result during training. When the loss function result is small enough to be within a preset range, the trajectory encoder training is complete.

[0076] S8. After inputting normal map trajectory data into the trajectory encoder, continuous latent space data is obtained. The probability density of the latent space data is estimated to obtain the probability density function.

[0077] S9. Input the trajectory of the map to be tested into the trajectory encoder to obtain the mean of the latent space. Substitute the mean into the probability density function to obtain the trajectory anomaly probability.

[0078] Please see Figure 3 A schematic diagram illustrating an embodiment of the computer-readable storage medium provided by the present invention. (See diagram below.) Figure 3 As shown, this embodiment provides a computer-readable storage medium 1400, on which a computer program 1411 is stored. When the computer program 1411 is executed by the processor, it performs the following steps: S1, converting the latitude and longitude coordinate sequence corresponding to the map trajectory points into raw data in the form of grid horizontal and vertical coordinates;

[0079] S2 transforms the original data into the dimensions required by the self-attention model through a fully connected layer, resulting in the original discrete trajectory sequence;

[0080] S3 encodes discrete trajectory sequences using a self-attention model;

[0081] S4, perform latent space resampling based on the encoding result to obtain the resampling result z;

[0082] S5, the training method of sampling from attention decoding decodes the resampling result z;

[0083] S6, by converting the fully connected dimension into the dimension of the grid's horizontal and vertical coordinates, obtains the decoded discrete trajectory sequence;

[0084] S7. The mean squared error is obtained by calculating the mean squared error loss function between the decoded discrete trajectory sequence and the original discrete trajectory sequence. The divergence loss function and the mean squared error are added together to obtain the complete loss function result during training. When the loss function result is small enough to be within a preset range, the trajectory encoder training is complete.

[0085] S8. After inputting normal map trajectory data into the trajectory encoder, continuous latent space data is obtained. The probability density of the latent space data is estimated to obtain the probability density function.

[0086] S9. Input the trajectory of the map to be tested into the trajectory encoder to obtain the mean of the latent space. Substitute the mean into the probability density function to obtain the trajectory anomaly probability.

[0087] It should be noted that, in the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.

[0088] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.

[0089] Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if such changes and modifications fall within the scope of the claims and their equivalents, the present invention is intended to include such changes and modifications.

Claims

1. An abnormal trajectory detection method based on self-attention and unsupervised learning, characterized in that, Includes the following steps: S1 converts the latitude and longitude coordinate sequence corresponding to the map trajectory points into raw data in the form of grid horizontal and vertical coordinates; S2 transforms the original data into the dimensions required by the self-attention model through a fully connected layer, resulting in the original discrete trajectory sequence; S3 encodes discrete trajectory sequences using a self-attention model; S4, perform latent space resampling based on the encoding result to obtain the resampling result z; S5, the training method of sampling from attention decoding decodes the resampling result z; S6, by converting the fully connected dimension into the dimension of the grid's horizontal and vertical coordinates, obtains the decoded discrete trajectory sequence; S7. The mean squared error is obtained by calculating the mean squared error loss function between the decoded discrete trajectory sequence and the original discrete trajectory sequence. The divergence loss function and the mean squared error are added together to obtain the complete loss function result during training. When the loss function result is small enough to be within a preset range, the trajectory encoder training is complete. S8. After inputting normal map trajectory data into the trajectory encoder, continuous latent space data is obtained. The probability density of the latent space data is estimated to obtain the probability density function. S9. Input the trajectory of the map to be tested into the trajectory encoder to obtain the mean of the latent space. Substitute the mean into the probability density function to obtain the trajectory anomaly probability.

2. The abnormal trajectory detection method based on self-attention and unsupervised learning according to claim 1, characterized in that, S1 specifically includes: S11: Obtain continuous floating-point map trajectory points to form a latitude and longitude coordinate sequence; S12 assigns map trajectory points to discrete grids, and replaces the original latitude and longitude coordinate sequences with the horizontal and vertical integer indices of the grids to obtain the original data of the two-dimensional attributes corresponding to the latitude and longitude coordinate sequences.

3. The abnormal trajectory detection method based on self-attention and unsupervised learning according to claim 1, characterized in that, S3 specifically includes: First, the information of the entire discrete trajectory sequence is incorporated into each item of the encoding result through a self-attention model; Then, the first and second terms of the encoded result sequence are selected as the mean and variance var of the latent space.

4. The abnormal trajectory detection method based on self-attention and unsupervised learning according to claim 3, characterized in that, S3 further includes: During the encoding process, the divergence loss function is used to make the encoded mean and variance var approximate the standard normal distribution to the preset baseline.

5. The abnormal trajectory detection method based on self-attention and unsupervised learning according to claim 4, characterized in that, S4 specifically includes: The reparameterization method is used to introduce the sampling results of the standard normal distribution from the outside, multiply them by the variance, and add the mean to obtain the resampling result z.

6. The abnormal trajectory detection method based on self-attention and unsupervised learning according to claim 1, characterized in that, S5 includes: During the decoding process, the input data includes not only the resampled result z, but also the discrete trajectory sequence after dimension adjustment.

7. The abnormal trajectory detection method based on self-attention and unsupervised learning according to claim 4, characterized in that, The function model for the trajectory encoder training process in S7 specifically includes: MSE_Loss=||X-decode(z)|| 2 ; Total_Loss=weight*KL_Loss+MSE_Loss; Where MSE_Loss is the mean squared error, decode is the decoding process, X is the original discrete trajectory sequence, z is the result of encoding resampling and transformation in the latent space, i.e., the decoded discrete trajectory sequence, Total_Loss is the complete loss function result, and weight is the weight of KL_Loss. The optimization directions of KL_Loss and MSE_Loss are not quite the same. During training, it is necessary to skillfully increase the weight of KL_Loss with the number of iterations, gradually adjusting it from 0 to 1. When the result of the loss function is less than the preset value, a reliable trajectory encoder is obtained, and the training process is completed.

8. An abnormal trajectory detection system based on self-attention and unsupervised learning, characterized in that, The system is used to implement the abnormal trajectory detection method based on self-attention and unsupervised learning as described in any one of claims 1-7, comprising: The training module is used to convert the latitude and longitude coordinate sequence corresponding to the map trajectory points into raw data in the form of grid horizontal and vertical coordinates; the raw data is converted into the dimensions required by the self-attention model through a fully connected layer to obtain the original discrete trajectory sequence; the discrete trajectory sequence is encoded through the self-attention model; the latent space is resampled based on the encoding result to obtain the resampled result z; the resampled result z is decoded by the sampling self-attention decoding training method; the fully connected dimension is converted into the grid horizontal and vertical coordinate dimension to obtain the decoded discrete trajectory sequence; the mean squared error is calculated by applying the mean squared error loss function to the decoded discrete trajectory sequence and the original discrete trajectory sequence; the divergence loss function and the mean squared error are added together to obtain the complete loss function result during training; when the loss function result is small enough to fall within a preset range, the trajectory encoder training is complete. The inference module is used to input normal map trajectory data into the trajectory encoder to obtain continuous latent space data, perform probability density estimation on the latent space data to obtain a probability density function; input the map trajectory to be tested into the trajectory encoder to obtain the mean of the latent space, and substitute the mean into the probability density function to obtain the trajectory anomaly probability.

9. An electronic device, characterized in that, The system includes a memory and a processor, wherein the processor is used to execute computer management programs stored in the memory to implement the steps of the abnormal trajectory detection method based on self-attention and unsupervised learning as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, It stores a computer management program, which, when executed by a processor, implements the steps of the abnormal trajectory detection method based on self-attention and unsupervised learning as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Ship abnormal track data detection method and device based on variational auto-encoder

    CN112395382A

  • Detecting anomalous trajectories in a video surveillance system

    WO2011025662A2