## 2 Materials and Methods
### Raman Spectrum Enhancement Module (RSEM)  
#### 2.3.1 WGAN Network Structure  
Generative adversarial networks (GANs) consist of a generator network and a discriminator network. The generator network is responsible for generating data similar to real samples, while the discriminator network is responsible for distinguishing generated data from real data. Since the introduction of GANs, hundreds of different types of GANs have emerged, and they have been proven to demonstrate excellent performance in specific domains. In order to select the most suitable generative adversarial network, we conducted a series of comparative experiments on several types of generative adversarial networks and found that WGAN had the most outstanding performance in terms of the quality of generated data and the duration of model training. Therefore, we chose WGAN as the network for the data augmentation module. The comparative experimental results are presented in Section 3.2. Unlike the original GAN discriminator, which solves for the classification of 0 or 1, the WGAN discriminator employs the Wasserstein distance to distinguish between generated and real data [33]. The network provides a trustworthy training process indicator, avoiding the gradient vanishing problem that frequently happens in the original GAN. The Wasserstein distance formula is shown below:  
\[W\big{(}P_{r},P_{g}\big{)}= \begin{array}{c}inf\\ \gamma\sim\Pi\big{(}P_{r},P_{g}\big{)}E_{(x,y)\sim\gamma}[\|x-y\|\,]\end{array}  \tag{1}\]  
where \(P_{r}\) represents the distribution of real data, \(P_{g}\) represents the distribution of generated data, \(\Pi\big{(}P_{r},P_{g}\big{)}\) represents the set of all possible joint distributions combining \(P_{r}\) and \(P_{g}\), \(E_{(x,y)\sim\gamma}[\|x-y\|]\) represents the expectation value of the distance between the real data x and the generated data y under the joint distribution \(\gamma\). After a series of derivations, the Wasserstein distance can be approximated as  
\[L=E_{x\sim P_{g}}[f_{\omega}(x)\,]-E_{x\sim P_{g}}[f_{\omega}(x)\,] \tag{2}\]  
Figure 2: Raman spectra of four pathogens. The solid line in the figure represents the average value of Raman data for each pathogen, and the shaded part represents the standard deviation. The horizontal axis represents the Raman shift, and the vertical axis represents the Raman scattering intensity. where \(f_{\omega}(x)\) represents a function containing parameter \(\omega\). Specifically in the WGAN network, the loss function expression can be written as  
\[V_{\text{WGAN}}\;G,D=E_{x\sim P_{g}}[logD(x)\,]-E_{x\sim P_{g}}[logD(G(x))\,] \tag{3}\]  
where \(D(x)\) represents the result judged by the discriminator on real data, \(G(x)\) represents the generated data, and \(D(G(x))\) represents the result judged by the discriminator on the generated data. Therefore, the generator's loss function can be expressed as  
\[L_{G}=-E_{x\sim P_{g}^{*}}[logD(G(x))\,] \tag{4}\]  
The loss function of the discriminator can be expressed as  
\[L_{D}=E_{x\sim P_{g}}[logD(G(x))\,]-\,E_{x\sim P_{g}}[logD(x)\,] \tag{5}\]  
The generator and discriminator are trained towards the goal of minimizing the loss function, and the two constantly compete until reaching a Nash equilibrium. Figure 3 shows the improved WGAN structure used in our paper. The WGAN network is made up of a generator and a discriminator. The generator features a five-layer network structure. Each layer has a deconvolution layer and a normalization layer. Each layer generates output using the LeakyRelu activation function. Similarly, the discriminator has a five-layer network structure, with each layer consisting of a convolution layer and a normalization layer, and each layer using the Relu activation function to generate output. First, low-dimensional noise data \(Z\) is generated at random and used as the generator network's input, after which sample data is generated using generator network mapping. The discriminator then receives both the sample and real data as inputs.