Trajectory anomaly detection method based on diffusion model and computer equipment
By adopting a diffusion model-based method in ship trajectory anomaly detection and using the TUGnet denoising network and conditional diffusion model for trajectory prediction, the problem of insufficient accuracy in trajectory anomaly detection under complex ship interaction situations is solved and the safety of ship driving is improved.
Patent Information
- Application Number
- CN202411918191.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-01-24
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art cannot accurately analyze the abnormal state of the ship trajectory under complex ship interactions, resulting in insufficient ship safety.
The trajectory abnormal detection method based on the diffusion model is adopted to obtain the current historical trajectory associated information of the ship, build a space -time chart, and use TUGNET's exfoliating network and condition diffusion model for trajectory prediction to detect whether the ship is abnormally driving.
It improves the accuracy of the abnormal detection of the ship's trajectory, enhances the safety of the ship's driving, and can effectively identify the abnormal behavior of the ship.
Smart Images

Figure CN119357875A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of ship safety technology, and in particular to a trajectory anomaly detection method and computer equipment based on a diffusion model. Background Art
[0002] With the rapid development of the global shipping industry, maritime traffic volume and ship density continue to increase, and ship trajectory prediction plays a vital role in maritime traffic safety. Accurate trajectory prediction can not only assist ships in collision avoidance, but also provide decision support for shipping optimization and port scheduling. At the same time, it also helps to detect abnormal behaviors of ships (such as deviation, not following the route, etc.) in real time, becoming the key to improving the intelligence and safety of maritime traffic.
[0003] In related technologies, statistical analysis methods and traditional machine learning methods are widely used for trajectory anomaly detection. However, most of these methods are based on simple feature aggregation of neighboring ships and cannot cope with complex ship interactions. They cannot capture the spatiotemporal characteristics of ship trajectory data well, and are insufficient in learning long-term dependencies and identifying complex patterns. In summary, current methods for detecting anomalies in maritime ship trajectories have limitations.
[0004] Therefore, how to improve the accuracy of ship trajectory anomaly detection has become a technical problem that needs to be solved urgently. Summary of the invention
[0005] The embodiments of the present application provide a trajectory anomaly detection method and computer device based on a diffusion model, aiming to solve the technical problem in the related art that the abnormal state of the ship trajectory cannot be accurately analyzed under complex ship interaction conditions, resulting in insufficient ship safety.
[0006] In a first aspect, an embodiment of the present application provides a method for detecting anomaly in a ship trajectory, comprising: During the real-time travel of a ship in the target sea area, current historical track association information of the ship within a first time step is obtained, wherein the first time step is an adjacent historical period of the current moment, and the current historical track association information is used to reflect the position change of the ship in the target sea area within the first time step and the interaction relationship between the ships; Based on the current historical trajectory association information, determine a set of spatial graphs of the current historical trajectory of the ship in the target sea area at multiple moments in the first time step as a space-time graph; Adding Gaussian noise to the current historical trajectory for a specified number of iterations to obtain noise trajectories corresponding to the specified number of iterations; The current historical trajectory, the spatiotemporal graph and the noise trajectory corresponding to each iteration are used as input information of a TUGnet denoising network, and the Gaussian noise corresponding to each iteration is output through the TUGnet denoising network; Construct a denoising function based on the Gaussian noise corresponding to each iteration; Taking the current historical trajectory and the space-time graph within the first time step, and the denoising function as input information of a conditional diffusion model, outputting the predicted trajectory of the ship in the target sea area within a second time step adjacent to the first time step through the conditional diffusion model; After the second time step, determining the difference between the actual trajectory of the ship in the second time step and the predicted trajectory; Based on the difference, it is determined whether the ship travels abnormally within the second time step.
[0007] In a second aspect, an embodiment of the present application provides a computer device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are configured to execute the method described in the first aspect above.
[0008] In a third aspect, an embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute the method described in the first aspect above.
[0009] The above technical solution aims at the technical problem in the related technology that the ship's trajectory cannot be accurately predicted in complex ship interaction situations, resulting in insufficient ship safety. In the real-time driving process of the ship in the target sea area, the spatiotemporal graph of the ship is added as one of the input information of the conditional diffusion model, and the trajectory of the ship is predicted. In the reverse diffusion process of the conditional diffusion model, the TUGnet denoising network is introduced to predict the movement trajectory of the ship. The noise characteristics and the spatiotemporal characteristics of the target sea area where the ship is located are integrated into the trajectory prediction process through the TUGnet denoising network. Finally, the difference between the predicted trajectory and the actual trajectory corresponding to the predicted trajectory is used to determine whether the ship is driving abnormally. In this way, the accuracy of ship trajectory anomaly detection can be greatly improved, which helps to improve the safety of ship driving. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments 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 creative work.
[0011] Figure 1 A flow chart of a method for detecting abnormal ship trajectory according to an embodiment of the present application is shown; Figure 2 A schematic diagram showing the overall working process of the TUGnet denoising network according to an embodiment of the present application is shown; Figure 3 A block diagram of a computer device according to an embodiment of the present application is shown; Figure 4 A block diagram of a computer device according to another embodiment of the present application is shown. DETAILED DESCRIPTION
[0012] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0013] Figure 1 A flow chart of a method for detecting abnormal ship trajectory according to an embodiment of the present application is shown.
[0014] like Figure 1 As shown, according to an embodiment of the present application, a method for detecting abnormal ship trajectory includes: Step 102: During the real-time travel of the ship in the target sea area, current historical track association information of the ship within a first time step is obtained.
[0015] The first time step is the adjacent historical period of the current moment, and the current historical trajectory association information is used to reflect the change of ship position and the interaction relationship between ships in the target sea area within the first time step. Thus, the current historical trajectory association information within the most recent historical period can be obtained as the basis for subsequent future trajectory prediction.
[0016] In a possible design, before step 102, a track association information set of the ship in the first time step may be obtained, and the track association information set may be preprocessed, and the preprocessing result may be used as the current historical track association information.
[0017] Wherein, the preprocessing includes one or more of the following: First, the repeated ship trajectory points with the same timestamp of a single ship in the trajectory association information set are deleted, that is, the trajectory points in the trajectory association information set are deduplicated, wherein a single ship can be equated with the corresponding MMSI (Maritime Mobile Service Identity), and the repeated ship trajectory points with the same timestamp are deduplicated for the trajectory points corresponding to each MMSI.
[0018] Second, the longitude and latitude of all ship track points are converted into coordinates in a specified coordinate system, and the minimum longitude and minimum latitude of all ship track points are used as the origin of the specified coordinate system. In this way, the position changes of ships in the target sea area and the interaction relationship between ships are standardized, which is convenient for subsequent calculations.
[0019] Third, adjacent ship track points whose continuous time interval is less than the specified interval are determined, and the track gap positions between the adjacent ship track points are interpolated by cubic spline interpolation, that is, the discontinuous tracks are interpolated to improve the accuracy of subsequent track prediction by improving the integrity of the current historical track. Optionally, the specified interval is 300s.
[0020] Fourth, a reference time span is determined within the first time step, wherein the number of ships in the scene of the target sea area corresponding to the reference time span is greater than or equal to 2 and the trajectory span of each ship is equal to the reference time span. In other words, only when the number of ships reaches two and both of them keep moving within the reference time span, there is a possibility of interaction. At this time, since there is a possibility of interaction between the two, it is necessary to predict the trajectories of the two.
[0021] Step 104: Based on the current historical trajectory association information, a set of spatial graphs of the current historical trajectory of the ship in the target sea area at multiple moments in the first time step is determined as a space-time graph.
[0022] Since the current historical trajectory association information reflects the changes in the positions of ships in the target sea area and the interaction relationship between ships within the first time step, the positions and interactions of ships in the target sea area within the first time step can be determined based on the current historical trajectory association information, and this performance is a space-time diagram.
[0023] Specifically, the current historical trajectory association information of the ships in the target sea area within the first time step is obtained, including obtaining the vertex set of all the ships in the target sea area within the first time step and obtaining the mutual influence degree between every two ships in the target sea area. In other words, the current historical trajectory association information includes the vertex set of the ships in the target sea area within the first time step and the mutual influence degree between every two ships.
[0024] The calculation method of the mutual influence degree between every two ships in the target sea area is as follows: =
[0025] Indicates the relationship between the i-th ship and the j-th ship in the target sea area The mutual influence within a reference time span, and Respectively represent the i-th ship and the j-th ship in the The current position of a reference time span, is the preset range parameter.
[0026] On this basis, step 104 includes: determining a set of spatial graphs of the current historical trajectories of the ships in the target sea area at multiple moments in the first time step based on the vertex set in the target sea area and the mutual influence degree between every two ships, wherein: =( , ), Indicates that the target sea area is A space-time diagram with a reference time span, ={ ∣∀i∈(1,…,N)}, is the a set of vertices that can refer to a time span, ={ ∣∀i,j∈(1,…,N)}, which means the The edge set inside the space-time graph in a referenceable time span; and the set of space-time graphs of multiple referenceable time spans in the first time step is determined as the space-time graph.
[0027] Among them, The set of vertices with reference time spans reflects the The starting position of each ship in the reference time span, The edge set inside the space-time graph in the reference time span reflects the Whether every two ships have the possibility of interaction within a reference time span. It can be understood that if , then the i-th ship and the j-th ship in the target sea area are The probability of interaction within a reference time span is 1 / , otherwise, the probability is 0.
[0028] Step 106 , adding Gaussian noise to the current historical trajectory for a specified number of iterations to obtain noise trajectories corresponding to the specified number of iterations.
[0029] This step is the forward diffusion process of the conditional diffusion model, that is, gradually adding Gaussian noise to the current historical trajectory until the number of iterations reaches the specified number. After each addition of Gaussian noise, the current historical trajectory is transformed into the corresponding noise trajectory.
[0030] Step 108, using the current historical trajectory, the spatiotemporal graph and the noise trajectory corresponding to each iteration as input information of the TUGnet denoising network, and outputting the Gaussian noise corresponding to each iteration through the TUGnet denoising network.
[0031] It can be said that the TUGnet denoising network is used to reflect the correlation between the current historical trajectory of the ship, the spatiotemporal map of the target sea area, and the noise trajectory corresponding to a single iteration and the Gaussian noise added by the single iteration. Therefore, the Gaussian noise applied in each iteration can be restored through the TUGnet denoising network.
[0032] This process can be used as a precursor to the back diffusion of the conditional diffusion model.
[0033] On this basis, the sample historical trajectory, the real historical trajectory after the sample historical trajectory and the space-time graph corresponding to the sample historical trajectory can be used as input information, and the noise between the sample historical trajectory and the real historical trajectory can be used as output information to train the TUGnet denoising network.
[0034] In a possible design, step 108 includes: for each of the noise trajectories, splicing the noise trajectory with the corresponding current historical trajectory to obtain an intermediate trajectory; based on a step-by-step downsampling and step-by-step upsampling process, processing the intermediate trajectory, wherein, in at least one residual block in the step-by-step downsampling and the step-by-step upsampling, for an input trajectory input into the residual block, normalizing the input trajectory and splicing it with the noise step value to obtain a noise splicing feature; based on a GraphConv module, fusing the noise splicing feature with the spatiotemporal graph into a spatiotemporal fusion feature as output information of the residual block.
[0035] That is to say, in the process of processing at least one residual block in the TUGnet denoising network, the input information of the residual block (i.e., the intermediate trajectory of the residual block after the previous structure processing, i.e., the above-mentioned input trajectory) is normalized and spliced with the noise step value, and then further integrated with the spatiotemporal graph, and the noise characteristics and the spatiotemporal performance characteristics of the ship are integrated into the TUGnet denoising network, so that the output information of the residual block and even the output information of the TUGnet denoising network can consider the influence of the noise characteristics and the spatiotemporal performance characteristics of the ship to a certain extent. As a result, it is convenient to obtain more accurate and reliable noise to be removed in the reverse diffusion process, and the output accuracy of the conditional diffusion model is improved.
[0036] Step 110: construct a denoising function based on the Gaussian noise corresponding to each iteration.
[0037] The denoising function reflects the correlation between the adjacent track of the noise track before the noise track and the Gaussian noise corresponding to the noise track and the current iteration, specifically: , in, It is The noise trajectory obtained by the iteration is It is The noise trajectory obtained by the iteration is For the The variance term in the Gaussian transfer in the iterations, , represents the output of the TUGnet denoising network, The Gaussian noise corresponding to the iteration is represents the current historical trajectory, represents the space-time graph, is a random variable from a standard Gaussian distribution.
[0038] Step 112, using the current historical trajectory and the space-time graph within the first time step, and the denoising function as input information of a conditional diffusion model, and outputting the predicted trajectory of the ship in the target sea area within a second time step adjacent to the first time step through the conditional diffusion model.
[0039] It can be said that the conditional diffusion model reflects the correlation between the current historical trajectory of the ship, the spatiotemporal graph of the target sea area, and the denoising function, and the predicted trajectory of the ship in the target sea area. On this basis, in the training method of the conditional diffusion model, the current historical trajectory, the noise trajectory corresponding to the specified number of iterations, the specified number of times, the variance term in the Gaussian transfer in the specified number of iterations, and the spatiotemporal graph are used as input information, and the denoising function is used as output information for training. Therefore, by adding input conditions, the conditional diffusion model can more deeply explore the performance of the ship's predicted trajectory under the influence of the added noise and spatiotemporal characteristics in iterative training, thereby improving the prediction accuracy of the conditional diffusion model.
[0040] Step 114, after the second time step, determining the difference between the actual trajectory of the ship in the second time step and the predicted trajectory.
[0041] Step 116: Determine whether the ship travels abnormally within the second time step based on the difference.
[0042] After the predicted trajectory is obtained, it can be determined whether the ship is sailing safely based on the difference between the actual trajectory of the ship in the second time step and the predicted trajectory.
[0043] In one possible design, the difference includes speed difference and / or direction difference, wherein if the difference is within a preset abnormal range, an abnormal warning message is generated; if the difference is not within the preset abnormal range, it indicates that the ship is sailing safely and no warning is needed.
[0044] The above technical solution, during the real-time driving process of the ship in the target sea area, adds the space-time diagram of the ship as one of the input information of the conditional diffusion model, predicts the trajectory of the ship, and introduces the TUGnet denoising network in the reverse diffusion process of the conditional diffusion model to predict the movement trajectory of the ship. In the process of trajectory prediction, the noise characteristics and the space-time characteristics of the target sea area where the ship is located are integrated into the TUGnet denoising network. Finally, by comparing the difference between the predicted trajectory and the actual trajectory corresponding to the predicted trajectory, it is determined whether the ship is driving abnormally. In this way, the accuracy of ship trajectory prediction can be greatly improved, which helps to improve the safety of ship driving.
[0045] Similarly, in the process of training the TUGnet denoising network and the conditional diffusion model, the space-time graph of the ship is also introduced as part of the training data, so that the TUGnet denoising network and the conditional diffusion model can effectively learn the characteristics of the space-time graph of the ship, so that the TUGnet denoising network and the conditional diffusion model can more accurately predict the characteristics of the ship's trajectory. Specifically, in the process of processing at least one residual block in the TUGnet denoising network, the input information of the residual block is normalized and spliced with the noise step value, and then further integrated with the space-time graph, and the noise characteristics and the space-time performance characteristics of the ship are integrated into the TUGnet denoising network, so that the output information of the residual block and even the output information of the TUGnet denoising network can consider the impact of the noise characteristics and the space-time performance characteristics of the ship to a certain extent. As a result, it is convenient to obtain more accurate and reliable noise to be removed in the reverse diffusion process, and the output accuracy of the conditional diffusion model is improved.
[0046] In another possible design, the difference is determined in the following manner: selecting a plurality of real trajectory points and a plurality of predicted trajectory points corresponding to the plurality of real trajectory points in the real trajectory of the ship and the predicted trajectory of the ship respectively; determining the mean square error and dynamic time warping distance between the real trajectory and the predicted trajectory based on the plurality of real trajectory points and the plurality of predicted trajectory points; performing weighted summation processing on the mean square error and the dynamic time warping distance to obtain the difference between the real trajectory and the predicted trajectory. On this basis, step 116 includes: determining the cumulative value of the difference of a specified number of historical time steps, and if the cumulative value of the difference is within a preset abnormal range, determining that the ship is traveling abnormally within the second time step. Wherein, the specified number of historical time steps includes the first time step and several historical time steps before the first time step.
[0047] Therefore, it is possible to effectively identify whether a ship is operating abnormally based on the predicted trajectory, facilitate timely warning, and improve the safety of ship operation.
[0048] In addition, after determining that the ship is traveling abnormally within the second time step, the abnormal mode of the ship can be determined based on the accumulated values of the difference between the second time step and several historical time steps before the second time step, wherein the abnormal mode is a speed abnormality model, a direction abnormality model, and a speed and direction abnormality model. In other words, when judging the abnormal travel of a ship, it can be further judged whether the direction of the ship is abnormal, the speed is abnormal, or both are abnormal. The judgment of the abnormal travel mode helps to have a deeper understanding of the performance of abnormal travel of the ship, so as to facilitate the timely adoption of control measures adapted to its abnormal situation.
[0049] The following is an explanation of the training of the conditional diffusion model, which uses the DMTM-AD framework.
[0050] During the training process, the original DDPM generates unconditional images in a different way. Specifically, the historical trajectory x and the spatial map A are fed into the conditional diffusion model as input information, so that the conditional diffusion model can use past motion patterns and spatial dependencies to more accurately predict the trajectory. The future trajectory y0 is processed by noiseschedule, and Gaussian noise is iteratively added to generate y k The TUGnet denoising network learns to y by minimizing the mean square error (MSE) k The denoising is then performed to estimate the original trajectory.
[0051] During the prediction process, random noise is input into the conditional diffusion model together with x and A, and the conditional diffusion model generates the prediction trajectory through iteration. , simulating possible future paths.
[0052] The forward diffusion process and the backward diffusion process of the conditional diffusion model are both defined as Markov chains with Gaussian transitions. Specifically, the forward diffusion process is defined as , where K represents the maximum number of diffusion steps. This process gradually introduces uncertainty, transforming the true trajectory into noise data. In contrast, the reverse diffusion process Gradually reduce from The uncertainty at the beginning will eventually restore the target trajectory.
[0053] First, define arrive The forward diffusion process is: , Next, we define the back-diffusion process for generating trajectories from the noise distribution. This back-diffusion process is modeled by a parameterized Gaussian transfer based on the observed trajectories, specifically:
[0054] in, is the initial Gaussian noise distribution, and θ represents the parameters of the diffusion model. These parameters are trained using trajectory data and shared across all transfers.
[0055] In addition, the variance term in the Gaussian transfer can be set as , and finally get the simplified loss function: , Training will be done at each step On.
[0056] After training with the back-diffusion process, we generate Start and apply the reverse process To generate a reasonable trajectory. arrive Generate the trajectory in reverse as follows: , where z is a random variable from a standard Gaussian distribution, is the trained network (i.e., TUGnet denoising network), The input includes the prediction of the previous step , historical trajectory x and spatial graph A and current step k.
[0057] In one possible design, the pseudo code of the training process of the conditional diffusion model, i.e., DMTM-AD, is shown below.
[0058] Input: Distribution of training data , diffusion steps K, variance scheduling ( ), historical ship trajectory x, adjacency matrix A (i.e., adjacency matrix form of spatial graph); Output: Denoising function after training ; 1: Repeat the following steps; 2: From the uniform distribution Uniform ( ) and sample k from Medium Sampling ; 3: From the standard normal distribution Sampling noise , whose dimensions are same; 4: Calculate the noise target ; 5: Calculate the gradient And perform gradient descent; 6: Until convergence.
[0059] In one possible design, the pseudo code of the sampling process of the conditional diffusion model, i.e., DMTM-AD, is shown below.
[0060] Input: historical ship trajectory x, adjacency matrix A, trained denoising function ; Output: Future predicted trajectory ; 1: From the standard normal distribution Sampling noise , whose dimensions are same; 2: for k=K to 1 do; 3: Sampling based on x and A ; 4: end for; 5: return .
[0061] Furthermore, the overall working process of the TUGnet denoising network is as follows Figure 2 As shown on the left, the working process of at least one residual block in the TUGnet denoising network is as follows Figure 2 As shown on the right. TUGnet denoising network is based on , x and A as input, and output noise The TUGnet denoising network combines x and , extracting spatiotemporal features. The core of the U-network is the residual block, which runs through the entire network. In each residual block, the GraphConv module utilizes the historical interaction graph A to further enhance the effect of the model.
[0062] First, the input history track and predicted trajectory Contact in the time dimension .
[0063] Next, Perform Conv2d 1×1 processing, that is, embed it into a higher-dimensional latent space through a 1×1 convolution kernel, and obtain , where C represents the hidden feature dimension.
[0064] Next, the model performs a step-by-step downsampling and upsampling process marked by index i. Each step consists of multiple residual blocks. In addition, the downsampling process is to copy and concatenate the features.
[0065] set up represents the input of the i-th residual block, where the initial input is =H. The output of the i-th residual block is During downsampling, the spatial feature dimension Increase, and the time dimension In contrast, during upsampling, Reduce, In the intermediate stages between downsampling and upsampling, the dimension remains unchanged. In addition, in each upsampling step, the model concatenates the input with the corresponding feature map from the downsampling path through a skip connection.
[0066] Finally, the upsampled output is convolved through a 1×1 convolution kernel from Projecting back to the original feature space , and then a fully connected layer (FC) is used to connect the time dimension and Align and generate the final output .
[0067] In the residual block, the input H is first normalized, and then the noise step value k after embedding K is added to obtain . It is then processed through a graph convolution module to fuse the spatiotemporal features A. Finally, the ReLU activation function is applied to the output of the graph convolution layer and a residual connection is added, allowing the model to retain the original feature information while introducing spatiotemporal aggregation.
[0068] In summary, in this application, the graph construction is combined with the multi-time step modeling method, and the adjacency matrix is used to represent the time-varying interaction relationship between ships. Taking into account the properties of ships (such as Euclidean distance, speed difference, etc.), it is possible to capture The spatiotemporal graph is suitable for real-time updating and supports subsequent trajectory modeling by constructing a representation of ship positions and interactions.
[0069] At the same time, with the help of the spatiotemporal graph, the historical trajectory x and the interaction relationship A are input into the spatiotemporal graph neural network for feature extraction and integration of time and space information. In the spatiotemporal aggregation process, the adjacency matrix is used Aggregate neighboring node features at time step t to obtain feature representation across time and nodes Moreover, the conditional diffusion model is further used to model trajectory generation. Combined with the multimodal generation capability of the conditional diffusion model, it can effectively identify the uncertainty of the modeled trajectory and generate multiple possible future trajectories, which is suitable for complex environments.
[0070] In addition, spatiotemporal feature extraction and fusion are performed based on the TUGnet denoising network. Through downsampling and upsampling paths, the temporal and spatial feature dimensions are gradually scaled to capture multi-scale trajectory information. In addition, in the downsampling and upsampling process, the residual block is combined with graph convolution to further fuse the spatiotemporal features. In addition, in the upsampling stage, the feature map in the downsampling path is spliced to the current layer through jump connections to enhance the accuracy and robustness of ship trajectory prediction.
[0071] In addition, in one embodiment, the present application provides a computer device, which may be a server, and its internal structure diagram may be as shown in FIG. Figure 3 As shown. The computer device includes a processor, a memory, a network interface and a database connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile and / or volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external client via a network connection. When the computer program is executed by the processor, the method described in any of the above embodiments can be implemented.
[0072] In one embodiment, the present application further provides a computer device, which may be a client, and its internal structure diagram may be as follows: Figure 4 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external server via a network connection. When the computer program is executed by the processor, the method described in any of the above embodiments can be implemented.
[0073] Any of the above-mentioned computer devices in the embodiments of the present application may exist in various forms, including but not limited to: (1) Mobile communication devices: These devices are characterized by their mobile communication functions and their main purpose is to provide voice and data communications. These terminals include: smart phones (such as iPhone), multimedia phones, functional phones, and low-end phones.
[0074] (2) Ultra-mobile personal computer devices: These devices fall into the category of personal computers, have computing and processing capabilities, and generally also have mobile Internet access features. These terminals include: PDA, MID and UMPC devices, such as iPad.
[0075] (3) Portable entertainment devices: These devices can display and play multimedia content. They include audio and video players (such as iPods), handheld game consoles, e-books, as well as smart toys, wearable devices, and portable car navigation devices.
[0076] (4) Server: A device that provides computing services. The server consists of a processor, hard disk, memory, system bus, etc. The server is similar to a general computer architecture, but because it needs to provide highly reliable services, it has higher requirements in terms of processing power, stability, reliability, security, scalability, and manageability.
[0077] (5) Other electronic devices with data interaction functions.
[0078] In addition, an embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to perform the following steps: During the real-time travel of a ship in the target sea area, current historical track association information of the ship within a first time step is obtained, wherein the first time step is an adjacent historical period of the current moment, and the current historical track association information is used to reflect the position change of the ship in the target sea area within the first time step and the interaction relationship between the ships; Based on the current historical trajectory association information, determine a set of spatial graphs of the current historical trajectory of the ship at multiple moments in the first time step as a space-time graph; Adding Gaussian noise to the current historical trajectory for a specified number of iterations to obtain noise trajectories corresponding to the specified number of iterations; The current historical trajectory, the spatiotemporal graph and the noise trajectory corresponding to each iteration are used as input information of a TUGnet denoising network, and the Gaussian noise corresponding to each iteration is output through the TUGnet denoising network; Construct a denoising function based on the Gaussian noise corresponding to each iteration; Taking the current historical trajectory and the space-time graph within the first time step, and the denoising function as input information of a conditional diffusion model, outputting the predicted trajectory of the ship in the target sea area within a second time step adjacent to the first time step through the conditional diffusion model; After the second time step, determining the difference between the actual trajectory of the ship in the second time step and the predicted trajectory; Based on the difference, it is determined whether the ship travels abnormally within the second time step.
[0079] It should be noted that the above functions or steps that can be implemented by the computer-readable storage medium or computer device can refer to the relevant description in the aforementioned method embodiment. In order to avoid repetition, they will not be described one by one here.
[0080] The technical solution of the present application is described in detail above in conjunction with the accompanying drawings. Through the technical solution of the present application, the spatiotemporal graph is added as one of the input information of the conditional diffusion model, the trajectory of the ship in the target sea area is predicted, and the TUGnet denoising network is introduced in the reverse diffusion process of the conditional diffusion model to predict the motion trajectory of the ship. Among them, the noise characteristics and the spatiotemporal characteristics of the target sea area where the ship is located are integrated into the trajectory prediction process through the TUGnet denoising network, thereby greatly improving the accuracy of ship trajectory prediction and the accuracy of anomaly detection, which helps to improve the safety of ship driving.
[0081] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0082] The word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.
[0083] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the present application. The singular forms "a", "said" and "the" used in the embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.
[0084] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0085] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0086] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0087] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A trajectory anomaly detection method based on a diffusion model, characterized in that: include: During the real-time travel of a ship in the target sea area, current historical track association information of the ship within a first time step is obtained, wherein the first time step is an adjacent historical period of the current moment, and the current historical track association information is used to reflect the position change of the ship in the target sea area within the first time step and the interaction relationship between the ships; Based on the current historical trajectory association information, determine a set of spatial graphs of the current historical trajectory of the ship at multiple moments in the first time step as a space-time graph; Adding Gaussian noise to the current historical trajectory for a specified number of iterations to obtain noise trajectories corresponding to the specified number of iterations; The current historical trajectory, the spatiotemporal graph and the noise trajectory corresponding to each iteration are used as input information of a TUGnet denoising network, and the Gaussian noise corresponding to each iteration is output through the TUGnet denoising network; Construct a denoising function based on the Gaussian noise corresponding to each iteration; Taking the current historical trajectory and the space-time graph within the first time step, and the denoising function as input information of a conditional diffusion model, outputting the predicted trajectory of the ship in the target sea area within a second time step adjacent to the first time step through the conditional diffusion model; After the second time step, determining the difference between the actual trajectory of the ship in the second time step and the predicted trajectory; Based on the difference, it is determined whether the ship travels abnormally within the second time step.
2. The method according to claim 1, characterized in that Before acquiring the current historical track association information of the ship within the first time step, the method further includes: Acquire a set of trajectory association information of the ship within the first time step; Preprocessing the trajectory association information set, wherein the preprocessing includes one or more of the following: Deleting repeated ship track points of a single ship with the same timestamp in the track association information set; Convert the longitude and latitude of all ship track points into coordinates in a specified coordinate system, and use the minimum longitude and minimum latitude of all ship track points as the origin of the specified coordinate system; Determine adjacent ship track points whose continuous time interval is less than a specified interval, and interpolate track vacant positions between the adjacent ship track points using a cubic spline interpolation method; A reference time span is determined within the first time step, wherein the number of ships in the scene of the target sea area corresponding to the reference time span is greater than or equal to 2 and the trajectory span of each ship is equal to the reference time span.
3. The method according to claim 1, characterized in that The obtaining of the current historical track association information of the ship within the first time step includes: Obtaining a vertex set of all ships in the target sea area within the first time step; Obtain the mutual influence degree between every two ships in the target sea area, where: = Indicates that the i-th ship and the j-th ship in the target sea area are The mutual influence within a reference time span, and Respectively represent the i-th ship and the j-th ship in the The current position of a reference time span, is the preset range parameter; The step of determining, based on the current historical trajectory association information, a set of spatial graphs of the current historical trajectory of the ship at multiple moments in the first time step as a space-time graph comprises: Based on the vertex set and the mutual influence degree between every two ships, a set of spatial graphs of the current historical trajectory of the ship at multiple moments in the first time step is determined, wherein: =( , ), Indicates that the target sea area is A space-time diagram with a reference time span, ={ ∣∀i∈(1,…,N)}, is the a set of vertices that can refer to a time span, ={ ∣∀i,j∈(1,…,N)}, which means the The set of edges inside the space-time graph in the referenceable time span; Determine a space-time graph adjacency matrix of the set of spatial graphs at the multiple time moments as the space-time graph.
4. The method according to claim 1, characterized in that Before outputting the Gaussian noise corresponding to each iteration through the TUGnet denoising network, it also includes: Taking a sample historical trajectory, a real historical trajectory after the sample historical trajectory, and a spatiotemporal graph corresponding to the sample historical trajectory as input information, and taking the noise between the sample historical trajectory and the real historical trajectory as output information, training the TUGnet denoising network; The Gaussian noise corresponding to each iteration is outputted by the TUGnet denoising network, including: For each of the noise trajectories, concatenate the noise trajectories with the corresponding current historical trajectories to obtain an intermediate trajectory; The intermediate traces are processed based on a stepwise downsampling and stepwise upsampling process, wherein: In at least one residual block in the stepwise downsampling and the stepwise upsampling, for an input trajectory input into the residual block, normalize the input trajectory and splice it with the noise step value after embedding to obtain a noise splicing feature; Based on the GraphConv module, the noise splicing feature is fused with the spatiotemporal graph into a spatiotemporal fusion feature as the output information of the residual block.
5. The method according to claim 3, characterized in that: The denoising function is: , in, It is The noise trajectory obtained by the iteration is It is The noise trajectory obtained by the iteration is For the The variance term in the Gaussian transfer in the iterations, , represents the output of the TUGnet denoising network, The Gaussian noise corresponding to the iteration is represents the current historical trajectory, represents the adjacency matrix of the space-time graph, is a random variable from a standard Gaussian distribution.
6. The method according to claim 5, characterized in that Before outputting the predicted trajectory of the ship in the target sea area in a second time step adjacent to the first time step through the conditional diffusion model, the method further includes: The conditional diffusion model is trained by taking the current historical trajectory, the noise trajectory corresponding to each of the specified number of iterations, the specified number of times, the variance term in the Gaussian transfer in the specified number of iterations, and the space-time graph as input information and taking the denoising function as output information.
7. The method according to claim 1, characterized in that The determining the difference between the actual trajectory of the ship in the second time step and the predicted trajectory includes: Selecting a plurality of real track points and a plurality of predicted track points corresponding to the plurality of real track points in a one-to-one manner from the real track of the ship and the predicted track of the ship respectively; Determine a mean square error and a dynamic time warping distance between the actual trajectory and the predicted trajectory based on the multiple actual trajectory points and the multiple predicted trajectory points; Performing weighted sum processing on the mean square error and the dynamic time warping distance to obtain a difference between the true trajectory and the predicted trajectory; The determining, based on the difference, whether the ship travels abnormally within the second time step includes: Determining a cumulative difference value for a specified number of historical time steps, wherein the specified number of historical time steps includes the first time step and a number of historical time steps before the first time step; If the difference cumulative value is within a preset abnormal range, it is determined that the ship is traveling abnormally within the second time step.
8. The method according to claim 1, characterized in that After determining that the ship is traveling abnormally within the second time step, the method further includes: Based on the accumulated values of the differences between the second time step and several historical time steps before the second time step, the abnormal mode of the ship is determined, wherein the abnormal mode is a speed abnormal model, a direction abnormal model and a speed and direction abnormal mode.
9. A computer device, characterized in that: include: at least one processor; and, a memory communicatively coupled to the at least one processor; The memory stores instructions executable by the at least one processor, and the instructions are configured to enable the processor to execute the method according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that: Computer executable instructions are stored, and the computer executable instructions are configured to execute the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Vehicle trajectory prediction method and system based on motion uncertainty diffusion model
CN116403404A
Multi-modal trajectory prediction method based on conditional diffusion model
CN119167322A
Cited By
Conditional diffusion model-based scene-level trajectory prediction method and system, medium and equipment
CN120611600A
Fault detection method for marine transportation tool of tower drum of wind turbine generator
CN121954132A