Mamba state space model-based multi-modal adaptive preprocessing method for gas sensors
Patent Information
- Application Number
- CN202511777247.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-28
- Publication Date
- 2026-09-18
- Estimated Expiration
- 2045-11-28
AI Technical Summary
这类系统通常会产生异构的多源数据流,这些数据流在时间分辨率、信号特性和噪声特征方面存在显著差异,因此对数据预处理提出了严峻挑战
[0042] Significantly improves preprocessing accuracy and robustness: Efficiently performs deep time-series modeling of long sequence sensor signals through a bidirectional Mamba state-space model, while introducing hard/soft constraint layers guided by physical knowledge, so that the model output strictly conforms to the real physical laws of sensors such as electrochemical, infrared, and semiconductor sensors, effectively suppressing errors caused by changes in environmental temperature and humidity, cross-interference and nonlinear response, and maintaining extremely high stability and accuracy, especially under complex mixed gas and variable environmental conditions.
Smart Images

Figure CN121633397B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of gas detection, and more specifically, to a multimodal adaptive preprocessing method for gas sensors based on the Mamba state-space model. Background Technology
[0002] Gas detection technology plays a crucial role in environmental monitoring, industrial safety, medical diagnosis, and air quality assessment. With the rapid development of IoT technology and intelligent sensing devices, higher demands are being placed on the accuracy, reliability, and real-time performance of gas detection systems. In practical applications, single-type gas sensors often struggle to meet the detection needs of complex gas environments. Therefore, multimodal gas sensing technology has emerged, integrating multiple sensing mechanisms such as electrochemical sensors, infrared sensors, and semiconductor sensors to acquire more comprehensive and complementary gas information, thereby improving the robustness and accuracy of the detection system.
[0003] Multimodal gas sensing systems, by synergistically utilizing the outputs of sensors operating on different principles, can effectively overcome the limitations of single sensors in terms of selectivity, stability, and anti-interference capabilities. These systems typically generate heterogeneous multi-source data streams with significant differences in temporal resolution, signal characteristics, and noise features, posing a significant challenge to data preprocessing. Traditional sensor preprocessing methods usually include baseline correction, temperature and humidity compensation, drift calibration, and noise filtering; however, these methods are mostly based on fixed physical or statistical models and are difficult to adapt to the actual situation where sensor characteristics change over time and environmental conditions fluctuate. Summary of the Invention
[0004] The purpose of this invention is to provide a multimodal adaptive preprocessing method for gas sensors based on the Mamba state-space model. By combining end-to-end deep temporal modeling with physical constraints, this method enables high-precision, real-time adaptive signal preprocessing for various gas sensors in complex real-world environments, thus completely solving the technical challenges of traditional methods in dealing with sensor drift, environmental interference, nonlinear response, and heterogeneity of multimodal data.
[0005] The technical solution of this invention is: to provide a multimodal adaptive preprocessing method for gas sensors based on the Mamba state-space model, the method comprising:
[0006] S1. Data Acquisition: Synchronously acquire raw sensor signals, environmental parameters, and historical time-series data;
[0007] 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 ;
[0008] 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... hist Extending to all time steps and concatenating them along the channel dimension yields the final fused feature F. final ;
[0009] 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 output as a zero-point offset prediction sequence Δzero(t) through a linear layer; when |Δzero(t)| exceeds a preset threshold, background zero-point calibration is triggered, and the predicted value is used to compensate the real-time signal C during calibration. compensated (t) = I measured (t) - Δzero(t);
[0010] 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 ;
[0011] S6. Nonlinear correction: For the filtered signal s... filtered Correction is performed using a learnable piecewise linear network;
[0012] 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.
[0013] In any of the above technical solutions, the raw sensor signal further includes at least one of the following: current or voltage signal from an electrochemical sensor, light intensity signal from an infrared sensor, and resistance or conductivity signal from a semiconductor sensor; the acquisition time window length is 300 to 1000 time steps; the environmental parameters include temperature, humidity, and air pressure; the temperature measurement range is -10℃ to 50℃ with an accuracy better than 0.5℃; the humidity measurement range is 0 to 100% relative humidity with an accuracy better than 2% relative humidity; the air pressure measurement range is 900 to 1100 hPa with an accuracy better than 1 hPa; the historical time series data includes the signal mean, standard deviation, maximum value, minimum value, rate of change, signal trend direction, zero drift rate, and the Unix timestamp of the last zero calibration time in the past hour.
[0014] In any of the above technical solutions, step S2 further includes:
[0015] The raw sensor signal is first normalized using the following formula:
[0016] ;
[0017] Where I(t) is the initial current value at time t, I min and I max These are the preset minimum and maximum current values, respectively, typical I min =0μA、I max =500μA, the normalized signal range is [0, 1];
[0018] After normalization, the signal is processed through three parallel one-dimensional convolutional branches to extract local temporal features. The kernel sizes are 3, 7, and 15, respectively, and each branch outputs 32 channels. The branch outputs are concatenated along the channel dimension. The concatenated local features are then input into a bidirectional Mamba state-space model for deep temporal modeling. The Mamba model uses input-dependent parameters.
[0019] ;
[0020] ;
[0021] ;
[0022] 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;
[0023] Discretize using the zero-order preservation method to obtain Ā and . :
[0024] ;
[0025] ;
[0026] 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;
[0027] 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 ;
[0028] After normalizing the environmental parameters, they are input into a fully connected neural network (3→64→128→256) to generate an environmental embedding vector. Then, a constraint layer guided by physical knowledge applies constraints, imposing different physical constraints based on the sensor type, ultimately generating the environmental feature vector F. env ;
[0029] After Z-score standardization of historical time-series data, the data is input into a fully connected neural network (8→32→64→128→256) to generate historical feature vector F. hist .
[0030] In any of the above technical solutions, the contrastive learning encoder is further trained using InfoNCE loss, with positive samples being moments when the zero-point offset difference is less than 0.02 μA, and negative samples being states when different sensors or gases are present.
[0031] InfoNCE loss is defined as:
[0032] ;
[0033] Where N is the batch size. For anchor point samples, As a positive sample, For negative samples; sim(·, ·) is the cosine similarity function, defined as:
[0034] ;
[0035] τ is a temperature hyperparameter that 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, 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).
[0037] In any of the above technical solutions, the constraint formula of the physical constraint layer further includes at least one of the following:
[0038] The relationship between sensor sensitivity and temperature: Where S0 is the reference sensitivity, E a The activation energy is R, the gas constant is T, and the absolute temperature is T.
[0039] Relationship between current and temperature in electrochemical sensors: Where I0 is the reference current, α is the temperature coefficient, and ΔT is the temperature change;
[0040] The Beer-Lambert Law for Infrared Sensors: , where ε is the molar absorptivity, C is the gas concentration, and L is the optical path length.
[0041] The beneficial effects of this invention are:
[0042] Significantly improves preprocessing accuracy and robustness: Efficiently performs deep time-series modeling of long sequence sensor signals through a bidirectional Mamba state-space model, while introducing hard / soft constraint layers guided by physical knowledge, so that the model output strictly conforms to the real physical laws of sensors such as electrochemical, infrared, and semiconductor sensors, effectively suppressing errors caused by changes in environmental temperature and humidity, cross-interference and nonlinear response, and maintaining extremely high stability and accuracy, especially under complex mixed gas and variable environmental conditions.
[0043] Achieving true adaptive zero-point drift calibration: The zero-point drift prediction module, which combines contrastive learning with the Mamba temporal prediction network, can monitor and accurately predict zero-point offset in real time without interrupting detection. When the offset exceeds the threshold, it automatically triggers background calibration, which completely solves the limitations of traditional periodic manual calibration or fixed model compensation and significantly extends the sensor's maintenance-free cycle.
[0044] Leading capabilities in deep multimodal data fusion and dynamic environmental compensation: By using an adaptive fusion mechanism based on multi-head attention and combining historical statistical features, the system achieves dynamic weighted fusion of sensor signals, environmental parameters, and historical context, enabling it to accurately sense and compensate for environmental disturbances such as temperature, humidity, and air pressure in real time. It exhibits strong anti-interference capabilities in complex scenarios such as industrial flue gas and ambient air.
[0045] Intelligent Adaptive Noise Filtering and Nonlinear Correction: The noise covariance Q / R is dynamically predicted by a neural network based on real-time signal quality. Combined with a learnable piecewise linear correction network, the filtering and nonlinear correction are fully adaptive to sensor aging and current operating conditions, improving the signal-to-noise ratio. The smoothness of the output signal matches the true concentration curve very well, completely solving the failure problem of fixed parameter filtering in variable noise environments.
[0046] Output confidence level and data quality reliability assessment to improve system-level reliability: Monte Carlo Dropout provides uncertainty quantification and confidence level scores, while outputting detailed data quality indicators, enabling the host computer system to automatically determine data reliability, avoid false alarms and missed alarms, and significantly improve the overall system decision reliability and security. Attached Figure Description
[0047] The advantages of the above and additional aspects of the present invention will become apparent and readily understood in the description of the embodiments in conjunction with the following drawings, wherein:
[0048] Figure 1 This is a schematic diagram of the overall process of a multimodal adaptive preprocessing method for a gas sensor based on the Mamba state-space model according to an embodiment of the present invention, illustrating the complete processing flow from data acquisition to final output;
[0049] Figure 2 This is a detailed structural diagram of the multimodal feature extraction module of the gas sensor multimodal adaptive preprocessing method based on the Mamba state-space model according to an embodiment of the present invention. It shows in detail the internal structure of the sensor signal processing submodule, the environmental parameter processing submodule, and the historical feature processing submodule.
[0050] Figure 3 This is a schematic diagram of the structure of the Mamba state-space model layer of the gas sensor multimodal adaptive preprocessing method based on the Mamba state-space model according to an embodiment of the present invention, which shows the internal calculation process of the Mamba model in detail.
[0051] Figure 4 This is a structural diagram of an adaptive multimodal fusion module for a gas sensor multimodal adaptive preprocessing method based on the Mamba state-space model according to an embodiment of the present invention, illustrating the working principle of the multi-head attention mechanism;
[0052] Figure 5 This is a structural diagram of a zero-drift prediction module for a multimodal adaptive preprocessing method for gas sensors based on the Mamba state-space model, according to an embodiment of the present invention. It includes a contrastive learning encoder and a Mamba temporal prediction network. Figure 5 The paper also demonstrates the calculation process of InfoNCE loss and the zero-point calibration triggering mechanism;
[0053] Figure 6 This is a schematic diagram of an adaptive Kalman filter module for a multimodal adaptive preprocessing method for gas sensors based on the Mamba state-space model, according to an embodiment of the present invention. It shows in detail the noise covariance prediction and the Kalman filter loop.
[0054] Figure 7 This is a schematic diagram of the constraint layer guided by physical knowledge in a multimodal adaptive preprocessing method for gas sensors based on the Mamba state-space model according to an embodiment of the present invention. It shows the physical constraint methods for different types of sensors and the two implementation methods of soft constraints and hard constraints. Detailed Implementation
[0055] To better understand the above-mentioned objectives, features, and advantages of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that, unless otherwise specified, the embodiments of the present invention and the features thereof can be combined with each other.
[0056] In the following description, many specific details are set forth in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and therefore the scope of protection of the invention is not limited to the specific embodiments disclosed below.
[0057] like Figure 1 As shown, this embodiment provides a multimodal adaptive preprocessing method for gas sensors based on the Mamba state-space model. This method includes:
[0058] S1. The data acquisition module synchronously acquires raw sensor signals, environmental parameters, and historical time-series data:
[0059] The acquired raw sensor signals include at least one of the following: current or voltage signals from electrochemical sensors, light intensity signals from infrared sensors, resistance or conductivity signals from semiconductor sensors, laser absorption spectroscopy signals, and Raman spectroscopy signals. The acquisition time window is T time steps, typically ranging from 300 to 1000 time steps, corresponding to a sampling time of 5 to 20 minutes.
[0060] Environmental parameters include at least one of temperature, humidity, and air pressure, and optionally also include gas flow rate and background gas concentration. The temperature measurement range is -10℃ to 50℃, with a measurement accuracy better than 0.5℃; the humidity measurement range is 0 to 100% relative humidity, with a measurement accuracy better than 2% relative humidity; the air pressure measurement range is 900 to 1100 hPa, with a measurement accuracy better than 1 hPa.
[0061] Historical time-series data includes sensor signal statistical characteristics, zero-point drift rate, last zero-point calibration time, and device status event flags for the past hour. Statistical characteristics include signal mean μ, standard deviation σ, maximum value max, minimum value min, rate of change rate, and signal trend direction; zero-point drift rate is recorded in microamps per hour or millivolts per hour; the last zero-point calibration time is stored in Unix timestamp format; device status event flags include markers for events such as sensor startup, calibration, and failure.
[0062] S2. The original sensor signal is processed sequentially by normalization, multi-scale one-dimensional convolution feature extraction, and bidirectional Mamba state space model processing to obtain the sensor feature vector.
[0063] Specifically, such as Figure 2 As shown, step S2 includes:
[0064] S21. Extract sensor signal features, specifically including:
[0065] S211. Normalization Processing: First, the original sensor signal is normalized. For the current signal of an electrochemical sensor, the normalization formula is:
[0066] ;
[0067] Where I(t) is the initial current value at time t, I min and I max These are the preset minimum and maximum current values, respectively, typical I min =0μA、I max =500μA, the normalized signal range is [0, 1], which is beneficial for the training and convergence of the neural network.
[0068] S212. Multi-scale one-dimensional convolutional local temporal feature extraction: The normalized signal is input into three parallel multi-scale one-dimensional convolutional branches with kernel sizes of 3, 7, and 15, a stride of 1, and a padding method of "same". Each branch outputs 32 channels. Each branch consists of a convolutional layer, a batch normalization layer, a ReLU activation function, and a Dropout layer. The outputs of the three branches are concatenated along the channel dimension to obtain a local feature tensor.
[0069] S213, Deep temporal modeling of bidirectional Mamba state-space model: such as Figure 3 As shown, 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 functions:
[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 heads 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: Integrating Attention Output with F sensor Perform residual join: Then, the historical feature vector F hist Extending to all time steps and concatenating them yields 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 output as a zero-point offset prediction sequence Δzero(t) through a linear layer; when |Δzero(t)| exceeds a preset threshold, background zero-point calibration is triggered, and the predicted value is used to compensate the real-time signal C during calibration. compensated (t) = I measured (t) - Δzero(t).
[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 variations, modifications, and equivalents made to the invention without departing from the scope and spirit of the invention.
Claims
1. A multimodal adaptive preprocessing method for gas sensors based on the Mamba state-space model, characterized in that, The method includes: S1. Data Acquisition: Synchronously acquire raw sensor signals, environmental parameters, and historical time-series data; 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 ; 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... hist Extending to all time steps and concatenating them along the channel dimension yields the final fused feature F. final ; 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 output as a zero-point offset prediction sequence Δzero(t) through a linear layer; when |Δzero(t)| exceeds a preset threshold, background zero-point calibration is triggered, and the predicted value is used to compensate the real-time signal C during calibration. compensated (t) = I measured (t) - Δzero(t); 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 ; S6. Nonlinear correction: For the filtered signal s... filtered Correction is performed using a learnable piecewise linear network; 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. Step S2 specifically includes: The raw sensor signal is first normalized using the following formula: ; Where I(t) is the initial current value at time t, I min and I max These are the preset minimum and maximum current values, respectively, typical I min =0μA、I max =500μA, the normalized signal range is [0, 1]; After normalization, the signal is processed through three parallel one-dimensional convolutional branches to extract local temporal features. The kernel sizes are 3, 7, and 15, respectively, and each branch outputs 32 channels. The branch outputs are concatenated along the channel dimension. The concatenated local features are then input into a bidirectional Mamba state-space model for deep temporal modeling. The Mamba model uses input-dependent parameters. ; ; ; Where x(t) is the concatenated local feature, B(t) is the input matrix, C(t) is the output matrix, and Δ(t) is the time step parameter, a scalar value. The Softplus function is defined as Softplus(x) = log(1 + exp(x)), ensuring that Δ(t) is a positive value. Discretize using the zero-order preservation method to obtain Ā and . : ; ; Where A is the continuous state transition matrix, B is the continuous state input matrix, and 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; 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 ; After normalizing the environmental parameters, they are input into a fully connected neural network (3→64→128→256) to generate an environmental embedding vector. Then, a constraint layer guided by physical knowledge applies constraints, imposing different physical constraints based on the sensor type, ultimately generating the environmental feature vector F. env ; After Z-score standardization of historical time-series data, the data is input into a fully connected neural network (8→32→64→128→256) to generate historical feature vector F. hist .
2. The multimodal adaptive preprocessing method for gas sensors based on the Mamba state-space model as described in claim 1, characterized in that, The raw sensor signals include at least one of the following: current or voltage signals from an electrochemical sensor, light intensity signals from an infrared sensor, and resistance or conductivity signals from a semiconductor sensor. The acquisition time window length is 300 to 1000 time steps. The environmental parameters include temperature, humidity, and air pressure. The temperature measurement range is -10℃ to 50℃ with an accuracy better than 0.5℃. The humidity measurement range is 0 to 100% relative humidity with an accuracy better than 2% relative humidity. The air pressure measurement range is 900 to 1100 hPa with an accuracy better than 1 hPa. The historical time series data includes the signal mean, standard deviation, maximum value, minimum value, rate of change, signal trend direction, zero drift rate, and the Unix timestamp of the last zero calibration time in the past hour.
3. The multimodal adaptive preprocessing method for gas sensors based on the Mamba state-space model as described in claim 1, characterized in that, The contrastive learning encoder is trained using InfoNCE loss. Positive samples are the moments when the difference in zero offset is less than 0.02 μA, and negative samples are the states when different sensors or gases are present. InfoNCE loss is defined as: ; Where N is the batch size. For anchor point samples, As a positive sample, For negative samples; sim(·, ·) is the cosine similarity function, defined as: ; τ is a temperature hyperparameter that controls the smoothness of the distribution.
4. The multimodal adaptive preprocessing method for gas sensors based on the Mamba state-space model as described in claim 1, characterized in that, The correction formula in step S6 is: 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).
5. The multimodal adaptive preprocessing method for gas sensors based on the Mamba state-space model as described in claim 1, characterized in that, The constraint formula of the constraint layer includes at least one of the following: The relationship between sensor sensitivity and temperature: Where S0 is the reference sensitivity, E a The activation energy is R, the gas constant is T, and the absolute temperature is T. Relationship between current and temperature in electrochemical sensors: Where I0 is the reference current, α is the temperature coefficient, and ΔT is the temperature change; The Beer-Lambert Law for Infrared Sensors: , where ε is the molar absorptivity, C is the gas concentration, and L is the optical path length.
Citation Information
Patent Citations
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