Directional Wave Spectrum Estimation with Ship Motion Responses using Adversarial Networks

The external environmental conditions around a vessel are essential for efficient and safe ship operation, among which the sea state is of key importance. Considering the ship as a large wave buoy, the sea state can be estimated from motion responses without extra sensors installed. This is a challenging task since the relationships between the waves and the ship motions are hard to describe accurately. Machine learning approaches can learn these mapping without an explicitmodel, whichispromisingforseastateestimation. Currentmachinelearningapproaches represent the sea state as a set of categories or a number of wave parameters while neglecting the 2D wave spectrum. This paper proposes a sea state estimation network that estimates the 2D wave spectrum along with a discrimination network. The discrimination network can detect and correct high-order inconsistencies of the spectrum. Simulation studies are performed to show that the proposed method can provide wave spectrum estimation with high accuracy.


Introduction
Environmental conditions are of key importance for efficient and safe ship operations.The external wave conditions are one of the crucial factors affecting the dynamics of a vessel.The continuous sea state information around a ship are valuable for providing onboard decision supports and operational guidance, including takeoff and landing of helicopters, crane operations.By incorporating knowledge about sea states, the safety of the operations can be increased and even more efficient.Therefore, in-situ sea state estimation is important for any type of decision support and system with high level of autonomy.
In oceanography, the general condition of the ocean with respect to wind waves and swell at a certain location is referred to as the sea state.The waves are stochastic with time and it is almost impossible to evaluate on a waveby-wave basis in the time domain (Ochi, 2005).The ocean waves are considered to be a stochastic process and their statistical properties can be evaluated in the frequency domain.Specifically, the potential and kinematic energies of stochastic waves are represented by the wave spectrum.
Nowadays, the primary tool for collecting accurate ocean wave statistics is floating wave buoys.However, They are not practical for a vessel in maneuvering operation since they are fixed at a specific location.Meteorological satellite can also provide wave statistics, but the resolution is often poor.The x-band wave radar provides in-situ wave spectrum, but it is expensive to install, requires frequent calibration (Stredulinsky and Thornhill, 2011), and is yet only equipped on a limited number of vessels.Similar to the wave buoy, the motion responses of a vessel reflect the sea state conditions and therefore a vessel can also be considered as a large wave buoy.The majority of marine vessels today are equipped with sufficient sensors that measure the ship motion in 6 degrees of freedom.Therefore, a vessel is essentially equipped with an environmental condition estimation system (Brodtkorb, Nielsen and Sørensen, 2018).
Estimating the sea state based on ship motions has been a topic of interest in the literature.This task is challenging due to the operation of the vessel, as well as the inaccurate relationship between waves and the ship motions.Ship responses, in principle, are non-linearly related to wave excitation.Previous methods usually rely on the response amplitude operators (RAOs) to relate the waves and the ship motions.RAOs are usually calculated by linearizing the results from strip theory or computational fluid dynamics and therefore only valid for light and moderate sea states (Nielsen, 2005).In addition, RAOs might need to be tuned with real-world data.Another possible solution is to treat the task as a supervised machine learning problem.The fundamental idea is to learn the mapping from measured ship motion responses to the actual sea state from historical data.The advantage of data-driven methods is that it does not require specific knowledge of the vessels to discover the pattern between ship motions and sea states.
Sea state estimation with ship motion responses based on machine learning approaches is usually regarded as a classification or regression task.The sea state is predefined as multiple categories (Cheng, Li, Ellefsen, Chen, Hildre and Zhang, 2020) or represented by several integrated wave parameters (Han, Li, Cheng, Skjong and Zhang, 2021a), e.g., significant wave height and peak period.Pre-defining the sea state categories might be problematic since it is difficult to use limited categories to cover all possible sea states.The resolution of the estimation results might also be too low for practical use.The integrated wave parameters are a summary expression of the wave spectrum.These two methods, either classification or regression, only provide limited information on the sea state.Ideally, a 2D directional wave spectrum could be estimated to fully describe the sea state.In addition, the 2D directional wave spectrum is fundamental for operational safety analysis such as extreme value analysis.
In such a context, this work aims to build a machine learning model for estimating the 2D directional wave spectrum using ship motion responses.The proposed model follows the generative adversarial networks (Goodfellow, Pouget-Abadie, Mirza, Xu, Warde-Farley, Ozair, Courville and Bengio, 2014) architecture.Two separate deep convolutional neural networks, an estimation network, and a discrimination network are established.The estimation network uses the ship motion as input and estimates 2D wave spectrum.The discrimination network tries to classify the 2D wave spectrum as real or fake.In this way, an adaptive loss is learned and unrealistic wave spectrum will not be tolerated.Simulation studies show that the proposed method can provide estimates of wave spectrum based on ship motions.To the best of our knowledge, it is the first time that an adversarial network is used in sea state estimation.The main contributions of this paper are highlighted as follows: • A novel model is developed to estimate the 2D directional wave spectrum using the measured ship motion responses.It can estimate a wide range of sea state conditions.
• Extensive simulation studies are performed to validate the proposed method and comparison with model-based method is made.
• The proposed model performs well in estimating different types of spectra and is robust regarding noisy measurements.
The remainder of this paper is organized as follows: A literature review on sea state estimation using ship motion responses is given in Section 2. The proposed adversarial neural network is introduced in Section 3. The experimental setup and experiment are discussed in Section 4. Section 5 concludes the paper.

Literature review
Estimating the sea state information based on the motion responses has been investigated in the literature.Previous works differ in whether the estimation problem is formulated in the frequency domain or time domain.In the frequency domain solution, the time series motion responses are first transformed into the frequency domain through fast Fourier transform or autocorrelation analysis.The RAOs are used to relate the wave spectrum to the motion spectrum.To obtain the wave spectrum, the fundamental idea is to minimize the difference between the measured ship spectrum and the calculated ship spectrum (Nielsen, 2006).A wave spectra, e.g., JONSWAP, Bretschneider with the  2 spreading model, can be assumed.In this way, a nonlinear optimization process is formed, the wave parameters in the hypothetical wave spectrum can be obtained through optimization techniques (Tannuri, Sparano, Simos and Da Cruz, 2003;Han et al., 2021a).This method is computationally intensive and may not converge since the objective function is nonlinear and non-convex.A non-parametric approach, in which the wave spectrum is represented in a discrete frequency-directional domain, can also be applied.The problem is an ill-posed problem and therefore different kinds of prior are used, e.g., the smoothness of wave spectrum (Iseki and Ohtsu, 2000;Ren, Han, Verma, Dirdal and Skjetne, 2021) and the sparsity of wave spectrum (Ren et al., 2021).These methods can be extended to ships with forward speed by incorporating the Doppler shift function (Iseki and Ohtsu, 2000).The effectiveness of this method is shown with a container ship (Nielsen and Dietz, 2020).
For the time domain solution, the focus is on real-time sea state updates obtained from continuous response measurements.A framework based on the Kalman filter is established (Pascoal and Soares, 2009;Pascoal, Perera and Soares, 2017), in which an irregular wave represented as a number of regular waves.In the Kalman filter framework, the amplitude and frequency of the regular waves are treated as states.The waves are considered constant between two discrete time intervals.A similar second-order nonlinear observer is developed to estimate the frequency of wave (Belleter, Galeazzi and Fossen, 2015).In addition, the optimization can be performed directly in the time domain (Nielsen, Galeazzi and Brodtkorb, 2016).However, the latter two approaches can only estimate a single sinusoid wave.
The above methods are model-based approaches that require a model to relate the wave and the ship motion.Machine learning is another solution that learns that mapping from measured ship motion responses to the sea state.The sea states are usually predefined into various categories (Tu, Ge, Choo and Hang, 2018;Cheng et al., 2020) or represented as several integrated wave parameters (Mak and Düz, 2019;Han, Li, Skjong, Wu and Zhang, 2021b) depending on whether this task is formulated as a classification task or a regression task.Various machine learning models, e.g., multi-layer perceptron, Gaussian process, deep learning models, have been utilized.However, these methods can not provide a detailed 2D wave spectrum that is usually required in practical applications.Kawai, Kawamura, Okada, Mitsuyuki and Chen (2021) estimated the 2D wave spectrum using convolutional neural network.The problem is still considered as a regression problem.They estimated 8 parameters of the Ochi-Hubble-type spectrum from the neural network, and then reconstructed the 2D wave spectrum.In this paper, no specific form of wave spectrum is assumed.The focus of this paper is to bridge the gap by developing a machine learning model that estimates the 2D wave spectrum directly without assuming the structure of wave spectrum.

Methodology
The proposed method consists of two separate networks, as outlined in Figure 1.The inputs are the cross spectrum of the ship motion.The cross spectrum is normalized and then fed into the estimation network to be converted into a 2D wave spectrum.In this paper, no specific form of wave spectrum is assumed, and the output 2D wave spectrum from the estimation network is represented as a 36 by 100 matrix.In other words, there are 36 discrete directions and 100 discrete frequencies.The discrimination network takes a 2D wave spectrum as input and distinguishes whether it is generated from the estimation network or is the actual wave spectrum.In the training phase, the estimation network tries to generate a realistic wave spectrum while the discrimination network tries to distinguish it.In this way, the two networks are improved together and the high-order statistics of the output wave spectrum are penalized to force the estimation network to provide continuous and realistic results.At inference time, the discrimination network is omitted, and the estimation network is used to output the estimated 2D wave spectrum from ship motion responses.

Channel-wise normalization
Since the input for the proposed network is the cross-spectrum of the ship motion, the cross-spectrum is assigned into different channels to form multi-channel 1D inputs.The inputs are then normalized to the range [0, 1] with respect to its channel.Specifically, each channel (each component of the cross-spectrum) maintains its statistics and it is normalized individually.

Data augmentation with noise
Data augmentation is a technique for improving the robustness and training of neural networks.The idea is to simulate various expected variations in the datasets by manipulating the training samples.Since the inputs for the proposed estimation network is a spectral representation of the motion responses, the augmented spectral signal is formulated as follow: where   and  are the augmented and original spectrum, respectively.⊙ is the element-wise Hadamard product. denotes the normal distribution while  denotes the uniform distribution.In this approach, the original spectrum is augmented randomly in each training epoch since the noise level  2 is drawn from a distribution.The noise added also depends on the value of the spectrum.Figure 2 shows two examples of the augmented spectrum.

Network architectures
Estimation network.The proposed estimation network follows an encoder-decoder structure.In the network, the input is passed through a series of 1D convolution layers that progressively downsample, to a bottleneck layer, then the process is reversed, and upsampling is achieved by a series of transposed 2D convolution layers.In this way, the network takes the 1D data as inputs and outputs a 2D wave spectrum.The network uses modules in the form of convolution-BatchNorm-ReLu.The ResNet block (He, Zhang, Ren and Sun, 2016) is used in this network since it provides better performance in many applications.For the output layers, the Sigmoid activation function is applied.
Discrimination network.The discrimination network follows a convolutional neural network structure, in which the modules in the form of convolution-BatchNorm-LeakyReLu are used.The LeakyReLu activation function is used since it can stabilize the training (Radford, Metz and Chintala, 2015).
Details of the architectures of the estimation network and discrimination network are presented in Appendix A.

Adversarial training
A hybrid loss which is a weighted sum of two terms is used.The first is the mean square error that encourages the estimation model to predict the wave spectrum.The second loss term is based on the adversarial convolutional network.This loss term is large if the adversarial network can discriminate the output of the estimation network from the actual wave spectrum.The aim of the adversarial term is to penalize mismatches in the high-order spectral power value statistics, e.g., the power value of wave spectrum should be smooth in the near region, which is not accessible by the mean square loss function.
Given a training ship motion responses  and a corresponding wave spectrum , the estimator  and the discriminator  would be competed in a two-player min-max optimization routine: where   is the mean square loss, .  is a hyperparameter to balance these two different losses.
The training of the estimation model minimizes the mean square error loss while at the same time trying to fool the discriminator model.The objective function of the estimation model is: In practice, the term −  ((, ()), 0) is replaced by +  ((, ()), 1) (Goodfellow et al., 2014).This means that the probability that the adversarial model predicts the estimated wave spectrum to be the actual one is maximized, instead of minimizing the probability that the adversarial model predicts the estimated wave spectrum to be synthetic.
For the adversarial model, only the binary classification loss is related.Therefore, training the adversarial model is equal to minimizing the following objective function:

Implementation details
The proposed model is implemented in Pytorch.To optimize the proposed network, we alternate between one gradient descent step on , then one step on .The Adam solver (Kingma and Ba, 2014) with minibatch is used to minimize the objective function for  and .The minibatch size is set as 256 in the training procedure.For the estimation network , a learning rate of 1 × 10 −4 with  2 regularization term of 1 × 10 −3 is used.For the discriminating network , a learning rate of 1 × 10 −5 with  2 regularization term of 1 × 10 −3 is used.The hyperparameter  is set as 0.01 to balance the losses.

Data
The wave spectrum-ship motion pairs are generated from simulations.In the simulations, a double-peak wave spectrum (Hogben and Cobb, 1986) is adopted since it covers a wide range of possible spectrum shapes and it models both the wind waves and the swell waves.The directional wave spectrum is given by: where   is the significant wave height,   is the mean wave direction and   is the model angular frequency. and  are two shape parameters.Γ demotes the Gamma function.The function () is defined as: Note that the above wave spectrum model   (, ) is only used to generate the simulation data for this study and will not be used in our estimation network model.NTNU's research vessel R/V Gunnerus with a length between perpendiculars of 28.9m, a breadth of 9.6m, and a draught of 2.7m is used as the example vessel (NTNU, 2021).The complex-valued response amplitude operators (RAOs) of the vessel are obtained from ShipX (Fathi, 2004).The ship motion cross-spectra is then calculated as: where Φ(, ) is the complex-value transfer function and Φ(, ) is its complex conjugate.
In this study, the wave spectrum is discretized into a 36 × 100 grid after generating from Eq. ( 5), where 36 different headings with interval of 10 • and 100 angular frequencies from 0.2∕ to 3∕ is considered.It is equal to the output wave spectrum shape from our estimation network, and therefore validation can be easily performed.Three corresponding ship motions, sway velocity, pitch, heave, are used.This results in 9 power spectra (6 real part and 3 imaginary part) and therefore the size of response spectrum is 9 × 100.The used wave spectrum consists of 10 parameters [ ,1 ,  ,1 ,  ,1 ,  1 ,  1 ,  ,2 ,  ,2 ,  ,2 ,  2 ,  2 ].These parameters are sampled randomly to generate 1000 different wave spectrum, the sampling range is described in Table 1.Note that  is an integer.The corresponding ship motion cross spectrum is then calculated, forming a dataset with 1000 wave spectrum-ship motion pairs.The dataset is then divided into 500 as training set and the rest 500 as test set.The reason why 500 samples are used in the test set is because these samples can cover the wave space of interest.

Time series generation
Ship motions, in principle, are measured in the time domain.To generate time series of ship motions under a specific wave spectrum, we follow the procedure in (St Dinis and Pierson Jr, 1953).The time-domain ship motion response () can be expressed as follow: where  is the discrete number of wave frequencies and  is the discrete number of headings. denotes the complex transfer function and  is the wave spectrum.Δ  and Δ  are the increments of the discrete wave frequencies and the discrete headings.It is noteworthy that for an equidistant frequency discretization, the time series response () will repeat itself after a period of 2∕Δ.A simple way to handle this problem is to use non-equidistant frequency discretization: where  is a small factor and it is chosen as 0.01 while   is a stochastic variable with values between 0 and 1.We generate 1800 seconds long time series responses for sway velocity, pitch, and heave.
To simulate the noisy measurements, Gaussian white noise is then added to the time series motion response.The signal-to-noise ratio (SNR) is used in this study to measure the noise level.The SNR is defined in eq. ( 10), where   and   is the standard deviation of the measured motion response and noise, respectively.

Integrated wave parameters
The overall outcome of the proposed model is given by a directional wave spectrum (, ).For comparison, the integrated wave parameters are then evaluated.The spectral moment of order  is defined as (Faltinsen, 1993): Thus, the significant wave height   and the mean wave period   can be calculated as follows: The mean wave direction   and the mean directional spread   is given by: where  and  are defined as: The mean directional spread   is a parameter representing the spread of the spectrum.Specifically,   decreases as the shape parameter  increase in the cos2s spreading function.The smaller the   , the directional spread is broader.The wave spreads equally in all directions when   is close to 1.4.

Description on the generated data
Figure 3 shows the distribution of the integrated wave parameters of the generated dataset.The significant wave height   ranges from around 0.7 to 5.3.The mean wave period   is around 2 to 14 while the mean directional spread   is around 0.2 to 1.4.The mean wave direction   is distributed uniformly from 0 • to 360 • .This dataset covers a wide range of sea states that the vessel might encounter in the real world.
Figure 4 presents a sample from the dataset.The sea state is described as a 2D wave spectrum.The integrated wave parameters   ,   ,   ,   are the summation of the 2D wave spectrum.The cross spectrum of motion responses as well as the time series of the ship motion is presented.In the cross spectrum, the subscripts 1, 2, 3 denotes sway velocity, pitch, heave, respectively.The cross spectrum of motion responses will be used as the input and the target is to estimate the 2D wave spectrum.

Evaluation metrics
To evaluate and compare the performance of the proposed model, the mean absolute error (MAE) is used: where  is the number of samples, ŷ and  is the estimated and actual value, respectively.In this paper, the MAE of the discrete wave spectrum and the MAE of the integrated wave parameters are evaluated.For abbreviation, the MAE of the wave spectrum is referred to as the pixel error in the rest of the paper.For mean wave direction, Eq. ( 15) is to consider that 0 • and 360 • are the same.

Experimental results
In this section, the performance of the proposed method will be evaluated.Two baseline models are implemented for comparison: • Bayesian wave buoy analogy method: This method is a model-based method for directional wave spectrum estimation using ship motion responses.The wave spectrum is represented in a discrete frequency-directional domain.The fundamental idea is to minimize the difference between the measured and the calculated spectrum.However, this forms an ill-posed inverse problem, and therefore smooth prior is introduced to solve the problem in the Bayesian framework.In this paper, a two hyperparameters method (Nielsen, 2008) is used.The two hyperparameters are responsible for the smooth prior of wave spectrum in the discrete frequency and discrete direction, respectively.Details of this method is described in Nielsen (2008).In the following, the Bayesian wave buoy analogy method is denoted as "WBA", the neural network model without adversarial training is denoted as "Proposed w/o AT", and the proposed neural network model with adversarial training is denoted as "Proposed w AT".

Experiment with perfect response spectrum
In this part, the perfect measured response cross spectrum is used for validation.Figure 5 presents the estimated directional wave spectrum from three random samples in the test set.The colors of values larger than the color bar upper limits remain the same as that of the upper limit.It is shown that the Bayesian WBA method provides a similar shape of the spectrum as the actual ones but the values are less accurate.The reason is that the performance of this method depends on the two hyperparameters and the initial guess of the wave spectrum.In this paper, several combinations Figure 6 shows the correlation between the actual and estimated integrated wave parameters of the test data.The black line denotes that the estimated parameter is equal to the actual one.It is observed that both methods provides relatively accurate results.The WBA tends to provide lower estimated   than the actual one and it is not that accurate for .The proposed method with adversarial training provides more accurate estimation in terms of   and .However, the proposed network have low variability in terms of estimating   and   for most samples, some of which are quite different from actual estimates.

Generalization to JONSWAP-type wave spectrum
As presented in Section 4.1, the training data is generated through a double Pierson-Moskowitz type wave spectrum.This type of spectrum might not cover the possible wave spectrum.Therefore, the zero-shot learning ability of this model to other types of wave spectrum is investigated.
In this part, the generalization ability of the model is evaluated with the JONSWAP-type wave spectrum.The JONSWAP type spectrum has a more pronounced peak in the spectrum than the Pierson-Moskowitz (PM) type wave spectrum.The JONSWAP wave spectrum and the Torsethaugen wave spectrum (a double peak JONSWAP-type spectrum) are used to generate two extra test sets with 100 samples, respectively.The trained model is then used to estimate the 2D wave spectrum.Figure 7 shows the estimated 2D wave spectrum from two examples in the two extra test sets, respectively.The proposed model presents a less narrow spectrum than the actual one, which might be due to the Pierson-Moskowitz type wave spectrum used in the training data.Nonetheless, the proposed model still provides a reasonable estimate.
Figure 8 summarizes the MAE of   ,   ,   ,  for the JONSWAP and Torsethaugen wave spectrum.The proposed model achieves the lowest deviation among these three methods.It demonstrates that the proposed model successfully captures the relation between ship motion and wave spectrum, therefore, it is able to estimate the type of wave spectrum not present in the training data.
Figure 9 shows that correlation of actual and estimated integrated wave parameters from JONSWAP and Torsethaugen wave spectrum.It is shown than the proposed model provides accurate estimation in terms of   ,   , and   for both wave spectrum.However, the model gives higher  than the actual one.The reason might be that for the training data samples a broader range of directional spreading functions than the test data here.Specifically, the  parameter in the cos2s spreading function is sampled in the range of [1,26] for the training data while [5,26] for the JONSWAP-type spectrum, which results in a smaller range of .The model can not adjust to the distribution shift since it is in zero-shot setting.

Effect of noisy ship motion measurement
Ship motions are measured in the time domain.In order to use the proposed approach, the ship motion in the time domain must be transformed into the frequency domain through cross spectrum analysis.The cross spectrum analysis typically is performed through fast Fourier transform or multivariate autoregressive modeling, which would inevitably introduce a certain deviation from the actual motion response spectrum.In addition, noise in the measured ship motion would introduce a certain degree of error.In this section, the effect of cross spectrum analysis and the noises in ship motion on the estimated results will be evaluated.The cross spectrum analysis in this paper is performed through the Welch method.White noise is added and four different SNR levels, 10, 5, 2, 1, are investigated.For simplification, the time series ship motion without noise added is denoted as "SNR=+∞".In "SNR=+∞", only the effect of cross spectrum analysis is included.Figure 10 presents an example of an estimated 2D wave spectrum under different SNR levels.From the estimates for the perfect response spectrum and SNR=+∞, the power value and spectral shape are changed due to the cross spectrum analysis.As the SNR level decreases, the quality of the estimates, usually but not definitely, also decreases.In general, the estimated 2D wave spectrum is relatively close to the actual wave spectrum.
Figure 11 compares the MAE of integrated wave parameters in WBA and the proposed model under different SNR levels.The proposed model is less sensitive to noise than the WBA.The WBA method shows low error in   while the proposed model has low error in   ,   and .

Conclusion
Estimating the sea state based on the measured ship motion response is a complicated and arduous task.Previous machine learning approaches can not capture the directional wave spectrum.This paper presents an estimation network and discriminant network based on convolutional neural networks.The high-order inconsistencies of the wave spectrum from the estimation network are penalized by the estimation network, thereby forcing the estimation network to produce accurate and realistic results.Simulation studies show that the proposed model guarantees the smoothness of the wave spectrum and provides accurate estimation results.The generalizability of the method is demonstrated by estimating the JONSWAP-type spectrum that is not in the training set.Comparison with the model-based Bayesian WBA approach indicates that the proposed model is more robust to measurement noises.
Nonetheless, the proposed method suffers from the typical drawback of the machine learning model, e.g., a large amount of data is required.The necessity of collecting wave spectrum makes it even harder to collect in real-world scenarios.In addition, the training of adversarial networks might be unstable and requires careful tuning.Future works will focus on transferring the model trained in simulated environments to the real world, as well as including the vessels with advancing speeds.

Figure 1 :
Figure 1: Schematic illustration of the proposed model for 2D directional wave spectrum estimation using ship motion responses.

Figure 2 :
Figure 2: Examples of augmentation on the spectral inputs.

Figure 3 :
Figure 3: Distribution of the integrated wave parameters in the generated dataset.

Figure 4 :
Figure 4: A sample from the generated dataset.The left upper graph is the 2D wave spectrum and its integrated wave parameters.The right upper graphs are the cross spectrum of motion responses.The lower three graphs are the time series data of these three ship motions.

Figure 5 :
Figure 5: Examples of contour plots of the estimated directional wave spectrum based on perfect motion spectrum.

Figure 6 :Figure 7 :
Figure 6: Actual and estimated integrated wave parameters for perfect response spectrum.

Figure 8 :Figure 9 :
Figure 8: MAE of the integrated wave parameters for the JONSWAP and Torsethaugen wave spectrum.

Figure 10 :Figure 11 :
Figure 10: Examples of contour plots of the estimated directional wave spectrum with different SNR levels.
Architectures of the discrimination network.

Figure A. 1 :
Figure A.1: Architectures of the estimation and discrimination network.

Table 2
MAE of different methods on the test set This model is the estimation network proposed in this paper.The discriminator network is neglected by setting the hyperparameter  as 0. This model is implemented to show the effect of adversarial training.