A trajectory anomaly detection method based on trajectory similarity

By calculating trajectory features and building anomaly matrix based on trajectory similarity, the problem of high cost and poor reliability of trajectory anomaly detection in the prior art is solved, and efficient and accurate trajectory anomaly detection is achieved.

CN119226988BActive Publication Date: 2025-02-14湖南工商大学
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411751688.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-02
Publication Date
2025-02-14
Estimated Expiration
2044-12-02

AI Technical Summary

Technical Problem

Existing trajectory anomaly detection algorithms have problems of high cost and poor reliability, especially when it comes to high cost of obtaining tagged data and privacy regulations, and there are supervisory methods that do not perform well when dealing with unseen abnormal patterns.

Method used

Using a trajectory anomaly detection method based on trajectory similarity, the method includes acquiring multiple target trajectories and applying enhanced operations, calculating the structural and spatial characteristics of trajectories, calculating the trajectory characteristics, calculating the similarity between trajectories, and constructing a potential anomaly matrix and Concurrent noise matrix, finalize the exception trajectory.

Benefits of technology

By utilizing the similarity between trajectories for abnormal identification, the trajectory is not required to pre-label, which reduces the cost of data collection and processing, and is suitable for detection of unknown anomalies, improving the reliability and accuracy of trajectory anomaly detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119226988B_ABST
    Figure CN119226988B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of trajectory anomaly detection, and provides a trajectory anomaly detection method based on trajectory similarity. The method includes: calculating the first structural feature and the first spatial feature of the trajectory point in the first trajectory, and calculating the first trajectory feature of the first trajectory based on the first structural feature and the first spatial feature; calculating the second structural feature and the second spatial feature of the trajectory point in the second trajectory, and calculating the second trajectory feature of the second trajectory based on the second structural feature and the second spatial feature; calculating the similarity between the target trajectory according to the first trajectory feature and the second trajectory feature, and constructing a potential anomaly matrix based on all similarities; dividing the target trajectory into multiple trajectory segments, and using the trajectory segments to obtain detection errors, and constructing a concurrent noise matrix based on the detection errors; determining the abnormal trajectory according to the potential anomaly matrix and the concurrent noise reconstruction matrix. The method of the present application can improve the reliability of trajectory anomaly detection and reduce costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of trajectory anomaly detection, and in particular to a trajectory anomaly detection method based on trajectory similarity. Background Art

[0002] In modern traffic monitoring systems, trajectory analysis is a key technology for identifying and predicting traffic patterns. Existing trajectory analysis methods usually rely on supervised learning, which requires a large amount of labeled data to train the model. However, obtaining this data is not only costly, but may also be restricted by privacy regulations. In addition, supervised methods often perform poorly when dealing with unseen abnormal patterns because they lack sufficient generalization capabilities. It can be seen that existing trajectory anomaly detection algorithms have the problems of high cost and poor reliability of trajectory anomaly detection. Summary of the invention

[0003] The present application provides a trajectory anomaly detection method based on trajectory similarity, which can solve the problems of high cost and poor reliability of trajectory anomaly detection.

[0004] In a first aspect, an embodiment of the present application provides a trajectory anomaly detection method based on trajectory similarity, the trajectory anomaly detection method comprising:

[0005] Acquire multiple target trajectories, and apply an enhancement operation to each target trajectory to obtain a first trajectory and a second trajectory of each target trajectory;

[0006] For each first trajectory, respectively, calculate a first structural feature and a first spatial feature of each trajectory point in the first trajectory, and calculate a first trajectory feature of the first trajectory based on all the first structural features and the first spatial features;

[0007] For each second trajectory, respectively, calculate the second structural feature and the second spatial feature of each trajectory point in the second trajectory, and calculate the second trajectory feature of the second trajectory based on all the second structural features and the second spatial features;

[0008] Calculate the similarity between every two target trajectories according to all the first trajectory features and all the second trajectory features, and construct a potential anomaly matrix based on all the similarities; the potential anomaly matrix is ​​used to describe the potential abnormal condition of each target trajectory;

[0009] Each target trajectory is divided into multiple trajectory segments according to multiple time periods, and the detection error of each target trajectory is obtained using all trajectory segments, and a concurrent noise matrix is ​​constructed based on all detection errors; the concurrent noise matrix is ​​used to describe the false abnormal conditions of each target trajectory;

[0010] The abnormal trajectories are determined from all target trajectories according to the potential anomaly matrix and the concurrent noise reconstruction matrix.

[0011] Optionally, calculating a first structural feature and a first spatial feature of each trajectory point in the first trajectory includes:

[0012] By formula:

[0013]

[0014] Calculate the The first structural feature of the trajectory point ;

[0015] in, represents the weight matrix, Indicates the first track Track points, represents the bias term, , represents the number of trajectory points in the first trajectory;

[0016] By formula:

[0017]

[0018] Calculate the The first spatial feature of the trajectory points ;

[0019] in, represents the weight matrix, Represents the bias term.

[0020] Optionally, calculating a first trajectory feature of the first trajectory based on all the first structural features and the first spatial features includes:

[0021] Calculating a structural attention score based on all first structural features, and calculating a spatial attention score based on all first spatial features;

[0022] Performing self-attention encoding on the first trajectory to obtain a trajectory encoding of the first trajectory, and obtaining a contrast enhancement feature of the first trajectory according to the trajectory encoding;

[0023] The first track feature of the first track is calculated using the structural attention score, the spatial attention score, and the contrast enhancement feature.

[0024] Optionally, a structural attention score is calculated based on all first structural features, including:

[0025] By formula:

[0026]

[0027]

[0028] Calculating structural attention score ;

[0029] in, represents the structure query vector, represents the structure key vector, represents a structure value vector, Represents the dimension, represents all first structural features, , , Both represent weight matrices;

[0030] The spatial attention score is calculated based on all first spatial features, including:

[0031] By formula:

[0032]

[0033]

[0034] Calculating spatial attention score ;

[0035] in, represents the spatial query vector, represents the spatial key vector, represents a space-valued vector, Represents the dimension, represents all first space features, , , Both represent weight matrices;

[0036] Acquiring a contrast enhancement feature of the first trajectory according to the trajectory encoding includes:

[0037] By formula:

[0038]

[0039] Computing contrast enhancement features ;

[0040] in, represents the weight coefficient, represents the trajectory encoding, Indicates The trajectory encoding of negative sample trajectories, , Represents the number of negative sample trajectories;

[0041] The first track features of the first track are calculated using the structural attention score, the spatial attention score, and the contrast enhancement feature, including:

[0042] By formula:

[0043]

[0044] Calculate the first trajectory features of the first trajectory .

[0045] Optionally, calculating the similarity between every two target trajectories according to all first trajectory features and all second trajectory features includes:

[0046] By formula:

[0047]

[0048] Calculate the The target trajectory and The similarity between target trajectories ;

[0049] in, Represents similarity calculation, Indicates The first trajectory feature or the second trajectory feature corresponding to the target trajectory, Indicates The first trajectory feature or the second trajectory feature corresponding to the target trajectory, , , Indicates the number of target trajectories.

[0050] Optionally, construct a potential anomaly matrix based on all similarities, including:

[0051] Calculate the anomaly score of each target track based on all similarities;

[0052] Construct a potential anomaly matrix based on all anomaly scores.

[0053] Optionally, calculate an anomaly score for each target track based on all similarities, including:

[0054] By formula:

[0055]

[0056] Calculate the Anomaly score of target trajectories ;

[0057] Build a potential anomaly matrix based on all anomaly scores, including:

[0058] By formula:

[0059]

[0060] Calculate the elements in the potential anomaly matrix ;

[0061] in, Indicates The anomaly score of the target trajectory, represents the anomaly score threshold, when When The target trajectory and target tracks are marked as potential anomalies.

[0062] Optionally, use all trajectory segments to obtain the detection error of each target trajectory, including:

[0063] For each trajectory segment, calculate the segment similarity between each other trajectory segment with the same time period as the trajectory segment;

[0064] Obtain the original features of each trajectory segment, and use the similarities of all segments to update the original features of each trajectory segment to obtain the updated features of each trajectory segment;

[0065] All updated features are used to perform feature reconstruction to obtain multiple reconstructed features;

[0066] The detection error of each object track is calculated based on all reconstructed features and all original features.

[0067] Optionally, calculate the segment similarity between each other trajectory segment with the same number as the target trajectory and the trajectory segment, including:

[0068] By formula:

[0069]

[0070] Calculate the The target trajectory The trajectory segment and The target trajectory The segment similarity between trajectory segments ;

[0071] in, Indicates The target trajectory Track fragments, Indicates The target trajectory A trajectory segment, , , represents the number of target trajectories, , Indicates the number of time periods;

[0072] All updated features are used to perform feature reconstruction to obtain multiple reconstructed features, including:

[0073] By formula:

[0074]

[0075] Calculate the The target trajectory Reconstructed features of trajectory segments ;

[0076] in, Indicates The target trajectory The updated features of the trajectory segments, Indicates The target trajectory There is a set of target trajectories corresponding to the trajectory segments with segment similarity between the trajectory segments, Represents the weight coefficient:

[0077]

[0078]

[0079] in, Indicates The initial detection error of the target trajectory is Indicates The target trajectory and The similarity between target trajectories is Indicates The anomaly score of the target trajectory;

[0080] Based on all reconstructed features and all original features, the detection error of each target track is calculated, including:

[0081] By formula:

[0082]

[0083] Calculate the The detection error of the target trajectory ;

[0084] in, Indicates The set of original features of all trajectory segments of a target trajectory, Indicates The set of reconstructed features of all trajectory segments of a target trajectory, represents the L2 norm;

[0085] Construct a concurrent noise matrix based on all detection errors, including:

[0086] By formula:

[0087]

[0088] Compute the elements in the concurrent noise matrix ;

[0089] in, Indicates The detection error of the target trajectory is Represents the detection error threshold. When The target trajectory and target tracks are marked as false anomalies.

[0090] Optionally, abnormal trajectories are determined from all target trajectories according to the potential abnormality matrix and the concurrent noise reconstruction matrix, including:

[0091] By formula:

[0092]

[0093] Calculate the The target trajectory and Abnormal value of target trajectory ;

[0094] in, Represents the potential anomaly matrix The target trajectory and The elements corresponding to the target trajectory are represents the number of concurrent noise reconstruction matrices The target trajectory and The elements corresponding to the target trajectory are , , represents the number of target trajectories;

[0095] For each target trajectory, if there is an abnormal condition value of 1 among all abnormal condition values ​​corresponding to the target trajectory, the target trajectory is marked as an abnormal trajectory.

[0096] In a second aspect, an embodiment of the present application provides a trajectory anomaly detection device based on trajectory similarity, comprising:

[0097] an enhancement module, acquiring a plurality of target trajectories, and applying an enhancement operation to each target trajectory to obtain a first trajectory and a second trajectory of each target trajectory;

[0098] a first calculation module, for each first trajectory, calculating a first structural feature and a first spatial feature of each trajectory point in the first trajectory, and calculating a first trajectory feature of the first trajectory based on all the first structural features and the first spatial features;

[0099] A second calculation module calculates, for each second trajectory, a second structural feature and a second spatial feature of each trajectory point in the second trajectory, and calculates a second trajectory feature of the second trajectory based on all the second structural features and the second spatial features;

[0100] A first construction module calculates the similarity between every two target trajectories according to all first trajectory features and all second trajectory features, and constructs a potential anomaly matrix based on all similarities; the potential anomaly matrix is ​​used to describe the potential abnormal condition of each target trajectory;

[0101] The second construction module divides each target trajectory into multiple trajectory segments according to multiple time periods, and uses all trajectory segments to obtain the detection error of each target trajectory, and constructs a concurrent noise matrix based on all detection errors; the concurrent noise matrix is ​​used to describe the false abnormality of each target trajectory;

[0102] The determination module determines the abnormal trajectories from all target trajectories based on the potential anomaly matrix and the concurrent noise reconstruction matrix.

[0103] In a third aspect, an embodiment of the present application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned trajectory anomaly detection method based on trajectory similarity when executing the above-mentioned computer program.

[0104] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned trajectory anomaly detection method based on trajectory similarity is implemented.

[0105] The above solution of the present application has the following beneficial effects:

[0106] In an embodiment of the present application, a plurality of target trajectories are obtained, and an enhancement operation is applied to each target trajectory to obtain a first trajectory and a second trajectory of each target trajectory. Then, for each first trajectory, a first structural feature and a first spatial feature of each trajectory point in the first trajectory are calculated, and the first trajectory feature of the first trajectory is calculated based on all the first structural features and the first spatial features. Then, for each second trajectory, a second structural feature and a second spatial feature of each trajectory point in the second trajectory are calculated, and the second trajectory feature of the second trajectory is calculated based on all the second structural features and the second spatial features. Then, the similarity between every two target trajectories is calculated based on all the first trajectory features and all the second trajectory features, and a potential anomaly matrix is ​​constructed based on all the similarities. Then, each target trajectory is divided into a plurality of trajectory segments according to a plurality of time periods, and a detection error of each target trajectory is obtained using all the trajectory segments, and a concurrent noise matrix is ​​constructed based on all the detection errors. Finally, an abnormal trajectory is determined from all the target trajectories based on the potential anomaly matrix and the concurrent noise reconstruction matrix. Among them, the similarity between trajectories is used to identify trajectory anomalies, without the need to mark the trajectories in advance, which reduces the cost of data collection and processing. It is suitable for anomaly detection of unknown anomalies and improves the reliability of trajectory anomaly detection. In addition, the abnormal trajectory is determined based on the potential anomaly matrix and the concurrent noise reconstruction matrix, which improves the accuracy of trajectory anomaly detection.

[0107] Other beneficial effects of the present application will be described in detail in the subsequent specific implementation section. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0109] Figure 1 A flowchart of a trajectory anomaly detection method based on trajectory similarity provided in an embodiment of the present application;

[0110] Figure 2 A schematic diagram of the structure of a trajectory anomaly detection device based on trajectory similarity provided in one embodiment of the present application;

[0111] Figure 3 A schematic diagram of the structure of a terminal device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0112] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0113] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.

[0114] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0115] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.

[0116] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0117] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0118] In view of the problems of high cost and poor reliability of trajectory anomaly detection in existing trajectory anomaly detection algorithms, an embodiment of the present application provides a trajectory anomaly detection method based on trajectory similarity. The trajectory anomaly detection method obtains multiple target trajectories and applies an enhancement operation to each target trajectory to obtain a first trajectory and a second trajectory of each target trajectory. Then, for each first trajectory, a first structural feature and a first spatial feature of each trajectory point in the first trajectory are calculated respectively, and the first trajectory feature of the first trajectory is calculated based on all the first structural features and the first spatial features. Then, for each second trajectory, a second structural feature and a second spatial feature of each trajectory point in the second trajectory are calculated respectively, and the second trajectory feature of the second trajectory is calculated based on all the second structural features and the second spatial features. Then, the similarity between every two target trajectories is calculated based on all the first trajectory features and all the second trajectory features, and a potential anomaly matrix is ​​constructed based on all the similarities. Then, each target trajectory is divided into multiple trajectory segments according to multiple time periods, and the detection error of each target trajectory is obtained by using all the trajectory segments, and a concurrent noise matrix is ​​constructed based on all the detection errors. Finally, an abnormal trajectory is determined from all the target trajectories according to the potential anomaly matrix and the concurrent noise reconstruction matrix. Among them, the similarity between trajectories is used to identify trajectory anomalies, without the need to mark the trajectories in advance, which reduces the cost of data collection and processing. It is suitable for anomaly detection of unknown anomalies and improves the reliability of trajectory anomaly detection. In addition, the abnormal trajectory is determined based on the potential anomaly matrix and the concurrent noise reconstruction matrix, which improves the accuracy of trajectory anomaly detection.

[0119] Next, the trajectory anomaly detection method based on trajectory similarity provided in this application is exemplified.

[0120] like Figure 1 As shown, the trajectory anomaly detection method based on trajectory similarity provided by the present application includes the following steps:

[0121] Step 11: Acquire multiple target trajectories, and apply an enhancement operation to each target trajectory to obtain a first trajectory and a second trajectory of each target trajectory.

[0122] The target trajectory is a trajectory that needs to be detected for trajectory anomaly, such as a vehicle driving trajectory, etc. The target trajectory includes multiple trajectory points.

[0123] In some embodiments of the present application, the above-mentioned enhancement operation can be a point displacement operation, that is, randomly moving the position of a point; a point masking operation, that is, randomly masking certain points and replacing the masked points with placeholders; a trajectory truncation operation, that is, randomly truncating the end part of the trajectory and only retaining the front end, etc., using different enhancement operations to obtain a first trajectory and a second trajectory with different target trajectories.

[0124] For example, after obtaining the target trajectory, normalization and other processing may be performed on it to standardize all target trajectories, and the expression is:

[0125]

[0126] in, The target trajectory The mean of is the standard deviation, is the target trajectory obtained after normalization.

[0127] Step 12: for each first trajectory, calculate the first structural feature and the first spatial feature of each trajectory point in the first trajectory respectively, and calculate the first trajectory feature of the first trajectory based on all the first structural features and the first spatial features.

[0128] The first structural feature is used to describe the structural information of the trajectory point, such as the shape of the trajectory and the connectivity of the points, and the first spatial feature is used to describe the spatial information of the trajectory point, such as the position of the trajectory point.

[0129] In some embodiments of the present application, the steps of calculating the first structural feature and the first spatial feature of each trajectory point in the first trajectory, and calculating the first trajectory feature of the first trajectory based on all the first structural features and the first spatial features are specifically as follows:

[0130] In the first step, a first structural feature and a first spatial feature of each trajectory point in the first trajectory are calculated.

[0131] Specifically, through the formula:

[0132]

[0133] Calculate the The first structural feature of the trajectory point ;

[0134] in, represents the weight matrix, Indicates the first track Track points, represents the bias term, , Indicates the number of trajectory points in the first trajectory.

[0135] By formula:

[0136]

[0137] Calculate the The first spatial feature of the trajectory points ;

[0138] in, represents the weight matrix, Represents the bias term.

[0139] In the second step, the structural attention score is calculated based on all the first structural features, and the spatial attention score is calculated based on all the first spatial features.

[0140] Specifically, through the formula:

[0141]

[0142]

[0143] Calculating structural attention score ;

[0144] in, represents the structure query vector, represents the structure key vector, represents a structure value vector, Represents the dimension, represents all first structural features, , , Both represent weight matrices.

[0145] By formula:

[0146]

[0147]

[0148] Calculating spatial attention score ;

[0149] in, represents the spatial query vector, represents the spatial key vector, represents a space-valued vector, Represents the dimension, represents all first space features, , , Both represent weight matrices.

[0150] The third step is to perform self-attention encoding on the first trajectory to obtain the trajectory encoding of the first trajectory, and obtain the contrast enhancement feature of the first trajectory according to the trajectory encoding.

[0151] Specifically, through the formula:

[0152]

[0153] Computing contrast enhancement features ;

[0154] in, represents the weight coefficient, represents the trajectory encoding, Indicates The trajectory encoding of negative sample trajectories, , Indicates the number of negative sample tracks.

[0155] In the fourth step, the first trajectory feature of the first trajectory is calculated using the structural attention score, the spatial attention score, and the contrast enhancement feature.

[0156] Specifically, through the formula:

[0157]

[0158] Calculate the first trajectory features of the first trajectory .

[0159] Exemplarily, the above steps may be executed using computer software such as matlab, python, etc. to obtain the first trajectory feature of the first trajectory.

[0160] It is worth mentioning that by obtaining the first structural features and the first spatial features of the trajectory points in the first trajectory, the structural information and the spatial information of the trajectory points can be characterized, thereby improving the information richness and accuracy of the first trajectory features obtained based on the first structural features and the first spatial features.

[0161] Step 13: for each second trajectory, calculate the second structural feature and the second spatial feature of each trajectory point in the second trajectory respectively, and calculate the second trajectory feature of the second trajectory based on all the second structural features and the second spatial features.

[0162] It should be noted that the process of calculating the second structural features and the second spatial features of each trajectory point in the second trajectory, and calculating the second trajectory features of the second trajectory based on all the second structural features and the second spatial features is consistent with step 12, and the second trajectory is processed by the processing process of the first trajectory in step 12 to obtain the second trajectory features of the second trajectory.

[0163] In some embodiments of the present application, in order to improve the accuracy of the first trajectory feature and the second trajectory feature, a loss function may be constructed and used to optimize the first trajectory feature and the second trajectory feature. If the value of the loss function is greater than a preset value of the loss function, the parameters in the formula for calculating the first trajectory adjustment and the second trajectory feature are adjusted. If the value of the loss function is less than or equal to the preset value of the loss function, the optimization is completed. The loss function may be:

[0164]

[0165]

[0166] in, represents the value of the loss function, represents the first trajectory feature, represents the second trajectory feature corresponding to the first trajectory feature, represents the first trajectory features of other first trajectories, Indicates the number of target trajectories.

[0167] It is worth mentioning that by acquiring the second structural features and the second spatial features of the trajectory points in the second trajectory, the structural information and the spatial information of the trajectory points can be characterized, thereby improving the information richness and accuracy of the second trajectory features obtained based on the second structural features and the second spatial features.

[0168] Step 14: Calculate the similarity between every two target trajectories according to all the first trajectory features and all the second trajectory features, and construct a potential anomaly matrix based on all the similarities.

[0169] The above potential anomaly matrix is ​​used to describe the potential abnormal conditions of each target trajectory.

[0170] In some embodiments of the present application, the steps of calculating the similarity between every two target trajectories according to all the first trajectory features and all the second trajectory features, and constructing a potential anomaly matrix based on all the similarities are specifically as follows:

[0171] In the first step, the similarity between every two target trajectories is calculated based on all first trajectory features and all second trajectory features.

[0172] Specifically, through the formula:

[0173]

[0174] Calculate the The target trajectory and The similarity between target trajectories ;

[0175] in, Represents similarity calculation, Indicates The first trajectory feature or the second trajectory feature corresponding to the target trajectory, Indicates The first trajectory feature or the second trajectory feature corresponding to the target trajectory, , , Indicates the number of target trajectories.

[0176] It should be noted that For One of the first trajectory feature or the second trajectory feature corresponding to the target trajectory is randomly selected to participate in the calculation.

[0177] In the second step, the anomaly score of each target trajectory is calculated based on all similarities.

[0178] Specifically, through the formula:

[0179]

[0180] Calculate the Anomaly score of target trajectories .

[0181] In the third step, a potential anomaly matrix is ​​constructed based on all anomaly scores.

[0182] Specifically, through the formula:

[0183]

[0184] Calculate the elements in the potential anomaly matrix .

[0185] in, Indicates The anomaly score of the target trajectory, represents the anomaly score threshold, when When The target trajectory and target tracks are marked as potential anomalies when When The target trajectory and None of the target tracks are marked as potential anomalies.

[0186] It should be noted that the potential anomaly matrix includes elements, each of which takes the value of 1 or 0, and is used to describe whether the corresponding two target trajectories are marked as potential anomalies.

[0187] It is worth mentioning that by calculating the similarity between target trajectories and constructing a potential anomaly matrix, the similarity between target trajectories can be analyzed to preliminarily determine whether each target trajectory has an anomaly.

[0188] Step 15, dividing each target trajectory into multiple trajectory segments according to multiple time periods, and using all trajectory segments to obtain the detection error of each target trajectory, and constructing a concurrent noise matrix based on all detection errors.

[0189] The above concurrent noise matrix is ​​used to describe the false anomaly condition of each target trajectory.

[0190] In some embodiments of the present application, the steps of dividing each target trajectory into multiple trajectory segments according to multiple time periods, obtaining the detection error of each target trajectory using all trajectory segments, and constructing a concurrent noise matrix based on all detection errors are specifically as follows:

[0191] In the first step, each target trajectory is divided into multiple trajectory segments according to multiple time periods.

[0192] Exemplarily, the target trajectory can be divided using a time window, such as dividing the corresponding segment in the first target trajectory in the first time period into a trajectory segment and marking it as the first trajectory segment of the first target trajectory, corresponding to the first time period, and dividing the corresponding segment in the second target trajectory in the first time period into a trajectory segment and marking it as the first trajectory segment of the second target trajectory, which also corresponds to the first time period. When dividing all target trajectories, the size of the window used is the same, and the time points corresponding to the starting points of all target trajectories are aligned with the starting time point of the first time period.

[0193] In the second step, for each trajectory segment, the segment similarity between each other trajectory segment with the same time period as the trajectory segment is calculated.

[0194] Specifically, through the formula:

[0195]

[0196] Calculate the The target trajectory The trajectory segment and The target trajectory The segment similarity between trajectory segments ;

[0197] in, Indicates The target trajectory A trajectory segment, Indicates The target trajectory A trajectory segment, , , represents the number of target trajectories, , Indicates the number of time periods.

[0198] Exemplarily, for each divided window (ie, time period), multiple trajectory segments corresponding to the divided window may be used as multiple nodes, and similarities between nodes may be used as edges to construct a graph structure.

[0199] The third step is to obtain the original features of each trajectory segment, and update the original features of each trajectory segment using the similarities of all segments to obtain the updated features of each trajectory segment.

[0200] For example, the original features can be obtained by using a model such as a gated neural network, and the original features can be updated by using a graph convolutional neural network to obtain updated features. The calculation formula of the graph convolutional neural network is:

[0201]

[0202] in, Indicates Layer The target trajectory The features corresponding to the trajectory segments are Indicates Layer The target trajectory The features corresponding to the trajectory segments are With The target trajectory There is a set of target trajectories corresponding to trajectory segments with segment similarity between the trajectory segments (if a graph structure is constructed, For the The target trajectory The set of neighbor nodes of the node corresponding to the trajectory segment). represents the adaptive propagation weight, Indicates The target trajectory The trajectory segment and The target trajectory The segment similarity between trajectory segments, Indicates The weight of the layer, Indicates The bias of the layer, , Represents the total number of layers of the graph convolutional neural network. hour, Indicates The target trajectory The original features of the trajectory segments, when hour, Indicates The target trajectory Update features of each trajectory segment.

[0203] It should be noted that the adaptive propagation weight The calculation formula is:

[0204]

[0205] in, represents an adjustable hyperparameter, Indicates The target trajectory The trajectory segment and The target trajectory The segment similarity between the trajectory segments.

[0206] The fourth step is to use all updated features to reconstruct features and obtain multiple reconstructed features.

[0207] Specifically, through the formula:

[0208]

[0209] Calculate the The target trajectory Reconstructed features of trajectory segments .

[0210] in, Indicates The target trajectory The updated features of the trajectory segments, With The target trajectory There is a set of target trajectories corresponding to the trajectory segments with segment similarity between the trajectory segments, Represents the weight coefficient:

[0211]

[0212]

[0213] in, Indicates The initial detection error of the target trajectory is Indicates The target trajectory and The similarity between target trajectories is Indicates The anomaly score of each target track.

[0214] In the fifth step, the detection error of each target track is calculated based on all reconstructed features and all original features.

[0215] Specifically, through the formula:

[0216]

[0217] Calculate the The detection error of the target trajectory .

[0218] in, Indicates The set of original features of all trajectory segments of a target trajectory, Indicates The set of reconstructed features of all trajectory segments of a target trajectory, represents the L2 norm.

[0219] In the sixth step, a concurrent noise matrix is ​​constructed based on all detection errors.

[0220] Specifically, through the formula:

[0221]

[0222] Compute the elements in the concurrent noise matrix .

[0223] in, Indicates The detection error of the target trajectory is Represents the detection error threshold. When The target trajectory and target tracks are marked as false anomalies when When The target trajectory and target tracks are not marked as false anomalies.

[0224] It should be noted that the concurrent noise matrix includes elements, each of which takes the value of 1 or 0, and is used to describe whether the corresponding two target trajectories are marked as false anomalies.

[0225] It is worth mentioning that by dividing the target trajectory into multiple trajectory segments and analyzing the trajectory segments, a detailed analysis of the target trajectory is achieved, which improves the accuracy of the elements in the concurrent noise matrix.

[0226] Step 16, determining the abnormal trajectories from all target trajectories according to the potential abnormality matrix and the concurrent noise reconstruction matrix.

[0227] In some embodiments of the present application, the step of determining the abnormal trajectory from all target trajectories according to the potential abnormal matrix and the concurrent noise reconstruction matrix is ​​specifically as follows:

[0228] The first step is through the formula:

[0229]

[0230] Calculate the The target trajectory and Abnormal value of target trajectory .

[0231] in, Represents the potential anomaly matrix The target trajectory and The elements corresponding to the target trajectory are represents the number of concurrent noise reconstruction matrices The target trajectory and The elements corresponding to the target trajectory are , , Indicates the number of target trajectories.

[0232] The logic of the above formula is:

[0233] if and , that is, The target trajectory and target tracks are marked as potential anomalies but are not affected by concurrent noise, then , indicating that they are finally judged as abnormal trajectories.

[0234] if and , that is, The target trajectory and target tracks are marked as potential anomalies, but may be affected by concurrent noise, then , indicating that they are excluded as false anomalies.

[0235] if , then regardless of What is the value of , indicating that the two trajectories are considered normal.

[0236] In the second step, for each target trajectory, if there is an abnormal condition value of 1 among all abnormal condition values ​​corresponding to the target trajectory, the target trajectory is marked as an abnormal trajectory.

[0237] Exemplarily, the abnormal status values ​​of the first target trajectory, the second target trajectory, the third target trajectory, and the fourth target trajectory are 0, 1, 0, and 0 respectively. If there is an abnormal status value of 1, the first target trajectory is marked as an abnormal trajectory.

[0238] It is worth mentioning that the similarity between trajectories is used to identify trajectory anomalies. There is no need to mark the trajectories in advance, which reduces the cost of data collection and processing. It is suitable for anomaly detection of unknown anomalies and improves the reliability of trajectory anomaly detection. In addition, the abnormal trajectory is determined based on the potential anomaly matrix and the concurrent noise reconstruction matrix, which improves the accuracy of trajectory anomaly detection.

[0239] The following is an exemplary description of the trajectory anomaly detection device based on trajectory similarity provided by the present application.

[0240] like Figure 2 As shown, the embodiment of the present application provides a trajectory anomaly detection device based on trajectory similarity, and the trajectory anomaly detection device 200 based on trajectory similarity includes:

[0241] An enhancement module 201 acquires a plurality of target trajectories and applies an enhancement operation to each target trajectory to obtain a first trajectory and a second trajectory of each target trajectory;

[0242] A first calculation module 202 calculates, for each first trajectory, a first structural feature and a first spatial feature of each trajectory point in the first trajectory, and calculates a first trajectory feature of the first trajectory based on all the first structural features and the first spatial features;

[0243] A second calculation module 203 calculates, for each second trajectory, a second structural feature and a second spatial feature of each trajectory point in the second trajectory, and calculates a second trajectory feature of the second trajectory based on all the second structural features and the second spatial features;

[0244] The first construction module 204 calculates the similarity between every two target trajectories according to all the first trajectory features and all the second trajectory features, and constructs a potential anomaly matrix based on all the similarities; the potential anomaly matrix is ​​used to describe the potential abnormal condition of each target trajectory;

[0245] The second construction module 205 divides each target trajectory into multiple trajectory segments according to multiple time periods, obtains the detection error of each target trajectory using all the trajectory segments, and constructs a concurrent noise matrix based on all the detection errors; the concurrent noise matrix is ​​used to describe the false abnormality of each target trajectory;

[0246] The determination module 206 determines the abnormal trajectory from all target trajectories according to the potential abnormality matrix and the concurrent noise reconstruction matrix.

[0247] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.

[0248] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0249] like Figure 3 As shown, an embodiment of the present application provides a terminal device. The terminal device D10 of this embodiment includes: at least one processor D100 ( Figure 3 Only one processor is shown in the figure), a memory D101, and a computer program D102 stored in the memory D101 and executable on the at least one processor D100, wherein the processor D100 implements the steps of any of the above-mentioned method embodiments when executing the computer program D102.

[0250] Specifically, when the processor D100 executes the computer program D102, it obtains a plurality of target trajectories and applies an enhancement operation to each target trajectory to obtain a first trajectory and a second trajectory of each target trajectory, and then respectively calculates the first structural feature and the first spatial feature of each trajectory point in the first trajectory for each first trajectory, and calculates the first trajectory feature of the first trajectory based on all the first structural features and the first spatial features, and then respectively calculates the second structural feature and the second spatial feature of each trajectory point in the second trajectory for each second trajectory, and calculates the second trajectory feature of the second trajectory based on all the second structural features and the second spatial features, and then calculates the similarity between every two target trajectories based on all the first trajectory features and all the second trajectory features, and constructs a potential anomaly matrix based on all the similarities, and then divides each target trajectory into a plurality of trajectory segments according to a plurality of time periods, and uses all the trajectory segments to obtain the detection error of each target trajectory, and constructs a concurrent noise matrix based on all the detection errors, and finally determines the abnormal trajectory from all the target trajectories based on the potential anomaly matrix and the concurrent noise reconstruction matrix. Among them, the similarity between trajectories is used to identify trajectory anomalies, without the need to mark the trajectories in advance, which reduces the cost of data collection and processing. It is suitable for anomaly detection of unknown anomalies and improves the reliability of trajectory anomaly detection. In addition, the abnormal trajectory is determined based on the potential anomaly matrix and the concurrent noise reconstruction matrix, which improves the accuracy of trajectory anomaly detection.

[0251] The processor D100 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0252] In some embodiments, the memory D101 may be an internal storage unit of the terminal device D10, such as a hard disk or memory of the terminal device D10. In other embodiments, the memory D101 may also be an external storage device of the terminal device D10, such as a plug-in hard disk, a smart memory card (SMC, SmartMedia Card), a secure digital (SD, Secure Digital) card, a flash card (Flash Card), etc. equipped on the terminal device D10. Further, the memory D101 may also include both an internal storage unit of the terminal device D10 and an external storage device. The memory D101 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program, etc. The memory D101 may also be used to temporarily store data that has been output or is to be output.

[0253] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.

[0254] An embodiment of the present application provides a computer program product. When the computer program product runs on a terminal device, the terminal device can implement the steps in the above-mentioned method embodiments when executing the computer program product.

[0255] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the trajectory anomaly detection method device / terminal device based on trajectory similarity, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a disk or an optical disk.

[0256] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0257] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0258] The above is a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles described in the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A trajectory anomaly detection method based on trajectory similarity, characterized in that: Traffic pattern recognition and prediction applied to modern traffic monitoring systems, including: Acquire multiple target trajectories, and apply an enhancement operation to each of the target trajectories to obtain a first trajectory and a second trajectory of each of the target trajectories; For each of the first trajectories, respectively, calculate a first structural feature and a first spatial feature of each trajectory point in the first trajectory, and calculate a first trajectory feature of the first trajectory based on all the first structural features and the first spatial features; For each of the second trajectories, respectively, calculate a second structural feature and a second spatial feature of each trajectory point in the second trajectory, and calculate a second trajectory feature of the second trajectory based on all the second structural features and the second spatial features; Calculating the similarity between every two target trajectories according to all the first trajectory features and all the second trajectory features, and constructing a potential anomaly matrix based on all the similarities; the potential anomaly matrix is ​​used to describe the potential abnormal condition of each target trajectory; Divide each of the target trajectories into a plurality of trajectory segments according to a plurality of time periods, obtain the detection error of each of the target trajectories using all the trajectory segments, and construct a concurrent noise matrix based on all the detection errors; the concurrent noise matrix is ​​used to describe the false abnormality of each target trajectory; Determining abnormal trajectories from all target trajectories according to the potential abnormal matrix and the concurrent noise reconstruction matrix; The calculating the first structural feature and the first spatial feature of each trajectory point in the first trajectory includes: By formula: Calculate the The first structural feature of the trajectory point ; in, represents the weight matrix, Indicates the first track Track points, represents the bias term, , represents the number of trajectory points in the first trajectory; By formula: Calculate the The first spatial feature of the trajectory points ; in, represents the weight matrix, Represents the bias term.

2. The trajectory anomaly detection method according to claim 1, characterized in that: The calculating the first trajectory feature of the first trajectory based on all the first structural features and the first spatial features comprises: Calculating a structural attention score based on all first structural features, and calculating a spatial attention score based on all first spatial features; Performing self-attention encoding on the first trajectory to obtain a trajectory encoding of the first trajectory, and obtaining a contrast enhancement feature of the first trajectory according to the trajectory encoding; The first trajectory feature of the first trajectory is calculated using the structural attention score, the spatial attention score, and the contrast enhancement feature.

3. The trajectory anomaly detection method according to claim 2, characterized in that: The calculating of the structural attention score based on all the first structural features comprises: By formula: Calculate the structural attention score ; in, represents the structure query vector, represents the structure key vector, represents a structure value vector, Represents the dimension, represents all first structural features, , , Both represent weight matrices; The calculating of the spatial attention score based on all the first spatial features comprises: By formula: Calculate the spatial attention score ; in, represents the spatial query vector, represents the spatial key vector, represents a space-valued vector, Represents the dimension, represents all first space features, , , Both represent weight matrices; The acquiring the contrast enhancement feature of the first trajectory according to the trajectory encoding includes: By formula: Computing contrast enhancement features ; in, represents the weight coefficient, represents the trajectory encoding, Indicates The trajectory encoding of negative sample trajectories, , Represents the number of negative sample trajectories; The calculating the first trajectory feature of the first trajectory by using the structural attention score, the spatial attention score, and the contrast enhancement feature includes: By formula: Calculate the first trajectory feature of the first trajectory .

4. The trajectory anomaly detection method according to claim 1, characterized in that: The calculating the similarity between every two target trajectories according to all the first trajectory features and all the second trajectory features includes: By formula: Calculate the The target trajectory and The similarity between target trajectories ; in, Represents similarity calculation, Indicates The first trajectory feature or the second trajectory feature corresponding to the target trajectory, Indicates The first trajectory feature or the second trajectory feature corresponding to the target trajectory, , , Indicates the number of target trajectories.

5. The trajectory anomaly detection method according to claim 4, characterized in that: The potential anomaly matrix is ​​constructed based on all similarities, including: Calculate the anomaly score of each target track based on all similarities; Construct a potential anomaly matrix based on all anomaly scores.

6. The trajectory anomaly detection method according to claim 5, characterized in that: The anomaly score of each target track is calculated based on all similarities, including: By formula: Calculate the Anomaly score of target trajectories ; The potential anomaly matrix is ​​constructed according to all anomaly scores, including: By formula: Calculate the elements in the potential anomaly matrix ; in, Indicates The anomaly score of the target trajectory, represents the anomaly score threshold, when When The target trajectory and target tracks are marked as potential anomalies.

7. The trajectory anomaly detection method according to claim 1, characterized in that: The method of obtaining the detection error of each target trajectory by using all trajectory segments includes: For each trajectory segment, respectively, calculate the segment similarity between each other trajectory segment having the same time period as the trajectory segment and the trajectory segment; Acquire the original features of each trajectory segment, and update the original features of each trajectory segment using all segment similarities to obtain updated features of each trajectory segment; All updated features are used to perform feature reconstruction to obtain multiple reconstructed features; The detection error of each object track is calculated based on all reconstructed features and all original features.

8. The trajectory anomaly detection method according to claim 7, characterized in that: The calculating of the segment similarity between each other trajectory segment having the same number as the target trajectory segment and the trajectory segment includes: By formula: Calculate the The target trajectory The trajectory segment and The target trajectory The segment similarity between trajectory segments ; in, Indicates The target trajectory A trajectory segment, Indicates The target trajectory A trajectory segment, , , represents the number of target trajectories, , Indicates the number of time periods; The feature reconstruction is performed using all updated features to obtain multiple reconstructed features, including: By formula: Calculate the The target trajectory Reconstructed features of trajectory segments ; in, Indicates The target trajectory The updated features of the trajectory segments, Indicates that The target trajectory There is a set of target trajectories corresponding to the trajectory segments with segment similarity between the trajectory segments, Represents the weight coefficient: in, Indicates The initial detection error of the target trajectory is Indicates The target trajectory and The similarity between target trajectories is Indicates The anomaly score of the target trajectory; The detection error of each target track is calculated based on all the reconstructed features and all the original features, including: By formula: Calculate the The detection error of the target trajectory ; in, Indicates the The set of original features of all trajectory segments of a target trajectory, Indicates the The set of reconstructed features of all trajectory segments of a target trajectory, represents the L2 norm; The concurrent noise matrix is ​​constructed based on all detection errors, including: By formula: Compute the elements in the concurrent noise matrix ; in, Indicates The detection error of the target trajectory is Represents the detection error threshold. When The target trajectory and target tracks are marked as false anomalies.

9. The trajectory anomaly detection method according to claim 1, characterized in that: The determining of abnormal trajectories from all target trajectories according to the potential abnormality matrix and the concurrent noise reconstruction matrix includes: By formula: Calculate the The target trajectory and Abnormal value of target trajectory ; in, Represents the potential anomaly matrix The target trajectory and The elements corresponding to the target trajectory are represents the number of concurrent noise reconstruction matrices The target trajectory and The elements corresponding to the target trajectory are , , represents the number of target trajectories; For each of the target trajectories respectively, if there is an abnormal condition value with a value of 1 among all abnormal condition values ​​corresponding to the target trajectory, the target trajectory is marked as an abnormal trajectory.

Citation Information

Patent Citations

  • Urban traffic illegal behavior detection method based on video monitoring system

    CN103942533A

  • Ship trajectory model establishment and abnormal trajectory detection method

    CN111949750A