# Potato Leaf Disease Segmentation Method Based on Improved UNet
## 2 Materials and Methods
### Improved U-Net Network Model  
UNet was originally widely applied to small-sample segmentation tasks in medical imaging, showing remarkable performance. However, when applied to the segmentation of complex potato leaf images, it faces challenges due to the diverse morphologies, colors, and sizes of potato leaf disease spots, necessitating a more robust feature-extraction mechanism to enhance segmentation accuracy [26; 27]. Therefore, improvements were made to UNet by incorporating an encoder, ResNet50, and introducing the SE (squeeze and excitation) attention mechanism, while retaining the UNet structure as the decoder, resulting in the RS-UNet architecture as illustrated in Figure 8. Using ResNet50 as the encoder: Traditional UNet models employ convolution and pooling layers in the encoder section to progressively extract and reduce the features of input images. However, when dealing with complex and diverse image data, a traditional encoder may not fully capture complex features in the image [28; 29]. Thus, ResNet50 was chosen as the encoder, known for its superior feature extraction capabilities for potato leaf disease spots. ResNet50 introduces residual blocks  
Figure 7: SE-ResNet Network Architecture. during training, which can effectively train deep networks, avoid gradient vanishing issues, and enhance feature representation. Introducing the SE attention mechanism: The SE attention mechanism is a mechanism used to enhance feature representation capabilities. Applying the SE attention mechanism to the feature maps of ResNet50 allows the network to focus more on important feature channels while ignoring less important ones. This mechanism adaptively adjusts the importance of different channels in the feature maps by learning channel weights. In disease spot segmentation tasks, different disease spot morphologies and colors in potato leaves may be reflected in different channels, and the SE attention mechanism helps the network to concentrate on these key features, thereby improving segmentation accuracy. Retaining UNet as the decoder: UNet is a common architecture used for image segmentation [30], and its decoder section can effectively restore the spatial information of feature maps, generating prediction results. In the improvement, the decoder structure of UNet was retained, ensuring that the network can preserve detailed information when generating prediction results. The decoder retains skip connections, connecting the feature maps of the encoder and decoder, thus facilitating the fusion of multi-level features and improving segmentation accuracy. The network structure is shown in Figure 8. In the encoding phase, input images of potato leaf disease spots with a size of 256 \(\times\) 256 undergo convolutional layers and pooling layers in ResNet50, resulting in a series of feature maps containing potato leaf disease spots. The SE attention mechanism is applied to each feature map to enhance the representation of important features [31]. The output features are enhanced by the SE attention mechanism. The encoding stage includes a 3 \(\times\) 3 convolution operation, followed by a Resblock and Max-pooling operation, using maximum pooling with a stride of 2 to reduce the Image size to 128 \(\times\) 128, and eventually, after four convolutions, the size is reduced to 16 \(\times\) 16, reaching a minimum size. After each downsampling, the traditional convolution module is replaced by the SE-Resnet structure to address the overfitting issues caused by deep networks. The decoder adopts the UNet structure, taking the improved feature maps as input into the UNet encoder section. The encoder consists of a series of convolutional layers and pooling layers, progressively extracting features and reducing the size of feature maps. The output feature maps of the encoder are connected to the corresponding input feature maps of the decoder through skip connections to preserve more detailed information.