## 2 Proposed Methods
### Mask R-CNN  
On the basis of the Faster R-CNN, the Mask R-CNN adds a parallel target prediction mask branch to the edge recognition branch. This allows the network to effectively detect a target in an image and also generates a high-quality segmentation mask for each case. In addition, it provides a conceptually simple but versatile segmentation framework of targets, as shown in Figure 1. This includes a convolution backbone network for feature extraction over the entire image, a bounding box used in the classification and regression of RoI, and the network head of the forecast mask. The mask branch added to the Mask R-CNN is applied to the small-size fully convolutional network (FCN) of each region proposals. This branch predicts segmentation masks in a pixel-to-pixel manner. Meantime, faced with the problem that the RoI pooling cannot achieve the pixel-to-pixel alignment between the input and output of the Faster R-CNN, this paper proposes a simple quantization-free layer, the RoIAlign layer, to ensure the spatial position accuracy. On this basis, the Mask R-CNN performs segmentation forecast on the mask and classification and independently predicts a binary mask for each classification forecast and also performs the classification using the RoI classification branch of the network. The Mask R-CNN performs two processes: (1) extracts region proposals using the RPN, and (2) outputs a binary mask for each RoI using the mask branch. These processes are conducted in parallel with the prediction of the bounding-boxes offset. During training, the multi-task loss of each sampled RoI is calculated by:  
\[L=L_{cls}+L_{box}+L_{mask}, \tag{1}\]  
where \(L_{mask}\) denotes a mask loss, \(L_{cls}\) is the classification loss, which represents a logarithmic number between the target and non-target, and \(L_{box}\) is the regression loss, which is calculated by:  
\[L_{box}(t_{i},t_{i}^{*})=R(t_{i}-t_{i}^{*}), \tag{2}\]  
where \(R\) is the robust loss function \(smooth_{L1}\), which is expressed as:  
\[smooth_{L_{1}}(x)=\left\{ \begin{array}{l}0.5x^{2},\text{if}|x|<1\\ |x|-0.5,\text{otherwise}\end{array} \right. \tag{3}\]  
For the regression loss, the following four parameterized coordinates are used:  
\[ \begin{array}{l}t_{x}=(x-x_{a})/w_{a},t_{y}=(y-y_{a})/h_{a},t_{w}=\log(w/w_ {a}),t_{h}=\log(h/h_{a})\\ t_{x}^{*}=(x^{*}-x_{a})/w_{a},t_{y}^{*}=(y^{*}-y_{a})/h_{a},\ t_{w}^{*}=\log(w^{*}/w_{a}),\ t_{h}^{*}=\log(h^{*}/h_{a})\end{array}  \tag{4}\]  
where \(x\), \(y\), \(w\), and \(h\) represent the two coordinates at the center, width, and height of the box, respectively; \(x\), \(x_{a}\), and \(x^{*}\) correspond to the predicted, anchor, and ground-truth boxes (similarly for \(y\), \(w\), and \(h\)), respectively. Therefore, it may be regarded as the bounding box regression from an anchor box to a nearby ground-truth box. The mask branch has a \(K_{m}{}^{2}\)-dimensional output for each RoI, with each output encoding \(K\) binary masks with a resolution of \(m\)\(\times\)\(m\), where \(K\) is the number of categories. Using the per-pixel sigmoid, \(L_{mask}\) is defined as a mean cross-entropy loss. For the RoI related to the ground-truth category \(k\), \(L_{mask}\) is defined only for the kth mask while the other masks' outputs do not contribute to the loss. The definition of \(L_{mask}\) allows the network to generate masks for each category without competition. The segmentation is decomposed into two branches, the classification branch and mask branch. The mask branch corresponding to the output is obtained using the class label predicted by the classification branch. Figure 1: Mask R-CNN: add mask branch to Faster R-CNN. The RoIAlign layer eliminates the quantization of the RoIPooling layer and accurately aligns the extracted features with the input, i.e., any quantization of the RoI boundaries or bins is avoided; for instance, \(x/16\) is used instead of [\(x/16\)] when VGG16 is used as a backbone network.