# Probabilistic Ship Detection and Classification Using Deep Learning
## 2 Ship Detection and Classification from an Image  
In this study, ships were detected in each frame using Faster R-CNN [10], as in our previous work [17]. The Faster R-CNN is a representative region-based object detection model based on deep learning. As shown by [PERSON] et al. [18], Faster R-CNN outperforms the other models [19; 20] in general object detection problem. Although R-CNN [21] and the Fast R-CNN [22] use Selective Search [23] to generate possible object locations, Faster R-CNN introduced the region proposal network (RPN), which outputs region proposals from shared full-image convolutional features, thereby improving speed performance. Faster R-CNN combines RPN and Fast R-CNN into a single network for object detection by sharing their convolutional features, as shown in Figure 1.  
When an image is used as input data, the convolutional neural network (CNN) generates the convolutional features. Then, the fully-convolutional RPN predicts the bounding box and object scores at each position of the convolutional features, as shown in Figure 1b. Thus, the RPN tells the Fast R-CNN where to look and classify. In our experiments, we used the Zeiler and Fergus model (ZF net) [24] that five shareable convolutional layers.  
The Faster R-CNN is trained with a four-step training algorithm to learn shared features via alternative optimization. In the first step, the RPN is initialized with a pre-trained model and then fine-tuned end-to-end to propose regions. In the second step, the Fast R-CNN is trained using the region proposals generated by the first-step RPN not sharing convolutional layers. In the third step, the shared convolutional layers are fixed and the unique layers of RPN are fine-tuned. Finally, the layers unique to Fast R-CNN are fine-tuned while maintaining the shared convolutional layers. The detailed alternating algorithm for training the Faster R-CNN is found in [PERSON] et al. [10].  
The Faster R-CNN detection result for a single image can be expressed as a bounding box represented by:  
\[B=(v_{x},\,v_{y},\,v_{w},\,v_{h}), \tag{1}\]  
where \(B\) denotes the four values of the bounding box: coordinates \((v_{x},v_{y})\), width \((v_{w})\), and height \((v_{h})\), as shown in Figure 1b. The class confidence of the bounding box predicted by the Faster R-CNN can be represented by:  
\[p(\omega=k|B)\triangleq p_{k},\,\,\text{where}\,\sum_{k=1}^{C}p_{k}=1, \tag{2}\]  
where \(\omega\) denotes the class of ship, \(k\in\{1,\,2,\,3,\,\cdots,\,C\}\) is one of the possible values that \(\omega\) can take, \(B\) is the bounding box predicted by the Faster R-CNN, and \(C\) is the number of classes in the ship dataset created in this study.  
We used seven different classes of ships in this study; thus, \(C\) was set to eight, including the background. The class index is summarized in Table 1. The class of the detected bounding box is predicted by:  
\[class(B)=\underset{k=1,\omega,C}{\text{argmax}}p_{k}. \tag{3}\]  
Figure 1: Structures of (**a**) Faster region-based convolution neural network (Faster R-CNN) and (**b**) region proposal network (RPN).  
As shown in Equation (3), the determined class of the predicted bounding box is the class with the highest confidence. Our method considers the class and detection confidence from the Faster R-CNN as the probability and exploits it using Bayesian fusion.