# Packaging Design Image Segmentation Based on Improved Full Convolutional Networks
## 3 Methods and Materials
### Model Improvement Based on Multi-Branch and Dual-Attention Feature Extraction  
The superpixel-assisted ISS model with FCN can enhance the segmentation effect on small targets. However, in the process of ISS, when downsampling or pooling operations are performed, some important edge details may be lost. Therefore, this paper proposes a strategy for ISS model with multi-branch and dual-attention feature extraction. This method mainly consists of the encoding network, decoding network, and attention mechanism module. The design criteria of coding and decoding structures proposed in this paper are to improve multi-scale feature extraction, improve segmentation accuracy of small targets, and optimize computational efficiency. The main process of the improvement method is shown in Figure 3.  
In Figure 3, the encoding network is mainly constructed through dilated convolution to capture spatial contextual information and multi-level features of the image. The purpose is to expand the receptive field through dilated convolution while maintaining the spatial resolution of the feature map, thereby capturing richer contextual information and multi-scale features in the image. In the decoding network, this study fuses high-level semantic features extracted from the encoding network with low-level features through spatial alignment. In the attention mechanism module, parallel channel attention (CA) and spatial attention (SA) are introduced to enhance the model's ability to learn key features. Figure 4 illustrates the configuration of the encoding network. Figure 3: Main Process of Improving ISS Model. In Figure 4, the encoding network is designed as a multi-branch structure, with each branch focusing on features at different scales to capture multi-scale information from local to global. The fully connected layer is removed, and the first five stages of the encoding network are retained for feature extraction. In the third to fifth stages of the network, ordinary convolutions are replaced. Hollow convolution allows networks to capture a wider range of contextual information without sacrificing resolution. The receptive field calculation of ordinary convolution is shown in Equation (1). \[f_{n}^{(k-1)}=\left(f^{(k)}+1\right)\times s^{(k)}-1 \tag{1}\]  
In Equation (1), \(f_{n}^{(k-1)}\) represents the receptive field of the \(k-1\)-th layer; \(f^{(k)}\) represents the size of the convolution kernel of the \(k\)-th layer; and \(s^{(k)}\) represents the convolution step size of the \(k\)-th layer. The receptive field calculation equation for dilated convolution is shown in Equation (2). \[f_{n}^{(k-1)}=\left(\frac{f^{(k)}+\left(r^{(k)}-1\right)\times\left(f^{(k)}-1 \right)}{r^{(k)}}+1\right)\times s^{(k)}-1 \tag{2}\]  
In Equation (2), \(r^{(k)}\) represents the void ratio of the \(k\)-th layer, which defines the distance between two elements in the convolution kernel. To avoid the loss of small target information, the first layer branch structure of the network in the fourth and fifth stages is set to a step size of 1, keeping the resolution of the feature image unchanged. Ultimately, this encoding network is able to output advanced features with high semantic information, providing strong input for subsequent decoding networks. In essence, the encoding network is tasked with the extraction of multi-scale features, thereby enabling the model expand the receptive field while maintaining a reduced number of parameters. This approach facilitates the capture of global contextual information. The multi-branch structure allows for the integration of features at varying scales, which are then employed in the decoding stage to ensure the accurate handling of small targets and complex backgrounds. This ultimately enhances the precision of the segmentation process. Figure 5 illustrates the structure of the decoding network. Figure 4: Schematic Diagram of the Coding Network.