## 3 Materials and Methods
### Feature Extraction  
The features extracted by multi-level feature pyramid network are not all beneficial to the instance segmentation tasks, because some of the extracted features contain redundant and disturbing information. Therefore, in order to avoid the interference of redundant features and improve the effectiveness of instance segmentation network parameters, a convolutional block attention module (CBAM) is introduced into the feature extraction network. The CBAM as an important attention mechanism can focus on effective features and suppress unnecessary features by paying attention to what is meaningful and where is useful information in the input image. The size of the feature map generated by the first stage of ResNet-50 network before max pooling is reduced by 2 times compared with the input image. And \(\{C_{2},C_{3},C_{4},C_{5}\}\) have strides of \(\{4,8,16,32\}\) pixels relative to the input image. In ResNet-50 network, the feature map generated by the first stage before max pooling has the smallest size reduction with respect to the input image and contains the most abundant detail information such as contours, edges and textures in the five stages. Besides, the feature map generated by the last stage possesses the largest size reduction in relation to the input image and includes the richest abstract semantic information after many convolution and pooling operations in all stages. Therefore, the CBAM is included in front of the max pooling of the first stage and behind the last residual block of the last stage in ResNet-50 network to generate attention maps which focuses on instance related features in the low-level detail information and high-level semantic information. The detailed architecture is shown in Figure 2.  
Figure 1: The architecture of the attention-based feature pyramid module (AFPM). The convolutional block attention module (CBAM) is composed of a channel attention module and spatial attention module, which can capture the essential features along the channel dimension and spatial dimension. The architecture of CBAM is shown in Figure 3. In the channel attention module, spatial information of input features is obtained through the global average pooling (GAP) and global max pooling (GMP) operations, and two spatial context descriptors \(F_{\text{avg}}^{\text{c}}\) and \(F_{\text{max}}^{\text{c}}\) are generated. Then, \(F_{\text{avg}}^{\text{c}}\) and \(F_{\text{max}}^{\text{c}}\) generate channel attention map \(M_{\text{c}}\) through a shared network of multi-layer perceptron (MLP) with a hidden layer. When input tensor is \(F\in\mathbb{R}^{\text{C}\times H\times W}\) (\(\mathbb{R}^{Channel\times Height\times Width}\)), the calculation formula of channel attention in CBAM is as follows:  
\[M_{\text{c}}(F)=\sigma(W_{1}R(W_{0}g(F))+W_{1}R(W_{0}\delta(F)))=\sigma(W_{1}R (W_{0}F_{\text{avg}}^{\text{c}})+W_{1}R(W_{0}F_{\text{max}}^{\text{c}})), \tag{1}\]  
where \(M_{\text{c}}(F)\in\mathbb{R}^{\text{C}\times 1\times 1}\); \(W_{1}\in\mathbb{R}^{\text{C}\times\text{C}/r}\); \(W_{0}\in\mathbb{R}^{\text{C}/r\times\text{C}}\); \(r\) represents the reduction ratio in the bottleneck of the MLP and the value of \(r\) is set to 16; \(\sigma(\cdot)\) represents the sigmoid activation function; \(R(\cdot)\) represents the rectified linear unit; \(g(\cdot)\) is the global average pooling (GAP) function; \(\delta(\cdot)\) is the global max pooling (GMP) function. Figure 3: The architecture of CBAM [21]. Figure 2: The architecture of feature extraction. We exploit ResNet-50 with convolutional block attention module (CBAM) to extract instance related features. In the spatial attention module, the pooling operations including average pooling and max pooling are performed along the channel axis, and two two-dimensional feature maps \(F_{\text{avg}}^{\text{rs}}\) and \(F_{\text{max}}^{\text{rs}}\) are generated. Then, they are concatenated and convoluted through the standard convolution layer to generate the spatial attention map \(M_{\text{s}}\).