Trajectory anomaly detection method and system

By dividing the trajectory data into equal-length segments and using variational autoencoding and flow models, combined with spatial embedding features and position information, the problem of pattern length changes in trajectory anomaly detection is solved and the robustness and accuracy of detection are improved. Fast anomaly identification of trajectories of any length is achieved.

CN118691880APending Publication Date: 2024-09-24SHANDONG ZHENGZHONG COMP NETWORK TECH CONSULTING
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410723614.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-05
Publication Date
2024-09-24

AI Technical Summary

Technical Problem

Insufficient robustness caused by pattern length changes and different data instance lengths in trajectory anomaly detection makes it difficult for traditional methods to effectively detect rare and diverse abnormal events.

Method used

Divide the trajectory data into equal-length segments, extract spatial embedding features and fuse trajectory embedding features, use a detection model based on variational autoencoding and flow models, obtain trajectory outliers through cross-entropy loss and likelihood value calculation, consider trajectory segments location information to improve detection accuracy.

Benefits of technology

It improves the robustness of trajectory anomaly detection and can quickly and accurately identify abnormal trajectories of any length without the need for anomalies, which enhances the model's robustness and detection accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118691880A
    Figure CN118691880A
Patent Text Reader

Abstract

The invention provides a trajectory anomaly detection method and system, and relates to the field of trajectory anomaly detection, and the method comprises the steps: obtaining trajectory data, and dividing the trajectory data into a plurality of equilong trajectory segments; obtaining space embedding features and track embedding features of each track segment, and fusing the space embedding features and the track embedding features to obtain space track embedding fusion features of each track segment; the space trajectory is embedded into the fusion feature input detection model, and a trajectory abnormal value is obtained; wherein the detection model extracts features of the input quantity and reconstructs the features, and cross entropy loss between a reconstruction result and the input quantity is used as a first loss value; the detection model also calculates a trajectory likelihood value as a second loss value according to the extracted characteristics of the input quantity based on the unconditional flow; and obtaining a trajectory abnormal value according to the first loss value and the second loss value. According to the invention, the robustness of trajectory anomaly detection can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of trajectory anomaly detection, and in particular to a trajectory anomaly detection method and system. Background Art

[0002] Trajectory anomaly detection refers to the detection of abnormal behaviors occurring in driving trajectories. With the increasing popularity of trajectory positioning technologies such as GPS, it has become increasingly necessary to automatically identify abnormal events in trajectories. However, abnormal events are rare and diverse. Abnormal events rarely occur and may be events that have never been seen before. Therefore, it is quite difficult to collect all types of abnormal events, which makes traditional binary classification methods unsuitable for trajectory anomaly detection. In addition, it is difficult to clearly define abnormal situations in anomaly detection. Compared with anomaly detection in other fields such as video, trajectory anomaly detection has the characteristics of pattern length variation. Different data instances may have different lengths and cannot be directly compared, resulting in insufficient robustness of trajectory anomaly detection based on traditional methods. Summary of the invention

[0003] In order to solve the deficiencies of the prior art, an object of the present invention is to provide a trajectory anomaly detection method and system to improve the robustness of trajectory anomaly detection.

[0004] In order to achieve the above object, according to some embodiments, a first aspect of the present invention provides a trajectory anomaly detection method, comprising:

[0005] Obtain trajectory data, and divide the trajectory data into a number of trajectory segments of equal length;

[0006] The spatial embedding features and trajectory embedding features of each trajectory segment are obtained respectively, and the spatial trajectory embedding fusion features of each trajectory segment are obtained by fusion;

[0007] The spatial trajectory is embedded into the fusion feature input detection model to obtain the trajectory outlier value;

[0008] Among them, the detection model extracts the characteristics of the input quantity and reconstructs it, and uses the cross entropy loss between the reconstruction result and the input quantity as the first loss value; the detection model also calculates the trajectory likelihood value based on the unconditional flow according to the characteristics of the extracted input quantity as the second loss value; the trajectory anomaly value is obtained according to the first loss value and the second loss value.

[0009] A second aspect of the present invention provides a trajectory anomaly detection system, comprising:

[0010] a data acquisition module, configured to acquire trajectory data and divide the trajectory data into a number of trajectory segments of equal length;

[0011] An embedding module is configured to respectively obtain the spatial embedding features and the trajectory embedding features of each trajectory segment, and fuse them to obtain the spatial trajectory embedding fusion features of each trajectory segment;

[0012] an anomaly detection module, configured to embed the spatial trajectory into the fusion feature input detection model to obtain the trajectory anomaly value;

[0013] Among them, the detection model extracts the characteristics of the input quantity and reconstructs it, and uses the cross entropy loss between the reconstruction result and the input quantity as the first loss value; the detection model also calculates the trajectory likelihood value based on the unconditional flow according to the characteristics of the extracted input quantity as the second loss value; the trajectory anomaly value is obtained according to the first loss value and the second loss value.

[0014] According to a third aspect of the present invention, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to complete the steps of the above-mentioned trajectory anomaly detection method.

[0015] According to a fourth aspect of the present invention, a computer-readable storage medium is provided for storing computer instructions, and when the computer instructions are executed by a processor, the steps of the above-mentioned trajectory anomaly detection method are completed.

[0016] According to a fifth aspect of the present invention, a computer program product is provided, comprising a computer program / instruction, which implements the steps of the above-mentioned trajectory anomaly detection method when executed by a processor.

[0017] Compared with the prior art, the present invention has the following beneficial effects:

[0018] The present invention provides a trajectory anomaly detection method and system, which divides a trajectory into trajectory segments of fixed size, performs anomaly detection on each trajectory segment respectively, and solves the problem of pattern length variation; in anomaly detection, the position information of the trajectory segment is considered, the spatial embedding amount of the trajectory segment is extracted, and the spatial embedding feature is obtained, and the high-dimensional feature of the spatial position is introduced on the basis of the traditional low-dimensional geometric feature, so as to improve the accuracy of anomaly detection and have better robustness for subsequent trajectory anomaly detection; it is predicted that the segments belonging to the normal trajectory have a higher likelihood value than the segments belonging to the abnormal trajectory, and the two capabilities of the variational autoencoder and the flow model of f-VAEs are used to extract and reconstruct the input image, and the first loss value is obtained according to the cross entropy loss of the reconstructed image and the original image, and the unconditional flow is used to perform reversible calculation on the extracted features to obtain the likelihood value as the second loss value, and the anomaly is judged from the two perspectives of reconstruction and trajectory data distribution. Compared with the traditional binary classification method, no anomaly labeling is required, and the robustness of the model is improved.

[0019] Advantages of additional aspects of the present invention will be given in part in the following description, and in part will become obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The accompanying drawings in the specification, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.

[0021] Figure 1 is a flow chart of the method in Embodiment 1;

[0022] Figure 2 Workflow diagram for the detection model. DETAILED DESCRIPTION

[0023] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.

[0024] Embodiment 1

[0025] Embodiment 1 of the present invention, as Figure 1 As shown, a trajectory anomaly detection method is provided, comprising:

[0026] Step S1, obtaining trajectory data, and dividing the trajectory data into a number of trajectory segments of equal length;

[0027] Step S2, respectively obtain the spatial embedding features and trajectory embedding features of each trajectory segment, and fuse them to obtain the spatial trajectory embedding fusion features of each trajectory segment;

[0028] Step S3: embed the spatial trajectory into the fusion feature input detection model to obtain the trajectory outlier value.

[0029] Among them, the detection model extracts the characteristics of the input quantity and reconstructs it, and uses the cross entropy loss between the reconstruction result and the input quantity as the first loss value; the detection model also calculates the trajectory likelihood value based on the unconditional flow according to the characteristics of the extracted input quantity as the second loss value; the trajectory anomaly value is obtained according to the first loss value and the second loss value.

[0030] In step S1, the trajectory data to be identified is divided into several trajectory segments of equal length, and anomaly detection is performed on each trajectory segment. If any trajectory segment is identified as abnormal, the entire trajectory is determined to have an abnormality, so that the anomaly can be quickly and accurately identified for trajectory data of any length.

[0031] In step S2, the trajectory embedding amount and spatial embedding amount of the trajectory segment are extracted respectively, and fused with the trajectory segment to obtain the trajectory embedding feature and the spatial embedding feature. The spatial trajectory embedding fusion feature is fused and used as the extraction feature of the trajectory segment, which is input into the subsequent model for anomaly detection. In the trajectory detection process, the importance of all trajectory segments is different. In the traditional anomaly detection algorithm, the trajectory is usually represented by manually extracted geometric features or low-dimensional linear combinations of geometric features. In the general embedding amount extraction process, the position information of the segment in the original data is not included. However, this method will ignore the high-dimensional features in the trajectory and cannot obtain the relative spatial information in the trajectory segment. Therefore, this embodiment introduces position encoding condition information into the original data. The original trajectory data is obtained according to the position encoding function to obtain the position matrix PE, which has the same dimension as the original trajectory data. The position matrix PE is encoded and fused with the trajectory segment of the corresponding position to obtain the spatial embedding feature.

[0032] The position encoding function is as follows:

[0033]

[0034] Among them, pos represents the position of the trajectory segment in the original trajectory data, d model is the dimension of the trajectory segment, and i represents the position of the trajectory element in the original trajectory data. Therefore, the above formula indicates that the sin variable is added to the even position of the trajectory element of each trajectory segment, and the cos variable is added to the odd position to fill the entire PE matrix.

[0035] The entire PE matrix is ​​passed through an encoder to keep the PE matrix dimension unchanged and obtain the spatial embedding. The spatial embedding is fused with the corresponding trajectory segments to obtain the spatial embedding features.

[0036] The trajectory segment is also passed through an encoder to obtain the trajectory embedding amount, which is then fused with the trajectory segment at the corresponding position to obtain the trajectory embedding feature. Finally, the trajectory embedding feature is added to the corresponding elements of the spatial embedding feature to obtain the spatial trajectory embedding fusion feature. The two encodings for extracting the trajectory embedding amount and the spatial embedding amount use the same encoder, and any model can be used according to the needs.

[0037] In step S3, the detection model uses a flow-based variational autoencoder f-VAEs model. f-VAEs is a more general framework that includes flow models and variational autoencoders. Compared with the original generative flow (Glow) model, f-VAEs converges faster and can achieve the same generation effect with a smaller network scale.

[0038] like Figure 2As shown, f-VAEs is an encoder-decoder structure, and the encoder is a stack of convolution and compression operators. Specifically, the encoder consists of five blocks, and compression is performed before each block. Each block is composed of several steps, and each step is composed of three 3x3 convolutions and one 1x1 convolution in series. The decoder (generator) is a stack of convolution and decompression operators, which is the inverse of the encoder in structure. The activation function tanh(·) can be added to the end of the decoder, but this is not necessary. The result of the unconditional flow F(·) is copied from the Glow model, but the Glow model has a deeper learning depth and a larger number of convolution kernels.

[0039] The encoder extracts features from the input, and the decoder reconstructs the original image based on the extracted features. The first loss value can be obtained by using the reconstructed image and the original image according to the cross entropy loss calculation; the unconditional flow continues to perform reversible calculations on the features extracted by the encoder to obtain a likelihood value, which is the trajectory likelihood value. The second loss value is obtained by estimating the trajectory likelihood value according to the maximum likelihood. The first loss value and the second loss value are added to obtain the total loss value of f-VAEs, that is, the trajectory anomaly value, which is used as the basis for judging whether the trajectory is abnormal. In the process of judging the abnormality, a set threshold needs to be preset, which can be obtained by training the normal trajectory and abnormal trajectory data. The obtained total loss value is compared with the set threshold, and the trajectory anomaly detection result is obtained according to the comparison result. If the obtained total loss value exceeds the set threshold, it is judged that the trajectory is abnormal.

[0040] Embodiment 2

[0041] This embodiment provides a trajectory anomaly detection system, including:

[0042] a data acquisition module, configured to acquire trajectory data and divide the trajectory data into a number of trajectory segments of equal length;

[0043] An embedding module is configured to respectively obtain the spatial embedding features and the trajectory embedding features of each trajectory segment, and fuse them to obtain the spatial trajectory embedding fusion features of each trajectory segment;

[0044] an anomaly detection module, configured to embed the spatial trajectory into the fusion feature input detection model to obtain the trajectory anomaly value;

[0045] Among them, the detection model extracts the characteristics of the input quantity and reconstructs it, and uses the cross entropy loss between the reconstruction result and the input quantity as the first loss value; the detection model also calculates the trajectory likelihood value based on the unconditional flow according to the characteristics of the extracted input quantity as the second loss value; the trajectory anomaly value is obtained according to the first loss value and the second loss value.

[0046] It should be noted here that the modules in this embodiment correspond to the steps of the method in Embodiment 1, and the specific implementation process is the same, which will not be repeated here.

[0047] Embodiment 3

[0048] This embodiment provides an electronic device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to complete the steps of the method in the first embodiment.

[0049] Embodiment 4

[0050] This embodiment provides a computer-readable storage medium for storing computer instructions. When the computer instructions are executed by a processor, the steps of the method in the first embodiment are completed.

[0051] Embodiment 5

[0052] This embodiment provides a computer program product, including a computer program / instruction, characterized in that the computer program / instruction implements the steps of the method in the first embodiment when executed by a processor.

[0053] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A trajectory anomaly detection method, It is characterized in that include: Obtain trajectory data, and divide the trajectory data into a number of trajectory segments of equal length; The spatial embedding features and trajectory embedding features of each trajectory segment are obtained respectively, and the spatial trajectory embedding fusion features of each trajectory segment are obtained by fusion; The spatial trajectory is embedded into the fusion feature input detection model to obtain the trajectory outlier value; Among them, the detection model extracts the characteristics of the input quantity and reconstructs it, and uses the cross entropy loss between the reconstruction result and the input quantity as the first loss value; the detection model also calculates the trajectory likelihood value based on the unconditional flow according to the characteristics of the extracted input quantity as the second loss value; the trajectory anomaly value is obtained according to the first loss value and the second loss value.

2. A trajectory anomaly detection method as claimed in claim 1, It is characterized in that The spatial embedding feature is obtained by: converting the trajectory segment into a position matrix through a position encoding function, converting the position matrix into a spatial embedding amount through an encoder; and fusing the spatial embedding amount with the trajectory segment to obtain the spatial embedding feature.

3. A trajectory anomaly detection method as claimed in claim 2, It is characterized in that The position encoding function is: Among them, pos represents the position of the trajectory segment in the original trajectory data, d model is the dimension of the trajectory segment, i represents the position of the trajectory element in the original trajectory data, and PE represents the position matrix.

4. A trajectory anomaly detection method as claimed in claim 1, It is characterized in that The method for obtaining the trajectory embedding feature includes: extracting the trajectory embedding amount in the trajectory segment through an encoder, and fusing the trajectory embedding amount with the trajectory segment to obtain the trajectory embedding feature.

5. A trajectory anomaly detection method as claimed in claim 1, It is characterized in that The detection model is a flow-based variational autoencoder model.

6. A trajectory anomaly detection method as claimed in claim 5, It is characterized in that The first loss value and the second loss value are added to obtain a total loss value, and the trajectory anomaly detection result is obtained according to the comparison result between the total loss value and the set threshold.

7. A trajectory anomaly detection system, It is characterized in that include: a data acquisition module, configured to acquire trajectory data and divide the trajectory data into a number of trajectory segments of equal length; An embedding module is configured to respectively obtain the spatial embedding features and the trajectory embedding features of each trajectory segment, and fuse them to obtain the spatial trajectory embedding fusion features of each trajectory segment; an anomaly detection module, configured to embed the spatial trajectory into the fusion feature input detection model to obtain the trajectory anomaly value; Among them, the detection model extracts the characteristics of the input quantity and reconstructs it, and uses the cross entropy loss between the reconstruction result and the input quantity as the first loss value; the detection model also calculates the trajectory likelihood value based on the unconditional flow according to the characteristics of the extracted input quantity as the second loss value; the trajectory anomaly value is obtained according to the first loss value and the second loss value.

8. An electronic device, It is characterized in that The invention comprises a memory, a processor and a computer program stored in the memory, wherein the processor executes the computer program to complete the steps of the method according to any one of claims 1 to 6.

9. A computer-readable storage medium, It is characterized in that Used to store computer instructions, which, when executed by a processor, complete the steps of the method according to any one of claims 1 to 6.

10. A computer program product comprising a computer program / instructions, It is characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Video multi-target tracking and segmentation system and method

    CN112801068A

  • VAE-based trajectory big data anomaly detection method and system

    CN115879051A