Infrared spectrum preprocessing method based on Mama and Unet models
The noise and baseline drift problems in the infrared spectrum of alkane gas are solved by the preprocessing method combining Mamba and Unet models, and high-quality spectral data are generated for gas composition and concentration analysis.
Patent Information
- Application Number
- CN202510913767.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-03
- Publication Date
- 2025-10-03
AI Technical Summary
Existing technologies have difficulty in effectively dealing with noise and baseline drift in the infrared spectrum of alkane gases, resulting in insufficient spectral analysis accuracy.
A preprocessing method based on the Mamba and Unet models was adopted. The Mamba model was used to capture the long-range dependence of the spectrum and the Unet model was used for denoising. The adaptive loss function and dynamic weighting mechanism were combined to perform baseline correction and denoising to generate high-quality infrared spectra of alkane gases.
The quality of infrared spectra of alkane gases has been significantly improved, enabling more accurate analysis of gas composition and concentration, overcoming the limitations of traditional methods.
Smart Images

Figure CN120747699A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of spectrum analysis, and in particular relates to an infrared spectrum preprocessing method based on Mamba and Unet models. Background Art
[0002] Infrared spectroscopy of alkane gases has wide applications in environmental monitoring, industrial production, safety testing, and other fields. By analyzing the infrared spectra of alkane gases, accurate information on the gas composition and concentration can be obtained. However, during the actual acquisition process, infrared spectral data is inevitably affected by various noise interferences and baseline drift. Sources of noise include electronic noise from the instrument itself and environmental interference. These noises blur the spectral signal, causing deviations in the position and intensity of spectral peaks, affecting the accurate determination of gas composition and concentration. Baseline drift, caused by factors such as instrument instability and ambient temperature fluctuations, causes fluctuations in the spectral baseline, obscuring the true spectral characteristics and making quantitative analysis based on spectral data difficult.
[0003] Currently, commonly used spectral preprocessing methods include filtering-based methods (such as Gaussian filtering and median filtering) and baseline correction methods based on polynomial fitting. Although filtering-based methods can suppress noise to a certain extent, their filtering effect is limited for complex noise distributions and spectral characteristics, and they are prone to over-smoothing the spectrum, resulting in loss of spectral peak details. The effectiveness of baseline correction methods based on polynomial fitting for baseline drift correction depends on the order of the polynomial. Too high an order may introduce additional errors, while too low an order cannot effectively correct complex baseline drift. Moreover, these traditional methods are often unable to simultaneously address noise and baseline drift, making them difficult to meet the requirements of high-precision spectral analysis.
[0004] With the application of deep learning technology in spectral data processing, several deep learning-based spectral preprocessing methods have been proposed. For example, convolutional neural networks (CNNs) are used for spectral denoising, where denoising is achieved by extracting local spectral features through convolution operations. However, CNNs have limitations in handling long-range dependencies and are not effective in handling long-range baseline drift in spectra. Additionally, some methods use recurrent neural networks (RNNs) and their variants to process sequence data in an attempt to address long-range dependencies. However, RNNs suffer from problems such as vanishing and exploding gradients, are difficult to train, and are inefficient when processing spectral data. Therefore, a new method is urgently needed to effectively address the noise and baseline drift issues in the infrared spectra of alkane gases and improve the quality of spectral data. Summary of the Invention
[0005] The present invention aims to overcome the shortcomings of the prior art and provide an infrared spectrum preprocessing method based on the Mamba and Unet models. The method comprises: preprocessing acquired raw infrared spectrum data, constructing an infrared spectrum preprocessing model based on the preprocessed infrared spectrum data; determining core parameters of the Mamba model, and using the Mamba model to output a prediction result of a spectrum baseline; constructing a Unet decoder part through a deconvolution layer and upsampling, using a training data sequence as input layer data, and using the Unet model to generate a denoised spectrum; designing an adaptive loss function by comprehensively considering the difference between the noisy spectrum and the processed spectrum; and using a dynamic weighting mechanism to fuse the output features of the Mamba branch and the Unet branch through weight parameters to obtain a final baseline-corrected and denoised infrared spectrum of alkane gas. The method can significantly improve the quality of the infrared spectrum data of alkane gas and provide more accurate spectral data for subsequent applications such as gas composition analysis and concentration detection.
[0006] In order to achieve the above technical effects, the following technical solutions are adopted: An infrared spectrum preprocessing method based on Mamba and Unet models comprises the following steps: S1: Use professional experimental instruments to collect infrared spectrum data of alkane gases, and obtain raw infrared spectrum data including single-component alkane gas, multi-component mixed alkane gas, category labels and concentration labels; S2: Pre-process the original infrared spectrum data to obtain valid infrared spectrum data, divide the valid infrared spectrum data into training data, test data and verification data according to the proportion, and build an infrared spectrum preprocessing model based on the valid infrared spectrum data; S3: Based on the principles of the state-space model (SSM), determine the core parameters of the Mamba model, including but not limited to the dimensions of the state space and the input and output matrices. Implement the Mamba model structure using a deep learning framework, using the training data sequence as input layer data. Use the Mamba model to continuously capture long-range dependencies in the spectral sequence and output the predicted spectral baseline. S4: Multiple convolutional layers and pooling layers are used to alternately construct the Unet encoder part, and the Unet decoder part is constructed through deconvolution layers and upsampling. The training data sequence is used as the input layer data, and the denoised spectrum is gradually generated using the Unet model; S5: Taking into account the differences between noisy and processed spectra, an adaptive loss function is designed to calculate the mean square error (MSE) between the effective infrared spectrum and the infrared spectrum after baseline correction and denoising, as well as the mean absolute error (MAE) between the effective infrared spectrum and the baseline predicted by the Mamba model. The adaptive loss function is obtained through adjustable weight parameters and continuously optimized during model training to improve the quality of spectral preprocessing. S6: Using a dynamic weighting mechanism, the output features of the Mamba branch and the Unet branch are fused through learnable weight parameters. The baseline prediction features output by the Mamba branch and the denoised spectral features output by the Unet branch are used as input. After calculation by the feature fusion module, the final baseline-corrected and denoised infrared spectrum of the alkane gas is obtained.
[0007] Furthermore, the professional experimental instruments and equipment in step S1 include, but are not limited to: a mid-infrared spectrometer, a long optical path gas cell, and a high-precision gas mixing and distribution system.
[0008] Furthermore, in step S1, professional experimental instruments and equipment are used to collect infrared spectrum data of alkane gas, and raw infrared spectrum data including single-component alkane gas, multi-component mixed alkane gas, category labels and concentration labels are obtained, as follows: The professional experimental instruments and equipment used include a mid-infrared spectrometer, a long optical path gas cell, and a high-precision gas mixing and distribution system. The wavenumber range of the mid-infrared spectrometer covers 2000-6000cm -1 , used to achieve effective detection of the target spectral range; the optical path length of the long optical path gas cell is greater than 3.3m, which can increase the interaction distance between light and alkane gas and improve the spectral signal intensity; the high-precision gas mixing and distribution system has a mixing accuracy of ±0.5%FS and a maximum flow rate of up to 5000mL / min, which can accurately prepare alkane mixed gases of different concentrations and components.
[0009] Furthermore, the alkane gases collected in step S1 include, but are not limited to, elemental gases and mixed gases of methane, ethane, propane, n-butane, isobutane, n-pentane, and isopentane. For mixed gases, the component types and number thereof may include, but are not limited to, 1-6, to meet the needs of different experimental scenarios and data diversity. Through the above-described instrumentation and gas collection setup, it is possible to comprehensively and accurately collect raw infrared spectral data covering a variety of alkane gas types and concentration combinations, providing a rich and representative data foundation for the training and application of subsequent spectral preprocessing models.
[0010] Furthermore, the pre-processing in step S2 includes the following steps: Data cleaning: Perform missing value processing and outlier processing operations on the original spectral data. According to the data characteristics and processing requirements, one of the three processing methods is selected: deletion, supplementation, and replacement. Data normalization: Use 0-1 normalization method and zero-mean normalization method to normalize the original spectral data to reduce the dimensional differences between data dimensions and simplify the subsequent data processing process; Data enhancement: Use Lorentzian and Gaussian functions to generate simulated pure spectra. Use exponential, trigonometric, and linear functions to generate simulated baselines and add them to simulated pure spectra. At the same time, random noise is added to the simulated and original spectra to enhance data diversity and improve model generalization. The valid infrared spectrum data obtained after pre-processing is divided into training data, test data and verification data in a ratio of 7:1:2.
[0011] Furthermore, in step S3, the core parameters of the Mamba model are determined based on the principle of the state space model SSM, which specifically includes the following steps: the state space dimension is set to 128, the input matrix A and the output matrix C are generated by random initialization, and are optimized and adjusted during the training process; the deep learning framework includes but is not limited to TensorFlow and PyTorch.
[0012] For example, the Mamba model architecture was implemented using the PyTorch deep learning framework: training data sequences were fed into the model in batches, with each batch containing 32 spectral data points. Through continuous iterative training, the model leveraged the Mamba model's advantage in processing long sequences to capture long-range dependencies within the spectral sequence and predict the spectral baseline. During training, the Adam optimizer was used, with the learning rate initialized to 0.001. Training was performed for 50 epochs, with the learning rate dynamically adjusted based on the loss on the validation data. The model ultimately outputs the predicted spectral baseline.
[0013] Furthermore, the encoder part in step S4 adopts an alternating structure of 4 convolutional layers and pooling layers; the convolution kernel size of each convolution layer is 3×3, and the number of channels is 64, 128, 256, and 512 respectively. Spectral features are extracted through convolution operation, and the pooling layer adopts maximum pooling with a pooling kernel size of 2×2; feature dimensionality reduction is achieved.
[0014] Furthermore, the decoder in step S4 consists of a deconvolution layer and an upsampling layer. The deconvolution layer also uses a 3×3 convolution kernel with a gradually decreasing number of channels. Upsampling uses bilinear interpolation to restore the features extracted by the encoder. The training data sequence is input into the Unet model, which gradually denoises the spectrum. The Adam optimizer is used during training, with a learning rate set to 0.001. Training is repeated for 50 epochs, and model performance is evaluated using validation data to ultimately generate a denoised spectrum.
[0015] Furthermore, in step S5, the difference between the noisy spectrum and the processed spectrum is comprehensively considered to design an adaptive loss function, which specifically includes the following steps: Design an adaptive loss function L, which consists of two parts: Spectral intensity difference term: Use the mean square error to calculate the intensity difference between the noisy spectrum and the processed spectrum at the corresponding wavelength, that is: ; in, represents the mean square error, is the noisy spectral data, For spectral data after denoising and baseline correction, Indicates the Spectral data at wavelength points, is the number of wavelength points of the spectral data; Baseline correction difference term: To further measure the effect of baseline correction, the difference between the original spectral baseline and the baseline predicted by the Mamba model is calculated using the mean absolute error, that is: ; in, is the mean absolute error, represents the original spectrum baseline, represents the Mamba model prediction baseline, Indicates the Spectral data at wavelength points, is the number of wavelength points of the spectral data; The final adaptive loss function is: ; in, represents the mean square error; is the mean absolute error, represents the adaptive loss function, For adjustable weight parameters, their values are determined through training optimization to balance the effects of spectral intensity denoising and baseline correction, so that the model is continuously optimized during training and the quality of spectral preprocessing is improved.
[0016] Furthermore, in step S6, a dynamic weighting mechanism is used to fuse the output features of the Mamba branch and the Unet branch through learnable weight parameters. The baseline prediction features output by the Mamba branch and the denoised spectral features output by the Unet branch are used as inputs. After operation by a feature fusion module, the final baseline-corrected and denoised infrared spectrum of the alkane gas is obtained. Specifically, the following steps are included: The dynamic weighting mechanism includes constructing a learnable weight parameter matrix whose dimension matches the feature dimension of the Mamba branch and the Unet branch output; taking the baseline prediction features output by the Mamba branch and the denoised spectral features output by the Unet branch as input, and performing a weighted sum operation: ; in, It is the fusion of the output features of the Mamba branch and the Unet branch. Output features for the Mamba branch, Output features for the Unet branch, and is a learnable weight that satisfies ; Through training, the weight parameters are continuously optimized to obtain the final infrared spectrum of alkane gas after baseline correction and denoising.
[0017] The beneficial effects of the present invention are: The present invention proposes a method for preprocessing the infrared spectrum of alkane gases based on the Mamba and Unet models. In terms of spectral denoising, the Unet branch can effectively remove various noises in the spectrum. At the same time, the feature fusion module is combined with the Mamba branch to remove the noise without losing the important features of the spectrum. Compared with traditional filtering methods, it can better retain the details of the spectral peaks and improve the quality of the spectrum after denoising. In terms of baseline correction, the Mamba branch can accurately model and predict the long-distance baseline drift of the spectrum based on the state-space model. Combined with the constraint of the adaptive loss function on the baseline smoothness, the baseline correction is more accurate and stable, overcoming the limitations of traditional baseline correction methods. Therefore, this method can significantly improve the quality of alkane gas infrared spectral data, provide more accurate spectral data for subsequent gas composition analysis, concentration detection and other applications, and has important theoretical significance and broad application prospects. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 Flowchart of the infrared spectrum preprocessing method for alkane gas based on Mamba and Unet models provided in an embodiment of the present invention; Figure 2The baseline and original spectrum obtained by preprocessing the infrared spectrum of methane gas using the alkane gas infrared spectrum preprocessing method based on the Mamba and Unet models provided in an embodiment of the present invention; Figure 3 The results and original spectrum of the preprocessing method of alkane gas infrared spectrum based on Mamba and Unet models provided in an embodiment of the present invention are shown. DETAILED DESCRIPTION
[0019] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0020] It should be noted that the following detailed descriptions are exemplary and intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which the present invention belongs.
[0021] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present invention. As used herein, unless the context clearly indicates otherwise, the singular form is intended to include the plural form. In addition, it should be understood that when the terms "comprise" and / or "include" are used in this specification, they indicate the presence of features, steps, operations and / or combinations thereof.
[0022] Example 1: Figure 1 The present invention provides a flow chart of the infrared spectrum preprocessing method for alkane gas based on the Mamba and Unet models, which includes the following steps: S1: Alkane sample gas was fed into an LFIX-7000 gas mixing system (Laifeng, Chengdu, China) with nitrogen as the background carrier gas. The sample gas was dehumidified at a rate of 1000 ml / min through an MD-070-24F-4091119-02 drying tube (PermaPure-US) and then passed into a PMG10030 optical pathlength cell (Fengsa, Shanghai, China) with a volume of 400 ml and an effective optical pathlength of 4.8 m. The cell was equipped with a thermostat, which was controlled by a temperature control unit to maintain a constant temperature of 27.5°C. A computer-controlled infrared spectrometer, Bruker ALPHAI (Germany), was used to collect data in the wavenumber range of 2000–6500 cm-1. -1The raw infrared spectrum data contains single-component alkane gas, multi-component mixed alkane gas, category label and concentration label; S2: Perform missing value processing and outlier processing on the original infrared spectral data, and use the 0-1 normalization method to normalize the original spectral data. At the same time, use the Lorentz function and Gaussian function to generate simulated pure spectra, and use the exponential function, trigonometric function, linear function, etc. to generate simulated baselines to add to the simulated pure spectra. At the same time, add random noise to the simulated spectrum and the original spectrum data to perform data enhancement, expand the data sample diversity, and obtain valid infrared spectrum data. The valid infrared spectrum data obtained after pre-processing is divided into training data, test data and verification data in a ratio of 7:1:2. Based on this valid infrared spectrum data, an infrared spectrum preprocessing model is constructed; S3: Based on the principle of state-space model (SSM), the core parameters of the Mamba model are determined. The state space dimension is set to 128, which can fully capture the characteristics of the spectral sequence while ensuring the computational efficiency of the model; the input matrix A and the output matrix C are generated by random initialization and optimized during the training process. The PyTorch deep learning framework is used to implement the Mamba model structure, and the training data sequence is input into the model in batches, with each batch containing 32 spectral data. Through continuous iterative training, the model takes advantage of the long sequence processing of the Mamba model to capture the long-range dependencies in the spectral sequence to predict the spectral baseline. During the training process, the Adam optimizer is used, the learning rate is initialized to 0.001, and 50 epochs are trained. The learning rate is dynamically adjusted according to the loss on the verification data, and the prediction results of the spectral baseline are finally output; such as Figure 2 shown.
[0023] S4: The Unet encoder is constructed by alternating multiple convolutional layers and pooling layers. The encoder uses a structure of 4 alternating convolutional layers and pooling layers. The convolution kernel size of each convolutional layer is 3×3, and the number of channels is 64, 128, 256, and 512, respectively. Spectral features are extracted through convolution operations. The pooling layer uses maximum pooling with a pooling kernel size of 2×2 to achieve feature dimensionality reduction. The Unet decoder is constructed through deconvolution layers and upsampling. The decoder consists of deconvolution layers and upsampling layers. The deconvolution layer also uses a 3×3 convolution kernel, and the number of channels is gradually reduced. The upsampling uses a bilinear interpolation method to restore the features extracted by the encoder. The training data sequence is input into the Unet model, and the model gradually denoises the spectrum. The Adam optimizer is also used during training, with a learning rate set to 0.001. 50 epochs are trained, and the model performance is evaluated using validation data. Finally, the denoised spectrum is generated. S5: Considering the differences between the noisy spectrum and the processed spectrum, an adaptive loss function is designed to calculate the mean square error (MSE) between the effective infrared spectrum and the infrared spectrum after baseline correction and denoising, as well as the mean absolute error (MAE) between the effective infrared spectrum and the baseline predicted by the Mamba model. The adaptive loss function is obtained through adjustable weight parameters, as follows: Designing an adaptive loss function , taking into account the difference between the noisy spectrum and the processed spectrum. The loss function consists of two parts: Spectral intensity difference term: Use the mean square error to calculate the intensity difference between the noisy spectrum and the processed spectrum at the corresponding wavelength, that is: ; in, represents the mean square error, is the noisy spectral data, For spectral data after denoising and baseline correction, Indicates the Spectral data at wavelength points, is the number of wavelength points of the spectral data.
[0024] Baseline correction difference term: To further measure the effect of baseline correction, the difference between the original spectral baseline and the baseline predicted by the Mamba model is calculated, and the mean absolute error is used, that is, ; in, is the mean absolute error, represents the original spectrum baseline, represents the Mamba model prediction baseline, Indicates the Spectral data at wavelength points, is the number of wavelength points of the spectral data.
[0025] The final adaptive loss function is: ; in, is the mean absolute error, represents the mean square error, represents the adaptive loss function, For adjustable weight parameters, their values are determined through training optimization to balance the effects of spectral intensity denoising and baseline correction, so that the model is continuously optimized during training and the quality of spectral preprocessing is improved.
[0026] S6: Using a dynamic weighting mechanism, the output features of the Mamba branch and the Unet branch are integrated through learnable weight parameters. The baseline prediction features output by the Mamba branch and the denoised spectral features output by the Unet branch are used as inputs, and a weighted sum operation is performed: ; in, It is the fusion of the output features of the Mamba branch and the Unet branch. Output features for the Mamba branch, Output features for the Unet branch, and is a learnable weight that satisfies Through continuous optimization of weight parameters through training, the final infrared spectrum of alkane gas after baseline correction and denoising is obtained; Figure 3 shown.
[0027] In summary, the present invention discloses a method for preprocessing infrared spectra of alkane gases based on the Mamba and Unet models. In terms of spectral denoising, the Unet branch can effectively remove various noises in the spectrum. At the same time, the feature fusion module is combined with the Mamba branch to remove the noise without losing the important features of the spectrum. Compared with traditional filtering methods, it can better retain the details of the spectral peaks and improve the quality of the spectrum after denoising. In terms of baseline correction, the Mamba branch can accurately model and predict the long-distance baseline drift of the spectrum based on the state-space model. Combined with the constraints of the adaptive loss function on the baseline smoothness, the baseline correction is more accurate and stable, overcoming the limitations of traditional baseline correction methods. Therefore, this method can significantly improve the quality of alkane gas infrared spectrum data, provide more accurate spectral data for subsequent gas composition analysis, concentration detection and other applications, and has important theoretical significance and broad application prospects.
[0028] At this point, those skilled in the art will recognize that, although the embodiments of the present invention have been shown and described in detail herein, many other variations or modifications consistent with the principles of the present invention may be directly determined or derived from the disclosure of the present invention without departing from the spirit and scope of the present invention. Therefore, the scope of the present invention should be understood and deemed to cover all such other variations or modifications.
Claims
1. An infrared spectrum preprocessing method based on Mamba and Unet models, characterized in that: The following steps are involved: S1: Use professional experimental instruments to collect infrared spectrum data of alkane gases, and obtain raw infrared spectrum data including single-component alkane gas, multi-component mixed alkane gas, category labels and concentration labels; S2: Pre-process the original infrared spectrum data to obtain valid infrared spectrum data, divide the valid infrared spectrum data into training data, test data and verification data according to the proportion, and build an infrared spectrum preprocessing model based on the valid infrared spectrum data; S3: Based on the principles of the state-space model (SSM), determine the core parameters of the Mamba model, including but not limited to the dimensions of the state space and the input and output matrices. Implement the Mamba model structure using a deep learning framework, using the training data sequence as input layer data. Use the Mamba model to continuously capture long-range dependencies in the spectral sequence and output the predicted spectral baseline. S4: Multiple convolutional layers and pooling layers are used to alternately construct the Unet encoder part, and the Unet decoder part is constructed through deconvolution layers and upsampling. The training data sequence is used as the input layer data, and the denoised spectrum is gradually generated using the Unet model; S5: Taking into account the differences between noisy and processed spectra, an adaptive loss function is designed to calculate the mean square error (MSE) between the effective infrared spectrum and the infrared spectrum after baseline correction and denoising, as well as the mean absolute error (MAE) between the effective infrared spectrum and the baseline predicted by the Mamba model. The adaptive loss function is obtained through adjustable weight parameters and continuously optimized during model training to improve the quality of spectral preprocessing. S6: Using a dynamic weighting mechanism, the output features of the Mamba branch and the Unet branch are fused through learnable weight parameters. The baseline prediction features output by the Mamba branch and the denoised spectral features output by the Unet branch are used as input. After calculation by the feature fusion module, the final baseline-corrected and denoised infrared spectrum of the alkane gas is obtained.
2. The infrared spectrum preprocessing method based on Mamba and Unet models according to claim 1, characterized in that: The professional experimental instruments and equipment in step S1 include, but are not limited to: a mid-infrared spectrometer, a long optical path gas cell, and a high-precision gas mixing and distribution system.
3. The infrared spectrum preprocessing method based on Mamba and Unet models according to claim 2, characterized in that: The wavenumber range of the mid-infrared spectrometer covers 2000-6000cm -1 The optical path length of the long optical path gas pool is greater than 3.3m, the mixing accuracy of the high-precision gas mixing and distribution system is ±0.5%FS, and the maximum flow rate can reach 5000mL / min.
4. The infrared spectrum preprocessing method based on Mamba and Unet models according to claim 1, characterized in that: The alkane gases collected in step S1 include but are not limited to single gases and mixed gases of methane, ethane, propane, n-butane, isobutane, n-pentane and isopentane; for the mixed gas, the component types and numbers thereof include but are not limited to 1-6.
5. The infrared spectrum preprocessing method based on Mamba and Unet models according to claim 1, characterized in that: The pre-processing in step S2 includes the following steps: Data cleaning: Perform missing value processing and outlier processing operations on the original spectral data. According to the data characteristics and processing requirements, one of the three processing methods is selected: deletion, supplementation, and replacement. Data normalization: Use 0-1 normalization method and zero-mean normalization method to normalize the original spectral data to reduce the dimensional differences between data dimensions and simplify the subsequent data processing process; Data enhancement: Use Lorentzian and Gaussian functions to generate simulated pure spectra. Use exponential, trigonometric, and linear functions to generate simulated baselines and add them to simulated pure spectra. At the same time, random noise is added to the simulated and original spectra to enhance data diversity and improve model generalization. The valid infrared spectrum data obtained after pre-processing is divided into training data, test data and verification data in a ratio of 7:1:
2.
6. The infrared spectrum preprocessing method based on Mamba and Unet models according to claim 1, characterized in that: In step S3, the core parameters of the Mamba model are determined based on the principle of the state space model SSM, which specifically includes the following steps: the state space dimension is set to 128, the input matrix A and the output matrix C are generated by random initialization, and are optimized and adjusted during the training process; the deep learning framework includes but is not limited to TensorFlow and PyTorch.
7. The infrared spectrum preprocessing method based on Mamba and Unet models according to claim 1, characterized in that: The encoder part in step S4 adopts an alternating structure of 4 convolutional layers and pooling layers; the convolution kernel size of each convolution layer is 3×3, and the number of channels is 64, 128, 256, and 512 respectively. Spectral features are extracted through convolution operations, and the pooling layer adopts maximum pooling, and the pooling kernel size is 2×2.
8. The infrared spectrum preprocessing method based on Mamba and Unet models according to claim 1, characterized in that: The decoder part in step S4 is composed of a deconvolution layer and an upsampling layer. The deconvolution layer also uses a 3×3 convolution kernel, the number of channels gradually decreases, and the upsampling adopts a bilinear interpolation method.
9. The infrared spectrum preprocessing method based on Mamba and Unet models according to claim 1, characterized in that: In step S5, the difference between the noisy spectrum and the processed spectrum is comprehensively considered to design an adaptive loss function, which specifically includes the following steps: Design an adaptive loss function L, which consists of two parts: Spectral intensity difference term: Use the mean square error to calculate the intensity difference between the noisy spectrum and the processed spectrum at the corresponding wavelength, that is: ; in, represents the mean square error, is the noisy spectral data, For spectral data after denoising and baseline correction, Indicates the Spectral data at wavelength points, is the number of wavelength points of the spectral data; Baseline correction difference term: To further measure the effect of baseline correction, the difference between the original spectral baseline and the baseline predicted by the Mamba model is calculated using the mean absolute error, that is: ; in, is the mean absolute error, represents the original spectrum baseline, represents the Mamba model prediction baseline, Indicates the Spectral data at wavelength points, is the number of wavelength points of the spectral data; The final adaptive loss function is: ; in, represents the mean square error; is the mean absolute error, represents the adaptive loss function, For adjustable weight parameters, their values are determined through training optimization to balance the effects of spectral intensity denoising and baseline correction, so that the model is continuously optimized during training and the quality of spectral preprocessing is improved.
10. The infrared spectrum preprocessing method based on Mamba and Unet models according to claim 1, characterized in that: In step S6, a dynamic weighting mechanism is used to fuse the output features of the Mamba branch and the Unet branch through learnable weight parameters. The baseline prediction features output by the Mamba branch and the denoised spectral features output by the Unet branch are used as inputs. After operation by a feature fusion module, the final infrared spectrum of the alkane gas after baseline correction and denoising is obtained. Specifically, the following steps are included: The dynamic weighting mechanism includes constructing a learnable weight parameter matrix whose dimension matches the feature dimension of the Mamba branch and the Unet branch output; taking the baseline prediction features output by the Mamba branch and the denoised spectral features output by the Unet branch as input, and performing a weighted sum operation: ; in, It is the fusion of the output features of the Mamba branch and the Unet branch. Output features for the Mamba branch, Output features for the Unet branch, and is a learnable weight that satisfies ; Through training, the weight parameters are continuously optimized to obtain the final infrared spectrum of alkane gas after baseline correction and denoising.
Citation Information
Cited By
Rapid detection method and system for tea quality
CN121384867A