Ship Motion Prediction Method and System Based on Dynamic Period 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
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-26
- Publication Date
- 2025-06-17
- 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 period mode is determined through the calculation of the main frequency energy proportion, and the final forecast results are dynamically weighted.
The learning ability of the forecast model for different periodic modes is improved, the phase offset of the forecast results is reduced, and the forecast accuracy and predictable time are improved.
Smart Images

Figure CN119719685B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of ship and ocean engineering, and particularly relates to a ship motion prediction method and system based on dynamic cycle pattern recognition and weighting. Background Technique
[0002] When a ship sails in the actual sea area, the environmental disturbances dominated by waves will cause the six-degree-of-freedom rolling motion of the ship, continuously interfering with the normal navigation and offshore operation activities of the ship, making it difficult to carry out precision operations such as carrier-based aircraft takeoff and landing and carrier-based weapon firing. In medium and high sea conditions, the highly complex interaction between the hull and the waves makes the ship's rolling motion more intense, and even threatens the safety of the personnel and equipment on board. Ship motion prediction refers to estimating the change in the navigation attitude of the ship in the future period according to the current or historical motion state of the ship, providing sufficient reaction time and necessary auxiliary decision-making information for the shipboard personnel, and is of extremely important significance for determining the stable operation period window at sea, avoiding potential risks, and ensuring operation safety.
[0003] However, there are still the following problems in the prediction of the ship's motion attitude. During the actual sea area navigation process of the ship, the complex wave excitation makes the ship's motion show strong volatility and randomness. Among them, when the sea wave undulation changes relatively gently, the ship motion time history data shows the characteristics of small amplitude and long period, while when the sea wave undulation changes relatively violently, the ship motion time history data shows the characteristics of large amplitude and short period. This dynamic ship motion cycle pattern that changes continuously with the sea wave undulation significantly increases the time-varying characteristics of the ship motion, seriously affecting the prediction performance of the traditional ship motion prediction model. Therefore, how to enable the prediction model to correctly identify and capture the cycle pattern that changes continuously with time and improve the learning ability of the prediction model for the time-varying periodic characteristics in the ship motion data is an urgent problem to be solved at present.
[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 to achieve the extrapolation and 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 in predicting weak periodic pattern data with obvious trends; a single frequency-domain prediction model is good at extracting global information of the overall time points, so it is more accurate for strong periodic pattern data with obvious periodicity. However, due to the complex marine environment characteristics in which the ship is located, various periodic patterns in the ship motion data set often coexist in a mixed manner, 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.
[0007] Through the above analysis, the problems and defects of the existing technology are as follows: In the very short-term prediction 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 state levels and sea area environments, the complex excitation effect of waves on ship motion makes ship motion data show 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 single periodic patterns, and large phase deviations will occur during the prediction process, thus seriously affecting the prediction accuracy of the model for ship motion data. Summary of the Invention
[0008] To overcome the problems in the related art, the disclosed embodiments of the present invention provide a ship motion prediction method and system based on dynamic periodic pattern recognition and weighting.
[0009] The technical solution is as follows: The ship motion prediction method based on dynamic periodic pattern recognition and weighting includes the steps of:
[0010] S1: Segment the time history data of the ship's motion in a certain degree of freedom to obtain the training set and the test set ;
[0011] S2: Set the historical input step length and the advance prediction step length , and construct the input training data set , output training data set , input test data set , and output test data set of the multi-period pattern dynamic prediction model according to the training set and the test set ;
[0012] S3: According to the obtained input training data set , input each segment of the input data therein into the frequency-domain prediction module for prediction to obtain the frequency-domain prediction result ;
[0013] S4: According to the obtained input training data set , input each segment of the input data therein into the time-domain prediction module for prediction to obtain the time-domain prediction result ;
[0014] S5: According to the obtained input training data set , calculate the proportion of the main frequency energy of each segment of the input data therein to obtain the corresponding weight proportion; among them, the corresponding weight proportion includes: the weight proportion of the frequency-domain prediction result and the weight proportion of the time-domain prediction result ;
[0015] S6: According to the obtained weight proportion of the frequency-domain prediction result and the weight proportion of the time-domain prediction result , multiply them with the obtained frequency-domain prediction result and the time-domain prediction result respectively to obtain the final prediction result, and compare and calculate the loss function with the output training data in the output training data set ;
[0016] S7: Input the input test data set obtained in step S2 into the trained multi-period mode dynamic prediction model, and each input test data is sequentially solved through the model to obtain the prediction result of the test data set
[0017] In step S3, when the frequency-domain prediction module makes a prediction, it includes:
[0018] According to the obtained input training data set , fill zero-value vectors behind the input training data therein to obtain the extended input training data , where is the historical input step length, is the forward prediction step length
[0019] Convert the extended input training data from the time domain to the frequency domain through the fast Fourier transform to obtain the extended input training spectrum data , where is the frequency component after Fourier transform; for the input training data set each input training data in perform the above operations to obtain an extended input training spectrum data set , where is the spectrum segment corresponding to each input training data;
[0020] The obtained extended input training spectrum data set each training spectrum data in is sequentially input into the complex-valued attention calculation network. In the complex-valued attention calculation network, it is extended to dimensional hidden space , where is D a vector in the dimensional hidden space;
[0021] in the dimensional hidden space respectively generate a query matrix through the learnable vector and the learnable vector a key matrix and a value matrix ;
[0022] Perform complex-valued dot product attention on the query matrix, key matrix, and value matrix to obtain an attention output result where is the normalized exponential function,
[0023] is the vector transpose; H The attention input result is mapped back to the original spectrum dimension through a linear transformation to obtain a spectrum matrix , where is the frequency component after linear transformation mapping;
[0024] Perform the inverse fast Fourier transform on the spectrum matrix to obtain the prediction result of the frequency domain prediction module , and perform sequence backward cropping on the extended model prediction result to obtain the prediction result of the frequency domain prediction model , where is the value at each prediction time point.
[0025] Furthermore, after performing sequence backward cropping on the extended model prediction result , only the last data are retained to obtain the prediction result of the frequency domain prediction model.
[0026] In step S4, the time-domain prediction module makes a prediction, including:
[0027] According to the input training data set obtained in step S2 , are sequentially input into the real-valued attention calculation network, and are extended to dimensional hidden space through linear mapping in the real-valued attention calculation network , where is a vector in the dimensional hidden space;
[0028] in the dimensional hidden space respectively generate a query matrix , a key matrix and a value matrix through learnable vectors , ; ;
[0029] Perform real-valued dot product attention on the query matrix, key matrix and value matrix to obtain the attention output result;
[0030] The attention input result is mapped back to the original dimension through linear transformation to obtain the time-domain prediction model prediction result.
[0031] Furthermore, the attention output result is:
[0032] ;
[0033] where is the normalized exponential function, is the vector transpose, and the time-domain prediction model prediction result is , where are the values at each prediction time point.
[0034] In step S5, the main frequency energy ratio of each segment of the input data is calculated to obtain the corresponding weight ratio, including:
[0035] According to the input training data set obtained in step S2 , in it are sequentially subjected to Fourier transform to generate the input training data frequency domain component set , where are the frequency domain components corresponding to each input training data; for in it, the individual frequency components are arranged in descending order of numerical value, and the frequency component with the largest numerical value is taken as the main frequency , where is the subscript corresponding to the main frequency; with the main frequency Expand from the center to both ends to obtain the main frequency range set , where is the radius of the main frequency range;
[0036] According to the main frequency range set and the frequency domain range set calculate the proportion of the main frequency energy ; obtain the weight proportions corresponding to the time domain prediction result and the frequency domain prediction result according to the proportion of the main frequency energy.
[0037] Furthermore, the weight proportion of the frequency domain prediction result is , and the weight proportion of the time domain prediction result is .
[0038] In step S6, multiply with the obtained frequency domain prediction result and the time domain prediction result respectively to obtain the final prediction result, and compare and calculate the loss function with the output training data in the output training data set , including:
[0039] Multiply the prediction result of the frequency domain prediction model obtained in step S3 by the weight proportion of the frequency domain prediction result obtained in step S5 , multiply the prediction result of the time domain prediction model obtained in step S4 by the weight proportion of the time domain prediction result obtained in step S5 , and the output final prediction result is . Multiply the final prediction result by the corresponding output training data to calculate the loss function ; in each round of training, the multi-period mode dynamic prediction model continuously adjusts the parameter settings of the internal network structure according to the loss function, so that the error between the final prediction result and the corresponding output training data is continuously reduced, and a trained model is obtained after multiple iterations.
[0040] In step S7, the prediction result of the test data set obtained includes: for the model input test data set obtained in step S2, input each segment of training input data in it into the trained model in step S6, and sequentially obtain the prediction result of the test data set through the solution of the multi-period mode dynamic prediction model.
[0041] Another object of the present invention is to provide a ship motion prediction system based on dynamic cycle pattern recognition and weighting, which implements the ship motion prediction method based on dynamic cycle pattern recognition and weighting. The system includes:
[0042] A training set and test set obtaining module, which is used to segment the time history data of the ship's motion in a certain degree of freedom to obtain the training set for time history prediction and the test set ;
[0043] An input data set and output data set construction module, which is used to set the historical input step and the advance prediction step , and construct the input training data set , output training data set , input test data set , and output test data set of the multi-cycle pattern dynamic prediction model according to the training set and the test set ;
[0044] A frequency domain prediction module, which is used to input each segment of the input data into the frequency domain prediction module for prediction according to the obtained input training data set to obtain the frequency domain prediction result ;
[0045] A time domain prediction module, which is used to input each segment of the input data into the time domain prediction module for prediction according to the obtained input training data set to obtain the time domain prediction result ;
[0046] A corresponding weight ratio obtaining module, which is used to calculate the main frequency energy ratio of each segment of the input data according to the obtained input training data set to obtain the corresponding weight ratio; wherein, the corresponding weight ratio includes: the weight ratio of the frequency domain prediction result and the weight ratio of the time domain prediction result ;
[0047] A final prediction result obtaining module, which is used to multiply the obtained frequency domain prediction result weight ratio and the time domain prediction result weight ratio with the obtained frequency domain prediction result and the time domain prediction result respectively to obtain the final prediction result, and compare and calculate the loss function with the output training data in the output training data set ;
[0048] 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.
[0049] In combination with all the above technical solutions, the beneficial effects of the present invention are as follows:
[0050] 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.
[0051] 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.
[0052] 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
[0053] 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;
[0054] 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;
[0055] 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;
[0056] Figure 3 It is the time history data diagram of the ship's pitching motion provided by the embodiment of the present invention;
[0057] Figure 4 It is the fragment diagram of the weak periodic mode of the ship's pitching motion time history provided by the embodiment of the present invention;
[0058] Figure 5 It is the fragment diagram of the strong periodic mode of the ship's pitching motion time history provided by the embodiment of the present invention;
[0059] Figure 6 It is the prediction result diagram of the ship's pitching motion 30 seconds in advance provided by the embodiment of the present invention;
[0060] Figure 7 It is the prediction result diagram of the ship's pitching motion 50 seconds in advance provided by the embodiment of the present invention;
[0061] Figure 8 It is the prediction result diagram of the ship's pitching motion 70 seconds in advance provided by the embodiment of the present invention;
[0062] Figure 9 It is the statistical chart of the prediction error of the ship's pitching motion provided by the embodiment of the present invention;
[0063] In the figure: 1. The module for obtaining the training set and the test set; 2. The module for constructing the input data set and the output data set; 3. The frequency domain prediction module; 4. The time domain prediction module; 5. The module for obtaining the corresponding weight ratio; 6. The module for obtaining the final prediction result; 7. The module for obtaining the prediction result of the test data set. Specific Embodiments
[0064] In order to make the above objects, features and advantages of the present invention more obvious and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Many specific details are set forth in the following description in order to fully understand 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 departing from the connotation of the present invention. Therefore, the present invention is not limited by the specific embodiments disclosed below.
[0065] 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.
[0066] Embodiment 1, the ship motion prediction method based on dynamic periodic pattern recognition and weighting provided by the embodiment of the present invention comprises:
[0067] 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 ;
[0068] 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.
[0069] 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 ;
[0070] 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 of is the output training data set ; The test set data is extracted by the sliding window method and ; Obtain The set of is the input test data set , obtain The set of is the output test data set .
[0071] 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 the supervised learning of the neural network model.
[0072] S3: According to the obtained input training data set , input each segment of input data therein into the frequency domain prediction module for prediction;
[0073] Exemplarily, the present invention innovatively proposes that the specific method for the frequency domain prediction module to perform prediction in step S3 is to, according to the input training data set obtained in step S2 , fill zero value vectors behind the input training data in it to obtain extended input training data ; Convert the extended input training data from the time domain to the frequency domain through the fast Fourier transform to obtain extended input training spectrum data , and perform the above operations on each input training data in the input training data set to obtain an extended input training spectrum data set ; Input each training spectrum data in the obtained extended input training spectrum data set into the complex-valued attention calculation network in turn, and expand it to dimensional hidden space in the network, where is determined according to the actual situation; in the dimensional hidden space respectively generate a query matrix , a key matrix and a value matrix through learnable vectors , where is determined according to the actual situation; Perform complex-valued dot product attention on the query matrix, key matrix and value matrix to obtain an attention output result , where is determined according to the actual situation; , where represents the normalized exponential function, represents the vector transpose; the attention input result H is mapped back to the original spectral dimension through linear transformation to obtain the spectral matrix ; the spectral matrix is subjected to the inverse fast Fourier transform to obtain the extended model prediction result , for the extended model prediction result is subjected to sequential backward clipping, and only the last data are retained to obtain the prediction result of the frequency domain prediction model .
[0074] 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, first, the data are converted into frequency domain components through extended spectral transformation, then a complex-valued attention calculation network is constructed to adaptively extract and learn the spectral components, and finally, the spectral components are converted back to the time domain, and the prediction result of this segment of input data is obtained through time domain sequence backward truncation.
[0075] The function of this technology is to model the characteristics of strong periodic patterns in ship motion data from the perspective of frequency domain components and improve the prediction performance.
[0076] Through three steps: extended spectral transformation, construction of a complex-valued attention calculation network, and sequential backward truncation. The function is to improve the learning ability of the overall method for strong periodic patterns in ship motion data.
[0077] S4: According to the obtained input training data set , each segment of the input data therein is input into the time domain prediction module for prediction;
[0078] Exemplarily, the present invention innovatively proposes that the specific method for prediction by the time domain prediction module in step S4 is, according to the input training data set obtained in step 2 , are sequentially input into the real-valued attention calculation network, and are extended to the -dimensional hidden space through linear mapping in the network , where is determined according to the actual situation; in the -dimensional hidden space , and generate the query matrix , the key matrix and the value matrix respectively through the learnable vectors Determined 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 , where represents the normalized exponential function, represents the vector transpose; the attention input result is mapped back to the original dimension through a linear transformation to obtain the prediction result of the time-domain prediction model .
[0079] It can be understood that step S4 innovatively proposes a method for predicting the time-domain characteristics of ship motion. For the input data, first, the data is converted into a high-dimensional matrix through a linear transformation, 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 this segment of input data.
[0080] The function of this technology is to model the characteristics of weak periodic patterns in ship motion data from the perspective of time-domain analysis and improve the prediction performance.
[0081] Through three steps: linear mapping transformation, construction of a real-valued attention calculation network, and inverse linear mapping transformation. The function is to improve the learning ability of the overall method for weak periodic patterns in ship motion data.
[0082] S5: According to the obtained input training dataset , calculate the main frequency energy proportion of each segment of input data therein to obtain the corresponding weight proportion; wherein, the corresponding weight proportion includes: the weight proportion of the frequency-domain prediction result and the weight proportion of the time-domain prediction result ;
[0083] Exemplarily, the specific method for calculating the main frequency energy proportion and generating the corresponding weight proportion in step S5 is as follows: According to the input training dataset obtained in step S2 , perform Fourier transform on the therein in sequence to generate a set of frequency-domain components of the input training data ; arrange the various frequency components in from largest to smallest according to the numerical value, and obtain the frequency component with the largest numerical value as the main frequency , where is the subscript corresponding to the main frequency; expand from the main frequency to both ends to obtain a set of main frequency ranges , where is the radius of the main frequency range, which can be determined according to the actual situation; according to the set of main frequency ranges and the set of frequency-domain ranges calculate the main frequency energy proportion ; Obtain the weight ratios corresponding to the time-domain prediction result and the frequency-domain prediction result according to the main frequency energy ratio, where the weight ratio of the frequency-domain prediction result is , and the weight ratio of the time-domain prediction result is .
[0084] It can be understood that step S5 innovatively proposes a periodic pattern recognition method. For the input data, determine the periodic pattern of the ship motion data segment by calculating the ratio of the main frequency energy to the total spectral energy of the ship motion data segment; finally, generate corresponding weights according to the periodic pattern of the ship motion data segment.
[0085] The function of this technology is to identify the periodic pattern of this data segment through the characteristics of the data itself, and at the same time generate the time and frequency weight ratios corresponding to the periodic pattern.
[0086] S6: According to the obtained weight ratio of the frequency-domain prediction result and the weight ratio of the time-domain prediction result , multiply them with the obtained frequency-domain prediction result and the time-domain prediction result respectively to obtain the final prediction result, and compare it with the output training data in the output training data set to calculate the loss function;
[0087] Exemplarily, the present invention innovatively proposes that the specific method for obtaining the final prediction result and calculating the loss function in step S6 is to multiply the frequency-domain prediction model prediction result obtained in step S3 with the weight ratio of the frequency-domain prediction result obtained in step S5 , and at the same time multiply the time-domain prediction model prediction result obtained in step S4 with the weight ratio of the time-domain prediction result obtained in step S5 , and the output final prediction result is , and calculate the loss function for the final prediction result and the corresponding output training data ; 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 error between the final prediction result and the corresponding output training data is continuously reduced, and a trained model is obtained after multiple iterations.
[0088] It can be understood that step S6 of the present invention innovatively proposes a spectral energy weighting method. Based on the weight ratios obtained from the periodic pattern recognition, the time-domain prediction result and the frequency-domain prediction result are weighted and combined to obtain the final prediction result of the ship motion data segment.
[0089] 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.
[0090] 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.
[0091] 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. .
[0092] 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.
[0093] 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.
[0094] 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:
[0095] 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;
[0096] 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.
[0097] 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.
[0098] 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;
[0099] 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.
[0100] 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.
[0101] 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:
[0102] (1) Obtaining ship motion history data;
[0103] (2) Perform model training / test dataset splitting;
[0104] (3) Use the frequency-domain prediction module to perform: extensible spectrum transformation, complex-valued attention calculation network, sequence backward clipping; and use the time-domain prediction module to perform: linear mapping transformation, real-valued attention calculation network, inverse linear mapping transformation;
[0105] (4) Dynamic spectrum energy weighting;
[0106] (5) Obtain the ship motion time history prediction result.
[0107] Embodiment 3, Figure 2 The ship motion prediction system based on dynamic periodic pattern recognition and weighting provided by the embodiment of the present invention includes:
[0108] The training set and test set obtaining module 1 is used to segment the ship's motion time history data in a certain degree of freedom to obtain the training set for time history prediction and the test set ;
[0109] The input dataset and output dataset construction module 2 is used to set the historical input step and the advance prediction step , and construct the input training dataset and the test set of the multi-period pattern dynamic prediction model, the output training dataset , the input test dataset and the output test dataset ; ;
[0110] The frequency-domain prediction module 3 is used to input each segment of the input data into the frequency-domain prediction module for prediction according to the obtained input training dataset to obtain the frequency-domain prediction result ;
[0111] The time-domain prediction module 4 is used to input each segment of the input data into the time-domain prediction module for prediction according to the obtained input training dataset to obtain the time-domain prediction result ;
[0112] The corresponding weight ratio obtaining module 5 is used to calculate the main frequency energy ratio of each segment of the input data according to the obtained input training dataset to obtain the corresponding weight ratio; wherein, the corresponding weight ratio includes: the weight ratio of the frequency-domain prediction result and the weight ratio of the time-domain prediction result ;
[0113] The final prediction result obtaining module 6 is used to obtain the weight ratio of the frequency-domain prediction result and the weight ratio of the time-domain prediction result , and multiply them with the obtained frequency-domain prediction result and the time-domain prediction result respectively to obtain the final prediction result, and calculate the loss function by comparing with the output training data in the output training data set ;
[0114] The test data set prediction result obtaining module 7 is used to input the obtained input test data set into the trained multi-period mode dynamic prediction model. Each input test data is sequentially solved by the model to obtain the test data set prediction result.
[0115] The ship motion time history data selects the zero-speed long-crested irregular wave tank test data of the ship model. The tank test is carried out in the towing tank of a certain university. The verification work of the method of the present invention is carried out based on the ship model motion data obtained from the test. The towing tank of a certain university is 150 meters long, 7 meters wide, and 3 meters deep, equipped with a wave maker and a trailer. The ITTC double-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, and the scale ratio is 1:50. The ship model equipped with an inclination sensor and a displacement sensor is fixed on the trailer, and the long-crested irregular waves under sea states of level 4, level 5, and level 6 are simulated by the wave-making board respectively, and the rolling motion of the ship model is measured in real time. The time step of the finally 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 Figure 3 shown.
[0116] Step 1: Segment the ship motion time history data of a certain degree of freedom to obtain the training set and test set for time history prediction. The specific method of the above step 1 is that the known ship motion time history data of a certain degree of freedom is , where is the number of data of the ship historical motion time history; the ship historical motion time history data is segmented into a training set: , test set ; among them, the number of data in the training set is , and the number of data in the test set is . The number of data in the training set and the test set are set according to actual needs.
[0117] Step 2: Set the historical input step and the advance prediction step , and according to the training set and the test set Construct the input dataset and output dataset of the model. The specific method of step 2 is to use the training set data Extract by the sliding window method And ; Among them, Is the input length, Is the output length; The set obtained Is the input training dataset , The set obtained Is the output training dataset ; Use the test set data Extract by the sliding window method And ; The set obtained Is the input test dataset , The set obtained Is the output test dataset .
[0118] Step 3: According to the input training dataset obtained in step 2 , Input each segment of input data into the frequency domain prediction module for prediction. The specific method of predicting in the frequency domain prediction module in step 3 is to, according to the input training dataset obtained in step 2 , Fill the zero value vector Behind the input training data To obtain the extended input training data ; Convert the extended input training data From the time domain to the frequency domain through the fast Fourier transform to obtain the extended input training spectrum data , Perform the above operations on each input training data In the input training dataset To obtain the extended input training spectrum dataset ; Input each training spectrum data In the obtained extended input training spectrum dataset Into the complex-valued attention calculation network in sequence, and expand it to the D-dimensional hidden space In the network, where Is determined according to the actual situation; In the D-dimensional hidden space Are respectively passed through the learnable vector , Learnable vector And learnable vector To generate the query matrix , Key matrix And value matrix , Where Determined 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 , where represents the normalized exponential function, represents the vector transpose; the attention input result H is mapped back to the original spectrum dimension through linear transformation to obtain the spectrum matrix ; the spectrum matrix is subjected to inverse fast Fourier transform to obtain the extended model prediction result , for the extended model prediction result perform sequence backward cropping, only keeping the last data to obtain the frequency domain prediction model prediction result .
[0119] Step 4: According to the input training data set obtained in Step 2, input each segment of the input data into the time domain prediction module for prediction. The specific method for predicting by the time domain prediction module in Step 4 is that according to the input training data set obtained in Step 2, is sequentially input into the real-valued attention calculation network, and is extended to the dimensional hidden space through linear mapping in the network, where is determined according to the actual situation; in the dimensional hidden space are respectively generated into the query matrix , key matrix and value matrix through the learnable vector , learnable vector and learnable vector ; where is determined 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 ; where represents the normalized exponential function, represents the vector transpose; the attention input result is mapped back to the original dimension through linear transformation to obtain the time domain prediction model prediction result .
[0120] Step 5: According to the input training data set obtained in Step 2, calculate the main frequency energy proportion of each segment of the input data therein to obtain the corresponding weight proportion. The specific method for calculating the main frequency energy proportion and generating the corresponding weight proportion in Step 5 is that according to the input training data set obtained in Step 2, for the Perform Fourier transform successively to generate a set of frequency-domain components of the input training data ; For each frequency component in , arrange them in descending order of numerical value, and obtain the frequency component with the largest numerical value as the main frequency , where is the subscript corresponding to the main frequency; Expand from the main frequency to both ends to obtain a set of main frequency ranges , where is the radius of the main frequency range, which can be determined according to the actual situation; Calculate the proportion of the main frequency energy according to the set of main frequency ranges and the set of frequency-domain ranges ; Obtain the weight proportions corresponding to the time-domain prediction result and the frequency-domain prediction result according to the proportion of the main frequency energy, where the weight proportion of the frequency-domain prediction result is , and the weight proportion of the time-domain prediction result is . As shown in . Such as Figure 4 the weak periodic mode segment of the ship's pitching motion history
[0121] and as shown in Figure 5 the strong periodic mode segment of the ship's pitching motion history
[0122] Step 6: According to the weight proportion of the frequency-domain prediction result and the weight proportion of the time-domain prediction result obtained in step 5, multiply them with the frequency-domain prediction result and the time-domain prediction result obtained in steps 3 and 4 respectively to get the final prediction result, and compare it with the output training data in the output training dataset to calculate the loss function. The specific method for obtaining the final prediction result and calculating the loss function in step 6 is to multiply the frequency-domain prediction model prediction result obtained in step 3 with the weight proportion of the frequency-domain prediction result obtained in step 5, and at the same time multiply the time-domain prediction model prediction result obtained in step 4 with the weight proportion of the time-domain prediction result obtained in step 5, and the output final prediction result is . Multiply the final prediction result with the corresponding output training data to calculate 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 and the corresponding output training data The error between them continuously decreases, and a trained model is obtained after multiple iterations.
[0123] Step 7: Input the input test data set obtained in Step 2 into the trained model in Step 6. Each input test data is successively solved by the model to obtain the prediction result of the test data set. The specific method of Step 6 is as follows. For the model input test data set obtained in Step 2 , for each piece of training input data therein input into the trained model in Step 6, and the prediction result of the test data set is successively obtained through model solution . Such as Figure 6 the prediction result of the ship's pitching motion 30 seconds in advance, and Figure 7 the prediction result of the ship's pitching motion 50 seconds in advance, Figure 8 the prediction result of the ship's pitching motion 70 seconds in advance shown. Table 1 shows the statistical table of the error calculation results of the time history prediction result of the ship's pitching motion.
[0124] Table 1 Statistical table of the prediction error of the ship's pitching motion
[0125]
[0126] Such as Figure 9 shown in the statistical analysis of the prediction error of the ship's pitching motion. From the comparison between the prediction time history curve and the real curve, this method can achieve good prediction results both in amplitude and phase. From the error curve, the error of this method is relatively stable in different advance prediction time lengths, indicating that this method can effectively extend the prediction time length of ship motion while ensuring high precision, and can provide effective information for subsequent ship auxiliary decision-making and avoiding potential risks.
[0127] The above is only a relatively preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any modification, equivalent replacement, and improvement made by those skilled in the art within the technical scope disclosed by the present invention, as long as they are made within the spirit and principle of the present invention, should be covered by 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 D of the time history forecast tr and the test set D te ; S2: Set the historical input step size back and the advance prediction step size ahead, according to the training set D tr and the test set D te Constructing the input training data set X for the multi-period pattern dynamic forecast model tr , output training data set Y tr , input test data set X te And the output test data set Y te ; S3: Based on the obtained input training data set X tr , input each segment of input data into the frequency domain prediction module for prediction, and obtain the frequency domain prediction result S4: Based on the obtained input training data set X tr , input each segment of input data into the time domain forecast module for forecasting, and obtain the time domain forecast result S5: Based on the obtained input training data set X tr , calculate the main frequency energy proportion of each segment of input data, and obtain the corresponding weight proportion; among which, the corresponding weight proportion includes: the weight proportion of frequency domain prediction result θ freq and the weight ratio of the time domain forecast results θ time ; S6: According to the obtained frequency domain forecast result weight ratio θ freq and the weight ratio of the time domain forecast results θ time , and the frequency domain prediction results obtained And time domain forecast results Multiply them respectively to get the final prediction result and add it to the output training data set Y tr Compare and calculate the loss function; S7: Input the test data set X obtained in step S2 te 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. In step S3, the frequency domain prediction module performs prediction, including: According to the input training data set obtained Input training data in it Fill the back with zero value vector Get extended input training data Among them, back is the historical input step length, and ahead is the advance prediction step length; 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. Among them, w i is the frequency component after Fourier transform; for the input training data set X tr 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 W tr Each training spectrum data Input the complex-valued attention computing network in sequence, and expand it to the D-dimensional latent space through linear mapping in the complex-valued attention computing network in, is a vector in the D-dimensional latent space; In D-dimensional latent space Through the learnable vector Learnable vectors and the learnable vector Generate query matrix Q = λ Q Γ tr , key matrix K = λ K Γ tr Sum value matrix V = λ V Γ tr ; Perform complex-valued dot product attention on the query matrix, key matrix, and value matrix to obtain the attention output result H = softmax(QK T )Vwhere softmax() is the normalized exponential function and T is the vector transpose; The attention input result H is mapped 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 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.
2. The ship motion prediction method based on dynamic periodic pattern recognition and weighting according to claim 1 is characterized in that: Prediction results of the extended model After backward pruning of the sequence, only the last ahead data is retained to obtain the prediction result of the frequency domain prediction model.
3. 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 X tr Input the real-valued attention calculation network in sequence, and expand it to the S-dimensional latent space through linear mapping in the real-valued attention calculation network in, is a vector in the S-dimensional latent space; In S-dimensional latent space Through the learnable vector Learnable vectors 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.
4. The ship motion prediction method based on dynamic periodic pattern recognition and weighting according to claim 3 is characterized in that: The attention output is: Among them, softmax() is the normalized exponential function, T is the vector transpose, and the prediction result of the time domain prediction model is in, is the value at each forecast time point.
5. 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 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; tr 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. Where ρ is the subscript corresponding to the main frequency; Expand to both ends from the center to get the main frequency range set Among them, ψ is the radius of the main frequency range; According to the main frequency range set Δ main With the frequency domain range set Δ tr Calculate the main frequency energy ratio The weight ratios of the time domain forecast results and the frequency domain forecast results are obtained according to the main frequency energy ratio.
6. The ship motion prediction method based on dynamic periodic pattern recognition and weighting according to claim 5 is characterized in that: The weight of the frequency domain forecast result is θ freq =θ, the weight of the time domain forecast result is θ time =1-θ.
7. 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 add it to the output training data set Y tr 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 prediction result obtained in step S5 freq 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 time 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 prediction model continuously adjusts the parameter settings of the internal network structure according to the loss function, so that the final prediction results The corresponding output training data The error between them keeps decreasing, and after many iterations, a trained model is obtained.
8. 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 Input data for each training segment 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.
9. 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 8, 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 D of the time history prediction. tr and the test set D te ; The input dataset and output dataset construction module (2) is used to set the historical input step size back and the advance prediction step size ahead according to the training set D tr and the test set D te Constructing the input training data set X for the multi-period pattern dynamic forecast model tr , output training data set Y tr , input test data set X te And the output test data set Y te ; The frequency domain prediction module (3) is used to obtain the input training data set X tr , 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 obtain the input training data set X tr , 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 obtaining module (5) is used to obtain the input training data set X tr , calculate the main frequency energy proportion of each segment of input data, and obtain the corresponding weight proportion; among which, the corresponding weight proportion includes: the weight proportion of frequency domain prediction result θ freq and the weight ratio of the time domain forecast results θ time ; The final forecast result is obtained in module (6), which is used to calculate the weight ratio θ of the frequency domain forecast result. freq and the weight ratio of the time domain forecast results θ time , and the frequency domain prediction results obtained And time domain forecast results Multiply them respectively to get the final prediction result and add it to the output training data set Y tr 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 X te 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
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