Multi-modal self-adaptive preprocessing method for gas sensor based on Mamba state space model
By employing a multimodal adaptive preprocessing method based on the Mamba state-space model, the problem of insufficient accuracy and stability of traditional gas sensors in complex environments is solved. This method achieves high-precision adaptive signal processing and calibration, thereby improving the robustness and reliability of the system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-28
- Publication Date
- 2026-03-10
AI Technical Summary
Traditional gas sensor preprocessing methods are difficult to adapt to changes in sensor characteristics over time and fluctuations in environmental conditions, resulting in insufficient detection accuracy and stability in complex gas environments.
A multimodal adaptive preprocessing method based on the Mamba state-space model is adopted. By combining end-to-end deep temporal modeling with physical constraints, adaptive fusion and correction of sensor signals, environmental parameters and historical data are achieved. This includes techniques such as multi-head attention mechanism, adaptive filtering and nonlinear correction.
It significantly improves the detection accuracy and stability of gas sensors in complex environments, realizes real-time adaptive zero-point drift calibration and noise filtering, and improves the robustness and reliability of the system.
Smart Images

Figure CN121633397A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of gas detection, and in particular to a multi-modal adaptive preprocessing method for gas sensors based on a Mamba state space model. BACKGROUND
[0002] Gas detection technology plays a crucial role in environmental monitoring, industrial safety, medical diagnosis, and air quality assessment. With the rapid development of Internet of Things technology and intelligent sensing devices, higher requirements are placed on the accuracy, reliability, and real-time performance of gas detection systems. In practical applications, a single type of gas sensor often struggles to meet the detection requirements in complex gas environments, thus giving rise to multi-modal gas sensing technology. By integrating various sensing mechanisms such as electrochemical sensors, infrared sensors, and semiconductor sensors, more comprehensive and complementary gas information can be obtained, thereby improving the robustness and accuracy of the detection system.
[0003] Multi-modal gas sensing systems effectively overcome the limitations of single sensors in terms of selectivity, stability, and anti-interference capability by synergistically utilizing sensor outputs of different working principles. These systems typically generate heterogeneous multi-source data streams, which differ significantly in terms of time resolution, signal characteristics, and noise features, thus posing severe challenges to data preprocessing. Traditional sensor preprocessing methods usually include baseline correction, temperature and humidity compensation, drift calibration, and noise filtering steps. However, these methods are mostly based on fixed physical or statistical models, which are difficult to adapt to the actual situation where sensor characteristics change over time and environmental conditions fluctuate. SUMMARY
[0004] The present application aims to provide a multi-modal adaptive preprocessing method for gas sensors based on a Mamba state space model. By combining end-to-end deep time series modeling with physical constraints, high-precision, real-time adaptive signal preprocessing of various gas sensors in complex real-world environments is achieved, thus completely solving the technical problems that traditional methods struggle to cope with sensor drift, environmental interference, nonlinear response, and multi-modal data heterogeneity.
[0005] The technical solution of the present application is to provide a multi-modal adaptive preprocessing method for gas sensors based on a Mamba state space model, which includes:
[0006] S1, data acquisition: synchronously acquiring sensor raw signals, environmental parameters, and historical time series data;
[0007] S2, multi-modal feature extraction: extracting features from the three types of data to generate sensor feature vectors F sensor , environmental feature vectors F env , and historical feature vectors F hist ;
[0008] S3, adaptive multi-modal fusion: with sensor feature vector F sensor as query Q, with environment feature vector F env as key K and value V, generate Q, K, V by linear transformation, compute attention output with 8-head multi-head attention mechanism, concatenate attention output with F sensor after residual connection, concatenate history feature vector F hist to all time steps and concatenate in channel dimension, get final fused feature F final ;
[0009] S4, zero-point drift prediction: input final fused feature F final to a contrastive learning encoder to map to a 128-dimensional L2 normalized embedding space; input low-dimensional embedding to a time-series prediction network composed of 3 stacked Mamba blocks, each layer with residual connection, finally output zero-point offset prediction sequence Δzero(t) through a linear layer; trigger background zero-point calibration when |Δzero(t)| exceeds a preset threshold, and use the predicted value to compensate the real-time signal Imeasured(t)-Δzero(t) during calibration;
[0010] S5, adaptive filtering: reconstruct Q matrix through a first neural network according to temperature, humidity, pressure, signal standard deviation, and current time prediction process noise covariance; predict observation noise covariance R through a second neural network according to signal-to-noise ratio, drift rate, and sensor usage time; perform adaptive Kalman filtering, loop prediction and update steps, and output filtered signal s filtered ;
[0011] S6, nonlinear correction: correct filtered signal s filtered with a learnable piecewise linear network;
[0012] S7, final output: subtract zero-point offset prediction value Δzero(t) from the signal after nonlinear correction to get gas concentration value; calculate prediction standard deviation by multiple forward propagation through Monte Carlo Dropout method and Sigmoid mapping to [0,1] to get confidence score; output zero-point estimate value and data quality flag at the same time, data quality flag includes whether there is an anomaly, anomaly type and noise level evaluation.
[0013] In any of the technical solutions above, further, the sensor original signal includes at least one of a current signal or a voltage signal of an electrochemical sensor, a light intensity signal of an infrared sensor, or a resistance signal or a conductance signal of a semiconductor sensor, and the length of the collection time window is 300 to 1000 time steps; the environmental parameters include temperature, humidity, and air pressure, the temperature measurement range is -10 to 50 DEG C with an accuracy of less than 0.5 DEG C, the humidity measurement range is 0 to 100% relative humidity with an accuracy of less than 2% relative humidity, and the air pressure measurement range is 900 to 1100 hundred Pa with an accuracy of less than 1 hundred Pa; and the historical time series data includes signal mean, standard deviation, maximum value, minimum value, change rate, signal trend direction, zero point drift rate, and the Unix timestamp of the last zero point calibration time within the past 1 hour.
[0014] In any of the technical solutions above, further, step S2 specifically includes:
[0015] The sensor original signal is first normalized, and the normalization formula is:
[0016] ;
[0017] Wherein, I(t) is the original current value at time t, I min and I max are the preset minimum and maximum current values, typically I min = 0 mu A, I max = 500 mu A, and the normalized signal value range is [0, 1];
[0018] The normalized signal is extracted through three parallel one-dimensional convolution branches, the convolution kernel size is 3, 7, and 15 respectively, the number of output channels of each branch is 32, and the branch outputs are spliced in the channel dimension; the spliced local features are input into a bidirectional Mamba state space model for deep time series modeling, and the Mamba model adopts input-dependent parameters:
[0019] ;
[0020] ;
[0021] ;
[0022] Wherein, B(t) is the input matrix; C(t) is the output matrix; Delta(t) is the time step parameter, a scalar value, and the Softplus function is defined as Softplus(x) = log(1 + exp(x)), which ensures that Delta(t) is positive.
[0023] Ā and are obtained by discretization using the zero-order hold method:
[0024] ;
[0025] ;
[0026] wherein A is a continuous state transition matrix, is a learnable parameter of the model; I is a unit matrix; Ā and are the discretized state transition matrix and input matrix
[0027] The parallel scanning algorithm is used to realize state updating, the hidden dimension of the forward Mamba layer and the backward Mamba layer is 128, and the sensor feature vector F is obtained by splicing the hidden states in two directions sensor ;
[0028] After the environmental parameters are normalized, the full connection neural network 3→64→128→256 is used to generate an environmental embedding vector, and then a constraint layer guided by physical knowledge is used for constraint, the constraint layer applies different physical constraints according to the sensor type, and finally an environmental feature vector F is generated env ;
[0029] After the historical time series data is standardized by Z-score, the full connection neural network 8→32→64→128→256 is used to generate a historical feature vector F hist .
[0030] In any of the above technical solutions, further, the contrast learning encoder is trained by using an InfoNCE loss, the positive sample is a moment with a zero point offset difference less than 0.02 μA, and the negative sample is a state when different sensors or gases exist;
[0031] The InfoNCE loss is defined as:
[0032] ;
[0033] wherein N is the batch size, is an anchor sample, is a positive sample, is a negative sample; sim(·, ·) is a cosine similarity function, and is defined as:
[0034] ;
[0035] τ is a temperature hyperparameter, and controls the smoothness of the distribution.
[0036] In any of the above technical solutions, further, the correction formula in step S6 is , N is the number of segments, and takes a value of 5 to 20, x is an input signal, i.e., a filtered signal S filtered ; y is a corrected signal; the weight coefficient of the i-th segment and the i-th threshold value Adaptively learned by the neural network according to the sensor model code, cumulative use time length, current temperature, humidity, and air pressure; ReLU is a rectified linear unit function, defined as ReLU(z) = max(0, z).
[0037] In any of the technical solutions above, further, the constraint formula of the physical constraint layer comprises at least one of the following:
[0038] Relationship between sensor sensitivity and temperature: where S0 is a reference sensitivity, E a is an activation energy, R is a gas constant, and T is an absolute temperature;
[0039] Relationship between electrochemical sensor current and temperature: where I0 is a reference current, a is a temperature coefficient, and ΔT is a temperature change;
[0040] Beer-Lambert law of infrared sensor: where ε is a molar absorption coefficient, C is a gas concentration, and L is an optical path length.
[0041] The beneficial effects of the present application are:
[0042] Significantly improve the preprocessing accuracy and robustness: through the bidirectional Mamba state space model for efficient deep time series modeling of long sequence sensor signals, while introducing a physical knowledge guided hard / soft constraint layer, the model output strictly conforms to the real physical law of electrochemical, infrared, semiconductor and other sensors, effectively suppressing the errors caused by environmental temperature and humidity changes, cross interference and nonlinear response, especially maintaining high stability and accuracy under complex mixed gas and variable environmental conditions.
[0043] Realize true adaptive zero drift calibration: using the zero drift prediction module of the contrast learning combined with the Mamba time series prediction network, the zero point offset can be monitored and accurately predicted in real time without interrupting the detection, and the background calibration is automatically triggered when the offset exceeds the threshold, completely solving the limitations of traditional periodic manual calibration or fixed model compensation, greatly prolonging the maintenance-free period of the sensor.
[0044] Leading in multi-modal data deep fusion and dynamic environment compensation capability: through the adaptive fusion mechanism based on multi-head attention, combined with historical statistical features, dynamic weighted fusion of sensor signals, environmental parameters and historical context is realized, so that the system can accurately perceive temperature, humidity, air pressure and other environmental disturbances and compensate in real time, showing strong anti-interference ability in complex scenes such as industrial flue gas and environmental air.
[0045] Adaptive noise filtering and nonlinear correction are more intelligent: the noise covariance Q / R is dynamically predicted by a neural network according to real-time signal quality, combined with a learnable piecewise linear correction network, so that the filtering and nonlinear correction are completely adaptive to sensor aging and current working conditions, which improves the signal-to-noise ratio, and the output signal smoothness and the real concentration curve are highly consistent, which completely solves the failure problem of fixed parameter filtering in variable noise environment.
[0046] Output confidence and data quality credible evaluation, improve system level reliability: through Monte Carlo Dropout to provide uncertainty quantification and confidence score, and output detailed data quality mark, so that the upper computer system can automatically judge the data credibility, avoid false alarm and miss alarm, significantly improve the decision reliability and safety of the whole system. BRIEF DESCRIPTION OF DRAWINGS
[0047] The above and additional aspects of the present application will become apparent and easy to understand from the following description of the embodiments, in conjunction with the accompanying drawings, in which:
[0048] Figure 1 is the overall flowchart of the multi-modal adaptive preprocessing method of the gas sensor based on the Mamba state space model according to an embodiment of the present application, which shows the complete processing flow from data acquisition to final output;
[0049] Figure 2 is the detailed structure diagram of the multi-modal feature extraction module of the multi-modal adaptive preprocessing method of the gas sensor based on the Mamba state space model according to an embodiment of the present application, which details the internal structure of the sensor signal processing sub-module, the environmental parameter processing sub-module and the historical feature processing sub-module;
[0050] Figure 3 is the structure diagram of the Mamba state space model layer of the multi-modal adaptive preprocessing method of the gas sensor based on the Mamba state space model according to an embodiment of the present application, which details the internal calculation process of the Mamba model;
[0051] Figure 4 is the structure diagram of the adaptive multi-modal fusion module of the multi-modal adaptive preprocessing method of the gas sensor based on the Mamba state space model according to an embodiment of the present application, which shows the working principle of the multi-head attention mechanism;
[0052] Figure 5 is the structure diagram of the zero drift prediction module of the multi-modal adaptive preprocessing method of the gas sensor based on the Mamba state space model according to an embodiment of the present application, which includes a contrastive learning encoder and a Mamba time series prediction network, Figure 5 The calculation process of InfoNCE loss and the zero point calibration trigger mechanism are also shown in the figure.
[0053] Figure 6 is a schematic diagram of an adaptive Kalman filter module based on a Mamba state space model gas sensor multi-modal adaptive preprocessing method according to an embodiment of the application, which details the noise covariance prediction and Kalman filter cycle;
[0054] Figure 7 is a schematic diagram of a physically knowledge guided constraint layer based on a Mamba state space model gas sensor multi-modal adaptive preprocessing method according to an embodiment of the application, which shows the physical constraint method of different types of sensors and the implementation of soft and hard constraints. DETAILED DESCRIPTION
[0055] In order to more clearly understand the above-mentioned purposes, features and advantages of the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.
[0056] In the following description, a large number of specific details are set forth in order to facilitate a thorough understanding of the present application, however, the present application can also be implemented in other ways different from those described herein, therefore, the scope of protection of the present application is not limited by the specific embodiments disclosed below.
[0057] As shown in Figure 1 the present embodiment provides a Mamba state space model based gas sensor multi-modal adaptive preprocessing method, which comprises:
[0058] S1, a data acquisition module synchronously acquires sensor raw signals, environmental parameters and historical time series data:
[0059] The acquired sensor raw signals include at least one of current signals or voltage signals of electrochemical sensors, light intensity signals of infrared sensors, resistance signals or conductance signals of semiconductor sensors, laser absorption spectrum signals, and Raman spectrum signals, and the length of the time window for acquisition is T time steps, typically 300 to 1000 time steps, corresponding to a sampling time of 5 to 20 minutes.
[0060] The environmental parameters include at least one of temperature, humidity and air pressure, and optionally further include gas flow rate and background gas concentration. The temperature measurement range is -10 to 50℃, and the measurement accuracy is better than 0.5℃; the humidity measurement range is 0 to 100% relative humidity, and the measurement accuracy is better than 2% relative humidity; the air pressure measurement range is 900 to 1100 hundred pascals, and the measurement accuracy is better than 1 hundred pascals.
[0061] The historical time series data includes sensor signal statistical features in the past 1 hour, zero point drift rate, last zero point calibration time, and device state event flag. The statistical features include signal mean μ, standard deviation σ, maximum value max, minimum value min, rate of change rate, signal trend direction trend; the zero point drift rate is recorded in units of microamperes per hour or millivolts per hour; the last zero point calibration time is stored in Unix timestamp format; the device state event flag includes the marks of sensor start, calibration, failure and other events.
[0062] S2, sequentially performing normalization processing, multi-scale one-dimensional convolution feature extraction and bidirectional Mamba state space model processing on the sensor raw signal to obtain a sensor feature vector.
[0063] Specifically, as shown in Figure 2 , step S2 includes:
[0064] S21, extracting sensor signal features, specifically including:
[0065] S211, normalization processing: first, the sensor raw signal is normalized. For the current signal of an electrochemical sensor, the normalization formula is:
[0066] ;
[0067] where I(t) is the original current value at time t, I min and I max are the preset minimum and maximum current values, typically I min =0μA, I max =500μA, and the normalized signal value range is [0, 1], which is conducive to the training and convergence of the neural network.
[0068] S212, multi-scale one-dimensional convolution local time series feature extraction: the normalized signal is input into three parallel multi-scale one-dimensional convolution branches, the convolution kernel size is 3, 7, and 15 respectively, the step is 1, the padding method is same, the number of output channels of each branch is 32, and the structure of each branch is a convolution layer, a batch normalization layer, a ReLU activation function, and a Dropout layer. The local feature tensor is obtained by concatenating the outputs of the three branches in the channel dimension.
[0069] S213, bidirectional Mamba state space model deep time series modeling: as shown in Figure 3 , the local feature tensor is input into the bidirectional Mamba state space model layer. The Mamba model first generates state space parameters through linear projection and activation function:
[0070] ;
[0071] ;
[0072] ;
[0073] Where B(t) is the input matrix; C(t) is the output matrix; Δ(t) is the time step parameter, a scalar value, and the Softplus function is defined as Softplus(x) = log(1 + exp(x)), ensuring that Δ(t) is a positive value.
[0074] The continuous state space is discretized using the Zero-Order Hold (ZOH) method:
[0075] ;
[0076] ;
[0077] Where A is the continuous state transition matrix, which represents the learnable parameters of the model; I is the identity matrix; and Ā and These are the discretized state transition matrix and the input matrix, respectively.
[0078] The state update equation is:
[0079] ;
[0080] ;
[0081] Where h(t) is the hidden state at time t; y(t) is the output; and D is the direct connection matrix.
[0082] A parallel scanning algorithm is used to update the state. The hidden dimensions of both the forward and backward Mamba layers are 128. The hidden states in the two directions are concatenated to obtain the sensor feature vector F. sensor .
[0083] S22. Extract environmental parameter features, specifically including:
[0084] S221. Normalization: The temperature normalization formula is:
[0085]
[0086] Where T is the measured temperature (in degrees Celsius), T ref For reference temperature, T range This refers to the temperature range, typically Tref = 20℃ and Trange = 30℃. Humidity and air pressure are normalized similarly; humidity is normalized to H... norm =H / 100, normalized air pressure to P norm =(P-1013) / 100.
[0087] S222, Fully Connected Network Encoding: Normalized 3D vectors are input into a fully connected neural network with a network structure of 3→64→128→256. ReLU activation function and Dropout regularization are used between each layer.
[0088] S223, such as Figure 7 As shown, physical constraints are applied based on the sensor type:
[0089] For electrochemical sensors, constrained by the linear relationship between temperature and current, the relationship between current and temperature in an electrochemical sensor can be expressed as:
[0090] ;
[0091] in, Let α be the reference current at the reference temperature, α be the temperature coefficient, and ΔT be the temperature change, i.e., ΔT = T - Temperature coefficient α and reference current As learnable parameters, they are automatically learned through end-to-end training.
[0092] For infrared sensors, applying Beer-Lambert's law, the relationship between the light intensity of the infrared sensor and the gas concentration follows Beer-Lambert's law:
[0093] ;
[0094] Where I is the transmitted light intensity. Let be the incident light intensity, ε be the molar absorptivity, C be the gas concentration, and L be the optical path length. The formula for calculating the gas concentration is:
[0095] ;
[0096] Within the constraint layer, the physically predicted concentration is calculated based on the measured light intensity signal. Embed it as prior knowledge to guide the environment:
[0097] ;
[0098] Where λ is the scaling factor, with a value ranging from 0.1 to 0.5.
[0099] For semiconductor sensors, applying the exponential relationship between resistance and temperature, the sensitivity of a semiconductor gas sensor can be expressed as follows:
[0100] ;
[0101] in, For reference sensitivity, Activation energy (unit: joules per mole), R is the gas constant (8.314 joules per mole per Kelvin), and T is the absolute temperature (unit: Kelvin). As learnable parameters, they are automatically learned through training.
[0102] In addition to implementing hard constraints through gating mechanisms, the physical constraint layer also implements soft constraints through a physical loss function. The physical loss function is defined as follows:
[0103] ;
[0104] in, For the environmental impacts predicted by the model, The environmental impact is calculated based on physical formulas. These are the weights for the physics loss. The physics loss is optimized along with other loss functions during model training to guide the model in learning parameters that conform to physical laws.
[0105] After physical constraints are applied, an environmental feature vector F is generated. env .
[0106] S23. Extract historical features, specifically including:
[0107] S231. Perform Z-score standardization on the following statistical characteristics: signal mean μ, standard deviation σ, maximum value max, minimum value min, rate of change rate, signal trend direction, and zero drift rate over the past hour. rate and the last zero-point calibration time cal These statistical characteristics reflect the sensor's historical operating status and zero-point drift trend.
[0108] S232. Fully Connected Network Encoding: The standardized feature input is a four-layer fully connected neural network with a network structure of 8→32→64→128→256. ReLU activation and Dropout regularization are used between each layer to generate historical feature vectors F. hist The dimension is 256.
[0109] S3, such as Figure 4 As shown, the adaptive multimodal fusion module uses a multi-head attention mechanism to achieve dynamic fusion of sensor signals and environmental parameters.
[0110] Specifically, it includes:
[0111] S31. Generate the query vector Q, key vector K, and value vector V. The calculation formulas include:
[0112] ;
[0113] ;
[0114] ;
[0115] in, , , It is a learnable linear transformation matrix.
[0116] S32. Multi-head attention calculation: An 8-head multi-head attention mechanism is adopted, with each head having a feature dimension of 32. After calculating the attention output, the components are concatenated and a linear transformation is performed to output the projection matrix. Obtain the final attention output :
[0117] ;
[0118] S33, Residual Connection and Historical Feature Concatenation: Connecting Attention Output with F sensor Perform residual join: Then, the historical feature vector F hist Extending to all time steps and concatenating them, we obtain the final fused feature F. final .
[0119] S4, the zero-point drift prediction module first learns the encoder through comparison to determine the F... final Mapped to a 128-dimensional embedding space, the contrastive learning encoder consists of two fully connected layers (dimensionality mapping from 512 to 256 to 128), ReLU activation, Dropout (p=0.1), and L2 normalization, trained using the InfoNCE loss function. Positive samples are times with a zero-point offset difference of less than 0.02 μA, and negative samples are states with different sensors or gases present. Then, the low-dimensional embedding z is input into a temporal prediction network consisting of three stacked Mamba blocks, with each layer using residual connections. Finally, the zero-point offset prediction sequence is output through a linear layer. Simultaneously calculate the zero-point drift rate. When |Δzero(t)| exceeds 0.05μA, a background zero-point calibration procedure is triggered. During calibration, the predicted value continues to be used to compensate the real-time signal C. compensated (t) = I measured (t) - Δzero(t), after calibration, reset the zero-point reference and clear the model state.
[0120] The calculation process of the contrastive learning encoder is as follows:
[0121] ;
[0122] Where z is a low-dimensional embedding vector with a dimension of T×128; This represents the L2 norm.
[0123] InfoNCE loss is a contrastive loss based on mutual information, which can effectively learn discriminative representations of data. For anchor samples... Positive samples and negative samples The InfoNCE loss is defined as:
[0124] ;
[0125] Where N is the batch size; sim(·, ·) is the cosine similarity function, defined as:
[0126] ;
[0127] τ is a temperature hyperparameter that controls the smoothness of the distribution. The lower the temperature, the more sensitive the model is to differences in similarity.
[0128] S5, such as Figure 6 As shown, the first neural network of the adaptive filtering module (input 5→64→32→4) reconstructs the Q matrix by using the Cholesky lower triangular elements of the prediction process noise covariance Q based on temperature, humidity, air pressure, signal standard deviation, and the current time step. Softplus activation is then applied to reconstruct the Q matrix. The lower triangular matrix L has the following form:
[0129] ;
[0130] Neural network output , , Three elements (actual output is four elements, the fourth is for future expansion), the Softplus activation function is applied to ensure the elements are positive:
[0131] ;
[0132] Calculate the Q matrix:
[0133] ;
[0134] Cholesky decomposition guarantees the symmetric positive definiteness of the Q matrix, which is a necessary condition for the Kalman filter algorithm.
[0135] The second neural network (3→32→16→1) is based on the signal-to-noise ratio. The drift rate and sensor usage time predict the observation noise covariance R.
[0136] Finally, adaptive Kalman filtering is performed, and the state vector... State transition matrix Observation matrix The prediction and update steps are executed 600 times in a loop, and the filtered signal s is output. filtered .
[0137] in, For signal power, s is the noise power, and s is the sensor signal value. Let Δt be the rate of change of the signal, and Δt be the sampling time interval.
[0138] The prediction steps include:
[0139] ;
[0140] ;
[0141] in, To predict the state, Let B be the prediction error covariance, B be the control input matrix, and Q(t) be the process noise covariance predicted by the neural network.
[0142] The update steps include:
[0143] First, calculate the innovation, which is the difference between the observed and predicted values:
[0144] ;
[0145] Where z(t) is the observed value at time t, i.e. the original sensor signal.
[0146] Then calculate the new information covariance matrix S:
[0147] ;
[0148] Where R(t) is the observation noise covariance predicted by the neural network.
[0149] Calculate the Kalman gain K, which represents the confidence trade-off between the predicted and observed values:
[0150] ;
[0151] Updated state estimate:
[0152] ;
[0153] Update error covariance:
[0154] ;
[0155] Where I is the identity matrix.
[0156] The Kalman gain K has a range of [0, 1]. When K is close to 1, it indicates that the observed values are trusted more; when K is close to 0, it indicates that the predicted values are trusted more. By dynamically adjusting Q and R, the system can adaptively adjust K according to the current environment and signal quality to achieve optimal filtering.
[0157] S6. Filter the signal s filtered A learnable piecewise linear network is used for correction, and the correction formula is as follows: N is the number of segments, ranging from 5 to 20, and x is the input signal, i.e., the filtered signal S. filtered y represents the corrected signal; the weighting coefficient of the i-th segment. and the i-th threshold It is obtained by the neural network based on sensor model encoding, cumulative usage time, current temperature, humidity and air pressure; ReLU is the modified linear unit function, defined as ReLU(z) = max(0, z).
[0158] S7. Predicted values of signal and zero-point offset after comprehensive nonlinear correction The gas concentration value is calculated, and the standard deviation of the predicted value is calculated through multiple forward propagation using the Monte Carlo Dropout technique. This standard deviation is used as the cognitive uncertainty and mapped to the [0,1] interval using the Sigmoid function to obtain the confidence score. At the same time, the zero-point estimate and data quality indicator are output.
[0159] Data quality indicators include: the presence of anomalies, the type of anomaly (sensor failure / environmental mutation / data noise), and noise level assessment.
[0160] In summary, this invention proposes a multimodal adaptive preprocessing method for gas sensors based on the Mamba state-space model, comprising:
[0161] S1. Data Acquisition: Synchronously acquire raw sensor signals, environmental parameters, and historical time-series data.
[0162] S2. Multimodal Feature Extraction: Feature extraction is performed on the three types of data respectively to generate sensor feature vector F. sensor Environmental feature vector F env and historical feature vector F hist .
[0163] S3, Adaptive Multimodal Fusion: Using sensor feature vector F sensor As the query Q, with the environmental feature vector F env As keys K and values V, Q, K, and V are generated through linear transformation. An 8-head multi-head attention mechanism is used to calculate the attention output, which is then compared with F. sensor After performing residual connections, the historical feature vector F is then... histExtending to all time steps and concatenating them along the channel dimension yields the final fused feature F. final .
[0164] S4, Zero-point drift prediction: The final fused feature F final The input contrastive learning encoder is mapped to a 128-dimensional L2 normalized embedding space; the low-dimensional embedded input is converted into a time-series prediction network consisting of three stacked Mamba blocks, with residual connections in each layer, and finally outputs the zero offset prediction sequence Δzero(t) through a linear layer; when |Δzero(t)| exceeds a preset threshold, background zero calibration is triggered, and the predicted value is used to compensate the real-time signal Imeasured(t)-Δzero(t) during calibration.
[0165] S5. Adaptive Filtering: The Q matrix is reconstructed using a first neural network based on temperature, humidity, air pressure, signal standard deviation, and the current time-predicted process noise covariance; the observation noise covariance R is predicted using a second neural network based on signal-to-noise ratio, drift rate, and sensor usage time; adaptive Kalman filtering is executed, iteratively performing prediction and update steps, and outputting the filtered signal s. filtered .
[0166] S6. Nonlinear correction: For the filtered signal s... filtered A learnable piecewise linear network is used for correction.
[0167] S7. Final output: The gas concentration value is obtained by subtracting the zero offset prediction value Δzero(t) from the signal after comprehensive nonlinear correction; the prediction standard deviation is calculated by performing multiple forward propagations using the Monte Carlo Dropout method and mapped to [0,1] using Sigmoid to obtain the confidence score; the zero estimate and data quality indicators are also output, including the presence of anomalies, anomaly type, and noise level assessment.
[0168] The steps in this invention can be adjusted, combined, or deleted according to actual needs.
[0169] The units in the device of the present invention can be merged, divided, or reduced according to actual needs.
[0170] In this invention, the terms "installation," "connection," "linking," and "fixing" should be interpreted broadly. For example, "connection" can be a fixed connection, a detachable connection, or an integral connection; "linking" can be a direct connection or an indirect connection through an intermediate medium. Those skilled in the art can understand the specific meaning of these terms in this invention according to the specific circumstances.
[0171] The shapes of the components in the accompanying drawings are schematic and may differ from their actual shapes. The drawings are only used to illustrate the principles of the present invention and are not intended to limit the present invention.
[0172] Although the invention has been disclosed in detail with reference to the accompanying drawings, it should be understood that these descriptions are merely exemplary and not intended to limit the application of the invention. The scope of protection of the invention is defined by the appended claims and may include various modifications, alterations, and equivalents made to the invention without departing from the scope and spirit of the invention.
Claims
1. A multi-modal adaptive pre-processing method for gas sensor based on Mamba state space model, characterized in that, The method comprises: S1, data acquisition: synchronously collecting sensor original signals, environmental parameters and historical time series data; S2, multi-modal feature extraction: feature extraction is performed on the three types of data respectively to generate sensor feature vectors F sensor , environment feature vectors F env , and history feature vectors F hist ; S3, adaptive multi-modal fusion: with sensor feature vector F sensor As query Q, with environment feature vector F env As key K and value V, generate Q, K, V through linear transformation, calculate attention output by adopting 8-head multi-head attention mechanism, and concatenate the attention output with F sensor After residual connection, the historical feature vector F hist is expanded to all time steps and concatenated with them in the channel dimension to obtain the final fused feature F final ; S4, zero drift prediction: the final fused feature F final The input contrastive learning encoder is mapped to a 128-dimensional L2 normalized embedding space; the low-dimensional embedding input is input into a time series prediction network composed of 3 layers of stacked Mamba blocks, each layer using residual connection, and finally outputting a zero offset prediction sequence Δzero(t) through a linear layer; when |Δzero(t)| exceeds a preset threshold, trigger the background zero calibration, and use the predicted value to compensate the real-time signal Imeasured(t)-Δzero(t) during calibration; S5, adaptive filtering: reconstructing the Q matrix according to the temperature, humidity, air pressure, signal standard deviation, and current time prediction process noise covariance through the first neural network; predicting the observation noise covariance R through the second neural network according to the signal-to-noise ratio, drift rate, and sensor use time; performing adaptive Kalman filtering, and cyclically performing the prediction and updating steps to output the filtered signal s filtered ; S6, non-linear correction: on the filtered signal s filtered Correction is performed using a learnable piecewise linear network; S7, final output: obtaining the gas concentration value by subtracting the zero point offset prediction value Δzero(t) from the nonlinear corrected signal; calculating the prediction standard deviation by multiple forward propagation through the Monte Carlo Dropout method and Sigmoid mapping to [0, 1] to obtain the confidence score; simultaneously outputting the zero point estimate value and the data quality mark, which includes whether there is an anomaly, the type of anomaly and the noise level evaluation.
2. The Mamba state-space model based gas sensor multi-modal adaptive preprocessing method of claim 1, wherein, The sensor original signal includes at least one of the current signal or the voltage signal of an electrochemical sensor, the light intensity signal of an infrared sensor, and the resistance signal or the conductance signal of a semiconductor sensor, and the collection time window length is 300-1000 time steps; the environmental parameters include temperature, humidity and air pressure, the temperature measurement range is-10-50℃ with an accuracy better than 0.5℃, the humidity measurement range is 0-100% relative humidity with an accuracy better than 2% relative humidity, and the air pressure measurement range is 900-1100 hundred Pa with an accuracy better than 1 hundred Pa; the historical time series data includes the signal mean, standard deviation, maximum value, minimum value, change rate, signal trend direction, zero point drift rate and Unix timestamp of the last zero point calibration time within the past 1 hour.
3. The Mamba state-space model based gas sensor multi-modal adaptive pre-processing method of claim 1, wherein, The step S2 specifically comprises: The sensor original signal is first normalized, and the normalization formula is: ; where I(t) is the original current value at time t, I min and I max are the preset minimum and maximum current values, respectively, typically I min = 0 μA and I max = 500 μA, and the normalized signal value range is [0, 1]; The normalized signal extracts local time series features through three parallel one-dimensional convolution branches, the convolution kernel size is 3, 7 and 15 respectively, the number of output channels of each branch is 32, and the branch outputs are spliced in the channel dimension; the spliced local features are input into the bidirectional Mamba state space model for deep time series modeling, and the Mamba model adopts the input-dependent parameter: ; ; ; Wherein, B(t) is the input matrix; C(t) is the output matrix; Δ(t) is the time step parameter, a scalar value, and the Softplus function is defined as Softplus(x) = log(1 + exp(x)), which ensures that Δ(t) is positive.
4. Discretize using the zeroth-order hold method to obtain Āand : ; ; wherein A is a continuous state transition matrix, is a learnable parameter of the model; I is an identity matrix; Ā and are the discretized state transition matrix and input matrix, respectively The parallel scanning algorithm is adopted to realize state updating, the hidden dimensions of the forward Mamba layer and the backward Mamba layer are 128, and the sensor feature vector F is obtained by splicing and combining hidden states in two directions sensor ; After the environmental parameters are normalized, they are input into a fully connected neural network 3→64→128→256 to generate an environmental embedding vector, and then a constraint layer guided by physical knowledge is used for constraint, the constraint layer applies different physical constraints according to the sensor types, and finally an environmental feature vector F is generated env ; The historical time series data is input into a full connection neural network 8→32→64→128→256 after Z-score standardization to generate a historical feature vector F hist .
5. The Mamba state-space model based gas sensor multi-modal adaptive preprocessing method of claim 1, wherein, The contrast learning encoder is trained using the InfoNCE loss, the positive sample is the time when the zero point offset difference is less than 0.02μA, and the negative sample is the state when different sensors or gases exist; The InfoNCE loss is defined as: ; where N is the batch size, is an anchor sample, is a positive sample, is a negative sample; sim(·, ·) is a cosine similarity function, defined as: ; τ is a temperature hyperparameter that controls the smoothness of the distribution.
6. The Mamba state-space model based gas sensor multi-modal adaptive preprocessing method of claim 1, wherein, The correction formula in the step S6 is , N is the number of segments, and takes a value of 5 to 20, x is an input signal, that is, a filtered signal S filtered ; y is a corrected signal; a weight coefficient of an i-th segment , and an i-th threshold value are obtained by a neural network according to a sensor model code, a cumulative use time length, a current temperature, humidity, and air pressure adaptive learning; and ReLU is a rectified linear unit function, defined as ReLU(z) = max(0,z).
7. The Mamba state-space model based gas sensor multi-modal adaptive preprocessing method of claim 1, wherein, The constraint formula of the physical constraint layer includes at least one of the following: Sensor sensitivity versus temperature: where S0 is the reference sensitivity, E a is the activation energy, R is the gas constant, and T is the absolute temperature; Electrochemical sensor current vs. temperature: where I0is the reference current, a is the temperature coefficient, and AT is the temperature change. Beer-Lambert's law for infrared sensors: where ε is the molar absorption coefficient, C is the gas concentration, and L is the optical path length.
Citation Information
Patent Citations
Block chain-based sesame raw material quality inspection management method and system
CN117078115A
Lithium battery SOC estimation method based on multi-scale physical information neural network
CN119881678A
Shafting load analysis method based on real-time data monitoring
CN119989238A
Lightweight surface electromyogram signal classification method and system
CN120470377A
Support structure stress state monitoring method based on artificial intelligence
CN120524256A
Cited By
Marine dissolved gas sensor data denoising and time-delay correction real-time processing method
CN121880941A
Real-time processing method for denoising and time lag correction of marine dissolved gas sensor data
CN121880941B