Raman spectrum model migration transfer method based on standard substance

Adaptive spectral transfer was achieved through convolutional neural networks, which solved the problem of spectral differences between Raman spectrometers, improved the accuracy and consistency of spectral data, and enhanced recognition capabilities.

CN121351933AActive Publication Date: 2026-01-16CHINA JILIANG UNIV

Patent Information

Application Number
CN202511903093.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-17
Publication Date
2026-01-16
Estimated Expiration
2045-12-17

AI Technical Summary

Technical Problem

Differences in hardware configuration and environmental interference between different Raman spectrometers lead to significant differences in spectral data across different instruments, affecting the accuracy and consistency of the spectral data. Traditional algorithms cannot effectively solve complex nonlinear variations, and parameter tuning is time-consuming.

Method used

A Raman spectral model transfer method based on standard substances is adopted, which realizes adaptive spectral transfer through convolutional neural networks, including beam alignment, multi-scale parallel gated convolution, windowing segmentation and local equalization processing, to optimize model parameters and improve spectral consistency.

Benefits of technology

It improves the consistency and comparability of spectra across different devices, reduces baseline noise inconsistencies and peak position shifts, and enhances the accuracy and identification capabilities of spectral data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121351933A_ABST
    Figure CN121351933A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of spectral data processing, and discloses a Raman spectrum model migration transfer method based on a standard substance, which comprises the following steps: S1, acquiring Raman spectrums under different devices as training data; s2, carrying out beam alignment; s3, performing point-by-point soft weighting on the spectrum after beam alignment by adopting a multi-scale parallel gating convolution strategy to obtain an enhanced feature map; s4, windowing segmentation is carried out based on the enhanced feature map, and intra-segment point-by-point gain is carried out; s5, superposing the gained segments, and carrying out normalization by using window energy to obtain local equalization output; s6, calculating a loss function according to local equalization, and optimizing model parameters; aiming at the common bottlenecks of baseline noise inconsistency, peak position offset, noise interference and the like in the existing Raman spectrum cross-device analysis process, the method is not limited to traditional piecewise linear migration, and self-adaptive spectrum migration is realized through the convolutional neural network, so that the spectrum consistency and comparability between different devices are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of spectral data processing technology, and more specifically to a method for the transfer of Raman spectral models based on standard substances. Background Technology

[0002] Currently, Raman spectroscopy is widely used in hazardous chemical identification, drug detection, materials analysis, and food safety due to its advantages such as non-contact, non-destructive nature, and unique molecular characteristics. However, in practical applications, differences in hardware configuration, environmental interference, and instrument aging among different instruments lead to significant differences in Raman spectra of the same standard substance measured on different instruments, severely affecting the accuracy and consistency of spectral data and thus limiting the widespread application of Raman spectroscopy in industry. Traditional DS and PDS algorithms typically assume a linear mapping relationship between the source and target instruments, which limits their ability to utilize complex nonlinear transformations, resulting in low transfer enhancement effects. Furthermore, PDS requires adjusting parameters such as segmentation, window size, step size, and the number of principal components; the optimal conversion parameters differ for each substance, requiring significant time for tuning.

[0003] Therefore, how to effectively achieve spectral consistency among different devices is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0004] In view of the above problems, the present invention provides a Raman spectroscopy model transfer method based on standard materials. It addresses the bottlenecks such as baseline noise inconsistency, peak position shift and noise interference that are common in the existing cross-device Raman spectroscopy analysis. Instead of being limited to traditional piecewise linear transfer, it achieves adaptive spectral transfer through convolutional neural networks, thereby improving the spectral consistency and comparability between different devices.

[0005] To achieve the above objectives, the present invention adopts the following technical solution: A method for migration and transfer of Raman spectroscopy models based on standard substances includes the following steps: S1: Obtain the Raman spectra of standard substances under different devices, and extract source domain data and target domain data as training data.

[0006] S2: Perform beam alignment on the source domain data.

[0007] S3: For the beam-aligned spectrum, a multi-scale parallel gated convolution strategy is used to perform point-by-point soft weighting to obtain an enhanced feature map.

[0008] S4: Perform windowed segmentation based on the enhanced feature map, and perform point-by-point gain within each segment.

[0009] S5: The amplified segments are superimposed and normalized using window energy to obtain a locally equalized output.

[0010] S6: Calculate the loss function based on the local equalization and the corresponding target domain data, and optimize the model parameters.

[0011] Preferably, step S2 includes: extracting the global displacement and local displacement of the source domain data respectively; and performing reverse mapping based on the total displacement obtained by superimposing the global displacement and the local displacement.

[0012] Preferably, the global displacement extraction method includes:

[0013] in, For global displacement, x is the input spectrum, and i is the sequence position index, representing the i-th sampling point; GAP(x) is global average pooling, which means taking the average value of the entire spectrum over the length dimension; is a fully connected network used to map the scalar features after global average pooling into a global displacement; tanh is the hyperbolic tangent function used to compress the output of the MLP to a bounded interval; Sg is the upper limit coefficient of the global displacement amplitude; and L is the spectral length. Preferably, the method for extracting the local displacement includes:

[0014] in, For local displacement, S is the upper limit of the displacement amplitude, which controls the maximum and minimum values ​​that each sampling point can move.

[0015] Preferably, S3 includes: S31: Perform multi-scale parallel convolution based on the beam-aligned spectrum.

[0016] S32: Concatenate the data along the channel dimension to obtain the comprehensive features.

[0017] S33: Calculate and confirm channel weights based on the comprehensive features.

[0018] S34: Compress the channels to 1 and normalize them to obtain the gated graph.

[0019] S35: Weight the beam-aligned spectrum based on the enhanced feature map.

[0020] Preferably, the local equalization output in S4 is:

[0021] in, The local equalization output is given, where m is the global sampling index. The result signal after point-by-point gain, where k is the segment index; For window functions, This represents the starting index of the k-th segment, where M is the segment length. This is an indicator function. When the variable within the parentheses satisfies the interval 0 to M-1, the indicator function takes the value 1; otherwise, it takes the value 0.

[0022] Preferably, the loss function includes a peak region error term and a background region error term. When calculating the loss function, a peak region window mask is introduced to calculate the peak region error and the background region error.

[0023] Preferably, the peak-priority regression loss is calculated as the loss function:

[0024] Where m is the peak window mask value, y is the output spectrum of the model, y* is the reference spectrum of the target instrument, and ⊙ represents element-wise multiplication, which is used to calculate the peak error. It is the L2 norm, in the above formula It calculates the sum of squares; , , These are weighting coefficients. The weight of the peak error, As the weight of the background region error, This represents the weight of the cosine similarity term.

[0025] Preferably, based on the peak-region priority regression loss, a zero-value constraint loss and a smoothness constraint loss are introduced to calculate the total loss function as the final loss function:

[0026]

[0027]

[0028] in, For the total loss function, For peak-priority regression loss, and Constrain the zero mean and smoothness of local displacements respectively. and The corresponding loss function coefficients, It is a mean function. This represents the local displacement corresponding to the i-th sampling point. and They are respectively The first and second derivatives, These are the coefficients of the second derivative.

[0029] As can be seen from the above technical solutions, compared with the prior art, the present invention discloses a Raman spectroscopy model transfer method based on standard materials. It addresses the bottlenecks such as baseline noise inconsistency, peak position shift and noise interference that are common in the cross-device analysis of existing Raman spectroscopy. Instead of being limited to traditional piecewise linear transfer, it achieves adaptive spectral transfer through convolutional neural networks, thereby improving the spectral consistency and comparability between different devices. Attached Figure Description

[0030] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0031] Figure 1 This is a schematic diagram of a Raman spectroscopy model migration and transfer method based on standard substances provided by the present invention.

[0032] Figure 2 This is a schematic diagram of the structure of the Raman spectral migration model in an embodiment of the present invention.

[0033] Figure 3 This is a schematic diagram illustrating the effect of data enhancement in an embodiment of the present invention.

[0034] Figure 4 This is a comparison of the normalized intensity of the spectral data before and after the migration of acetaminophen.

[0035] Figure 5 This is a comparison of the peak probability density before and after acetaminophen migration.

[0036] Figure 6 This is a comparison of the peak positions of acetaminophen before and after migration.

[0037] Figure 7 This is a comparison chart of acetaminophen before and after model transfer.

[0038] Figure 8 This is a comparison chart of the resorcinol model before and after migration.

[0039] Figure 9 This is a comparison chart of the n-hexane model before and after migration.

[0040] Figure 10 This is a comparison chart of the cyclohexane model before and after migration.

[0041] Figure 11 This is a comparison image of naphthalene migration before and after. Detailed Implementation

[0042] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0043] like Figure 1 and Figure 2 This invention discloses a Raman spectroscopy model migration and transfer method based on standard substances, comprising the following steps: S1: Obtain the Raman spectra of standard substances under different devices, and extract source domain data and target domain data as training data.

[0044] S2: Beam alignment of source domain data.

[0045] S3: For the beam-aligned spectrum, a multi-scale parallel gated convolution strategy is used to perform point-by-point soft weighting to obtain an enhanced feature map.

[0046] S4: Perform windowed segmentation based on the enhanced feature map and perform point-by-point gain within the segment.

[0047] S5: The amplified segments are superimposed and normalized using window energy to obtain a locally equalized output.

[0048] S6: Calculate the loss function based on the local equalization and the corresponding target domain data, and optimize the model parameters.

[0049] In this embodiment, the model first performs wavenumber migration correction to address the significant spectral differences caused by peak position shifts and baseline differences in cross-device spectra, aligning the wavenumbers of the source spectral peaks with the target spectrum.

[0050] Simultaneously, a peak position detection window mask is introduced. A soft peak function is obtained by training the spectral data in the training set, enabling the model to recognize peaks. For identifying characteristic peaks in the 200–3200 wavenumbers per centimeter range, a binary window mask with and without peaks is generated, increasing the weight of peaked regions and incorporating them as learnable parameters into the deep network training. This guides the model to focus on molecular vibrational feature regions, reducing the adverse effects of informationless segments on model convergence and generalization, thus solving the problem of effectively extracting characteristic peaks against complex interference backgrounds.

[0051] Secondly, the model uses multi-scale one-dimensional convolution and Resne residual blocks to extract segmented features from the spectrum, and then restores the spectrum to the same length as the input through upsampling and downsampling for subsequent segmented transfer processing. Multi-scale convolution can extract various features, comprehensively focusing on different features such as broad peaks and narrow peaks. Feature extraction uses a segmented little head to output a transfer matrix acting on the y-axis, i.e., peak intensity, through a fixed window of length M=300 and an overlap region of O=50. This matrix performs segment-wise multiplication correction on the original spectrum, and then performs de-overlapping stitching to reconstruct the complete transferred spectrum. This allows for adaptive correction of amplitude and baseline differences in different sub-regions while preserving peak position and shape details. Simultaneously, a lightweight classification branch is retained to achieve standard substance classification and identification, providing classification capabilities for the transfer process.

[0052] To further implement the above technical solution, handheld Raman, portable Raman, and micro Raman spectrometers were used to collect data on substances such as acetaminophen, cyclohexane, and naphthalene when acquiring the training dataset. Fifty data points were collected for each substance using each device, and data augmentation was performed to increase baseline noise and enrich the data. The augmented data was converted into .npy files, concatenated, and normalized before being used to divide the training and test sets, protecting the data from leakage and ensuring the authenticity of the transfer results.

[0053] To further implement the above technical solution, during beam alignment in S2, differences in spectrometers lead to a shift in the measured spectral wavenumbers. This invention uses the XAxisWarp algorithm to correct the source spectral data. After the input spectrum is fed into XAxisWarp, the model extracts both global and local features.

[0054] The global branch predicts a scalar shift for the entire spectrum using adaptive average pooling and a lightweight MLP. Its implementation formula is as follows:

[0055] Where x is the input spectrum, and i is the sequence position index, representing the i-th sampling point. GAP(x) is global average pooling, which means averaging the entire spectrum over its length dimension. The () function is a small MLP (fully connected network) used to map the scalar features after global average pooling into global shifts. tanh is the hyperbolic tangent function, used to compress the MLP output to a bounded interval of (-1, 1), ensuring that subsequent shifts do not become infinitely large. Sg is the upper limit coefficient of the global shift amplitude; to maintain the stability of the spectral shift, Sg = 0.5 * max_shift_bins.

[0056] Local branches employ multi-scale convolution kernels (7→7→5→3→3) for convolution. Different kernels provide different receptive fields, simultaneously capturing narrow peaks, wide peaks, shoulder peaks, and baseline slopes, making the model more sensitive to local structures and enabling fine-grained characterization of different bands. The implementation formula is as follows:

[0057] in, This represents a mapping consisting of a one-dimensional convolutional layer composed of convolutional kernels of different sizes stacked sequentially. Here, the convolutional kernels use a convolutional size of 7→7→5→3→3, which maps the spectrum into pointwise displacements of the same length. This represents the final local displacement, i.e., the wavenumber fine-tuning amount for each sampling point; a positive value indicates a displacement towards a higher wavenumber. S is the upper limit of the displacement amplitude, controlling the maximum and minimum values ​​that each sampling point can move.

[0058] If there is no overall shift, the global displacement output is close to zero, producing no additional superposition of results. A uniform translation is only applied when there is an overall spectral shift. The local branch only performs wavenumber shifting on regions where shifts are detected, correcting the shifted areas while leaving the unshifted areas unchanged. The total displacement is obtained by superimposing the obtained global and local displacements.

[0059]

[0060] Resampling is performed on the horizontal axis using inverse mapping, followed by linear interpolation to obtain the aligned data x_warp.

[0061] This method helps to correct the overall and local drift introduced by device differences while maintaining the integrity of the spectrum in the offset-free region, thereby reducing systematic errors and improving training stability in subsequent peak position identification, classification and model transfer.

[0062] To further implement the above technical solution, S3 specifically includes: This invention employs a multi-scale parallel gated convolution strategy (i.e., the MultiScaleGate module) to perform point-by-point soft weighting of the spectrum after Raman spectral wavenumber alignment. This moderately amplifies the "peak-like" regions, enhancing peak-related discriminative information and suppressing task-irrelevant perturbations. One-dimensional convolutions are performed using kernels of different sizes to obtain multi-scale features, which are then concatenated. BatchNorm1d is then used to reduce the amplitude differences between features at different scales. Finally, one-dimensional convolution and the ReLU activation function are used to fuse the feature information and reduce dimensionality. Simultaneously, a Squeeze-and-Excitation (SE) attention mechanism is introduced to adaptively assign weights to each channel. This amplifies channels with higher information content and suppresses redundant or noisy channels, achieving adaptive emphasis on more informative scale channels.

[0063] Specifically, as follows, let the aligned spectrum be... (B is the batch size, L is the input spectrum length). The multi-scale kernel set is denoted as... In this invention, {3, 5, 7, 11} are used, and the channel width of each branch is... The specific formula for parallel convolution is as follows:

[0064] Conv1d one-dimensional convolution is a sliding weighted summation operator in deep learning, commonly used for feature extraction from one-dimensional data such as speech, time series, and spectra. The above formula represents the size of each convolution kernel. Perform a set of 1→ A one-dimensional convolution with a stride of 1 / 2 ,expansion ,filling , ensure when When the number of scales is odd, the output length is L. After completion, the branches of each scale are concatenated along the channel dimension to obtain the comprehensive feature z, with the specific formula as follows:

[0065] The `concat` function (represented as `torch.cat` in PyTorch) concatenates tensors of the same shape end-to-end along a certain dimension to obtain a wider tensor. It does not add a new dimension; instead, it adds the lengths of the specified dimensions. Specifically, concatenating the scale branches along the channel dimension involves the convolution output shape of each branch. Using torch.cat, we can concatenate the data along the channel dimensions to obtain... .

[0066] After the splicing is completed, normalization is performed on each channel to alleviate training instability caused by inconsistent branch amplitudes at different scales. The formula is as follows:

[0067] in , The channel mean and variance are calculated along the (B,L) dimension. , These are learnable scaling and translation parameters. The output of BN is denoted as... (z). Then, a 1×1 convolution is used to perform a linear projection on the channel dimension, transforming (J) )Dimensions dropped to The channel number is activated by the ReLU activation function and then fed into the SE module to obtain channel weights and perform channel recalibration. Subsequently, a 1×1 convolution is used to compress the number of channels to 1, and a Sigmoid function is used to normalize it into a pointwise gated map of [0,1]. This gated map is then used for multiplicative residual modulation of the aligned spectrum to obtain the desired result. .

[0068] To further implement the above technical solution, this invention designs a segmented migration correction mechanism, which predicts the point-by-point adaptive gain curve segment by segment through a sliding window and performs multiplicative correction. This method can ensure the consistency of the overall spectral shape while meticulously correcting baseline drift and amplitude differences in different wavenumber regions.

[0069] Specifically, the model segments the feature map spectrum into multiple segments using a sliding window of step=150 (window length M=300, step size S=200, overlap O=50). A segment head network predicts a pointwise gain curve acting on the Y-axis (i.e., peak intensity) for each segment. This gain curve is then corrected element-wise with the corresponding spectral segment. Finally, an "overlap-add" method with a Hanning window smoothly stitches together all the corrected segments to reconstruct the complete output spectrum. This process adaptively corrects the amplitude and baseline of different sub-regions while preserving peak positions and shape details. A lightweight classification branch is also retained to perform standard substance classification and identification, providing classification capabilities for the transfer process and further ensuring the model's accuracy.

[0070] In obtaining Subsequently, this invention further employs segmented convolution combined with overlapping addition to achieve local amplitude variations, thereby improving the identification of weak peaks and shoulder peaks and suppressing unstructured noise. First, segmented windowing is performed, setting the segment length to M, the stride to H, and the overlap R=MH. The window function formula is:

[0071] If the starting point of segment k is sk=kH, then the windowed segmentation is:

[0072] For each segment, local context is extracted from the backbone features, and a pointwise gain g is generated using a combination of small 1D convolutions / dilated convolutions. k [n]∈[g min ,g max ].

[0073] Specifically, each spectral segment is fed into a multi-layer convolution, and the code for the multi-layer convolution is as follows: Conv1d(C, 32, 5, d=1) → ReLU Conv1d(32, 32, 5, d=2) → ReLU Conv1d(32, 16, 3) → ReLU Conv1d(16, 1, 1) Each layer slides the convolutional kernel along the wavenumber direction to extract local contextual features. The first convolutional layer (kernel size = 5, dilation = 1) captures nearest-neighbor details and is activated with ReLU. The second dilated convolutional layer (kernel = 5, dilation = 2) expands the receptive field, allowing the model to see a wider region, and is also activated with ReLU. The third layer further blends the previously extracted features and uses ReLU. The final layer uses a 1×1 convolution to compress the channels to 1 dimension, outputting a raw gain response. Its mathematical formula is:

[0074] in These are the convolutional kernels of each layer. σ represents a one-dimensional convolution operation, and σ represents the ReLU activation function.

[0075] To prevent excessive gain, this invention... A smoothing constraint was applied:

[0076] Where tanh is the activation function, which restricts the output to (-1, 1), so ∈[0.35,1.65], thus obtaining the final gain curve for each segment. Here The range [0.35, 1.65] corresponds to gk[n] ∈ [gmin, gmax]. Setting it to 1 indicates that the gain center is at 1, meaning the spectrum is output as is when the gain is 0 (here, we want the network to learn only relative corrections, not to push up or down the entire spectrum. Therefore, 1 represents a baseline intensity without any amplification or attenuation). Upward bias indicates amplification, and downward bias indicates attenuation. 0.65 is a value chosen based on experience and actual model training conditions; it is an empirical parameter that can be adjusted according to training conditions and the dataset.

[0077] The result after point-by-point gain is:

[0078] Next, all segments are overlapped and summed, and then normalized using window energy to obtain the locally equalized output y, the formula of which is:

[0079] This normalization ensures the amplitude continuity of the splicing between segments and reduces splicing artifacts at the boundaries. The numerator is the superimposed signal, and the denominator is used for windowed energy normalization. Specifically, the parameters m is the global sampling index, and k is the segment index. [n] is the modulated signal within the segment, and w[n] is the window function used. Represents an indicator function, when That is, the value is 1 if the k-th segment covers the output position m, and 0 otherwise. This ensures that the summation only occurs within the effective range of that segment. The numerator of the formula represents the summation of all windowed and gain-modulated segmented samples covering position m, and the denominator represents the summation using the window energy. Normalize the sum of squares to obtain a continuous, seamless reconstructed output y[m].

[0080] To further implement the above technical solution, this invention employs the prior constraint of peak region window mask, introducing the peak region window mask as feature learning information. Through Savitzky-Golay smoothing and a salient peak detection function, feature peaks are identified within the wavenumber range of 200–3200 per centimeter, generating a binary window mask with and without peaks. The weight of peak regions is increased and incorporated as learnable parameters into the deep network training. The specific formula is as follows:

[0081] Where y is the output spectrum of the model, y* is the reference spectrum of the target instrument, and ⊙ represents element-wise multiplication, which is used to calculate the peak error. It is the L2 norm, in the above formula It calculates the sum of squares. Represents cosine distance, primarily concerned with the consistency of shape / direction, and insensitive to overall amplitude scaling. , , These are weighting coefficients. The weight of the peak error, As the weight of the background region error, Let be the weight of the cosine similarity term, used to constrain the similarity of the overall spectral shape. Simultaneously, let This method prioritizes peak regions. It guides the model to focus on Raman feature regions, reducing the adverse effects of uninformative segments on model convergence and generalization, and overcoming the problem of excessive interference from non-peak regions in traditional full-spectrum fitting.

[0082] To ensure the stability of the migration spectrum, two types of regularization are introduced: local displacement zero-mean regularization for global translation, and displacement smoothing regularization for large-scale trends and oscillations. Therefore, the total loss function is given by the formula:

[0083]

[0084]

[0085] in, For peak-priority regression loss, and Constrain the zero mean and smoothness of the local displacements respectively. This form is equivalent to the Lagrangianization of constrained optimization, making the solution more numerically stable, physically interpretable, and possessing better cross-domain generalization ability.

[0086] Based on this, the present invention sets up classification branches in parallel to align the spectra modulated by multiplicative residuals. The system feeds in the backbone and classification head, outputs the class probabilities for classification, and completes the recognition task under the same input distribution, thereby achieving synergistic optimization of spectral alignment and recognition, which helps to verify the model transfer effect in advance.

[0087] To further implement the above technical solution, this invention adopts a gradient-based stepwise optimization and multi-loss function collaborative optimization method. In the early stage, the cross-entropy loss function is used to quickly stabilize the classification, and in the middle and late stages, the weight of the transfer-related loss function is gradually increased. The transfer optimization direction mainly consists of four parts: (1) window mask weighted cosine similarity loss, which is applied to the source domain and target domain spectra before and after transfer, respectively, to constrain peak alignment and limit overfitting in non-peak regions; (2) peak position RMSE based on window mask, which directly realizes the detection of peak position shift and continuously optimizes towards peak position alignment; (3) spectral gradient structure loss, which is used to maintain spectral shape and features. Thus, the consistency of spectral peak shape and similarity is taken into account. The optimizer adopts Adam (learning rate = 1e-4), and records the convergence trajectory of classification and each transfer loss function during training to prevent overfitting or loss function failure. This invention constructs a multi-objective loss optimization system that synergistically integrates cosine similarity, peak position RMSE, and spectral gradient structure loss. It achieves a balanced optimization in terms of peak position accuracy, spectral shape fidelity, and overall similarity, significantly improving the stability and generalization ability of the model in cross-instrument transfer.

[0088] To further implement the above technical solution, the original training data collected in S1 is subjected to data augmentation and normalization processing, such as... Figure 3 Each of the portable and handheld Raman spectral data for cyclohexane and acetaminophen was augmented 10-fold to improve the model's generalization ability.

[0089] Figure 4 This is a comparison of the normalized intensity of the acetaminophen spectrum before and after migration. Before migration, it is a comparison of the original spectrum and the target spectrum measured by hand. The purple filling in the middle envelope represents the difference between the two. In the comparison after migration, the green filling in the middle envelope represents the difference between the two. It can be seen that the area of ​​the green envelope after migration is smaller than the area of ​​the purple envelope before migration, which proves that the similarity is improved after migration.

[0090] Figure 5This is a comparison of the peak position probability density before and after the migration of acetaminophen. The peak position residuals were obtained by subtracting the Raman characteristic peaks of the target spectrum from the spectra before and after migration using a handheld Raman spectrometer. The number of each residual was counted to obtain the peak position residual probability density before and after migration. Yellow represents the residual distribution before migration, and blue represents the residual distribution after migration. The closer to the middle red line, the closer to the target spectrum. To reduce error, ±2 cm was added as a tolerance. The coverage rate before and after migration was statistically analyzed; higher coverage indicates greater similarity to the target spectrum. It can be seen that the peak positions of the migrated spectrum are significantly better than before migration. The peak RMSE was significantly lower than before migration, and the coverage was significantly improved.

[0091] Figure 6 This is a comparison of the peak positions of acetaminophen before and after model migration. The purple spectrum is the original acetaminophen spectrum measured using a handheld Raman spectrometer; the green spectrum is the migrated spectrum obtained after model migration; and the red spectrum is the target spectrum measured using a higher-precision portable Raman spectrometer. Y-shift stacking plots were created for the three spectra in the 200-2000 wavenumber range. The peak positions marked on the plot show that the original spectrum before migration has a larger peak position shift than the target spectrum, with a maximum shift of 40 wavenumbers, and the degree of shift varies within each segment. The peak positions of the spectrum after model migration are much closer to the target spectrum, with a maximum shift of about 10 wavenumbers, demonstrating the effectiveness of model migration in peak alignment.

[0092] Figure 7 This is a comparison chart of the acetaminophen model before and after migration. Figure 7 (a) in the image represents the state before migration. Figure 7 (b) shows the result after migration. The effect of model migration was tested using acetaminophen, with cosine similarity and peak position RMSE used as evaluation criteria. The first figure shows the original and target spectra measured by handheld measurement, with a similarity of approximately 89.9%. The second figure is a comparison of the model-transferred spectrum and the target spectrum; after migration, the similarity to the target spectrum increased to 98.0%.

[0093] Figure 8 This is a comparison chart of the resorcinol model before and after migration. Figure 8 (a) in the image represents the state before migration. Figure 8(b) shows the transferred spectrum. The effect of model transfer was tested using resorcinol, a substance the model had never encountered before. Cosine similarity and peak position RMSE were used as evaluation criteria; higher similarity indicates more similar spectra, and lower peak position RMSE indicates smaller peak position differences. The first image shows the original spectrum (source) and target spectrum measured handheld, with a similarity of approximately 92.7% and a peak position RMSE of 3.02. The second image shows the transferred spectrum after slight smoothing, compared to the target spectrum. After transfer, the similarity to the target spectrum increased to 95.2%, and the peak position RMSE decreased to 2.92.

[0094] Figure 9 This is a comparison chart of the n-hexane model before and after migration. Figure 9 (a) in the text represents before migration. Figure 9 (b) in the diagram represents the result after migration. The model's migration effect was tested using n-hexane, an unfamiliar substance not previously seen by the model. The model still showed migration effect on the original spectra obtained by handheld spectroscopy, which had high noise and poor signal. After migration, the cosine similarity with the target spectrum increased to 97.4%, and the peak position RMSE decreased to 1.41.

[0095] Figure 10 This is a comparison chart of cyclohexane migration before and after. Figure 10 (a) in the text represents before migration. Figure 10 (b) indicates that after migration, the similarity with the target spectrum increased from 76% to 92%, and the peak RMSE decreased from 5.54 to 2.62.

[0096] Figure 11 This is a comparison image of naphthalene migration before and after. Figure 11 (a) in the text represents before migration. Figure 11 (b) in the diagram represents the result after migration. After migration, the similarity to the target spectrum increased from 63.3% to 90.5%, and the peak position RMSE decreased from 7.63 to 4.53.

[0097] This invention addresses the cross-device Raman spectroscopy model transfer scenario, proposing a model transfer scheme that integrates peak window masking, piecewise transfer correction, and multi-scale parallel convolution. Addressing the bottlenecks commonly encountered in existing cross-device Raman spectroscopy analysis, such as inconsistent baseline noise, peak shift, and noise interference, this invention moves beyond traditional piecewise linear transfer. Instead, it utilizes a convolutional neural network to achieve adaptive spectral transfer, improving spectral consistency and comparability across different devices.

[0098] 1. Peak Position Nonlinear Shift: Differences between different instruments and batches cause overall translation shifts and wavenumber drift in local bands, making it difficult for traditional global linear / piecewise linear calibration to accurately align spectral positions. This invention employs decoupled modeling of global and local shifts to achieve peak position alignment of the source spectrum. It can handle both overall spectral translation shifts and perform fine-grained corrections for minor local shifts, reducing over- or under-correction. When there is no overall shift, the global shift output is approximately 0 and does not participate in correction. This is beneficial for maintaining the integrity of the spectral shape in the shift-free region while correcting overall and local drifts introduced by equipment differences, thereby reducing systematic errors and improving training stability in subsequent peak position identification, classification, and model transfer.

[0099] 2. Baseline Inconsistency and Noise Interference: Inconsistencies between background, baseline, and instrument response, as well as the submergence of weak peaks by noise, lead to the full spectrum fitting being dominated by "non-peak regions." Traditional classical algorithms cannot distinguish features, resulting in transfer failure. This invention employs a multi-scale amplitude gating algorithm, using parallel multi-scale convolution to extract peak shape features. Different convolution kernels provide different receptive fields, simultaneously capturing narrow peaks, wide peaks, shoulder peaks, and baseline slopes, making the model more sensitive to local structures. Furthermore, sample-adaptive scale weights are obtained through SE channel recalibration, ultimately generating point-by-point gating. Combined with a segmented transfer correction mechanism, the transfer matrix is ​​obtained through segmented prediction via a fixed window and multiplicative correction is performed, making it more sensitive to weak peaks, shoulder peaks, and slow baseline changes. This ensures the consistency of the overall spectral shape while more finely correcting baseline drift and amplitude differences at different wavenumbers. It helps to highlight peak regions, suppress flat and noisy segments, and achieves near identity mapping at gating ≈ 0, avoiding excessive modification of peakless regions that could lead to spectral distortion.

[0100] 3. Insufficient cross-domain generalization: Under device switching and environmental changes, the model struggles to maintain stable perception of peak shape and position, leading to decreased recognition performance and incomparability. Traditional methods require different parameters for different substances, consuming significant time and resources. This invention introduces peak window masks as feature learning information, dividing the spectrum into high-value and low-value regions through smoothing and saliency peak detection. It increases the weight of peak windows, enabling the deep residual convolutional network to focus on higher-value molecular vibrational feature regions during training, weakening the impact of non-peak regions and baseline fluctuations on optimization, and improving the model's generalization ability.

[0101] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to the method section.

[0102] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A standard substance-based Raman spectrum model migration transfer method, characterized by, The method comprises the following steps: S1: acquiring Raman spectra of standard substances under different devices, and extracting source domain data and target domain data as training data; S2: performing beam alignment on the source domain data; S3: performing soft weighting on each point of the spectrum after beam alignment by using a multi-scale parallel gated convolution strategy to obtain an enhanced feature map; S4: performing window segmentation based on the enhanced feature map, and performing point-by-point gain within the segment; S5: superimposing each segmented gain, and normalizing with window energy to obtain a local equalization output; S6: calculating a loss function according to the local equalization and the corresponding target domain data, and optimizing the model parameters. 2.The method of claim 1, wherein, The S2 comprises: extracting global displacement and local displacement of the source domain data respectively; and performing reverse mapping based on the total displacement after superimposition of the global displacement and the local displacement. 3.The method of claim 2, wherein, The extraction method of the global displacement comprises: ; where, is the global displacement, x is the input spectrum, i is the index of sequence position, denotes the i-th sample point; GAP(x) is the global average pooling, which means taking the average of the whole spectrum in the length dimension; is the fully connected network, which is used to map the scalar feature after global average pooling to the global displacement; tanh is the hyperbolic tangent function, which is used to compress the output of MLP to a bounded interval; Sg is the amplitude upper limit coefficient of the global displacement, and L is the spectrum length. 4.The method of claim 2, wherein, The extraction method of the local displacement comprises: ; wherein, is the local displacement, S is the set upper limit of the displacement amplitude, and the maximum minimum value of the movable of each sampling point, denotes a mapping consisting of one-dimensional convolution layers sequentially stacked by different size convolution kernels. 5.The method of claim 1, wherein, The S3 comprises: S31: performing multi-scale parallel convolution based on the spectrum after beam alignment; S32: performing splicing in the channel dimension to obtain comprehensive features; S33: performing channel attention calculation based on the comprehensive features to confirm channel weights; S34: compressing the channels to 1 and performing normalization to obtain a gating map; S35: weighting the spectrum after beam alignment based on the enhanced feature map. 6.The method of claim 1, wherein, The local equalization output in the S4 is: ; wherein, is the local equalization output, m is the global sample index, is the result signal after point-wise gain, k is the segment index; is the window function, denotes the start index of the k-th segment, M is the segment length, is the indicator function, which takes the value 1 if the variable within the brackets satisfies the interval 0 to M-1, otherwise 0. 7.The method of claim 1, wherein, The loss function comprises a peak region error term and a background region error term, and when the loss function is calculated, a peak region window mask is introduced to calculate the peak region error and the background region error. 8.The method of claim 7, wherein, The peak priority regression loss is calculated as the loss function: ; wherein, is the peak region regression loss, m is the peak region window mask value, y is the output spectrum of the model, is the target instrument reference spectrum, and represents element-wise multiplication, which is used to calculate the peak region error; is the L2 norm, and is the sum of squares; is the weight coefficient, is the weight of the peak region error, is the weight of the background region error, is the weight of the cosine similarity term.​​ 9.The method of claim 8, wherein, On the basis of the peak priority regression loss, a zero value constraint loss and a smoothness constraint loss are introduced to calculate a total loss as the final loss function: ; ; ; wherein, is a total loss function, is a peak area preferential regression loss, and are zero-value constraint loss and smoothness constraint loss, respectively, for constraining the zero mean and smoothness of the local displacement, and are corresponding loss function coefficients, is a mean function, is a local displacement corresponding to the i-th sampling point, and are a first derivative and a second derivative of respectively, is a second derivative coefficient.

Citation Information

Patent Citations

  • High-resolution spectrum rapid analysis method for fabric fiber components

    CN119880878A

  • AI-based chemical material detection information library retrieval and standard spectrum comparison system

    CN120108578A

  • Bacterial Raman spectrum chemical component cross-domain analysis method based on deep transfer learning

    CN120673875A

  • Multi-source Raman spectrum domain migration sheep echinococcosis classification model and classification method based on target related knowledge mining

    CN121053464A

Cited By

  • Libs cross-instrument spectral library transfer method and system based on spectral calibration and deep learning

    CN122448826A