# General Network Framework for Mixture Raman Spectrum Identification Based on Deep Learning
## 3 Method  
Different sample molecules or chemical bonds have different vibration modes and energy differences, leading to different characteristic peaks in the Raman spectrum. The mechanism for qualitative identification and quantitative analysis of Raman spectra involves measuring the similarity between the spectra of an object and those in a database by comparing these characteristic peaks [23]. Currently, common methods based on convolutional networks have achieved notable results. One of the practical solutions is to incorporate a Siamese network structure to compare spectral pairs and output the comparison results directly [33]. It can measure both the similarity between two Raman spectra and compare the intensity of characteristic peaks for quantitative analysis. However, this method still has certain shortcomings, since the traditional CNN model usually focuses on the characteristics of each spectrum in the spectrum pair, and does not connect the two spectra before the performing similarity measurement based on these characteristics, so it cannot be fully utilized. The correlation between spectral pairs is calculated when the two spectra are spliced as a complete input and then sent to the network. Although the two spectra are fused in the shallow layer of the model, some local features of each may still be ignored. At the same time, the traditional CNN model can only extract local feature information of the spectrum and cannot capture the connection between local and global features, resulting in inaccurate recognition results. In response to these problems, this study designed an innovative general network framework based on Raman spectrum pair comparison technology. This framework realizes three-branch feature fusion for the detection of food additives. This design aims to improve the accuracy and reliability of food additive detection by integrating the characteristic information of different branches. The specific network framework is shown in Figure 3.  
Figure 2: Raman spectroscopy data expansion. The network is divided into three branches. A Raman spectrum pair (\(R1\), \(R2\)) is given as input into the upper and lower network branches respectively. The upper branch is responsible for extracting features from the Raman spectrum data of the pure substance. The lower branch is responsible for extracting features from the Raman spectrum data of the object to be measured. The effectiveness of this architecture design, particularly in comparing spectral pairs, has been demonstrated in related structures like Siamese networks, which also learn similarities between input pairs [34]. The data size is 1 \(\times\) 2048. The feature maps of the two branches are combined as well as the intermediate branch itself at the same stage. The multi-head self-attention mechanism is used in both the upper and lower branches to capture the relationship between local spectral peak features and global features. The purpose of the model is to learn the similarity between spectral pairs and finally output two probabilities. Probability 1 represents the likelihood that the food additive is present in the analyte, and probability 2 represents the possible concentration of the food additive in the analyte. The above process can be expressed by Formula (1):  
\[P=S(R1,R2) \tag{1}\]  
where \(P\) represents the probability of output, \(S\) represents similarity learning, \(R1\) and \(R2\) represent the Raman spectrum data of the pure compound and the mixture. The current classic convolutional neural networks are typically constructed using stacked convolutional layers or enhanced convolution blocks. Therefore, in the network framework designed in this article, the upper branch and the lower branch consist of multiple stages, sharing a common backbone and parameters. The first stage consists of a one-dimensional convolution layer and a max pooling layer, which is responsible for down-sampling the input data and reducing their dimensionality.