Prediction method and device for ship trajectory data
By preprocessing and feature extraction of ship trajectory data, combining correlation parameters to generate predicted values, the problem of low prediction accuracy of ship trajectory data in the prior art is solved, and higher prediction accuracy is achieved.
Patent Information
- Application Number
- CN202410593969.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-14
- Publication Date
- 2025-02-07
AI Technical Summary
In the prior art, when there are few nonlinear ship trajectory data samples, it is difficult to improve the prediction accuracy of ship trajectory data.
By preprocessing the ship trajectory data, it is divided into support sets and query sets, and it is transformed by preset algorithms to obtain the time spectrum diagram. Then, feature extraction is performed on the time spectrum diagram, feature weights are obtained, and predicted values of ship trajectory data are generated through the fusion of correlation parameters.
It effectively improves the prediction performance of nonlinear ship trajectory data, solves the small sample problem, and improves the prediction accuracy.
Smart Images

Figure CN119397232A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of time series prediction, and in particular to a method and device for predicting ship track data. Background Art
[0002] The low prediction accuracy of the real-time navigation trajectory of ships is one of the important reasons for typical water traffic accidents such as ship collisions and ship-bridge collisions. The trajectory of a ship can describe the state of the ship and can also be used for ship navigation and collision avoidance, thereby improving the safety of ship navigation. With the rise of data mining technology in recent years, more and more technical means are used to mine and predict ship trajectories, trying to predict the ship's trajectory in the future based on historical ship track data, so as to perceive potential navigation risks and take effective measures to avoid ship collisions as soon as possible.
[0003] At present, the commonly used ship trajectory prediction methods include physical models, statistical models and neural network-based models, but these methods assume that there is a linear or simple nonlinear relationship in the ship trajectory time series. Since the ship trajectory data system is large and complex, it is easily affected by factors of different action periods, and the ship trajectory has a strong nonlinear characteristic; in addition, it is difficult to collect ship trajectories, there are large errors in the two dimensions of time and space, and there are fewer effective samples, which greatly reduces the prediction performance of the above commonly used ship trajectory prediction methods.
[0004] In view of this, overcoming the defects of the prior art is an urgent problem to be solved in the field of this technology. Summary of the invention
[0005] The technical problem to be solved by the present invention is how to improve the prediction accuracy of ship trajectory data under the premise that the samples of nonlinear ship trajectory data are small.
[0006] The present invention adopts the following technical solution:
[0007] In a first aspect, a method for predicting ship trajectory data is provided, comprising:
[0008] Preprocessing the ship trajectory data to obtain a task set, and dividing the task set into a support set and a query set;
[0009] Performing a preset algorithm transformation on the support set to obtain a first time-frequency spectrum diagram; performing the preset algorithm transformation on the query set to obtain a second time-frequency spectrum diagram;
[0010] Performing feature extraction on the first time-frequency spectrum to obtain a first feature weight; performing feature extraction on the second time-frequency spectrum to obtain a second feature weight;
[0011] A correlation parameter is obtained according to the first feature weight and the second feature weight, and a predicted value of the ship trajectory data is obtained according to the correlation parameter and the second feature weight.
[0012] Preferably, the preprocessing of the ship trajectory data to obtain a task set, and dividing the task set into a support set and a query set comprises:
[0013] Fitting the ship trajectory data, and dividing the fitted ship trajectory data into different task sets according to length;
[0014] The task set is divided into the support set and the query set in chronological order.
[0015] Preferably, performing a preset algorithm transformation on the support set to obtain a first time-frequency spectrum diagram includes:
[0016] The support set is transformed by a preset algorithm to obtain a one-dimensional time series x t The first time spectrum of One-dimensional time series x t The transformation coefficient X t (m,k) is expressed as:
[0017]
[0018] Among them, x q is a one-dimensional time series x t =[x t-H+1 ,…,x t ] data points; X t (m,k) is a two-dimensional function of (m,k), m represents the sampling point in the time domain, k represents the sampling point in the frequency domain, 0≤m≤H / R, R is the moving step size of w(q) each time, H is the length of the one-dimensional time series, 0≤k≤Q / 2, Q is the length of the window function; j is an imaginary number; w(q) is a sliding window function.
[0019] Preferably, the first time-frequency spectrum The expression is:
[0020]
[0021] Among them, ST t (m,k) is the first time-frequency spectrum The point at (m,k) in .
[0022] Preferably, the query set is transformed by a preset algorithm to obtain the second time-frequency spectrum diagram, wherein the second time-frequency spectrum diagram The expression is:
[0023]
[0024] Among them, ST t '(m,k) is the second time spectrum diagram The point at (m,k) in .
[0025] Preferably, the extracting features from the first time-frequency spectrum to obtain a first feature weight; extracting features from the second time-frequency spectrum to obtain a second feature weight comprises:
[0026] Construct a feature extraction module, and use the feature extraction module to extract the first time-frequency spectrum. Perform feature extraction to obtain the first feature weight
[0027] The second time-frequency spectrum is extracted by the feature extraction module Perform feature extraction to obtain the second feature weight
[0028] Among them, T i is the number of samples in a batch in the query set, and n is the batch sample.
[0029] Preferably, obtaining the correlation parameter according to the first feature weight and the second feature weight includes:
[0030] The weight of the first feature and the second feature weight The first feature weight and the second feature weight are fused to obtain a correlation parameter α between the first feature weight and the second feature weight, wherein the calculation formula of the correlation parameter α is:
[0031]
[0032] Among them, Q, K and V are linear matrix parameters; ω nt and ω n′t′ are the first feature weights, and are the second feature weights, T n and T n′ are the number of samples in a batch in the support set, and n is the batch sample.
[0033] Preferably, obtaining the predicted value of the ship trajectory data according to the correlation parameter and the second feature weight includes:
[0034] The predicted value of the ship trajectory data The expression is:
[0035]
[0036] Wherein, α is the correlation parameter, is the second feature weight, and g is the function for predicting the ship trajectory data.
[0037] In a second aspect, a device for predicting ship trajectory data is provided, the device for predicting ship trajectory data comprising: a processor and a memory for storing instructions executable by the processor;
[0038] Wherein, the processor is configured to execute the ship trajectory data prediction method described in the first aspect.
[0039] In a third aspect, a non-volatile computer storage medium is provided, wherein the computer storage medium stores computer executable instructions, and the computer executable instructions are executed by one or more processors to complete the ship trajectory data prediction method described in the first aspect.
[0040] In a fourth aspect, a device for predicting ship trajectory data is provided, for implementing the method for predicting ship trajectory data in the first aspect, the device comprising:
[0041] 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 executed by the processor to execute the ship trajectory data prediction method described in the first aspect.
[0042] In a fifth aspect, a chip is provided, comprising: a processor and an interface, for calling and running a computer program stored in a memory from a memory, and executing the method for predicting ship trajectory data as described in the first aspect.
[0043] In a sixth aspect, a computer program product comprising instructions is provided, which, when executed on a computer or a processor, enables the computer or the processor to execute the method for predicting ship trajectory data as described in the first aspect.
[0044] Compared with the prior art, the present invention has the following beneficial effects:
[0045] The present invention obtains ship trajectory data, obtains a task set based on the ship trajectory data, divides the task set into a support set and a query set based on the small sample idea, performs preset algorithm transformation on the support set and the query set, obtains a first spectrum graph and a second spectrum graph respectively, extracts the frequency domain representation on the time series through the preset algorithm transformation, effectively mines the characteristic operation law, and improves the prediction performance of nonlinear ship trajectory data; by performing feature extraction on the first spectrum graph and the second spectrum graph respectively, the correlation of hidden features in the query set and the support set is learned and the weight distribution of the features is extracted, and the effective features are enhanced, thereby solving the problem of small samples in ship trajectory data and improving the prediction accuracy of ship trajectory data. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, 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 invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0047] Figure 1 It is a flow chart of a method for predicting ship trajectory data provided by an embodiment of the present invention;
[0048] Figure 2 It is a schematic diagram of dividing a task set of a method for predicting ship trajectory data provided by an embodiment of the present invention;
[0049] Figure 3 It is a specific flow chart of a method for predicting ship trajectory data provided by an embodiment of the present invention;
[0050] Figure 4 It is a structural schematic diagram of a device for predicting ship trajectory data provided by an embodiment of the present invention;
[0051] Figure 5 It is a structural schematic diagram of a feature extraction module of a ship trajectory data prediction device provided by an embodiment of the present invention;
[0052] Figure 6 It is a structural schematic diagram of an output module of a device for predicting ship trajectory data provided by an embodiment of the present invention;
[0053] Figure 7 This is another structural schematic diagram of a device for predicting ship trajectory data provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0054] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0055] The terms "first", "second", etc. in the present invention are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first", "second", etc. may explicitly or implicitly include one or more of the features. In the description of the present invention, unless otherwise specified, "plurality" means two or more.
[0056] In the present invention, unless otherwise clearly specified and limited, the term "connection" should be understood in a broad sense. For example, "connection" can be a fixed connection, a detachable connection, or an integral connection; it can be a direct connection or an indirect connection through an intermediate medium.
[0057] In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0058] Embodiment 1:
[0059] In the prior art, it is difficult to obtain nonlinear ship trajectory data, resulting in fewer samples of ship trajectory data. Most algorithm technologies cannot be well trained during training, resulting in low prediction accuracy. To this end, this embodiment provides a method for predicting ship trajectory data, including: preprocessing the ship trajectory data to obtain a task set, and dividing the task set into a support set and a query set; performing a preset algorithm transformation on the support set to obtain a first time-frequency spectrum; performing the preset algorithm transformation on the query set to obtain a second time-frequency spectrum; performing feature extraction on the first time-frequency spectrum to obtain a first feature weight; performing feature extraction on the second time-frequency spectrum to obtain a second feature weight; obtaining a correlation parameter based on the first feature weight and the second feature weight, and obtaining a predicted value of the ship trajectory data based on the correlation parameter and the second feature weight.
[0060] Before starting the prediction, the original ship trajectory data needs to be preprocessed to facilitate subsequent analysis and processing. The original ship trajectory data includes characteristic values such as ship type, heading, speed, longitude and latitude. In this embodiment, the ship type can be converted into a digital label starting with 1, and the heading, longitude and latitude can be converted into floating point numbers in seconds. In this embodiment, the longitude can be used as an example to explain the prediction method of the ship trajectory data.
[0061] Preprocessing can include steps such as noise removal, filling missing values, data normalization, and feature selection. Through these steps, a clearer and more accurate task set can be obtained, laying a solid foundation for subsequent prediction work. Next, according to the idea of small sample learning, the preprocessed task set is divided into a support set and a query set. This division method helps to evaluate the performance of the model on unknown data, thereby improving the reliability of the prediction results. Use the preset algorithm transformation to transform the support set and the query set into a time-frequency spectrum. The time-frequency spectrum is a tool that can simultaneously display time, frequency, and amplitude information, and is very suitable for analyzing non-stationary time series data, such as the ship trajectory data proposed in this embodiment. Through the time-frequency spectrum transformation, the dynamic characteristics of the data can be better understood, which facilitates feature extraction.
[0062] After obtaining the first time-frequency spectrum diagram and the second time-frequency spectrum diagram corresponding to the support set and the query set respectively, the next step is to extract features from these diagrams. The purpose of feature extraction is to identify the factors that have the greatest impact on the prediction results, which may include time intervals, frequency distributions, amplitude changes, etc. The extracted features will be assigned weights, and the size of the weights reflects the importance of the features. The first feature weight comes from the support set, and the second feature weight comes from the query set. The correlation parameter is calculated based on the first feature weight and the second feature weight. The correlation parameter is an indicator that measures the strength and direction of the relationship between two or more variables. In this embodiment, the correlation parameter can help understand the similarity or difference between the query set and the support set. Finally, combined with the correlation parameter and the second feature weight, the predicted value of the ship trajectory data is calculated to generate a prediction of the future ship trajectory.
[0063] Next, the steps of the method for predicting the ship trajectory data will be described in detail. Figure 1 As shown, including:
[0064] Step 101: pre-process the ship trajectory data to obtain a task set, and divide the task set into a support set and a query set.
[0065] The preprocessing includes fitting the ship trajectory data, and dividing the fitted ship trajectory data into different task sets according to length; wherein the task set is represented as [TK1, TK2, …, TK p ], the length of the task set is Len TK .
[0066] Since the ship trajectory data has large errors in both time and space dimensions, and sometimes even obvious data missing problems, the ship trajectory data is preprocessed first. Affected by factors such as inconsistent transmission frequency of ship trajectory data, the time interval of received data is not uniform in most cases. Therefore, in one embodiment, the cubic spline interpolation method can be used to fit the data.
[0067] The steps of fitting the ship trajectory data using cubic spline interpolation generally include: determining the known data points, which are the key reference points in the interpolation process. For each segment of adjacent data points, construct a cubic polynomial function so that the value of this function at each data point is equal to the actual observed value. Maintain the continuity of the first-order derivative and the second-order derivative between adjacent polynomial functions to ensure the smoothness of the entire curve. It may be necessary to adjust parameters or use optimization algorithms to minimize the fitting error and ensure the accuracy of the interpolation results. The fitted ship trajectory data will be smoother and more continuous. Next, it can be divided according to the length of the data to create multiple task sets. The purpose of data partitioning is to split the data set into multiple subsets, each of which can be used separately for training and testing prediction models.
[0068] Among them, Figure 2 As shown, the task set is divided into the support set S and the query set Q in chronological order; the length of the support set is Len S , the length of the query set is Len Q , and Len S :Len Q =8:2. Dividing the support set and query set in chronological order ensures that the model can be trained on historical data and tested on new, unknown data. It can improve the generalization ability of the overall model and provide a reliable basis for the performance evaluation of the model. When dividing the task set, the chronological order must be strictly followed, and the data points should be sorted in the order in which they appear in the time series to ensure that the model does not "foresee" future data points during training.
[0069] In actual operation, the data set can be divided according to the following steps:
[0070] First, ensure that all ship trajectory data are sorted in chronological order and calculate the total length of all available data. Calculate the length of the support set according to the set ratio. For example, if the total length is 100 data points, then the length of the support set will be 80 data points. In the above example, the length of the query set will be 20 data points. Based on the calculated length, divide the support set and query set from the sorted data. Ensure that the data points of each set are continuous and that the data points in the support set are earlier in time than the data points in the query set. This partitioning method ensures that the prediction model is fully trained on historical data and can make effective predictions on new and unknown data. This partitioning strategy helps to improve the generalization ability and prediction accuracy of the model.
[0071] Step 102: performing a preset algorithm transformation on the support set to obtain a first time-frequency spectrum graph; performing a preset algorithm transformation on the query set to obtain a second time-frequency spectrum graph.
[0072] After dividing the task set into a support set and a query set,
[0073] The support set is transformed by a preset algorithm to obtain a one-dimensional time series x t The first time spectrum of One-dimensional time series x t The transformation coefficient X t (m,k) is expressed as:
[0074]
[0075] Among them, x q is a one-dimensional time series x t =[x t-H+1 ,…,x t ] data points; X t (m, k) is a two-dimensional function of (m, k), m represents a sampling point in the time domain, k represents a sampling point in the frequency domain, 0≤m≤H / R, R is the moving step of w(q) each time, H is the length of the one-dimensional time series, 0≤k≤Q / 2, Q is the length of the window function; j is an imaginary number; w(q) is a sliding window function. In one embodiment, Q=1024, R=16.
[0076] The first time-frequency spectrum The expression is:
[0077]
[0078] Among them, ST t (m,k) is the first time-frequency spectrum The point at (m,k) in ST tDescribes the energy distribution of the signal and reflects the relationship between the different frequency characteristics of the signal and time. t The unit of energy is dB.
[0079] Then, the query set is transformed by a preset algorithm to obtain the second time-frequency spectrum diagram. The expression is:
[0080]
[0081] Among them, ST t '(m,k) is the second time spectrum diagram The point at (m,k) in .
[0082] Among them, [x t-H+1 ,…,x t ] is a one-dimensional time series obtained by segmenting a sliding window of length H, where x t is the longitude at time t. The label of the sample is the predicted value of the longitude at the Kth moment in the future The corresponding true value is x t+K .
[0083] In a preferred embodiment, the preset algorithm transformation is a tool for analyzing the frequency characteristics of time-varying signals, which can reveal the frequency components of signals that change over time. In the ship trajectory data prediction method, the support set and the query set are converted from the time domain to the time-frequency domain by the preset algorithm transformation, thereby obtaining a time-frequency spectrum. For the support set and the query set, each data set is first preprocessed and windowed, and then the preset algorithm transformation is performed on them respectively. Finally, two time-frequency spectrum graphs are obtained: a first time-frequency spectrum graph and a second time-frequency spectrum graph, which will be used for subsequent feature extraction and the establishment of a prediction model. In practical applications, the preset algorithm transformation can be performed using ready-made library functions in signal processing software or programming languages (such as MATLAB, Python, etc.). These tools usually provide convenient interfaces and functions that can simplify the calculation process of the preset algorithm transformation. In this way, time-frequency features can be effectively extracted from ship trajectory data, laying a solid foundation for the establishment of a prediction model.
[0084] Step 103: extracting features from the first time-frequency spectrum to obtain a first feature weight; extracting features from the second time-frequency spectrum to obtain a second feature weight.
[0085] Reference Figure 3 , construct a feature extraction module, and use the feature extraction module to extract the first time-frequency spectrum Perform feature extraction to obtain the first feature weight T iis the number of samples in a batch in the support set, and n is the sample in the th batch; the second time-frequency spectrum is extracted by the feature extraction module. Perform feature extraction to obtain the second feature weight Among them, T i is the number of samples in a batch in the query set, and n is the batch sample.
[0086] Feature extraction aims to extract useful information from raw data for the analysis goal. In the context of ship trajectory data prediction, a feature extraction module is constructed, and the specific structure of the feature extraction module will be described below. The feature extraction module processes the first time-frequency spectrum and the second time-frequency spectrum to identify and quantify the most influential features for predicting future trajectories, including frequency distribution, energy concentration areas, and periodic patterns. A numerical weight is assigned to each identified key feature, which will be used for subsequent prediction model establishment and evaluation.
[0087] The weights can be determined in a variety of ways, such as by the information gain of the features in the training data, by feature selection through regularization methods (such as L1 regularization), or by automatically learning feature weights using models such as neural networks. In this way, it is possible to ensure that the prediction model can capture the key characteristics of the ship trajectory data changing over time, thereby improving the accuracy and reliability of the prediction.
[0088] Step 104: Obtain a correlation parameter according to the first feature weight and the second feature weight, and obtain a predicted value of the ship trajectory data according to the correlation parameter and the second feature weight.
[0089] Continue to refer to Figure 3 , the weight of the first feature and the second feature weight The first feature weight and the second feature weight are fused to obtain a correlation parameter α between the first feature weight and the second feature weight, wherein the calculation formula of the correlation parameter α is:
[0090]
[0091] Among them, Q, K and V are linear matrix parameters; ω nt and ω n′t′ are the first feature weights, and are the second feature weights, T n and T n′ are the number of samples in a batch in the support set, and n is the batch sample.
[0092] The correlation parameter α can reflect the correlation between the feature weights at two different time points (i.e., the support set and the query set). The first feature weight and the second feature weight are input into an attention mechanism module to fuse the two to obtain the correlation parameter. This fusion helps to improve the adaptability and accuracy of the prediction model to time changes. The specific fusion process is to input the first feature weight and the second feature weight The input is input into a pre-built attention mechanism module. The specific structure of the attention mechanism module will not be described in detail in this article.
[0093] Continue to refer to Figure 3 , the correlation parameter α and the second feature weight Input into an output module for fusion to obtain the predicted value of the ship trajectory data The expression is:
[0094]
[0095] Wherein, α is the correlation parameter, is the second feature weight, and g is the function for predicting the ship trajectory data.
[0096] The specific structure of the output module will be described below.
[0097] After obtaining the predicted value of the ship trajectory data Finally, the obtained results need to be trained and verified to obtain the optimal results. The specific training and verification process will be specifically described in the following embodiments.
[0098] This embodiment obtains ship trajectory data, obtains a task set based on the ship trajectory data, divides the task set into a support set and a query set based on the small sample idea, and performs preset algorithm transformation on the support set and the query set to obtain a first spectrum graph and a second spectrum graph respectively. The frequency domain representation on the time series is extracted through the preset algorithm transformation, and the feature operation law is effectively mined, thereby improving the prediction performance of nonlinear ship trajectory data; by performing feature extraction on the first spectrum graph and the second spectrum graph respectively, the correlation of hidden features in the query set and the support set is learned and the weight distribution of the features is extracted, and the effective features are enhanced, thereby solving the small sample problem in the ship trajectory data and improving the prediction accuracy of the ship trajectory data.
[0099] Embodiment 2:
[0100] In the first embodiment, a method for predicting ship trajectory data is proposed. In the present embodiment, a device for predicting ship trajectory data is proposed. Figure 3 and Figure 4As shown, it includes: data processing module, feature extraction module, attention mechanism module and output module.
[0101] The data processing module is used to preprocess the ship trajectory data to obtain the task set, and divide the task set into the support set and the query set; the data processing module is also used to perform a preset algorithm transformation on the support set to obtain the first time-frequency spectrum, and to perform the preset algorithm transformation on the query set to obtain the second time-frequency spectrum; the feature extraction module is used to perform feature extraction on the first time-frequency spectrum to obtain the first feature weight; the feature extraction module is also used to perform feature extraction on the second time-frequency spectrum to obtain the second feature weight; the attention mechanism module is used to obtain the correlation parameter according to the first feature weight and the second feature weight; the output module is used to obtain the predicted value of the ship trajectory data according to the correlation parameter and the second feature weight.
[0102] Among them, considering that the ship trajectory data is affected by factors of different action periods, the data processing module is constructed to extract the frequency domain representation of the time series, effectively mining its hidden component feature operation rules, and improving the prediction performance of the model;
[0103] In a preferred embodiment, the feature extraction module may be a convolutional neural network (CNN) feature extraction module, whose structure is as follows: Figure 5 As shown in the figure, it contains two convolutional layers, two pooling layers, one fully connected layer and one output layer. Each convolutional layer contains 32 convolution kernels of size 1×3, and the convolution operation uses the SAME method. The pooling layer is a non-overlapping maximum pooling of size 2×1, and the number of neural nodes in the fully connected layer is 10. It is worth noting that the feature extraction module can be expanded to neural networks such as Inception and MobileNet. At the same time, since the parameters of the attention mechanism module are not affected by the number of samples in the data set, task sets of different lengths can be generated for different data, making the model more targeted and universal.
[0104] The structure of the output module is as follows Figure 6 As shown in FIG, it consists of a fully connected layer and an output layer, where the number of neural nodes in the fully connected layer is 16.
[0105] In a preferred embodiment, reference Figure 2 , different task sets can also be divided into training sets, validation sets and test sets in chronological order. The subsequence numbers of the three data sets are n tr 、n va and n te, with a ratio of 6:2:2. The training set, validation set, and test set are used for model training, selection, and performance evaluation, respectively.
[0106] The feature extraction module, the attention mechanism module and the output module form a prediction model, and the prediction value of the ship trajectory data is obtained. Then, all the task sets in the training set are traversed, and on each task set, the parameters of all networks in the prediction model are updated using the gradient descent method, and the operation in Example 1 is repeated until all the task sets in the training set are traversed.
[0107] The data in the validation set are input into the trained prediction model, and the performance of the prediction model is evaluated using the mean absolute error. The grid search method is used to search for parameters and select the prediction model with the best prediction performance.
[0108] The trained prediction model is used to make predictions, and the data of the support set and the query set in the test set are input into the trained attention module to obtain the correlation parameters of the hidden feature weights of the support set and the query set, and then input into the output module trained on the training set to obtain the final prediction value. The mean absolute error is used as the model performance evaluation index, which proves to a certain extent that the prediction device described in this embodiment can effectively solve the small sample problem in ship trajectory prediction and has good generalization performance.
[0109] In a preferred embodiment, the ship trajectory prediction method described in Example 1 will be further described in conjunction with the ship trajectory prediction device. The specific steps are as follows:
[0110] S11: Use cubic spline interpolation method to fit the ship trajectory data and unify the time interval of the ship trajectory data.
[0111] S12: Using the idea of small sample learning, a ship trajectory dataset is divided into task sets, and each task set is divided into a support set and a query set.
[0112] S13: Process the support set and the query set respectively to obtain a time-frequency spectrum diagram of the one-dimensional time series.
[0113] S21: Input the time-frequency spectrum into the feature extraction module to obtain the feature weight of the sample data.
[0114] S22: Use the attention mechanism module to learn the correlation between the feature weights of the support set and the query set data.
[0115] S23: Inputting the correlation between the feature weights of the support set and the query set and the feature weight of the query set into the output module to obtain the predicted value of the ship trajectory data.
[0116] S24: Use the gradient descent method to adjust the parameters of the prediction model.
[0117] S3: Use the grid search method on the validation set to select the model with the best prediction performance.
[0118] S41: Use the adjusted prediction model to make predictions on the test set.
[0119] S42: Evaluate the performance of the prediction model.
[0120] This embodiment takes into account the nonlinearity and small sample characteristics of the ship's trajectory. First, the idea of small sample learning is used to divide the time series into multiple task sets, and the frequency features in the task set are extracted to obtain a time-frequency spectrum. Secondly, this embodiment designs a prediction model that can adaptively learn from the features and extract the weight distribution in the features. At the same time, the prediction model can be designed as different neural network models according to the needs. This embodiment can effectively solve the nonlinearity and small sample problems of the time series through the proposed prediction model, thereby improving the accuracy of ship trajectory prediction.
[0121] For the specific steps of the method for predicting the ship trajectory data, please refer to Example 1, which will not be repeated in this example.
[0122] Embodiment 3:
[0123] In Example 1, a method for predicting ship trajectory data is provided. In this embodiment, a device for predicting ship trajectory data is proposed. The device for predicting ship trajectory data includes: a processor and a memory for storing processor executable instructions; wherein the processor is configured to execute the method for predicting ship trajectory data described in Example 1.
[0124] like Figure 7 As shown, the device for predicting ship trajectory data includes a processor 21 and a memory 22, wherein the processor 21 and the memory 22 can be connected via a bus or other means.
[0125] The processor 21 may be a central processing unit (CPU). The processor 21 may also be 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, or a combination of the above chips.
[0126] The memory 22, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as program instructions / modules corresponding to the ship trajectory data prediction method in Embodiment 1 of the present invention. The processor executes various functional applications and training processes of the processor by running the non-transitory software programs, instructions and modules stored in the memory.
[0127] The memory 22 may include a program storage area and a training storage area, wherein the program storage area may store an operating system, an application required for at least one function; the training storage area may store training created by the processor, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 22 may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0128] The one or more modules are stored in the memory 22, and when executed by the processor 21, the following is performed: Figure 1 The method for predicting ship trajectory data in Example 1 is shown.
[0129] The specific details of the above-mentioned prediction method of ship trajectory data can be found in Figure 1 , Figure 2 and Figure 3 The corresponding descriptions and effects in the embodiments shown in the figure can be understood and will not be repeated here.
[0130] This embodiment also provides a non-volatile computer storage medium, which stores computer executable instructions. The computer executable instructions are executed by one or more processors to complete the ship trajectory data prediction method described in Example 1.
[0131] The computer storage medium stores computer executable instructions, which can execute the ship trajectory data prediction method in any of the above method embodiments. The storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk (HDD), or a solid-state drive (SSD); the storage medium can also include a combination of the above types of memory.
[0132] For the specific steps of the method for predicting the ship trajectory data, please refer to Example 1, which will not be repeated in this example.
[0133] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for predicting ship trajectory data, characterized in that: include: Preprocessing the ship trajectory data to obtain a task set, and dividing the task set into a support set and a query set; Performing a preset algorithm transformation on the support set to obtain a first time-frequency spectrum diagram; Performing the preset algorithm transformation on the query set to obtain a second time-frequency spectrum diagram; Performing feature extraction on the first time-frequency spectrum to obtain a first feature weight; Performing feature extraction on the second time-frequency spectrum to obtain a second feature weight; A correlation parameter is obtained according to the first feature weight and the second feature weight, and a predicted value of the ship trajectory data is obtained according to the correlation parameter and the second feature weight.
2. The method for predicting ship trajectory data according to claim 1, characterized in that: The preprocessing of the ship trajectory data to obtain a task set, and dividing the task set into a support set and a query set comprises: Fitting the ship trajectory data, and dividing the fitted ship trajectory data into different task sets according to length; The task set is divided into the support set and the query set in chronological order.
3. The method for predicting ship trajectory data according to claim 1, characterized in that: Performing a preset algorithm transformation on the support set to obtain a first time-frequency spectrum diagram includes: The support set is transformed by a preset algorithm to obtain a one-dimensional time series x t The first time spectrum of One-dimensional time series x t The transformation coefficient X t (m,k) is expressed as: Among them, x q is a one-dimensional time series x t =[x t-H+1 ,…,x t ] data points; X t (m,k) is a two-dimensional function of (m,k), m represents the sampling point in the time domain, k represents the sampling point in the frequency domain, 0≤m≤H / R, R is the moving step size of w(q) each time, H is the length of the one-dimensional time series, 0≤k≤Q / 2, Q is the length of the window function; j is an imaginary number; w(q) is a sliding window function.
4. The method for predicting ship trajectory data according to claim 3, characterized in that: The first time-frequency spectrum The expression is: Among them, ST t (m,k) is the first time-frequency spectrum The point at (m,k) in .
5. The method for predicting ship trajectory data according to claim 4, characterized in that: The query set is transformed by a preset algorithm to obtain the second time-frequency spectrum diagram. The expression is: Among them, ST t '(m,k) is the second time spectrum diagram The point at (m,k) in .
6. The method for predicting ship trajectory data according to claim 5, characterized in that: said performing feature extraction on the first time-frequency spectrum to obtain a first feature weight; Extracting features from the second time-frequency spectrum to obtain a second feature weight includes: Construct a feature extraction module, and use the feature extraction module to extract the first time-frequency spectrum. Perform feature extraction to obtain the first feature weight The second time-frequency spectrum is extracted by the feature extraction module Perform feature extraction to obtain the second feature weight Among them, T i is the number of samples in a batch in the query set, and n is the batch sample.
7. The method for predicting ship trajectory data according to claim 6, characterized in that: The obtaining of the correlation parameter according to the first feature weight and the second feature weight comprises: The weight of the first feature and the second feature weight The first feature weight and the second feature weight are fused to obtain a correlation parameter α between the first feature weight and the second feature weight, wherein the calculation formula of the correlation parameter α is: Among them, Q, K and V are linear matrix parameters; ω nt and ω n′t′ are the first feature weights, and are the second feature weights, T n and T n′ are the number of samples in a batch in the support set, and n is the batch sample.
8. The method for predicting ship trajectory data according to claim 7, characterized in that: The obtaining of the predicted value of the ship trajectory data according to the correlation parameter and the second feature weight comprises: The predicted value of the ship trajectory data The expression is: Wherein, α is the correlation parameter, is the second feature weight, and g is the function for predicting the ship trajectory data.
9. A device for predicting ship trajectory data, characterized in that: The device for predicting ship trajectory data includes: a processor and a memory for storing instructions executable by the processor; Wherein, the processor is configured to execute the ship trajectory data prediction method described in any one of claims 1-8.
10. A non-volatile computer storage medium, characterized in that: The computer storage medium stores computer executable instructions, which are executed by one or more processors to complete the ship trajectory data prediction method described in any one of claims 1-8.