## 3 Weather Data Feature Extraction  
First, feature extraction is applied to the input data. Among many environmental factors, wind speed and wave height are the two most direct variables affecting ship navigation. Therefore, this study selects wind speed and wave height as the input data of the model. Secondly, a convolutional neural network [40] is employed to extract three layers of features related to wind speed and wave height, which are then fed into a machine learning algorithm for model training. The feature extraction process is as follows:  
(1) Input Layer  
Let the input data be \(X\), and its expression is  
\[X(i,j)\in R^{H\times W} \tag{9}\]  
where \(H\) is the number of zonal grids, \(W\) is the number of meridional grids, and \(X(i,j)\) is the number of grids in row \(i\) and column \(j\). (2) Convolution Layer  
Each convolution kernel slides on the image, weights the local area, and adds bias terms to extract spatial local features:  
\[Y^{(f)}(i,j)=\sum_{m=0}^{k-1}\sum_{n=0}^{k-1}X(i+m,j+n)\cdot K^{(f)}(m,n)+b^{( f)} \tag{10}\]  
Figure 6: Spatial attention mechanism module. where \(K^{(f)}\) is the \(f\) convolution kernel, \(k\) is the convolution kernel size, \(b^{(f)}\) is the bias term, and \(Y^{(f)}(i,j)\) is the convolution output value. (3) Activation Function  
The ReLU activation function can introduce nonlinearity to the network so that it can fit complex features:  
\[Z^{(f)}(i,j)=max(0,Y^{(f)}(i,j)) \tag{11}\]  
where \(Z^{(f)}(i,j)\) is the feature value after activation, and \(\max(0,x)\) is the large value of 0 and \(x\). (4) Pooling Layer  
The pooling layer can down-sample each channel, retain the most significant features in the region, reduce size, and enhance invariance:  
\[P^{(f)}(i,j)= max\quad Z^{(f)}(s_{p}\cdot i+m,s_{p}\cdot j+n) \tag{12}\] \[0\leq n\leq p\]  
where \(p\) is the size of the pooling window, \(P^{(f)}(i,j)\) is the location of the pooling result, and \(s_{p}\) is the pooling step size. (5) Multilayer Stack  
More abstract and meaningful features can be extracted layer by layer by multiple convolution + activation + pooling layers:  
\[X^{(l)}=Pool(\sigma(X^{(l-1)}*L^{(l)}+b^{(l)})) \tag{13}\]  
where \(X^{(l)}\) is the output of layer \(l\), \(*\) is the convolution operation, \(\sigma(\cdot)\) is the activation function, and \(pool(\cdot)\) is the pooling operation. (6) Global Pooling  
Global pooling is the global average of each channel and retains the global spatial statistical information, which is suitable for lightweight modeling :  
\[v_{f}=\frac{1}{H\cdot W}\sum_{i=1}^{H}\sum_{j=1}^{W}X(i,j,f) \tag{14}\]  
where \(X(i,j,f)\) is the value of channel \(f\) at position \((i,j)\) in feature map \(X\). (7) Output Features  
The final output feature vector:  
\[v=CNN(X)\in R^{d} \tag{15}\]  
According to the above method, the feature extraction of the extracted model parameters is carried out. Taking the feature extraction process of 1 May 2021 00:00:00 UTC as an example, the three-layer feature extraction of the data is carried out, the extraction parameter settings are shown in Table 1, and the extracted features are shown in Figures 7-12. Figure 8: Conv2—wind speed features. \[Y^{(f)}(i,j)=\sum_{m=0}^{k-1}\sum_{n=0}^{k-1}X(i+m,j+n)\cdot K^{(f)}(m,n)+b^{( f)} \tag{10}\]0 Conv1—wind speed features. \[Y^{(f)}(i,j)=\sum_{m=0}^{k-1}\sum_{n=0}^{k-1}X(i+m,j+n)\cdot K^{(f)}(m,n)+b^{( f)} \tag{10}\]1 Conv1—wave height features. \[Y^{(f)}(i,j)=\sum_{m=0}^{k-1}\sum_{n=0}^{k-1}X(i+m,j+n)\cdot K^{(f)}(m,n)+b^{( f)} \tag{10}\]2 Conv3—wind speed features. \[Y^{(f)}(i,j)=\sum_{m=0}^{k-1}\sum_{n=0}^{k-1}X(i+m,j+n)\cdot K^{(f)}(m,n)+b^{( f)} \tag{10}\]3 Conv2—wave height features. \[Y^{(f)}(i,j)=\sum_{m=0}^{k-1}\sum_{n=0}^{k-1}X(i+m,j+n)\cdot K^{(f)}(m,n)+b^{( f)} \tag{10}\]4 Conv3—wave height features.