# _Applied sciences_
## 3 Methodology
### An Optimized UR-Net Model Based on the Combination of U-Net and Residual Blocks  
ResNet can reduce the loss of feature information and perform deeper learning by using unique residual blocks when executing network training. U-Net can learn more feature information and perform more accurate semantic segmentation when the training sample data are sparse by relying on the strong use of data augmentation. However, ResNet requires a large number of training samples, and U-Net is prone to salt-and-pepper noise when performing semantic segmentation on painted images, ultimately leading to unsatisfactory segmentation results. Compared with previous networks, U-Net can learn more feature information during training but still faces the problem of information loss, which can easily lead to the output image containing salt-and-pepper noise. Therefore, the U-Net architecture is optimized in this paper by adding residual blocks to reduce the loss of feature information during training and increase the feature extraction ability of U-Net again on its original basis to segment painted images more accurately. First, the residual blocks are improved to fit the U-Net architecture. Second, residual blocks are added to the contracting and expanding paths of U-Net. Finally, the optimized UR-Net model is constructed for the semantic segmentation of color paintings. Since the base residual block needs to be back-connected to the ReLU activation layer, adding it directly will result in a redundant ReLU activation layer in the U-Net structure, changing the original structure of the U-Net. As shown in Figure 8, the earth red pixels segmented by integrating the underlying residual block directly into the U-Net structure are still poorly segmented and have more pronounced noise. Figure 8: The earth red pixels segmented by integrating the underlying residual block directly into the U-Net structure. Figure 7: Schematic diagram of the U-Net architecture. The base residual block is not well adapted to the U-Net architecture, so it is necessary to improve the residual block based on its original structure by moving the ReLU activation layer from under the additional layer to the residual mapping, as shown in Figure 9. This operation allows for the more efficient use of the residual block without changing the basic architecture of U-Net or the function of the residual block so that the residual block can be better integrated into the U-Net architecture. Then, the UR-Net needs to be constructed by adding the improved residual blocks in Figure 9 to the U-Net architecture in Figure 7, as shown in Figure 10. The completed UR-Net with 128 layers and 141 connections is constructed. This architecture applies the U-Net feature extraction and upsampling functions while reducing information loss using residual blocks. The UR-Net aims to remove the salt-and-pepper noise generated after U-Net segmentation, improve segmentation accuracy, and achieve color consistency. In neural networks, the loss function is used to measure the degree of inconsistency between the predicted and true values of the model. The smal  
Figure 10: Schematic diagram of the UR-Net architecture. Figure 9: An improved residual block. function is, the better the model is trained and the higher its robustness. The original U-Net architecture was applied to cell segmentation using a weighted cross-entropy loss function to measure the model parameters with the aim of strengthening the segmentation line between similar adherent cells by adding the corresponding weight proportion to the cross-entropy loss function. However, the boundaries between different colors are more obvious, and weighting the cross-entropy loss function might instead affect the learning rate and risk overfitting. Therefore, this paper directly uses the cross-entropy loss function to ensure that the training results of U-Net continue to approximate the true value, which enhances the accuracy and robustness of segmentation while accelerating the learning rate of the network.