Ship motion forecasting method and system based on dynamic periodic pattern recognition and weighting
By adopting dynamic periodic pattern recognition and weighting methods in the ship motion forecasting model, combined with the time domain and frequency domain forecasting modules, the problem of difficult time to capture the time-varying periodic patterns in traditional models is solved, and higher forecasting accuracy and longer forecasting time are achieved.
Patent Information
- Application Number
- CN202510213843.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-26
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2045-02-26
AI Technical Summary
Traditional ship motion forecasting models are difficult to correctly identify and capture periodic patterns that change over time, resulting in reduced forecast performance and phase shift phenomena.
Using a method based on dynamic periodic pattern recognition and weighting, the forecast results are generated through the time domain and frequency domain forecast modules, and the periodic mode is determined through the calculation of the main frequency energy proportion, and the time domain and frequency domain forecast results are dynamically weighted to improve the forecast accuracy.
It effectively improves the phase shift phenomenon of the forecasting results of the forecast model during the forecasting process, improves the forecasting accuracy and forecasting time, and can achieve accurate phase analysis forecast of ship motion one minute in advance.
Smart Images

Figure CN119719685A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of ship and ocean engineering, and in particular relates to a ship motion prediction method and system based on dynamic periodic pattern recognition and weighting. Background Art
[0002] When a ship is sailing in the actual sea area, environmental disturbances dominated by waves will cause the ship's six-degree-of-freedom swaying motion, which will constantly interfere with the ship's normal navigation and marine operations, making it difficult to carry out precision operations such as aircraft carrier take-off and landing, and ship-borne weapon launches. In medium and high sea conditions, the highly complex interaction between the hull and the waves makes the ship's swaying motion more violent, and may even threaten the safety of personnel and equipment on board. Ship motion forecasting refers to estimating the changes in the ship's navigation attitude in the future based on the ship's current or historical motion state, so as to provide sufficient reaction time and necessary auxiliary decision-making information for the ship's personnel, which is extremely important for determining the safe period window for marine operations, avoiding potential risks and ensuring operational safety.
[0003] However, the following problems still exist in the prediction of ship motion attitude. When ships are sailing in actual sea areas, the complex wave excitation makes the ship motion show strong volatility and randomness. When the waves are relatively gentle, the ship motion history data shows the characteristics of small amplitude and long period, while when the waves are more violent, the ship motion history data shows the characteristics of large amplitude and short period. This dynamic ship motion periodic pattern that changes with the waves significantly increases the time-varying characteristics of ship motion, which seriously affects the prediction performance of traditional ship motion prediction models. Therefore, how to enable the prediction model to correctly identify and capture the periodic pattern that changes with time and improve the prediction model's learning ability for the time-varying periodic characteristics in ship motion data is a problem that needs to be solved urgently.
[0004] Existing ship motion prediction methods are mainly based on time series prediction models. For time series, there are two forms of expression: time domain and frequency domain. For time domain prediction models, this type of model is better at extracting local information between time points, so it is more accurate to predict weak periodic pattern data with obvious trends; while for frequency domain prediction models, this type of data is better at extracting global information of the entire time point, so it is more accurate for strong periodic pattern data with obvious periodicity. However, due to the constant change in the degree of fluctuation of waves, the periodic characteristics of ship motion have time-varying characteristics, which leads to the mixing of various periodic patterns in the ship motion data set, which is difficult to separate by conventional means. Therefore, whether it is the traditional time domain prediction model or the frequency domain prediction model, it is not suitable for predicting ship motion data with time-varying periodic patterns. In the prediction process, the model often has phase shift phenomenon, which cannot provide effective decision support for actual ship offshore operations.
[0005] In view of the problem that the ship motion cycle changes with time and the traditional neural network model is difficult to correctly identify and capture the periodic pattern that changes with time, a ship motion prediction method based on dynamic periodic pattern recognition and weighting is proposed. Firstly, for each segment of ship motion data input into the prediction model, the corresponding prediction results are obtained through the time domain prediction module and the frequency domain prediction module respectively; secondly, by calculating the proportion of the main frequency energy to the total spectrum energy of the segment of ship motion data, the periodic pattern of the segment of ship motion data is determined, and the corresponding weight ratio is given: if the main frequency energy ratio of the segment of data is large, it means that the segment of motion data represents a strong periodic pattern with large periodic fluctuations, and it is easier to capture the characteristics of such periodic patterns from the frequency domain perspective, so the frequency domain prediction module is given a higher weight for the prediction result; on the contrary, if the main frequency energy ratio of the segment of data is small, it means that the segment of motion data represents a weak periodic pattern with small periodic fluctuations, and it is easier to capture the characteristics of such periodic patterns from the time domain perspective, so the time domain prediction module is given a higher weight for the prediction result; the prediction results of the time domain prediction module and the frequency domain prediction results are multiplied by the weights corresponding to their respective modules respectively to obtain the final prediction results.
[0006] In previous studies, researchers often modeled and fitted the characteristics of ship motion data through time domain prediction models or frequency domain prediction models, thereby realizing the extrapolation prediction of ship motion time history data. Among them, a single time domain prediction model is good at extracting local information between time points, so it is more accurate to predict weak periodic pattern data with obvious trend; a single frequency domain prediction model is good at extracting global information of the entire time point, so it is more accurate for strong periodic pattern data with obvious periodicity. However, due to the complex marine environment characteristics of ships, various periodic patterns in ship motion data sets are often mixed with each other, and different periodic patterns are difficult to separate by conventional means. Therefore, traditional time domain prediction models and frequency domain prediction models are not suitable for predicting ship motion data with mixed periodic patterns, and serious phase shifts often occur during the prediction process.
[0007] Through the above analysis, the problems and defects of the existing technology are as follows: In terms of extremely short-term forecasting of ship motion, the existing implementation scheme is to model and fit the time domain or frequency domain characteristics of ship motion data through deep learning models such as neural networks, and then generate prediction results for future ship motion data. However, with the continuous changes in sea conditions and marine environment, the complex excitation of waves on ship motion causes ship motion data to present variable periodic patterns. These periodic patterns with time-varying characteristics greatly reduce the prediction performance of time domain prediction models or frequency domain prediction models that are only applicable to a single periodic pattern, and a large phase deviation will occur during the prediction process, which seriously affects the model's prediction accuracy for ship motion data. Summary of the invention
[0008] In order to overcome the problems existing in the related art, the disclosed embodiment of the present invention provides a ship motion prediction method and system based on dynamic periodic pattern recognition and weighting.
[0009] The technical solution is as follows: A ship motion prediction method based on dynamic periodic pattern recognition and weighting comprises the following steps: S1: Segment the time history data of a certain degree of freedom of the ship to obtain the training set of time history forecast and test set ; S2: Set the history input step size and the step-ahead prediction , according to the training set and test set Constructing the input training data set for the multi-period pattern dynamic forecast model , output training data set , input test data set And the output test dataset ; S3: Training data set based on the input obtained , input each segment of input data into the frequency domain prediction module for prediction, and obtain the frequency domain prediction result ; S4: Training data set based on the input obtained , input each segment of input data into the time domain forecast module for forecasting, and obtain the time domain forecast result ; S5: Training data set based on the input , calculate the main frequency energy proportion of each segment of input data to obtain the corresponding weight proportion; among which, the corresponding weight proportion includes: the weight proportion of frequency domain forecast result And the weight ratio of time domain forecast results ; S6: According to the weight ratio of the obtained frequency domain forecast results And the weight ratio of time domain forecast results , and the frequency domain prediction results obtained And time domain forecast results Multiply them respectively to get the final prediction result and output the training data set Output training data in Compare and calculate the loss function; S7: Input the test data set obtained in step S2 Input into the trained multi-period model dynamic forecast model, each input test data The prediction results of the test data set are obtained by solving the model in sequence.
[0010] In step S3, the frequency domain prediction module performs prediction, including: According to the input training data set obtained , where the input training data Fill the back with zero value vector , get the extended input training data ,in, is the history input step size, is the step-ahead prediction.
[0011] Expanding the input training data The extended input training spectrum data is obtained by converting from the time domain to the frequency domain through fast Fourier transform. ,in, is the frequency component after Fourier transform; for the input training data set Each input training data The above operations are carried out to obtain the extended input training spectrum data set ,in, is the spectrum fragment corresponding to each input training data; The obtained extension is input into the training spectrum dataset Each training spectrum data Input the complex-valued attention computing network in sequence, and expand to the complex-valued attention computing network through linear mapping Hidden Dimension Space ,in, for D Vectors in dimensional latent space; In the hidden space Through the learnable vector , learnable vector and the learnable vector Generate query matrix , key matrix Sum Matrix ; Perform complex-valued dot product attention on the query matrix, key matrix, and value matrix to get the attention output in, is the normalized exponential function, Transpose of a vector; Attention Input Results H Map back to the original spectrum dimension through linear transformation to obtain the spectrum matrix ,in, is the frequency component after linear transformation mapping; The spectrum matrix Perform inverse fast Fourier transform to obtain the prediction results of the frequency domain prediction module , the prediction results of the extended model Perform sequence backward pruning to obtain the prediction results of the frequency domain prediction model ,in, is the value at each forecast time point.
[0012] Furthermore, the extended model prediction results After sequence backward pruning, only the last The data are used to obtain the prediction results of the frequency domain prediction model.
[0013] In step S4, the time domain forecast module performs forecasting, including: According to the input training data set obtained in step S2 ,Will Input the real-valued attention calculation network in sequence, and expand to the real-valued attention calculation network through linear mapping Hidden Dimension Space ,in, for Vectors in dimensional latent space; In the hidden space Through the learnable vector , learnable vector and the learnable vector Generate query matrix , key matrix Sum Matrix ; Perform real-valued dot product attention on the query matrix, key matrix, and value matrix to obtain the attention output result; The attention input result is mapped back to the original dimension through linear transformation to obtain the prediction result of the time domain prediction model.
[0014] Further, the attention output is: ; in, is the normalized exponential function, is the vector transpose, and the prediction result of the time domain forecast model is ,in, is the value at each forecast time point.
[0015] In step S5, the main frequency energy proportion of each segment of input data is calculated to obtain the corresponding weight proportion, including: According to the input training data set obtained in step S2 , for which Perform Fourier transform in sequence to generate a set of frequency domain components of the input training data ,in, is the frequency domain component corresponding to each input training data; The frequency components in the array are arranged from large to small according to their numerical values, and the frequency component with the largest numerical value is taken as the main frequency. ,in, It is the subscript corresponding to the main frequency; Expand to both ends from the center to get the main frequency range set ,in, is the radius of the main frequency range; According to the main frequency range With frequency domain range collection Calculate the main frequency energy ratio ; According to the main frequency energy ratio, the weight ratio corresponding to the time domain forecast result and the frequency domain forecast result is obtained.
[0016] Furthermore, the weight of the frequency domain forecast result is , the weight of the time domain forecast result is .
[0017] In step S6, the frequency domain prediction result is obtained And time domain forecast results Multiply them respectively to get the final prediction result and output the training data set Output training data in Compare and calculate the loss function, including: The prediction results of the frequency domain prediction model obtained in step S3 The weight ratio of the frequency domain forecast result obtained in step S5 Multiply the prediction results of the time domain forecast model obtained in step S4 The weight ratio of the time domain forecast result obtained in step S5 Multiply them together and output the final prediction result: , the final prediction result The corresponding output training data Calculating the loss function In each round of training, the multi-period pattern dynamic forecasting model continuously adjusts the parameter settings of the internal network structure according to the loss function, so that the final prediction result The corresponding output training data The error between them keeps decreasing, and after many iterations, a trained model is obtained.
[0018] In step S7, obtaining the prediction result of the test data set includes: inputting the test data set into the model obtained in step S2 , for each training input data Input the trained model in step S6, and solve the multi-period model dynamic forecasting model to obtain the forecast result of the test data set. .
[0019] Another object of the present invention is to provide a ship motion prediction system based on dynamic periodic pattern recognition and weighting, the system implements the ship motion prediction method based on dynamic periodic pattern recognition and weighting, the system comprises: The training set and test set acquisition module is used to segment the time history data of a certain degree of freedom of the ship and obtain the training set of the time history forecast and test set ; Input dataset and output dataset building blocks for setting the history input step size and the step-ahead prediction , according to the training set and test set Constructing the input training data set for the multi-period pattern dynamic forecast model , output training data set , input test data set And the output test dataset ; The frequency domain prediction module is used to train the data set based on the input , input each segment of input data into the frequency domain prediction module for prediction, and obtain the frequency domain prediction result ; The time domain forecast module is used to train the data set based on the input obtained , input each segment of input data into the time domain forecast module for forecasting, and obtain the time domain forecast result ; The corresponding weight ratio acquisition module is used to train the data set according to the input obtained , calculate the main frequency energy proportion of each segment of input data to obtain the corresponding weight proportion; among which, the corresponding weight proportion includes: the weight proportion of frequency domain forecast result And the weight ratio of time domain forecast results ; The final forecast result acquisition module is used to calculate the weight of the frequency domain forecast results. And the weight ratio of time domain forecast results , and the frequency domain prediction results obtained And time domain forecast results Multiply them respectively to get the final prediction result and output the training data set Output training data in Compare and calculate the loss function; The test data set prediction result acquisition module is used to obtain the input test data set Input into the trained multi-period model dynamic forecast model, each input test data The prediction results of the test data set are obtained by solving the model in sequence.
[0020] In combination with all the above technical solutions, the beneficial effects of the present invention are as follows: In view of the above problems, a ship motion prediction method based on dynamic periodic pattern recognition and weighting is considered: first, for each segment of ship motion data input into the model, the corresponding prediction results are generated by the time domain prediction model and the frequency domain prediction model of the integrated attention algorithm; then, the periodic pattern of the ship motion data of this segment is determined by calculating the ratio of the main frequency energy to the total spectrum energy of the ship motion data of this segment; finally, according to the periodic pattern of the ship motion data of this segment, the corresponding weights are generated, and the time domain prediction results and the frequency domain prediction results are dynamically weighted to obtain the final prediction results.
[0021] The ship motion prediction method constructed by the present invention takes into account the periodic pattern of ship motion history data changing with time, determines the periodic pattern corresponding to each segment of historical data of the input model by calculating the spectrum energy ratio and generates the corresponding weight ratio, and weightedly outputs the prediction results of the time domain prediction model and the frequency domain prediction model, which fully utilizes the advantages of the time domain prediction model and the frequency domain prediction model in the periodic patterns they are good at, and effectively improves the phenomenon of phase shift of the prediction results of the prediction model during the prediction process.
[0022] The present invention solves the problem that multiple periodic patterns in ship motion data are mixed, and both traditional time domain forecasting methods and traditional frequency domain forecasting methods cannot fully and accurately capture and extract all periodic patterns. It improves the learning ability of the forecast model for different periodic patterns, and effectively improves the accuracy of the forecast model and the predictable time. It overcomes the prejudice that different periodic patterns in ship motion data cannot be modeled separately and all periodic patterns can only be forecasted through a single forecast model. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The accompanying drawings herein are incorporated in and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description, serve to explain the principles of the present disclosure; Figure 1 It is a schematic diagram of a ship motion prediction method based on dynamic periodic pattern recognition and weighting provided by an embodiment of the present invention; Figure 2 Schematic diagram of a ship motion prediction system based on dynamic periodic pattern recognition and weighting provided by an embodiment of the present invention; Figure 3 It is a time history data diagram of the ship pitching motion provided by an embodiment of the present invention; Figure 4 It is a fragment diagram of a weak periodic mode during the pitching motion of a ship provided by an embodiment of the present invention; Figure 5 It is a fragment diagram of a strong periodic mode during the pitching motion of a ship provided by an embodiment of the present invention; Figure 6 This is a graph showing the prediction result of the ship pitching motion 30 seconds in advance provided by an embodiment of the present invention; Figure 7 This is a graph showing the prediction result of the ship pitching motion 50 seconds in advance provided by an embodiment of the present invention; Figure 8 This is a graph showing the prediction result of the ship pitching motion 70 seconds in advance provided by an embodiment of the present invention; Fig. 9 is a statistical graph of ship pitch motion prediction errors provided by an embodiment of the present invention; In the figure: 1. Module for obtaining training set and test set; 2. Module for constructing input data set and output data set; 3. Frequency domain prediction module; 4. Time domain prediction module; 5. Module for obtaining corresponding weight proportion; 6. Module for obtaining final prediction result; 7. Module for obtaining prediction result of test data set. DETAILED DESCRIPTION
[0024] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention can be implemented in many other ways different from those described herein, and those skilled in the art can make similar improvements without violating the connotation of the present invention, so the present invention is not limited by the specific implementation disclosed below.
[0025] The innovation of the present invention lies in: in order to solve the problem that the time-varying characteristics of ship motion data under high sea conditions are obvious, and the aliasing of periodic patterns between different forecast windows leads to significant phase shift in the forecast results, the present invention identifies the periodic patterns in different forecast windows through main frequency energy ratio analysis, and constructs a time domain feature prediction model and a frequency domain feature prediction model from the two perspectives of time domain feature learning and frequency domain feature learning, and improves the modeling ability of the forecast model for different periodic patterns by weighted fusion of the forecast results of the time domain feature prediction module and the frequency domain feature prediction module, effectively improving the forecast accuracy and predictable duration of the forecast model, and can achieve accurate phase analysis forecast of ship motion one minute in advance.
[0026] Embodiment 1, the ship motion prediction method based on dynamic periodic pattern recognition and weighting provided by the embodiment of the present invention comprises: S1: Segment the time history data of a certain degree of freedom of the ship to obtain the training set of time history forecast and test set ; For example, the specific method of step S1 is that the known historical motion data of a certain degree of freedom of the ship is , where is the number of data on the ship's historical movement history; the ship's historical movement history data is divided into training sets: , test set The number of training set data is , the number of data in the test set is ,The amount of data in the training set and the test set is set according to actual needs.
[0027] S2: Set the history input step size and the step-ahead prediction , according to the training set and test set Constructing the input training data set for the multi-period pattern dynamic forecast model , output training data set , input test data set And the output test dataset ; Exemplarily, the specific method of step S2 is to convert the training set data Extraction by sliding window method as well as ;in, is the input length, is the output length; get The set is the input training data set ,get The set is the output training data set ; The test set data Extraction by sliding window method as well as ;get The set is the input test data set ,get The set is the output test data set .
[0028] It can be understood that the above sliding window method is used to divide the data in the model training set and test set into features and their corresponding labels for supervised learning of the neural network model.
[0029] S3: Training data set based on the input obtained , input each segment of input data into the frequency domain prediction module for prediction; Exemplarily, the present invention innovatively proposes that the specific method for the frequency domain prediction module in step S3 to perform prediction is as follows: according to the input training data set obtained in step S2 , where the input training data Fill the back with zero value vector , get the extended input training data ; Expand the input training data The extended input training spectrum data is obtained by converting from the time domain to the frequency domain through fast Fourier transform. , for the input training data set Each input training data The above operations are carried out to obtain the extended input training spectrum data set ; Input the obtained extension into the training spectrum dataset Each training spectrum data Input the complex-valued attention calculation network in sequence, and expand to Hidden Dimension Space ,in, Determined according to actual situation; In the hidden space Through the learnable vector , learnable vector and the learnable vector Generate query matrix , key matrix Sum Matrix ,in, Determine according to the actual situation; perform complex-valued dot product attention on the query matrix, key matrix, and value matrix to obtain the attention output result ,in, represents the normalized exponential function, Represents vector transpose; attention input result H Map back to the original spectrum dimension through linear transformation to obtain the spectrum matrix ; The spectrum matrix Perform inverse fast Fourier transform to obtain the prediction results of the extended model , the prediction results of the extended model Perform sequence back-pruning, keeping only the last data, and obtain the prediction results of the frequency domain prediction model .
[0030] It can be understood that step S3 of the present invention innovatively proposes a method for predicting the frequency domain characteristics of ship motion. For the input data, the data is first converted into frequency domain components through an extended spectrum transform, and then a complex-valued attention calculation network is constructed to perform adaptive feature extraction and learning on the spectrum components, and finally the spectrum components are converted back to the time domain, and the prediction result of the input data segment is obtained by backward truncation of the time domain sequence.
[0031] The purpose of this technology is to model the characteristics of strong periodic patterns in ship motion data from the perspective of frequency domain components to improve forecast performance.
[0032] Through three steps, namely, scalable spectrum transformation, complex-valued attention calculation network construction and sequence backward truncation, the purpose is to improve the overall method's ability to learn strong periodic patterns of ship motion data.
[0033] S4: Based on the obtained input training data set , input each segment of input data into the time domain forecast module for forecasting; Exemplarily, the present invention innovatively proposes that the specific method of the time domain forecast module in step S4 is to use the input training data set obtained in step 2 ,Will Input the real-valued attention calculation network in sequence, and expand it to Hidden Dimension Space ,in, Determined according to actual situation; In the hidden space Through the learnable vector , learnable vector and the learnable vector Generate query matrix , key matrix Sum Matrix ;in, Determine according to the actual situation; perform real-valued dot product attention on the query matrix, key matrix and value matrix to obtain the attention output result ,in, represents the normalized exponential function, Represents vector transpose; attention input result Mapping back to the original dimension through linear transformation, the prediction results of the time domain forecast model are obtained .
[0034] It can be understood that step S4 innovatively proposes a method for predicting ship motion time domain features. For the input data, the data is first converted into a high-dimensional matrix through linear transformation, and then a real-valued attention calculation network is constructed to perform adaptive feature extraction and learning on the high-dimensional matrix, and finally the high-dimensional matrix is converted back to the original dimension to obtain the prediction result of the input data segment.
[0035] The role of this technology is to model the characteristics of weak periodic patterns in ship motion data from the perspective of time domain analysis to improve forecasting performance.
[0036] Through three steps of linear mapping transformation, real-valued attention calculation network construction and linear mapping inverse transformation, the purpose is to improve the overall method's ability to learn weak periodic patterns of ship motion data.
[0037] S5: Training data set based on the input , calculate the main frequency energy proportion of each segment of input data to obtain the corresponding weight proportion; among which, the corresponding weight proportion includes: the weight proportion of frequency domain forecast result And the weight ratio of time domain forecast results ; Exemplarily, the specific method for calculating the main frequency energy proportion and generating the corresponding weight proportion in step S5 is as follows: , for which Perform Fourier transform in sequence to generate a set of frequency domain components of the input training data ;right The frequency components in the array are arranged from large to small according to their numerical values, and the frequency component with the largest numerical value is taken as the main frequency. ,in, It is the subscript corresponding to the main frequency; Expand to both ends from the center to get the main frequency range set ,in, is the radius of the main frequency range, which can be determined according to actual conditions; according to the main frequency range set With frequency domain range collection Calculate the main frequency energy ratio ; According to the main frequency energy ratio, the weight ratio of the time domain forecast result and the frequency domain forecast result is obtained, among which the weight ratio of the frequency domain forecast result is , the weight of the time domain forecast result is .
[0038] It can be understood that step S5 innovatively proposes a periodic pattern recognition method. For the input data, the periodic pattern of the ship motion data segment is determined by calculating the ratio of the main frequency energy to the total spectrum energy of the ship motion data segment; finally, the corresponding weight is generated according to the periodic pattern of the ship motion data segment.
[0039] The function of this technology is to identify the periodic pattern of the data through the characteristics of the data itself, and generate the time and frequency weight ratios corresponding to the periodic pattern.
[0040] S6: According to the weight ratio of the obtained frequency domain forecast results And the weight ratio of time domain forecast results , and the frequency domain prediction results obtained And time domain forecast results Multiply them respectively to get the final prediction result and output the training data set Output training data in Compare and calculate the loss function; Exemplarily, the present invention innovatively proposes that the specific method for obtaining the final forecast result and calculating the loss function in step S6 is to convert the frequency domain forecast model forecast result obtained in step S3 into The weight ratio of the frequency domain forecast result obtained in step S5 Multiply and add the prediction results of the time domain forecast model obtained in step S4 The weight ratio of the time domain forecast result obtained in step S5 Multiply them together and output the final prediction result: , the final prediction result The corresponding output training data Calculating the loss function ; In each round of training, the model continuously adjusts the parameter settings of the internal network structure according to the loss function, so that the final prediction result The corresponding output training data The error between them keeps decreasing, and after many iterations, a trained model is obtained.
[0041] It can be understood that step S6 of the present invention innovatively proposes a spectrum energy weighting method. Based on the weight proportion obtained by periodic pattern recognition, the time domain forecast result and the frequency domain forecast result are weighted and combined to obtain the final forecast result of the ship motion data of this section.
[0042] The function of this technology is to weight the time domain forecast results and the frequency domain forecast results respectively based on the proportion of spectrum energy, making full use of the advantages of the time domain forecast model and the frequency domain forecast model in their respective periodic patterns, and effectively improving the phase shift phenomenon of the forecast results.
[0043] S7: Input the test data set obtained in step S2 Input into the trained multi-period model dynamic forecast model, each input test data The prediction results of the test data set are obtained by solving the model in sequence.
[0044] Exemplarily, the specific method of step S7 is to input a test data set into the model obtained in step S2 , for each training input data Input the trained model in step S6, and solve the multi-period model dynamic forecasting model to obtain the forecast result of the test data set. .
[0045] It can be seen from the above embodiments that in previous studies, researchers often model and fit the characteristics of ship motion data through time domain prediction models or frequency domain prediction models, thereby realizing the extrapolation prediction of ship motion time history data, among which a single time domain prediction model is good at extracting local information between time points, so it is more accurate to predict weak periodic pattern data with obvious trend; a single frequency domain prediction model is good at extracting global information of the entire time point, so it is more accurate for strong periodic pattern data with obvious periodicity. However, due to the complex marine environment characteristics of the ship, various periodic patterns in the ship motion data set are often mixed with each other, and different periodic patterns are difficult to separate by conventional means. Therefore, traditional time domain prediction models and frequency domain prediction models are not suitable for predicting ship motion data with mixed periodic patterns, and serious phase shift phenomena often occur during the prediction process.
[0046] In view of the above problems, a ship motion prediction method based on dynamic periodic pattern recognition and weighting is considered: first, for each segment of ship motion data input into the model, the corresponding prediction results are generated by the time domain prediction model and the frequency domain prediction model of the integrated attention algorithm; then, the periodic pattern of the ship motion data of this segment is determined by calculating the ratio of the main frequency energy to the total spectrum energy of the ship motion data of this segment; finally, according to the periodic pattern of the ship motion data of this segment, the corresponding weights are generated, and the time domain prediction results and the frequency domain prediction results are dynamically weighted to obtain the final prediction results.
[0047] The advantages of the ship motion prediction method based on dynamic periodic pattern recognition and weighting proposed in the present invention over the traditional ship motion prediction method are: 1. Based on the real-valued attention computing network and the complex-valued attention computing network, the ship motion time domain prediction model and the ship motion frequency domain prediction model are constructed. By calculating the attention score, the periodic pattern characteristics implicit in the ship motion data are effectively captured, and the model's ability to capture key features is improved; 2. The present invention takes into account the time-varying characteristics of the periodic patterns in the ship motion data, and identifies the periodic patterns of the ship motion data in each time period through the method of dynamic spectrum energy weighting, and gives the corresponding weight ratio, and adaptively allocates weights to the time domain forecast results and the frequency domain forecast results, making full use of the advantages of the time domain forecast model and the frequency domain forecast model in the periodic patterns they are good at, and effectively improving the phenomenon of phase offset of the forecast results of the forecast model during the forecast process.
[0048] Based on the above advantages, the ship motion prediction method based on dynamic periodic pattern recognition and weighting proposed in the present invention has higher prediction accuracy for ship motion data and longer prediction time.
[0049] The advantages of the present invention are further reflected in: the present invention proposes to construct a ship motion time domain prediction model based on a real-valued attention calculation network, and effectively captures the weak periodic pattern characteristics implicit in the ship motion data by calculating the attention score, thereby improving the model's ability to capture key features; The present invention proposes to construct a ship motion time domain prediction model and a ship motion frequency domain prediction model based on a complex-valued attention computing network. By calculating the attention score, the strong periodic pattern characteristics implicit in the ship motion data are effectively captured, and the model's ability to capture key features is improved. At the same time, the extended spectrum transformation and sequence backward truncation operations are introduced to ensure that the model can achieve the correct mapping of spectrum features. The present invention takes into account the time-varying characteristics of the periodic patterns in the ship motion data, identifies the periodic patterns of the ship motion data in each time period by means of a dynamic spectrum energy weighting method, gives corresponding weight ratios, and adaptively distributes weights to the time domain forecast results and the frequency domain forecast results, making full use of the advantages of the time domain forecast model and the frequency domain forecast model in their respective periodic patterns, and effectively improving the phenomenon of phase shift of the forecast results of the forecast model during the forecast process.
[0050] Example 2, as another embodiment of the present invention, Figure 1 As shown, the ship motion prediction method based on dynamic periodic pattern recognition and weighting provided by the embodiment of the present invention includes: (1) Obtaining ship motion history data; (2) Split the model training / testing data set; (3) Using the frequency domain prediction module to perform: scalable spectrum transformation, complex-valued attention calculation network, and sequence backward pruning; and using the time domain prediction module to perform: linear mapping transformation, real-valued attention calculation network, and linear mapping inverse transformation; (4) Dynamic spectrum energy weighting; (5) Obtain the ship motion time history prediction results.
[0051] Embodiment 3, Figure 2 The ship motion prediction system based on dynamic periodic pattern recognition and weighting provided by an embodiment of the present invention includes: The training set and the test set are obtained from module 1, which is used to segment the time history data of a certain degree of freedom of the ship and obtain the training set of the time history forecast. and test set ; Input dataset and output dataset construction module 2, used to set the historical input step size and the step-ahead prediction , according to the training set and test set Constructing the input training data set for the multi-period pattern dynamic forecast model , output training data set , input test data set And the output test dataset ; Frequency domain prediction module 3 is used to train the data set according to the input , input each segment of input data into the frequency domain prediction module for prediction, and obtain the frequency domain prediction result ; Time domain prediction module 4 is used to train the data set according to the input , input each segment of input data into the time domain forecast module for forecasting, and obtain the time domain forecast result ; The corresponding weight ratio acquisition module 5 is used to train the data set according to the obtained input , calculate the main frequency energy proportion of each segment of input data to obtain the corresponding weight proportion; among which, the corresponding weight proportion includes: the weight proportion of frequency domain forecast result And the weight ratio of time domain forecast results ; The final forecast result is obtained in module 6, which is used to calculate the weight of the frequency domain forecast result. And the weight ratio of time domain forecast results , and the frequency domain prediction results obtained And time domain forecast results Multiply them respectively to get the final prediction result and output the training data set Output training data in Compare and calculate the loss function; The test data set prediction result obtaining module 7 is used to obtain the input test data set Input into the trained multi-period model dynamic forecast model, each input test data The prediction results of the test data set are obtained by solving the model in sequence.
[0052] The ship motion time history data selected the tank test data of long-peak irregular waves at zero speed of the ship model. The tank test was carried out in a towing tank of a certain university, and the verification work of the method of the present invention was carried out based on the ship model motion data obtained in the test. The towing tank of a certain university is 150 meters long, 7 meters wide, and 3 meters deep. It is equipped with a wave maker and a trailer. The ITTC dual-parameter spectrum is used as the wave-making spectrum. The slender standard ship model DTMB5145 recommended by ITTC is selected as the ship model for this tank test. The scale ratio is 1:50. The ship model equipped with an inclination sensor and a displacement sensor is fixed on the trailer, and a wave-making board is used to simulate the long-peak irregular waves under level 4, level 5 and level 6 sea conditions, respectively, to measure the swaying motion of the ship model in real time. The time step of the final measured ship motion time history data is 0.7 seconds, and the total time is 70 minutes. Among them, the ship pitch motion time history data is as follows Figure 3 shown.
[0053] Step 1: Segment the time history data of a certain degree of freedom of the ship to obtain the training set and test set of the time history forecast. The specific method of step 1 is that the known time history data of a certain degree of freedom of the ship is , where is the number of data on the ship's historical movement history; the ship's historical movement history data is divided into training sets: , test set ; Among them, the number of data in the training set is , the number of data in the test set is ,The amount of data in the training set and the test set is set according to actual needs.
[0054] Step 2: Set the history input step size and the step-ahead prediction , and according to the training set in step 1 and test set Construct the input data set and output data set of the model. The specific method of step 2 is to convert the training set data Extraction by sliding window method as well as ;in, is the input length, is the output length; get The set is the input training data set ,get The set is the output training data set ; The test set data Extraction by sliding window method as well as ;get The set is the input test data set ,get The set is the output test data set .
[0055] Step 3: Based on the input training data set obtained in step 2 , input each segment of input data into the frequency domain prediction module for prediction. The specific method of the frequency domain prediction module in step 3 is to use the input training data set obtained in step 2 , where the input training data Fill the back with zero value vector , get the extended input training data ; Expand the input training data The extended input training spectrum data is obtained by converting from the time domain to the frequency domain through fast Fourier transform. , for the input training data set Each input training data The above operations are carried out to obtain the extended input training spectrum data set ; Input the obtained extension into the training spectrum dataset Each training spectrum data Input the complex-valued attention calculation network in sequence, and expand it to the D-dimensional hidden space through linear mapping in the network ,in, Determined according to actual situation; In the hidden space Through the learnable vector , learnable vector and the learnable vector Generate query matrix , key matrix Sum Matrix ,in, Determine according to the actual situation; perform complex-valued dot product attention on the query matrix, key matrix, and value matrix to obtain the attention output result ,in, represents the normalized exponential function, Represents vector transpose; attention input result H Map back to the original spectrum dimension through linear transformation to obtain the spectrum matrix ; The spectrum matrix Perform inverse fast Fourier transform to obtain the prediction results of the extended model , the prediction results of the extended model Perform sequence back-pruning, keeping only the last data, and obtain the prediction results of the frequency domain prediction model .
[0056] Step 4: Based on the input training data set obtained in step 2 , input each segment of input data into the time domain forecast module for forecasting. The specific method of forecasting by the time domain forecast module in step 4 is to use the input training data set obtained in step 2 ,Will Input the real-valued attention calculation network in sequence, and expand it to Hidden Dimension Space ,in, Determined according to actual situation; In the hidden space Through the learnable vector , learnable vector and the learnable vector Generate query matrix , key matrix Sum Matrix ;in, Determine according to the actual situation; perform real-valued dot product attention on the query matrix, key matrix and value matrix to obtain the attention output result ;in, represents the normalized exponential function, Represents vector transpose; attention input result Mapping back to the original dimension through linear transformation, the prediction results of the time domain forecast model are obtained .
[0057] Step 5: Based on the input training data set obtained in step 2 , calculate the main frequency energy proportion of each segment of input data to obtain the corresponding weight proportion. The specific method of calculating the main frequency energy proportion and generating the corresponding weight proportion in step 5 is to calculate the main frequency energy proportion and generate the corresponding weight proportion according to the input training data set obtained in step 2. , for which Perform Fourier transform in sequence to generate a set of frequency domain components of the input training data ;right The frequency components in the array are arranged from large to small according to their numerical values, and the frequency component with the largest numerical value is taken as the main frequency. ,in, It is the subscript corresponding to the main frequency; Expand to both ends from the center to get the main frequency range set ,in, is the radius of the main frequency range, which can be determined according to actual conditions; according to the main frequency range set With frequency domain range collection Calculate the main frequency energy ratio ; According to the main frequency energy ratio, the weight ratio of the time domain forecast result and the frequency domain forecast result is obtained, among which the weight ratio of the frequency domain forecast result is , the weight of the time domain forecast result is .like Figure 4 The weak periodic mode fragments of the ship's pitch motion. As well as Figure 5 A fragment of a strong periodic pattern during the ship's pitching motion is shown.
[0058] Step 6: According to the weight ratio of the frequency domain forecast results obtained in step 5 And the weight ratio of time domain forecast results , and the frequency domain prediction results obtained in steps 3 and 4 And time domain forecast results Multiply them respectively to get the final prediction result and output the training data set Output training data in The specific method for obtaining the final forecast result and calculating the loss function in step 6 is to compare the forecast result of the frequency domain forecast model obtained in step 3 with the forecast result of the frequency domain forecast model obtained in step 3. The weight ratio of the frequency domain forecast result obtained in step 5 Multiply and add the prediction results of the time domain forecast model obtained in step 4 The weight ratio of the time domain forecast result obtained in step 5 Multiply them together and output the final prediction result: , the final prediction result The corresponding output training data Calculating the loss function ; In each round of training, the model continuously adjusts the parameter settings of the internal network structure according to the loss function, so that the final prediction result The corresponding output training data The error between them keeps decreasing, and after many iterations, a trained model is obtained.
[0059] Step 7: Input the test data set obtained in step 2 Input into the trained model in step 6, each input test data The prediction results of the test data set are obtained by solving the model in turn. The specific method of step 6 is to input the test data set into the model obtained in step 2 , for each training input data Input the trained model in step 6, and solve the model in turn to obtain the prediction results of the test data set .like Figure 6 The ship's pitch motion is predicted 30 seconds in advance, and Figure 7 The ship's pitch motion is predicted 50 seconds in advance. Figure 8 The prediction results of the ship's pitching motion 70 seconds in advance are shown in Table 1. The error calculation results of the ship's pitching motion time history prediction results are shown in Table 1.
[0060] Table 1 Statistics of ship pitch motion prediction errors
[0061] like Fig. 9 The statistics of the forecast error of the ship's pitching motion show that, compared with the forecast time history curve and the true curve, this method can achieve good prediction results in both amplitude and phase; from the error curve, the error of this method in different advance forecast time periods is relatively stable, indicating that this method can effectively extend the forecast time of ship motion while ensuring high accuracy, and can provide effective information for subsequent ship decision-making assistance and avoidance of potential risks.
[0062] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any modifications, equivalent substitutions and improvements made by any technician familiar with the technical field within the technical scope disclosed by the present invention and within the spirit and principles of the present invention should be covered within the protection scope of the present invention.
Claims
1. A ship motion prediction method based on dynamic periodic pattern recognition and weighting, characterized in that: The method comprises the steps of: S1: Segment the time history data of a certain degree of freedom of the ship to obtain the training set of time history forecast and test set ; S2: Set the history input step size and the step-ahead prediction , according to the training set and test set Constructing the input training data set for the multi-period pattern dynamic forecast model , output training data set , input test data set And the output test dataset ; S3: Training data set based on the input obtained , input each segment of input data into the frequency domain prediction module for prediction, and obtain the frequency domain prediction result ; S4: Training data set based on the input obtained , input each segment of input data into the time domain forecast module for forecasting, and obtain the time domain forecast result ; S5: Training data set based on the input , calculate the main frequency energy proportion of each segment of input data to obtain the corresponding weight proportion; among which, the corresponding weight proportion includes: the weight proportion of frequency domain forecast result And the weight ratio of time domain forecast results ; S6: According to the weight ratio of the obtained frequency domain forecast results And the weight ratio of time domain forecast results , and the frequency domain prediction results obtained And time domain forecast results Multiply them respectively to get the final prediction result and output the training data set Compare and calculate the loss function; S7: Input the test data set obtained in step S2 Input into the trained multi-period model dynamic forecasting model, and obtain the forecast result of the output test data set after the model is solved. .
2. The ship motion prediction method based on dynamic periodic pattern recognition and weighting according to claim 1 is characterized in that: In step S3, the frequency domain prediction module performs prediction, including: According to the input training data set obtained , where the input training data Fill the back with zero value vector , get the extended input training data ;in, is the history input step size, To predict the step length in advance; Expanding the input training data The extended input training spectrum data is obtained by converting from the time domain to the frequency domain through fast Fourier transform. ,in, is the frequency component after Fourier transform; for the input training data set Each input training data The above operations are carried out to obtain the extended input training spectrum data set ,in, is the spectrum fragment corresponding to each input training data; The obtained extension is input into the training spectrum dataset Each training spectrum data Input the complex-valued attention computing network in sequence, and expand to the complex-valued attention computing network through linear mapping Hidden Dimension Space ,in, for D Vectors in dimensional latent space; In the hidden space Through the learnable vector , learnable vector and the learnable vector Generate query matrix , key matrix Sum Matrix ; Perform complex-valued dot product attention on the query matrix, key matrix, and value matrix to get the attention output in, is the normalized exponential function, Transpose of a vector; Attention Input Results H Map back to the original spectrum dimension through linear transformation to obtain the spectrum matrix ,in, is the frequency component after linear transformation mapping; The spectrum matrix Perform inverse fast Fourier transform to obtain the prediction results of the frequency domain prediction module , the prediction results of the extended model Perform sequence backward pruning to obtain the prediction results of the frequency domain prediction model ,in, is the value at each forecast time point.
3. The ship motion prediction method based on dynamic periodic pattern recognition and weighting according to claim 2 is characterized in that: Prediction results of the extended model After the sequence is back-pruned, only the last The data are used to obtain the prediction results of the frequency domain prediction model.
4. The ship motion prediction method based on dynamic periodic pattern recognition and weighting according to claim 1 is characterized in that: In step S4, the time domain forecast module performs forecasting, including: According to the input training data set obtained in step S2 ,Will Input the real-valued attention calculation network in sequence, and expand to the real-valued attention calculation network through linear mapping Hidden Dimension Space ,in, for S Vectors in dimensional latent space; In the hidden space Through the learnable vector , learnable vector and the learnable vector Generate query matrix , key matrix Sum Matrix ; Perform real-valued dot product attention on the query matrix, key matrix, and value matrix to obtain the attention output result; The attention input result is mapped back to the original dimension through linear transformation to obtain the prediction result of the time domain prediction model.
5. The ship motion prediction method based on dynamic periodic pattern recognition and weighting according to claim 4 is characterized in that: The attention output is: ; in, is the normalized exponential function, is the vector transpose, and the prediction result of the time domain forecast model is ,in, is the value at each forecast time point.
6. The ship motion prediction method based on dynamic periodic pattern recognition and weighting according to claim 1 is characterized in that: In step S5, the main frequency energy proportion of each segment of input data is calculated to obtain the corresponding weight proportion, including: According to the input training data set obtained in step S2 , for which Perform Fourier transform in sequence to generate a set of frequency domain components of the input training data ,in, is the frequency domain component corresponding to each input training data; The frequency components in the array are arranged from large to small according to their numerical values, and the frequency component with the largest numerical value is taken as the main frequency. ,in, It is the subscript corresponding to the main frequency; Expand to both ends from the center to get the main frequency range set ,in, is the radius of the main frequency range; According to the main frequency range With frequency domain range collection Calculate the main frequency energy ratio ; According to the main frequency energy ratio, the weight ratio corresponding to the time domain forecast result and the frequency domain forecast result is obtained.
7. The ship motion prediction method based on dynamic periodic pattern recognition and weighting according to claim 6 is characterized in that: The weight of the frequency domain forecast result is , the weight of the time domain forecast result is .
8. The ship motion prediction method based on dynamic periodic pattern recognition and weighting according to claim 1 is characterized in that: In step S6, the frequency domain prediction result is obtained And time domain forecast results Multiply them respectively to get the final prediction result and output the training data set Output training data in Compare and calculate the loss function, including: The prediction results of the frequency domain prediction model obtained in step S3 The weight ratio of the frequency domain forecast result obtained in step S5 Multiply the prediction results of the time domain forecast model obtained in step S4 The weight ratio of the time domain forecast result obtained in step S5 Multiply them together and output the final prediction result: , the final prediction result The corresponding output training data Calculating the loss function In each round of training, the multi-period pattern dynamic forecasting model continuously adjusts the parameter settings of the internal network structure according to the loss function, so that the final prediction result The corresponding output training data The error between them keeps decreasing, and after many iterations, a trained model is obtained.
9. The ship motion prediction method based on dynamic periodic pattern recognition and weighting according to claim 1 is characterized in that: In step S7, obtaining the prediction result of the test data set includes: inputting the test data set into the model obtained in step S2 , for each training input data Input the trained model in step S6, and solve the multi-period model dynamic forecasting model to obtain the forecast result of the test data set. .
10. A ship motion prediction system based on dynamic periodic pattern recognition and weighting, characterized in that: The system implements the ship motion prediction method based on dynamic periodic pattern recognition and weighting as described in any one of claims 1 to 9, and the system comprises: The training set and test set acquisition module (1) is used to segment the time history data of a certain degree of freedom of the ship and obtain the training set of the time history forecast and test set ; Input dataset and output dataset construction module (2) for setting the historical input step size and the step-ahead prediction , according to the training set and test set Constructing the input training data set for the multi-period pattern dynamic forecast model , output training data set , input test data set And the output test dataset ; The frequency domain prediction module (3) is used to train the data set according to the input , input each segment of input data into the frequency domain prediction module for prediction, and obtain the frequency domain prediction result ; The time domain prediction module (4) is used to train the data set according to the input , input each segment of input data into the time domain forecast module for forecasting, and obtain the time domain forecast result ; The corresponding weight ratio acquisition module (5) is used to train the data set according to the obtained input , calculate the main frequency energy proportion of each segment of input data to obtain the corresponding weight proportion; among which, the corresponding weight proportion includes: the weight proportion of frequency domain forecast result And the weight ratio of time domain forecast results ; The final forecast result is obtained in module (6), which is used to calculate the weight of the obtained frequency domain forecast result. And the weight ratio of time domain forecast results , and the frequency domain prediction results obtained And time domain forecast results Multiply them respectively to get the final prediction result and output the training data set Output training data in Compare and calculate the loss function; The test data set prediction result obtaining module (7) is used to obtain the input test data set Input into the trained multi-period model dynamic forecast model, each input test data The prediction results of the test data set are obtained by solving the model in sequence.
Citation Information
Patent Citations
Multivariate time series trend prediction method and system based on deep learning
CN115146842A
Electromagnetic target identification method based on complex value attention network
CN115758109A
Ship motion long-time forecasting method and system integrated with time-frequency analysis
CN117932273A
Non-stationary ship motion forecasting method and system for power system modeling
CN118410722A
System and method for seismic data modeling and migration
US20120243371A1
Cited By
Sea condition prediction method based on PSO-ShipMotionNet and spectrum guided optimization strategy
CN120430530A
Sea state prediction method based on PSO-ShipMotionNet and spectrum-guided optimization strategy
CN120430530B