# Multifeature Fusion Neural Network for Oceanic Phenomena Detection in SAR Images
## 2 Multifeature Fusion Neural Network for Oceanic Phenomena Detection in SAR Images
### Parameter Optimization  
After determining the MFNN structure, it is necessary to train and optimize the parameters of the MFNN with the training dataset. First, we must define the loss function, which is used to describe the difference between the MFNN outputs and the ground truth of original input images. Class imbalance is a key problem in the actual calculation. Oceanic phenomena that occupy fewer pixels in the images  
Figure 4: Fusion and decision network structure.  
Figure 3: The structure of improved atrous spatial pyramid pooling (ASPP).  
have less influence on the calculation of the loss value, which makes the network insensitive to such phenomena during parameter optimization. This prevents the parameters from being effectively updated in the direction of detecting these phenomena during training, which leads to the detection effect of this kind of phenomenon being unimproved as the number of training iterations increases. Therefore, we use the weighted balance cross-entropy loss function to calculate the loss value during training and to increase the influence of phenomena comprising fewer pixels on the loss value by weighting to solve the problem of class imbalance.  
Assume that the detection output image has \(Q=I\times J\) pixels. Let \(Y_{i,j}\) be the ground truth of the pixel at the coordinate \((i,j)\) of the detection output image. If there are \(K\) classes for detection, then the cross-entropy loss function can be defined as:  
\[C(Y,p)=-\frac{1}{Q}\sum_{i=1,j=1}^{IJ}\sum_{k=1}^{K}Y_{i,j,k}\log(p_{i,j,k}) \tag{3}\]  
To maintain the balance between different types of oceanic phenomena and to strengthen the influence of classes with a small number of pixels on the loss value, the weighted balance cross-entropy loss function can be obtained by weighting each class:  
\[C(Y,p)=-\frac{1}{Q}\sum_{i=1,j=1}^{IJ}\sum_{k=1}^{K}w_{k}Y_{i,j,k}\log(p_{i,j,k}) \tag{4}\]  
The weight \(w_{k}\) can be defined as the ratio of \(\sum Q\) and \(\sum Q_{k}\). The total number of pixels of the overall sample in the training dataset is defined as \(\sum Q\). The total number of pixels of the k-th class samples in the training dataset is defined as \(\sum Q_{k}\). Then, \(w_{k}\) can be expressed as:  
\[w_{k}=\frac{\sum Q}{\sum Q_{k}} \tag{5}\]  
After determining the loss function, the network weights are iteratively optimized by gradient descent according to the loss value. However, the amount of data generated when the entire set of sample images are used to calculate the loss value is too large. Therefore, we use SGD as the parameter optimization algorithm. SGD only randomly selects some of the samples for parameters updating, effectively reducing the complexity of the calculation. If we assume that the number of training samples used in each step is \(M\) and the learning rate is \(\eta\), then the parameter update formula for the SGD is:  
\[\theta_{n}{}^{\prime}=\theta_{n}-\eta\frac{\partial\frac{1}{M}\sum\limits_{m=1 }^{M}C_{m}(Y,p)}{\partial\theta_{n}} \tag{6}\]  
We use the sample dataset of oceanic phenomena in SAR images as the training samples and use the SGD to update the MFNN parameters. When the loss value converges, we obtain the network of optimal parameters for the current sample dataset.