## 3 Instance Segmentation Framework Based on Improved YOLACT
### Modified FPN Based on Feature Fusion  
After realizing the light weight of the model, in order to further optimize its accuracy performance, this paper improves the feature fusion network in the model. The FPN network will fuse the features of different feature layers, and then predict on the fused feature map. In the original YOLACT model, the FPN module passes the P3-P7 output feature maps to the target detection module, and the P3 feature map is directly used as the input for the prototype mask branch. The high-level feature map has rich semantic information and the use of high-level feature maps is conducive to the network's understanding of the target. In the original YOLACT algorithm, the P3 layer, which is the input of the prototype mask branch, does not use the high-level feature information, while P5-P7 do not use the bottom-level information. This design has the disadvantage of using the feature information, which limits the accuracy of the model's detection and segmentation. In order to make full use of the information of each layer, a feature fusion structure is proposed. Figure 3 shows the structure of FPN with feature fusion. As shown in Figure 3, the P4-P7 feature map is firstly up-sampled by bilinear interpolation to achieve the same size as P3, which is recorded as E3-E7. Then, they are weighted and added to another layer. Specifically, E5, E6, and E7 are added to E3, E4, and E5, respectively, which brings the high-level information to the lower layer. Meanwhile, E3 and E4 are added to E6 and E7, enhancing the location information of the top-layer maps. After the E3-E7 maps are obtained, the next step is to down-sample them back to their original size, in which we use convolution and the Sigmoid layer, generating M3-M7 maps. Finally, the M3-M7 maps are passed to the Prediction module and Protonet. However, considering that the scale span from the P3 feature layer to the P7 feature layer is too large, skip connection is used between \(P_{i}\) and \(M_{i}\) in order to avoid the gradient disappearance or gradient explosion that may occur in training. The calculation process of \(M_{i}\) can be expressed by the following formula:  
\[M_{i}= \begin{cases}Sigmoid(P_{i}+Conv(\alpha_{i+2}\times upsample(P_{i+2})+P_ {i}),&\text{if }\ i=3,4,5\\ Sigmoid(P_{i}+Conv(\alpha_{i-3}\times upsample(P_{i-3})+P_{i}),&\text{if }\ i=6,7 \end{cases}  \tag{5}\]  
where \(Conv\) represents convolution using \(3\times 3\) or \(1\times 1\) kernels and different steps, \(upsample\) represents up-sampling the \(P_{i}\) feature map to the size of P3, and \(\alpha_{i}\) represents the weight hyper-parameter of the \(i\)-th layer. The new feature fusion method improves the input maps of the detection module and proto-mask module by using feature fusion, but with an additional attention module added, the feature maps could be further improved. Therefore, this paper introduces ECA-Net to optimize the overall quality of the feature map output by the FPN. ECA-Net proposes a dimensionless local cross-channel interaction strategy, which performs the appropriate cross-channel interactions while reducing the model complexity and maintaining its accuracy performance [10]. The process of the ECA structure is to first perform global pooling, then pass through a partial connection layer FC[\(k\)], and finally activate through a layer of Sigmoid. FC[\(k\)] is a connection operation of k nodes, which is not a conventional full  
Figure 3: Structure of FPN with feature fusion. connection, and it is implemented in the code through one-dimensional convolution. The overall operation of ECA can be expressed as:  
\[ECA(x)=x\times\sigma\Big{(}\text{Conv}_{1\text{d}}^{1\times 1}(\text{GMP}(x)) \Big{)} \tag{6}\]  
where \(x\) represents the input tensor, \(\sigma\) is the Sigmoid activation function, and \(\text{Conv}_{1\text{d}}^{1\times 1}\) represents one-dimensional \(1\times 1\) convolution. GMP represents global maximum pooling, as we use it instead of GAP (global average pooling) in this paper.