Raman spectrum cross-instrument conversion method and system based on twin neural network
Through feature extraction of twin neural networks and generative adversarial network processing, the problem of low spectral cosine similarity in cross-instrument conversion is solved, and efficient and accurate spectral data conversion is achieved, which is suitable for portable instruments.
Patent Information
- Application Number
- CN202510734552.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-04
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2045-06-04
AI Technical Summary
Existing cross-instrument conversion methods result in low spectral cosine similarity before and after conversion, affecting the accuracy of detection results.
A method based on twin neural networks is adopted to process the original spectrum and target spectrum through feature extraction module and generative adversarial network, including preprocessing, feature extraction, feature conversion and denoising. The deep separable convolutional network is used to improve the feature extraction efficiency and spectrum conversion quality.
The cosine similarity after spectral conversion exceeds 98%, the spectral features are almost lossless, the execution speed is fast, and it is suitable for deployment in portable instruments. It can quickly and efficiently complete the standardized conversion of spectral data.
Smart Images

Figure CN120259698B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of Raman spectroscopy technology, and specifically relates to a Raman spectrum cross-instrument conversion method and system based on twin neural networks. Background Art
[0002] In the field of Raman spectroscopy for mixture detection, portable instruments are typically used to detect the mixture and output spectra, which are then analyzed using more precise scientific Raman spectrometers. However, due to significant differences between portable and scientific Raman spectrometers in hardware design, optical path structure, and instrument parameters, the output spectral data formats and characteristics vary, resulting in low confidence in the final detection results and reduced detection efficiency. To address this issue, cross-instrument conversion algorithms are often configured within the device to ensure that spectra measured by different instruments have the same characteristics, thereby improving the accuracy of material analysis results.
[0003] Existing algorithms primarily utilize piecewise direct standardization (PDS), which divides the data into multiple segments, performs direct standardization within each segment, and establishes conversion coefficients between the source and target spectra using a sliding window to achieve spectral instrument transfer. While this algorithm ensures minimal transmission error between the two instruments and increases the robustness of the results with increasing numbers of conversion samples, this method results in a lack of sufficient similarity between the source and target spectra, making the accuracy of the final detection results unreliable.
[0004] In view of this, the present invention is proposed. Summary of the Invention
[0005] One object of the present invention is to solve the problem in existing cross-instrument conversion methods that the cosine similarity of spectra before and after conversion is low.
[0006] To achieve the above objectives, the present invention provides a Raman spectrum cross-instrument conversion method based on a twin neural network, comprising:
[0007] obtaining at least one original spectrum and one target spectrum, and preprocessing the spectrum;
[0008] Input each of the preprocessed original spectral information and each of the target spectral information into a sub-network of the twin neural network respectively;
[0009] The feature extraction module extracts features from the spectral information in each of the sub-networks;
[0010] The feature conversion module converts each of the extracted original spectral information into target spectral information;
[0011] The generative adversarial network reconstructs a spectrum based on the target spectrum information and performs denoising on the reconstructed spectrum.
[0012] Furthermore, the step of "obtaining at least one original spectrum and one target spectrum, and preprocessing them" includes: obtaining at least one original spectrum and one target spectrum; performing characteristic peak intensity transformation on each of the original spectrum and target spectrum respectively to limit the spectral characteristic peak intensity to the interval [0, 1].
[0013] Furthermore, the step of “converting the characteristic peak intensity of each of the original spectrum and the target spectrum” includes: inputting a signal: , Set to the original spectrum or target spectrum; get the minimum value in the spectrum information, that is, ; Subtract the minimum value from the spectral information, that is ; Get the maximum value in the spectral information, that is ; Normalize the spectral information and output the signal ,Right now .
[0014] Furthermore, the step of "extracting features from the spectral information in each of the sub-networks" includes: mapping the spectral information in each of the sub-networks to a low-dimensional feature space to obtain multiple feature vectors; calculating the distance between the feature vector corresponding to each original spectrum and the feature vector corresponding to the target spectrum; judging the similarity between the original spectrum and the target spectrum based on the distance; extracting the feature values of the original spectrum and the target spectrum to obtain a feature matrix corresponding to each original spectrum and a feature matrix corresponding to the target spectrum.
[0015] Furthermore, the step of “converting each of the extracted original spectral information into target spectral information” includes: converting each original spectral feature matrix into a target feature matrix.
[0016] Furthermore, the generative adversarial network includes an encoder and a decoder, and the step of "reconstructing the spectrum using the converted spectral information by the generative adversarial network" includes: the encoder maps each target feature matrix obtained after the conversion to a higher-dimensional feature space to obtain a parameter Z of the latent variable, and expresses the latent variable z as a formula; ;in, , is the mean of the output latent variable, is the standard deviation of the output latent variable, represents the normal distribution, is the identity matrix; the decoder reconstructs the data from the latent space, maps the latent variable z back to the target spectral data space, and reconstructs the spectrum.
[0017] Furthermore, the step of denoising the reconstructed spectrum includes: performing DoBechie wavelet transform, Fourier transform and Butterworth low-pass filter on the reconstructed spectrum in sequence to enhance and denoise the spectrum signal; and then removing noise peaks in the spectrum signal by value filtering.
[0018] Furthermore, the twin neural network consists of two or more sub-networks with the same structure and shared weights, and is trained using a cross-entropy loss function.
[0019] Furthermore, the feature extraction module is configured as the twin neural network composed of three one-dimensional convolutional layers, with a convolution kernel size of 1*3, and performs feature extraction on the spectral information in all the sub-networks to obtain an original spectral matrix corresponding to each of the original spectra and a target spectral matrix corresponding to the target spectrum; or, the feature extraction module is configured as a deep separable convolutional network, which receives the spectral information in each sub-network through the receiving layer, and performs convolution calculation on the spectral information in each channel respectively to obtain an original spectral matrix corresponding to each of the original spectra and a target spectral matrix corresponding to the target spectrum.
[0020] Furthermore, the feature conversion module is configured to consist of a convolutional layer and two fully connected layers, and the MSE function is used as the loss function to train the feature conversion module.
[0021] Furthermore, the network layer of the generative adversarial network is set as a fully connected layer, and the generative adversarial network is trained using a VAE loss function; and the fully connected layer in the twin neural network, the feature extraction module, the feature conversion module, and the generative adversarial network module are all configured to have input and output dimensions of 64*256, 256*512, and 512*1700, respectively.
[0022] In some further embodiments, a Raman spectrum inter-instrument conversion system is provided, and any of the above-described Raman spectrum inter-instrument conversion methods based on twin neural networks can be applied to the Raman spectrum inter-instrument conversion system.
[0023] In some further embodiments, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the Raman spectrum cross-instrument conversion method based on a twin neural network as described above is implemented and applied to the Raman spectrum cross-instrument conversion system described above.
[0024] In other embodiments, a computer-readable storage medium is provided, which stores a computer program. When the computer program is executed by a processor, it implements the Raman spectrum cross-instrument conversion method based on a twin neural network as described in any one of the above and is applied to the Raman spectrum cross-instrument conversion system described above.
[0025] Based on the foregoing description, those skilled in the art will understand that by using a twin neural network to perform comparative learning on the original spectrum and the target spectrum, and then automatically extracting features by a feature extraction network, a neural network is generated to convert the collected data of different instruments into the spectral space of the target instrument, thereby achieving standardized conversion of spectral data collected by different instruments. By mapping the source domain data to the target domain spectral space, the influence of instrument hardware differences on the analysis accuracy is eliminated. The cosine similarity of the spectrum after conversion of the present invention exceeds 98%, the spectral features are almost lossless, and the execution speed is very fast, which can reach within 0.05s on a PC CPU and 0.35s on a development board CPU. The method of the present invention has the characteristics of fast execution speed, low resource occupation, and accurate conversion accuracy, and can be directly deployed in portable instruments. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The accompanying drawings are part of this invention and are used to provide a further understanding of the invention. The exemplary embodiments of the invention and their descriptions are used to explain the invention and do not constitute an undue limitation of the invention. Obviously, the drawings described below are only some embodiments. For those skilled in the art, other drawings can be obtained based on these drawings without inventive efforts. In the accompanying drawings:
[0027] Figure 1 Flowchart of a Raman spectrum cross-instrument conversion method based on a twin neural network in some embodiments of the present invention;
[0028] Figure 2 Compare cosine similarity plots after completing cross-instrument conversion for multiple algorithms;
[0029] Figure 3 Different spectra of ethanol;
[0030] Figure 4 These are different spectra of n-propanol. DETAILED DESCRIPTION
[0031] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. The following embodiments are used to illustrate the present invention but are not used to limit the scope of the present invention.
[0032] In the description of the present invention, it should be noted that the terms "upper", "lower", "front", "back", "left", "right", "vertical", "inside", "outside", etc., indicating directions or positional relationships, are based on the directions or positional relationships shown in the accompanying drawings. They are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific direction, be constructed and operated in a specific direction. Therefore, they cannot be understood as limiting the present invention.
[0033] In the description of the present invention, it should be noted that, unless otherwise expressly specified or limited, the terms "mounted," "connected," and "connected" should be understood broadly. For example, they may refer to fixed, detachable, or integral connections; mechanical or electrical connections; and direct or indirect connections through an intermediary. Those skilled in the art will understand the specific meanings of the above terms in the present invention based on the specific circumstances.
[0034] It should be understood by those skilled in the art that the embodiments described below are only some embodiments of the present invention, rather than all embodiments of the present invention, and that these embodiments are intended to explain the technical principles of the present invention and are not intended to limit the scope of protection of the present invention. Based on the embodiments provided by the present invention, all other embodiments obtained by those skilled in the art without creative effort should still fall within the scope of protection of the present invention.
[0035] Refer to the following Figures 1 to 4 , to explain in detail the Raman spectrum cross-instrument conversion method based on twin neural networks in some embodiments of the present invention. Figure 1 Flowchart of a Raman spectrum cross-instrument conversion method based on a twin neural network in some embodiments of the present invention; Figure 2 Compare cosine similarity plots after completing cross-instrument conversion for multiple algorithms; Figure 3 Different spectra of ethanol; Figure 4 These are different spectra of n-propanol.
[0036] like Figure 1 As shown, in some embodiments of the present invention, a method for Raman spectrum cross-instrument conversion based on a twin neural network is provided, comprising:
[0037] Step S110: Acquire at least one original spectrum and one target spectrum, and pre-process them. The original spectrum is the spectrum information detected by the original instrument (the original instrument can be a portable instrument or a conventional Raman spectrometer), and the target spectrum is the spectrum information detected by the target instrument.
[0038] The preprocessing process includes: performing denoising on both the original spectrum and the target spectrum. Specifically, it includes: performing characteristic peak intensification processing on the original spectrum so that the characteristic peak intensity of the original spectrum information is controlled within the interval [0, 1]. Specifically, step S110 includes: obtaining at least one original spectrum and one target spectrum; and performing characteristic peak intensity transformation on each of the original spectrum and the target spectrum to limit the spectral characteristic peak intensity to the interval [0, 1].
[0039] The step of “performing characteristic peak intensity transformation on each of the original spectrum and the target spectrum” includes:
[0040] Input signal: , Set to original spectrum or target spectrum;
[0041] Get the minimum value in the spectral information, that is ;
[0042] Subtract the minimum value from the spectral information, i.e. ;
[0043] Get the maximum value in the spectral information, that is ;
[0044] Normalize the spectral information and output the signal ,Right now .
[0045] In step S120, each item of preprocessed original spectral information and each item of target spectral information are input into a sub-network of the twin neural network respectively.
[0046] A Siamese Neural Network (SNN) consists of two or more sub-networks with the same structure and shared weights, and is trained using the cross-entropy loss function.
[0047] In step S130 , the feature extraction module extracts features from the spectral information in each sub-network.
[0048] In other embodiments of the present invention, the feature extraction module is configured as a twin neural network consisting of three one-dimensional convolutional layers with a convolution kernel size of 1*3, and feature extraction is performed on the spectral information in all sub-networks to obtain an original spectral matrix corresponding to each original spectrum and a target spectral matrix corresponding to the target spectrum. The present invention uses multiple identical network branches to process two or more input samples, namely each original spectrum and target spectrum, respectively. These multiple branch sub-neural networks share weights to ensure that the same feature extraction operation is performed on the two input samples. In the present invention, unsupervised learning is used when training the twin neural network, and no labels are given. The loss function uses the cross-entropy loss function. Finally, two feature matrices of the original spectral information detected by the original instrument and the target spectral information detected by the target instrument are obtained.
[0049] In some further embodiments of the present invention, the feature extraction module is configured as a depthwise separable convolutional network. This network receives spectral information from each subnetwork via a receiving layer and performs convolution calculations on the spectral information within each channel to obtain an original spectral matrix corresponding to each original spectrum and a target spectral matrix corresponding to the target spectrum. Specifically, multiple convolutional layers are used to extract features from each original spectral information and target spectrum, and these layers are then stacked together to achieve hierarchical learning.
[0050] Wherein, step S130 includes:
[0051] Map the spectral information in each sub-network into a low-dimensional feature space to obtain multiple feature vectors;
[0052] Calculate the Euclidean distance between the eigenvector corresponding to each original spectrum and the eigenvector corresponding to the target spectrum;
[0053] The similarity between the original spectrum and the target spectrum is determined based on the Euclidean distance.
[0054] Extract the eigenvalues of the original and target spectra to obtain the feature matrices corresponding to each original spectrum and the feature matrix corresponding to the target spectrum. After training each subnetwork in the twin neural network as described above, the feature extraction module outputs the corresponding feature matrix.
[0055] Step S140: The feature conversion module converts each of the extracted original spectral information into target spectral information.
[0056] The feature conversion module consists of one convolutional layer and two fully connected layers. The convolutional layer further extracts features and reduces dimensionality, while the fully connected layer gradually adjusts the feature distribution and enhances the feature representation capability. It is trained using the mean squared error (MSE) function as the loss function to convert the original spectral feature vector into the target spectral feature vector.
[0057] Specifically, step S140 includes converting each original feature matrix into a target feature matrix.
[0058] In step S150, a generative adversarial network reconstructs a spectrum based on the target spectral information and performs denoising on the reconstructed spectrum. Specifically, the encoder maps the input feature matrix, i.e., the target feature matrix, to a higher-dimensional feature space to obtain the parameters of the latent variable (mean μ and variance σ), i.e., the mean μ and standard deviation σ of the latent variable, as well as the noise ε sampled from a standard normal distribution, ε ~ N(0, I), to obtain the following formula:
[0059] .
[0060] The decoder reconstructs the data from the latent space, maps the latent variable z back to the target spectral data space, and reconstructs the original input, that is, reconstructs the spectral signal.
[0061] The network layer of the generative adversarial network is set to a fully connected layer.
[0062] Since the fully connected layer can simplify the training process, the network layers used in the present invention are all fully connected layers, and the input and output dimensions are 64*256, 256*512, and 512*1700, respectively. That is, the fully connected layers in the twin neural network, feature extraction module, feature conversion module, and generative adversarial network module are all configured to have their input and output dimensions of 64*256, 256*512, and 512*1700, respectively.
[0063] Through the network layer structure, the VAE loss function is used to learn the latent structure of the data distribution and reconstruct the target spectrum information. By decoding points in the latent space, new samples similar to the original data are generated. The original spectra are then converted to the spectrum of the target instrument. During training, the VAE loss function consists of two parts: the root mean square reconstruction loss (MSEReconstruction loss) and the KL divergence loss. These two losses are weighted together to form a total loss, which is used to update the model parameters.
[0064] This invention replaces simple one-dimensional convolution with depthwise separable convolution. The steps involved in constructing depthwise separable convolution include: first, depthwise convolution (DW), which performs independent convolution on each input channel; then, pointwise convolution (PW), which uses a 1×1 convolution kernel to perform linear combinations along the channel dimension. The number of channels in the output feature map is determined by the number of output channels of the pointwise convolution kernel. This decomposition is based on the following theorem: for a standard convolution with C input channels and M output channels, the computational complexity is O(C×M×K²), where K is the kernel size. Depthwise separable convolution reduces the computational complexity to O(C×K²+C×M), effectively reducing the dimensionality of the depthwise separable convolution. This decomposition significantly reduces the computational effort, making the model faster and particularly suitable for resource-constrained environments. This makes the algorithm well-suited for deployment on portable devices.
[0065] The denoising process for the reconstructed spectrum includes: performing a Daubechies wavelet transform, a Fourier transform, and a Butterworth low-pass filter on the reconstructed spectrum to enhance and denoise the spectral signal; then, using value filtering to remove noise spikes from the spectral signal. First, the reconstructed spectral signal undergoes a Daubechies wavelet transform, using the db4 wavelet cap to calculate the wavelet decomposition coefficients of the signal, and then applying a threshold to eliminate noise. Next, a fast Fourier transform (FFT) is used to convert the time domain signal into the frequency domain for better analysis of the signal characteristics. A Butterworth low-pass filter is then used to extract and suppress specific frequency components, thereby smoothing the reconstructed spectral signal. Finally, a median filter is used to remove noise spikes from the signal.
[0066] In other embodiments of the present invention, a Raman spectrum inter-instrument conversion system is provided, and any of the above-described Raman spectrum inter-instrument conversion methods based on twin neural networks can be applied to the Raman spectrum inter-instrument conversion system.
[0067] The Raman spectrum cross-instrument conversion system of the present invention includes a scientific Raman instrument and a portable Raman instrument, wherein the original spectrum refers to the spectrum collected by the portable Raman instrument, and the target spectrum is the spectrum collected by the scientific Raman instrument. The portable Raman device mentioned in the present invention is a portable Raman spectrometer produced by Liqiong Optoelectronics. Specifically, the portable Raman device is a Blade 785B Pro model, which provides 200 cm -1 to 3200 cm -1 The spectral range is 785 nm with a resolution of 6 cm -1 to 8 cm -1The scientific benchtop Raman instrument is a Horiba LabRAM HR Evolution Raman spectrometer with a spectral range of 50 cm -1 to 4000 cm -1 , with a resolution of 0.35 cm -1 The available excitation wavelengths include 325nm, 532nm, 633nm and 785nm, and the output power is 500 mW.
[0068] In this example, the operator compared multiple methods, including raw spectra, a VAE-trained convolutional neural network (CNN-VAE) that only used a one-dimensional convolutional neural network (1D-CNN) to extract features, a VAE-trained convolutional neural network using a Siamese neural network combined with a regular 1D-CNN (SNN-VAE-CNN), a VAE-trained convolutional neural network using a Siamese neural network combined with a depthwise separable convolution (DSCNN) (SNN-VAE-DSCNN), and a generative adversarial network (Cycle-GAN).
[0069] like Figure 2As shown, due to the low cosine similarity between the raw spectrum and the standard spectrum (i.e., the target spectrum), instrument transfer using the raw data is ineffective and requires further feature extraction and processing. However, a VAE using 1D-CNN feature extraction (CNN-VAE) significantly improved performance. Furthermore, a VAE using a Siamese neural network combined with a 1D-CNN (SNN-VAE-CNN) outperformed CNN-VAE in most cases, particularly for cyclohexane and n-propanol. Therefore, the present invention employs a Siamese network for feature extraction and fusion. Meanwhile, the generative adversarial network (Cycle-GAN) demonstrated excellent generation quality, particularly for n-propanol and tetraethyl orthosilicate, achieving the highest performance, but slightly lagging behind SNN-VAE-CNN for ethanol and acetonitrile. A VAE using a Siamese neural network combined with a depthwise separable convolutional network (DSCNN) (SNN-VAE-DSCNN) performed comparable to SNN-VAE-CNN, slightly outperforming SNN-VAE-CNN in some cases (such as ethanol and acetonitrile), but slightly behind SNN-VAE-CNN in others (such as n-propanol). Therefore, the present invention combines a Siamese neural network with a deep separable convolutional VAE (SNN-VAE-DSCNN), achieving superior performance in instrument transfer tasks, particularly in terms of computational efficiency and feature extraction. While the generative adversarial network (Cycle-GAN) performs best in certain complex tasks, its performance in some cases lags behind that of SNN-VAE-CNN and SNN-VAE-DSCNN due to its greater network complexity and difficulty in training. Therefore, the present invention utilizes a combination of different algorithms to achieve cross-instrument Raman spectral transfer.
[0070] like Figure 3 and Figure 4 Figure 2 shows the differences between spectra of ethanol and n-propanol acquired on different instruments, and the role of the instrument transfer algorithm in spectral conversion. The instrument transfer algorithm utilizes the SNN-VAE-DSCNN. By comparing the two sub-figures in the figure horizontally, the differences between the portable instrument spectrum and its converted spectra can be clearly observed. The ethanol and n-propanol spectra acquired by the portable instrument exhibit more background and random noise than those obtained by the scientific instrument, with poor peak shape and significant peak deviation. In contrast, in the lower sub-figure, the spectra converted using the instrument transfer algorithm have had most of the noise removed and the peak shape adjusted to the standard spectrum, significantly improving the quality and accuracy of the spectra. This demonstrates the important role of the instrument transfer algorithm in the spectral conversion process, effectively enhancing the credibility of the detection results from the portable instrument spectrum.
[0071] In other embodiments of the present invention, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the computer device performs steps related to the Raman spectrum inter-instrument conversion system. When the processor executes the computer program, the Raman spectrum inter-instrument conversion method based on a twin neural network described above is implemented and applied to the Raman spectrum inter-instrument conversion system described above.
[0072] The computer used in this paper was an 11th-generation Intel Core i5-1155G7 CPU at 2.50GHz to verify the execution speed of training and testing of each algorithm. Both training and testing were performed for 50 epochs, with a learning rate of 0.01. The algorithm was also deployed on an Atlas 200 DK CPU, using a quad-core 1.0GHz Arm-A55 processor with 8GB of system memory. For Cycle-GAN, we used a pre-trained model available on Github.
[0073] As shown in Table 1, while Cycle-GAN performs exceptionally well in terms of generation quality, achieving the highest performance on n-propanol and tetraethyl orthosilicate, SNN-VAE-CNN and SNN-VAE-DSCNN demonstrate significant advantages in execution speed. While SNN-VAE-CNN slightly lags behind Cycle-GAN in cosine similarity, the difference is minimal and negligible. However, when focusing on the key metric of execution speed, the advantage of SNN-VAE-DSCNN becomes clear. On a PC CPU, SNN-VAE-DSCNN executes in just 0.044 seconds, compared to 1.42 seconds for Cycle-GAN. This significant speed advantage is double that of SNN-VAE-CNN. This gap widens even further on the development board's CPU, with SNN-VAE-DSCNN completing in just 0.35 seconds, compared to 22.31 seconds for Cycle-GAN. Furthermore, portable devices are usually limited by computing resources and battery life, and the SNN-VAE using depthwise separable convolution can not only process data quickly, but also provide high-quality spectral conversion results while maintaining high efficiency. Its comprehensive capabilities are stronger than those of SNN-VAE using only 1D-CNN and classic 1D-CNN. Therefore, considering speed, efficiency and applicability, the SNN-VAE using depthwise separable convolution in the present invention can not only complete complex feature extraction and conversion tasks in a short time, but also ensure that the generated spectral data meets the needs of practical applications in terms of quality and accuracy, thereby realizing efficient and reliable spectral instrument transmission on portable devices, and providing strong technical support for rapid on-site detection and real-time data analysis.
[0074] Table 1 Execution time of transfer algorithms between different instruments
[0075]
[0076] In other embodiments of the present invention, a computer-readable storage medium is provided, storing a computer program thereon. The computer program is used by a processor to execute the aforementioned method for Raman spectrum cross-instrument conversion based on a twin neural network. When executed by the processor, the computer program implements the aforementioned method for Raman spectrum cross-instrument conversion based on a twin neural network and is applied to the aforementioned system for Raman spectrum cross-instrument conversion.
[0077] Those skilled in the art will understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, prediction model or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0078] Those skilled in the art will clearly understand that for the sake of convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0079] It will be understood by those skilled in the art that the present invention uses a twin neural network to perform comparative learning on the original spectrum and the target spectrum, and then the feature extraction network automatically extracts features to generate a neural network to convert the collected data of different instruments into the spectral space of the target instrument, thereby achieving standardized conversion of spectral data collected by different instruments. By mapping the source domain data to the target domain spectral space, the influence of instrument hardware differences on the analysis accuracy is eliminated. The cosine similarity of the spectrum after conversion of the present invention exceeds 98%, the spectral features are almost lossless, and the execution speed is very fast, which can reach within 0.05s on a PC CPU and 0.35s on a development board CPU. The method of the present invention has the characteristics of fast execution speed, low resource occupation, and accurate conversion accuracy, and can be directly deployed in portable instruments.
[0080] The above description is merely a preferred embodiment of the present invention and does not constitute any form of limitation to the present invention. Although the present invention has been disclosed as above in terms of a preferred embodiment, it is not intended to limit the present invention. Any technician familiar with the present invention can make some changes or modifications to equivalent embodiments using the above-mentioned technical contents without departing from the scope of the technical solution of the present invention. The implementation schemes in the above-mentioned embodiments can be further combined or replaced. However, any simple modifications, equivalent changes and modifications made to the above-mentioned embodiments based on the technical essence of the present invention without departing from the content of the technical solution of the present invention are still within the scope of the solution of the present invention.
Claims
1. A Raman spectrum cross-instrument conversion method based on twin neural networks, characterized in that: include: obtaining at least one original spectrum and one target spectrum, and preprocessing the spectrum; Input each of the preprocessed original spectral information and each of the target spectral information into a sub-network of the twin neural network respectively; The feature extraction module extracts features from the spectral information in each of the sub-networks; The feature conversion module converts each of the extracted original spectral information into target spectral information; Generate an adversarial network to reconstruct a spectrum based on the target spectrum information, and perform denoising on the reconstructed spectrum; The step of extracting features from the spectral information in each of the sub-networks comprises: Mapping the spectral information in each of the sub-networks into a low-dimensional feature space to obtain a plurality of feature vectors; Calculate the Euclidean distance between the eigenvector corresponding to each original spectrum and the eigenvector corresponding to the target spectrum; Determine the similarity between the original spectrum and the target spectrum based on the Euclidean distance; Extract the eigenvalues of the original spectrum and the target spectrum to obtain the characteristic matrix corresponding to each original spectrum and the characteristic matrix corresponding to the target spectrum; The generative adversarial network includes an encoder and a decoder. The generative adversarial network reconstructs a spectrum using the converted spectral information, including: The encoder maps each target feature matrix obtained after the transformation to a higher-dimensional feature space to obtain the parameter Z of the latent variable, and expresses the latent variable z as a formula; in, , is the mean of the output latent variable, is the standard deviation of the output latent variable, represents the normal distribution, is the identity matrix; The decoder reconstructs the data from the latent space, maps the latent variables z back to the target spectral data space, and reconstructs the spectrum.
2. The Raman spectrum cross-instrument conversion method based on twin neural networks according to claim 1 is characterized in that: The step of obtaining at least one original spectrum and one target spectrum and preprocessing them comprises: acquiring at least one original spectrum and one target spectrum; A characteristic peak intensity transformation is performed on each of the original spectrum and the target spectrum respectively, so as to limit the intensity of the characteristic peak of the spectrum to the interval [0, 1].
3. The Raman spectrum cross-instrument conversion method based on twin neural networks according to claim 2 is characterized in that: The step of performing characteristic peak intensity conversion on each of the original spectrum and the target spectrum comprises: Input signal: , Set to original spectrum or target spectrum; Get the minimum value in the spectral information, that is ; Subtract the minimum value from the spectral information, i.e. ; Get the maximum value in the spectral information, that is ; Normalize the spectral information and output the signal ,Right now .
4. The Raman spectrum cross-instrument conversion method based on twin neural networks according to claim 3 is characterized in that: The step of converting each of the extracted original spectral information into target spectral information comprises: Each original spectral feature matrix is converted into a target feature matrix.
5. The Raman spectrum cross-instrument conversion method based on twin neural networks according to claim 4 is characterized in that: The step of performing denoising on the reconstructed spectrum comprises: The reconstructed spectrum is sequentially subjected to DoBechie wavelet transform, Fourier transform and Butterworth low-pass filter to enhance and denoise the spectral signal; Then, the noise peaks in the spectral signal are removed by value filtering.
6. The Raman spectrum cross-instrument conversion method based on twin neural networks according to claim 3 is characterized in that: The twin neural network consists of two or more sub-networks with the same structure and shared weights, and is trained using a cross-entropy loss function.
7. The Raman spectrum cross-instrument conversion method based on twin neural networks according to claim 5 is characterized in that: The feature extraction module is configured as the twin neural network consisting of three one-dimensional convolutional layers, with a convolution kernel size of 1*3, and performs feature extraction on the spectral information in all the sub-networks to obtain an original spectral matrix corresponding to each original spectrum and a target spectral matrix corresponding to the target spectrum; or, The feature extraction module is configured as a depthwise separable convolutional network, which receives the spectral information in each sub-network through a receiving layer and performs convolution calculations on the spectral information in each channel respectively to obtain an original spectral matrix corresponding to each original spectrum and a target spectral matrix corresponding to the target spectrum.
8. The Raman spectrum cross-instrument conversion method based on twin neural networks according to claim 6 is characterized in that: The feature conversion module is configured to consist of a convolutional layer and two fully connected layers, and the MSE function is used as the loss function to train the feature conversion module.
9. The Raman spectrum cross-instrument conversion method based on twin neural networks according to claim 7, characterized in that: The network layer of the generative adversarial network is set as a fully connected layer, and the generative adversarial network is trained using a VAE loss function; and The twin neural network, the feature extraction module, the feature conversion module and the fully connected layer in the generative adversarial network are all configured to have input and output dimensions of 64*256, 256*512 and 512*1700 respectively.
10. A Raman spectrum inter-instrument conversion system, characterized in that: The Raman spectrum cross-instrument conversion method based on twin neural networks described in any one of claims 1 to 8 can be applied to the Raman spectrum cross-instrument conversion system.
11. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the Raman spectrum cross-instrument conversion method based on a twin neural network as described in any one of claims 1 to 8 is implemented and applied to the Raman spectrum cross-instrument conversion system described in claim 10.
12. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, it implements the Raman spectrum cross-instrument conversion method based on a twin neural network as described in any one of claims 1 to 8 and is applied to the Raman spectrum cross-instrument conversion system described in claim 10.