## 2 Materials and Methods
### Raman Spectrum Denoising Module (RSDM)  
Although GANs can generate a large amount of data similar to the original data, the instability of the training process exists due to the principle of the generator and the discriminator competing with each other. In order to reduce the exaggerated noise in the training process and make the generated data more similar to the real data, the Unet model is introduced to denoise the generated data in this experiment. Figure 3: Network structure of the WGAN. The network consists of a generator network and a discriminator network, including convolutional layers, normalization layers, and activation function layers in both networks. In addition, compared to the original UNET, we have made some improvements to reduce the loss of data features in the network during upsampling and downsampling processes. Firstly, we improved the skip connection method of the U-Net network. In traditional UNet, in order to avoid losing a large number of precise spatial details in the decoder, the skip technique is used, which directly concatenates the map extracted from the encoder to the corresponding layer of the decoder. However, we believe that shallow feature information enters the decoder too early, which is not conducive to the process of the decoder extracting global feature information. Therefore, we connect the output of the encoder and the output of the decoder. The new connection method can integrate shallow feature information into deep spectral data details, which is more conducive to restoring clean spectral data. Secondly, we introduce an attention mechanism. The upsampling and downsampling in the UNET network are both based on convolution, and the receptive field kernel size of the convolution operation is small, so each convolution operation can only cover local features of the data. This results in the decoder losing data features during the data recovery process. The attention mechanism can better learn the dependency relationships between global features. We use a module called Attention Gates to train attention mechanisms, in which coarse-grained features capture contextual information and highlight the categories and positions of foreground objects. This module can suppress the task-independent parts of the model learning, while emphasizing the learning of task-related features. Subsequently, feature maps extracted at multiple scales are merged through skip connections to combine dense predictions at both coarse-grained and fine-grained levels. Our improvement can avoid data loss while allowing each layer of the network to perform noise reduction. Figure 6 shows the Attention Gates module we introduced, which can be trained in 5 steps. Step 1: After a \(1\times 1\) convolution, add together the outputs of the encoding layer On and the output of the decoding layer Ode. Step 2: Pass the added results through the Relu function. Step 3: Convolve the result of step 2 and reduce the channel to 1. Step 4: Sigmoid the result of Step 3 so that the value falls within the (0, 1) interval, which results in attention weights. Step 5: Multiply the attention weights obtained in step 4 with the output Oen of the encoding layer, and assign the attention weights to the low level feature. Figure 5: Improved U-NET Spectral Denoising Network. Blue blocks represent the input and output sizes of convolution, black arrows indicate convolution operations, rectangle blocks with plus signs represent convolution output connected to the ResNet, red arrows represent pooling operations (downsampling), and yellow arrows indicate upsampling. Additionally, during the downsampling process, we added residual blocks to the encoder [37]. The residual network adds the inputs and outputs of a large number of convolutional layers to extract features from the data. For networks with deeper network layers, adding a residual network can avoid the model degradation problem caused by vanishing gradients during training.