Gas concentration prediction method of time convolution network based on time attention mechanism

Through the time convolution network combined with the time attention mechanism, the problem of difficulty in simultaneously modeling the long-term diffusion effect and short-term mutation characteristics of gas concentration in the prior art is solved, and high-precision and real-time gas concentration prediction are achieved, which is suitable for multi-component gas monitoring in complex industrial environments.

CN120352574APending Publication Date: 2025-07-22JIAXING CHAOKUN INTELLIGENT CONTROL TECHNOLOGY CO LTD
View PDF 0 Cites 7 Cited by

Patent Information

Application Number
CN202510414411.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-03
Publication Date
2025-07-22

AI Technical Summary

Technical Problem

The existing gas concentration prediction methods are difficult to simultaneously model the long-term diffusion effect and short-term mutation characteristics of gas concentration, resulting in insufficient prediction accuracy in complex gas monitoring scenarios, and it is difficult to meet the demand for real-time detection of high dynamic gas concentrations in industrial closed environments.

Method used

A time convolution network based on the time attention mechanism is adopted, combined with a hybrid model of expanded causal convolution, gated cyclic units and time attention mechanism, capture long-term dependencies by gradually expanding the receptive field, dynamically regulate short-term dynamic changes, and adaptively allocate weights to enhance the feature expression of key time steps.

Benefits of technology

It realizes high-precision prediction of gas concentration, improves prediction stability and real-time performance, and is suitable for multi-component gas monitoring in complex industrial environments, significantly improving the modeling ability of long-term diffusion effects and short-term mutation signals.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120352574A_ABST
    Figure CN120352574A_ABST
Patent Text Reader

Abstract

The invention provides a gas concentration prediction method of a time convolution network based on a time attention mechanism, and belongs to the technical field of gas concentration prediction. According to the method, time series data are collected through multiple types of sensors, and after normalization and sliding window processing, a hybrid model integrating a time convolutional network, a gating circulation unit and a self-adaptive time attention mechanism is constructed. The time convolution network adopts an expansion causal convolution hierarchy to expand a receptive field, and captures a gas long-term accumulation effect; the gating circulation unit separates instantaneous fluctuation and trend characteristics through a double-time-scale architecture; the time attention mechanism dynamically distributes weights to strengthen key time steps. Through long-term and short-term feature fusion and dynamic optimization, the problem that a traditional model cannot give consideration to long-period dependence and short-term mutation is solved, the precision, stability and real-time performance of gas concentration prediction are remarkably improved, and the method is suitable for multi-component gas monitoring in a complex industrial environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of gas concentration prediction, and particularly relates to a gas concentration prediction method based on a temporal convolutional network with a temporal attention mechanism. Background Art

[0002] Existing gas concentration prediction methods mostly rely on single-time series models, such as long short-term memory networks or autoregressive integrated moving average models. Such methods rely on fixed time windows or local feature extraction mechanisms and are difficult to simultaneously model the long-period diffusion effect and short-term mutation characteristics of gas concentration. For example, traditional convolutional networks cannot cover the slow accumulation process due to limited receptive fields, while recurrent networks can capture temporal dependencies but are difficult to handle long sequences due to gradient problems, and the gating structure is complex, resulting in insufficient real-time performance. In addition, the uniform attention allocation mechanism easily ignores the features of key time points, resulting in low-concentration signals being masked by noise.

[0003] The above limitations make the existing technology have insufficient prediction accuracy in complex gas monitoring scenarios and are difficult to meet the requirements of real-time detection of high-dynamic gas concentration in industrial closed environments. Summary of the Invention

[0004] The present invention overcomes the deficiencies of the prior art and provides a gas concentration prediction method based on a temporal convolutional network with a temporal attention mechanism.

[0005] To achieve the above object, the technical solution adopted by the present invention is: a gas concentration prediction method based on a temporal convolutional network with a temporal attention mechanism, comprising the following steps:

[0006] S1. Continuously collect gas temporal concentration data in a closed environment to obtain raw data;

[0007] S2. Preprocess the raw data and divide the continuous sequence into sample segments of a fixed length;

[0008] S3. Construct a hybrid model integrating a temporal convolutional network, a gated recurrent unit, and a temporal attention mechanism, and use the data processed in S2 to train the model; the hybrid model is implemented in the following manner:

[0009] The temporal convolutional network adopts a deep network structure with dilated causal convolution to capture the long-term dependence relationship of gas concentration by gradually expanding the receptive field;

[0010] The gated recurrent unit regulates the fusion ratio of historical information and the current input through a gating mechanism to capture the short-term dynamic changes of gas concentration;

[0011] The temporal attention mechanism analyzes the feature correlation of different time points based on the self-attention mechanism and dynamically enhances the weights of key time steps;

[0012] S4. Input the time series segment of the gas concentration to be measured into the trained model and output the prediction result.

[0013] Preferably, the temporal convolutional network includes 4 residual blocks, and each residual block contains the following operations:

[0014] Perform dilated causal convolution operation on the input vector, and the dilation coefficient doubles hierarchically to gradually expand the time perception range;

[0015] Non-linearly activate the convolution output through the Gaussian error linear unit, and the function is defined as: GELU(x) = x·Φ(x); where x is the input value and Φ(x) is the cumulative distribution function of the standard Gaussian distribution;

[0016] Add the original input and the activated features through residual connection to avoid the degradation of deep network training. The formula is: y out = W d ·X in + F(X in , W i ); where X in is the input vector, W i is the convolution kernel weight matrix in the dilated causal convolution operation, which is used to perform feature transformation on X in ; W d is the dimension adaptation matrix, and F represents the transformation operation of dilated convolution and non-linear activation.

[0017] Preferably, the calculation of the dilated causal convolution output of the model is: k is the convolution kernel size, d is the dilation coefficient, which controls the interval step of the convolution kernel; w k is the convolution kernel weight; is the historical input data; the dimension adaptation matrix W d in the residual connection uses 1×1 convolution to achieve channel alignment when the input and output dimensions are inconsistent.

[0018] Preferably, the gated recurrent unit is implemented through the following gating mechanism:

[0019] The update gate calculates the retention ratio of the current input to the historical state. The formula is: z t = σ(W z ·[h t-1 , x t );

[0020] The reset gate controls the degree of forgetting of historical information. The formula is: r t = σ(W r ·[h t-1 , x t );

[0021] where rt For the reset gate, z t For the update gate; W z , W r is the weight matrix, σ is the Sigmoid function, h t-1 is the hidden state at the previous moment, x t is the current input;

[0022] The candidate state is generated after filtering historical information through the reset gate, and the formula is:

[0023] The final hidden state is obtained by the update gate fusing historical and candidate states, and the formula is:

[0024] where, is the candidate hidden state; h t is the final hidden state; W h is the weight matrix; ⊙ represents element-wise multiplication.

[0025] Preferably, the temporal attention mechanism is implemented through the following steps:

[0026] Map the input sequence to query vector Q, key vector K, and value vector V;

[0027] Calculate the similarity matrix between the query vector and the key vector, and generate attention weights through scaled dot product, and the formula is: where, Q = X P W Q ; K = X P W K ; V = X P W V ; X P is the input data after position encoding; W Q , W K and W V are weight matrices; d k is the dimension of the key vector, used to scale the gradient; the Softmax activation function is used to normalize the attention weights into a probability distribution to ensure that the sum of the weights at all time points is 1, and the specific formula is: where, z i is the i-th element of the input vector, and N is the vector dimension;

[0028] Weighted sum the weight matrix and the value vector to strengthen the feature expression of high-correlation time points.

[0029] Preferably, the method extracts gas concentration data segments of the historical 30 - 90 minutes as the model input through a sliding window, and real-time detects the gas concentration value at the current moment.

[0030] Preferably, the preprocessing includes normalization processing, using max-min standardization, and the formula is: where x min and x max are the minimum and maximum values of the original data column respectively, and the mapping interval is [-1, 1].

[0031] Preferably, the Adam optimization algorithm is used in the hybrid model training process, and the learning rate decays according to an exponential law: lr t = lr0 × 0.98 peoch ; where lr0 is the initial learning rate, epoch is the current training round; five-fold cross-validation is used to optimize the hyperparameters; the loss function is the mean squared error.

[0032] Preferably, the dilation coefficient d is dynamically adjusted according to the autocorrelation of the input sequence, and the formula is d l = d b ·(1 + log(1 + ρ l )); where ρ l is the Pearson autocorrelation coefficient of the input sequence at the l-th layer, and d b is the reference dilation coefficient.

[0033] Preferably, the gated recurrent unit is extended to a dual-time-scale architecture, including a fast GRU and a slow GRU. The fast GRU captures instantaneous changes at a 1-min step, and the slow GRU extracts trend features at a 5-min step. The final state fusion formula is: h = βh1 + (1 - β)h2; where β is the dynamic weight generated by sigmoid; h1 is the output of the GRU at a 1-min step; h2 is the output of the GRU at a 5-min step.

[0034] The present invention solves the defects existing in the background art, and the present invention has the following beneficial effects:

[0035] (1) Through the hybrid model integrating the temporal convolutional network, gated recurrent unit and temporal attention mechanism, the present invention combines dilated causal convolution to capture long-term dependencies, the gating mechanism to regulate short-term dynamic changes, and the attention mechanism to dynamically allocate key time step weights, realizing high-precision joint modeling of the long-period diffusion effect and short-time mutation signal of gas concentration, and improving the prediction stability and real-time performance.

[0036] (2) Aiming at long-term dependency modeling, the temporal convolutional network in the present invention adopts a residual structure with a hierarchical doubling of the dilation coefficient, fully captures the gas accumulation effect by expanding the receptive field, and combines the Gaussian error linear unit to optimize the nonlinear activation characteristics, solving the problem of long-range information loss caused by the fixed convolution step in the traditional model, and significantly improving the goodness of fit of the prediction trend compared with a single TCN or LSTM model.

[0037] (3) For short-term dynamic response, the gated recurrent unit adopts a dual-time-scale architecture. By separating the instantaneous fluctuations and trend features through fast and slow GRUs and combining the dynamic weight fusion mechanism, it reduces the problem of response delay of traditional single GRUs to sudden signals, and improves the detection accuracy of mutation signals while ensuring computational efficiency.

[0038] (4) The time attention mechanism and the multi-scale feature extraction module work together. By adaptively allocating weights to strengthen the features of key time steps and using residual connections and dynamic dilation coefficients to alleviate the problem of deep network degradation, it realizes the complementary fusion of long-term and short-term features, and shows stronger robustness and interpretability under complex working conditions. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments recorded in the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings;

[0040] Figure 1 is the framework diagram of AGT-TCN;

[0041] Figure 2 are the experimental results of AGT-TCN and the comparison model Figure 1 ;

[0042] Figure 3 are the experimental results of AGT-TCN and the comparison model Figure 2 ;

[0043] Figure 4 are the experimental results of AGT-TCN and the comparison model Figure 3 . DETAILED DESCRIPTION OF THE EMBODIMENTS

[0044] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.

[0045] Many specific details are set forth in the following description in order to provide a thorough understanding of the present invention. However, the present invention can also be implemented in other ways different from those described herein. Therefore, the scope of protection of the present invention is not limited by the specific embodiments disclosed below.

[0046] Exemplary Method:

[0047] As Figure 1 shown, a gas concentration prediction method based on a temporal convolutional network with a temporal attention mechanism includes the following steps:

[0048] S1. Continuously collect sequential concentration data through multi-type gas sensors in a closed environment with a sampling frequency not lower than 100 Hz and a continuous collection time exceeding 12 h to obtain raw data;

[0049] S2. Perform normalization processing on the raw data to eliminate the dimension difference, and divide the continuous sequence into sample segments of a fixed length through a sliding window; divide the processed data into a training set, a test set, and a validation set according to 7:2:1;

[0050] S3. Construct a hybrid model integrating a temporal convolutional network, a gated recurrent unit, and a temporal attention mechanism, use the data processed in S2 to train the model, and adopt a gradient optimization algorithm to iteratively update the parameters of the model until the prediction error converges;

[0051] The model is implemented in the following way:

[0052] The temporal convolutional network adopts a deep network structure with dilated causal convolution to capture the long-term dependence relationship of gas concentration by gradually expanding the receptive field;

[0053] The gated recurrent unit regulates the fusion ratio of historical information and the current input through a gating mechanism to capture the short-term dynamic changes of gas concentration;

[0054] The temporal attention mechanism analyzes the feature correlation at different time points based on the self-attention mechanism and dynamically enhances the weights of key time steps;

[0055] S4. Input the sequential segment of the gas concentration to be measured into the model and output the prediction result.

[0056] Traditional gas concentration prediction models usually adopt a single time series method (such as LSTM or ARIMA), which is difficult to capture both the long-term diffusion effect and the short-term mutation signal at the same time. For example, carbon monoxide (CO) requires long-range dependence modeling due to slow diffusion, while the concentration of ethylene (C2H4) mutates frequently and requires a fast response. The existing technology has insufficient prediction accuracy due to the fixed structure. The above method solves the above problems through a phased feature extraction architecture:

[0057] The temporal convolutional network (TCN) adopts dilated causal convolution to hierarchically expand the receptive field to cover the long-term cumulative effect of CO;

[0058] The gated recurrent unit (GRU) simplifies the gating structure (only the update gate and the reset gate) to reduce the computational complexity and adapt to the fast fluctuation characteristics of ethylene;

[0059] The temporal attention mechanism dynamically allocates weights to strengthen the feature expression at key time points such as the initial stage of mutation.

[0060] Through long - short - term feature separation extraction and dynamic fusion, high - precision prediction of low - concentration gases is achieved, especially suitable for multi - component mixing scenarios.

[0061] Furthermore, the temporal convolutional network includes 4 residual blocks, and each residual block contains the following operations:

[0062] Perform dilated causal convolution operation on the input vector, and the dilation coefficient doubles hierarchically to gradually expand the temporal perception range;

[0063] Non - linearly activate the convolutional output through the Gaussian error linear unit, and the function is defined as:

[0064] GELU(x) = x·Φ(x);

[0065] where x is the input value, and Φ(x) is the cumulative distribution function of the standard Gaussian distribution; the Gaussian error linear unit smooths the activation threshold through the probability distribution and is more suitable for processing the non - linear features of low - concentration gas data compared to ReLU.

[0066] Add the original input and the activated features through residual connection to avoid the degradation of deep network training, and the formula is:

[0067] y out =W d ·X in +F(X in ,W i );

[0068] where X in is the input vector, W i is the convolutional kernel weight matrix in the dilated causal convolution operation, used to perform feature transformation on X in ; W d is the dimension adaptation matrix, F represents the transformation operation of dilated convolution and non - linear activation, protects the original information through the identity mapping (left term), and extracts features by combining non - linear transformation (right term).

[0069] Deep convolutional networks are prone to the problem of vanishing gradients, and it is difficult for fixed dilation coefficients to adapt to the diffusion speed differences of different gases. For example, CO requires a large dilation coefficient to cover the cumulative effect of several hours, while ethylene requires a small coefficient to quickly respond to fluctuations at the minute level.

[0070] The dilation coefficient hierarchy expands the receptive field exponentially to ensure full capture of the long-term characteristics of CO; the residual connection preserves the original information through the identity mapping to avoid deep network degradation; compared with ReLU, the smooth threshold characteristic of GELU is more suitable for the non-linear fitting of low-concentration data, solves the training stability problem of deep TCNs, and adapts to the diffusion kinetic characteristics of different gases.

[0071] Furthermore, the dilation coefficient d is dynamically adjusted according to the autocorrelation of the input sequence, and the formula is:

[0072] d l = d b ·(1 + log(1 + ρ l ));

[0073] where ρ l is the Pearson autocorrelation coefficient (lag 10 steps) of the input sequence at the l-th layer, and d b is the reference dilation coefficient.

[0074] A fixed dilation coefficient cannot adapt to the differences in autocorrelation of different gases. For example, the autocorrelation of the CO sequence is high (ρ > 0.8), while the autocorrelation of the ethylene sequence is low (ρ < 0.3). When the autocorrelation is high, d is increased to expand the receptive field, and vice versa, d is reduced to focus on recent changes, enabling the model to automatically adapt to the diffusion patterns of different gases.

[0075] Furthermore, the output of the dilated causal convolution of the model is calculated as:

[0076]

[0077] where k is the convolution kernel size, fixed at 3, d is the dilation coefficient (1, 2, 4, 8), which controls the stride of the convolution kernel; w k is the convolution kernel weight (k = 1, 2, 3); is the historical input data; the dimension adaptation matrix W d in the residual connection uses a 1×1 convolution to achieve channel alignment when the input and output dimensions are inconsistent.

[0078] The fixed stride of traditional convolution results in the loss of information of distant time steps, while the gas diffusion process (such as the slow penetration of CO) requires covering historical data from dozens of minutes to several hours. The dilated convolution controls the interval of the convolution kernel through the d value. For example, when d = 8, each convolution kernel spans 8 time steps, expanding the receptive field of a single layer to 1 + 2×8 = 17 steps. In addition, when the number of input channels (such as 14) does not match the number of output channels (such as 32), the 1×1 convolution (W d ) adjusts the dimensions to ensure that residual addition is feasible. Through the collaborative design of the dilation coefficient and channel alignment, efficient modeling of long-range dependencies is achieved, especially suitable for predicting the cumulative effects of low-concentration gases.

[0079] Furthermore, the gated recurrent unit is implemented through the following gating mechanism:

[0080] The update gate calculates the retention ratio of the current input to the historical state, and the formula is:

[0081] z t = σ(W z · [h t-1 , x t ) ;

[0082] The reset gate controls the degree of forgetting of historical information, and the formula is:

[0083] r t = σ(W r · [h t-1 , x t ) ;

[0084] Among them, r t is the reset gate, and z t is the update gate; W z , W r are weight matrices, σ is the Sigmoid function, h t-1 is the hidden state at the previous moment, and x t is the current input;

[0085] The candidate state is generated by screening historical information through the reset gate, and the formula is:

[0086]

[0087] The final hidden state is obtained by the update gate fusing the historical and candidate states, and the formula is:

[0088]

[0089] Among them, is the candidate hidden state; h t is the final hidden state; W h is the weight matrix; ⊙ represents element-wise multiplication.

[0090] The LSTM has a slow training speed due to its complex gating structure (input gate, forget gate, output gate), while sudden changes in the concentration of gases such as ethylene require a fast response mechanism. The advantage of the GRU structure is that it only retains the update gate and the reset gate, with the number of parameters reduced by 33%, making it more suitable for scenarios with high real-time requirements. When a sudden change in ethylene concentration is detected (such as a slope change > 5% / second), the reset gate quickly reduces the historical weight and gives priority to responding to the current input. By simplifying the gating structure and dynamic response, the real-time performance of the model is improved while ensuring accuracy, adapting to the needs of rapid monitoring.

[0091] Furthermore, the gated recurrent unit is extended to a dual-time-scale architecture, including a fast GRU and a slow GRU. The fast GRU captures instantaneous changes at a 1-minute step, and the slow GRU extracts trend features at a 5-minute step. The final state fusion formula is:

[0092] h = βh1 + (1 - β)h2;

[0093] where β is the dynamic weight, generated by sigmoid; h1 is the output of the GRU at a 1-minute step; h2 is the output of the GRU at a 5-minute step.

[0094] A single-time-scale GRU is difficult to simultaneously respond to the second-level mutation of ethylene and the minute-level trend of CO. The fast GRU matches the fast fluctuation period of ethylene (30 seconds to 2 minutes) at a 1-minute step, and the slow GRU is designed to smooth the noise at a 5-minute step and extract the cumulative trend of CO. When the detected input slope exceeds the threshold, the output of the fast GRU is preferentially adopted. Through multi-scale gated fusion, both transient response and steady-state prediction are considered, adapting to the monitoring of multi-component mixed gases.

[0095] Furthermore, the time attention mechanism is implemented through the following steps:

[0096] Map the input sequence to query vector Q, key vector K, and value vector V;

[0097] Calculate the similarity matrix between the query vector and the key vector, and generate attention weights through scaled dot product. The formula is:

[0098]

[0099] where Q = X P W Q ; K = X P W K ; V = X P W V ; X P is the input data after position encoding; W Q 、W K and W V are weight matrices; d k is the dimension of the key vector, used to scale the gradient; the Softmax activation function is used to normalize the attention weights into a probability distribution, ensuring that the sum of the weights at all time points is 1. The specific formula is:

[0100]

[0101] where z i is the i-th element of the input vector, and N is the vector dimension;

[0102] Weight the weight matrix and the value vector for summation to strengthen the feature expression of highly correlated time points.

[0103] Uniform attention allocation tends to overlook key time points, while low-concentration gas signals are often masked by noise. The time attention mechanism is adopted. When it is detected that the CO concentration is continuously rising, the attention weight automatically enhances the initial time steps.

[0104] Furthermore, the method extracts gas concentration data segments from the past 30 - 90 minutes as the model input through a sliding window to detect the gas concentration value at the current moment in real time. Traditional gas detectors rely on instantaneous sensor readings, are susceptible to noise interference and cause false alarms, and cannot predict the concentration change trend. By inputting the historical data segments of the past 30 / 60 / 90 minutes, the model output is the concentration estimation value at the current moment. Long-term features are extracted through a temporal convolutional network, and GRU is combined to capture instantaneous fluctuations, enhancing the detection accuracy at the current moment.

[0105] Furthermore, the normalization process uses min-max normalization, and the formula is:

[0106]

[0107] where, x min and x max are the minimum and maximum values of the original data column respectively, and the mapping interval is [-1, 1].

[0108] For different gases (such as the CO range is 0 - 50 ppm, and the ethylene range is 0 - 200 ppm), calculate the normalization parameters for each column independently and linearly map them to the [-1, 1] interval to eliminate the dimensional differences of the sensors.

[0109] Furthermore, the Adam optimization algorithm is used during the training process of the hybrid model, and the learning rate decays according to an exponential law:

[0110] lr t = lr0 × 0.98 peoch ;

[0111] where, lr0 is the initial learning rate, and epoch is the current training round;

[0112] During the model training process, five-fold cross-validation is used to optimize the hyperparameters, and the loss function is the mean squared error. Five-fold cross-validation divides the dataset into 5 subsets, alternately uses 4 subsets for training and 1 subset for validation, and repeats 5 times to take the average performance to ensure the stable performance of the model under complex working conditions.

[0113] Furthermore, use model metrics to evaluate the model performance. The model metrics include:

[0114] Coefficient of determination, which reflects the goodness of fit between the predicted value and the true value. The calculation formula is:

[0115]

[0116] The mean absolute percentage error, which quantifies the relative magnitude of the prediction error, is calculated as follows:

[0117]

[0118] The relative root mean square error, which comprehensively evaluates the prediction stability, is calculated as follows:

[0119]

[0120] where n is the number of samples, y i is the true value, is the predicted value, is the mean of the true values.

[0121] The coefficient of determination measures the goodness of fit between the prediction trend and the true values and is applicable to evaluating the long-term cumulative effect of CO; MAPE quantifies the relative error and pays more attention to the prediction accuracy in the low-concentration range; RRSE comprehensively evaluates the stability, prevents the interference of outliers, and comprehensively reflects the performance differences of the model in different concentration ranges through a multi-dimensional evaluation system.

[0122] Experimental Example 1

[0123] (1) Experimental Equipment and Gas Configuration

[0124] The experimental equipment is shown in the following table:

[0125] Table 1 Experimental Equipment

[0126] Equipment / Materials Parameter Requirements Gas Mixing Chamber Volume 60mL, temperature and humidity controllable (25±1°C, 50±5%RH) Mass Flow Controller (MFC) Accuracy ±1%F.S., flow range 0 - 100mL / min Sensor Array 4 each of FigaroTGS2600, TGS2602, TGS2610, TGS2620 Data Acquisition System Sampling frequency 100Hz

[0127] The gas concentration gradient is shown in the following table:

[0128] Table 2 Gas Concentration Gradient

[0129]

[0130]

[0131] (2) Experimental Procedures

[0132] Step 1: Data Acquisition

[0133] Introduce the mixed gas according to the above concentration ratio, and each concentration lasts for 12 h. The total data volume is about 1 million samples (100 Hz × 12 h);

[0134] Simultaneously record the output voltage of the sensor (powered by 5 V) and the ambient temperature and humidity (for later data calibration).

[0135] Step 2: Data Preprocessing

[0136] The window lengths are [1800, 3600, 5400], and the step sizes are [60, 120, 180]; normalize independently to the [-1, 1] interval according to the sensor type; divide into training set, test set, and validation set in the ratio of 7:2:1.

[0137] Step 3: Model Training and Comparison

[0138] As shown in Table 3:

[0139] Table 3 Model Training and Comparison

[0140] Model Key Parameters Training Data AGT-TCN TCN expansion factor [1, 2, 4, 8], GRU hidden layer 64, attention heads 4 70% dataset LSTM Hidden layer 128, bidirectional structure Same as AGT-TCN TCN Expansion factor [1, 2, 4, 8, 16], 5 layers of residual blocks Same as AGT-TCN CNN-LSTM CNN kernel size 3, LSTM hidden layer 64 Same as AGT-TCN

[0141] Among them, the batch size is 128, the number of epochs is 100, and the learning rate is 0.01.

[0142] Step 4: Real-time Detection Test

[0143] Input the historical data of the previous 30 / 60 / 90 minutes and output the concentration value at the current moment.

[0144] (3) Result Analysis Method

[0145] As shown in Table 4:

[0146] Table 4 Model Performance Evaluation Metrics

[0147]

[0148]

[0149] Obtain the accurate evaluation results of each model based on 30min / 60min / 90min windows. As Figures 2 - 4 shown, the abscissa in the figure represents the model, and the ordinate represents the index value. It can be seen that the AGT-TCN model shows significant advantages in R2, MAPE, and RRSE. This is because:

[0150] By introducing an adaptive global time attention mechanism, AGT-TCN can dynamically capture long-term dependencies in time series, while traditional models such as TCN, GRU, LSTM, etc. only rely on local or fixed-time window modeling. This mechanism significantly improves the model's ability to recognize complex time patterns, resulting in better performance in R2 (coefficient of determination), indicating that the model has stronger interpretability for data. Compared with single-architecture models (LSTM or TCN), AGT-TCN combines the efficient local feature extraction ability of the temporal convolutional network (TCN) and the global modeling advantages of the attention mechanism, achieving the fusion of multi-scale features. This makes the model more stable in MAPE and RRSE and has higher prediction accuracy. Traditional models such as CNN-LSTM or LSTM-Transformer may suffer from information loss due to fixed weight allocation during feature fusion. AGT-TCN more effectively handles the impact of noise and outliers by dynamically adjusting the attention weights at different time steps, so the deviation between its prediction curve and the actual value is significantly smaller than that of other models.

[0151] It should be noted that gas concentration changes are characterized by high noise, non-stationarity, and multi-scale dependencies. Although traditional GRU can capture short-term dependencies, its ability to model long-term trends and sudden changes is limited. By introducing an adaptive time attention mechanism, AGT-TCN dynamically allocates weights at different time steps, enhancing the joint modeling ability for slow accumulation (long-term dependence) and sudden peaks (short-term mutations) of gas concentration; through multi-level feature extraction, local convolutional modules are embedded in the hidden layer of GRU to separate noise from effective signals and improve the signal-to-noise ratio.

[0152] Furthermore, the long sequence of gas data is likely to cause the problem of gradient vanishing or explosion in GRU. AGT-TCN introduces cross-layer residual connections in the update gate of GRU through residual gating to alleviate the problem of gradient decay and ensure the stability of long sequence training; and adaptively adjusts the parameter update step size according to the severity of gas concentration changes to avoid the model converging to a local optimum.

[0153] Compared with other models, AGT-TCN can capture the long-term and short-term dependencies of gas concentration when dealing with longer time series, obtain richer information, and significantly improve the robustness and interpretability of gas concentration prediction, especially suitable for high-dynamic gas monitoring tasks in complex environments (industrial emissions, confined spaces).

[0154] Based on the inspiration of the ideal embodiments of the present invention above, through the above description, relevant personnel can make various changes and modifications without departing from the technical idea of the present invention. The technical scope of the present invention is not limited to the content in the specification, and must be determined according to the scope of the claims.

Claims

1. A gas concentration prediction method based on a temporal convolutional network with a temporal attention mechanism, characterized in that, Including the following steps: S1. Continuously collect the time-series concentration data of the gas in a closed environment to obtain the original data; S2. Preprocess the original data and divide the continuous sequence into sample segments of a fixed length; S3. Construct a hybrid model integrating a temporal convolutional network, a gated recurrent unit, and a temporal attention mechanism, and use the data processed in S2 to train the model; the hybrid model is implemented in the following way: The temporal convolutional network adopts a deep network structure with dilated causal convolutions to capture the long-term dependencies of the gas concentration by gradually expanding the receptive field; The gated recurrent unit regulates the fusion ratio of historical information and the current input through a gating mechanism to capture the short-term dynamic changes of the gas concentration; The temporal attention mechanism analyzes the feature correlations at different time points based on the self-attention mechanism and dynamically enhances the weights of the key time steps; S4. Input the time-series segment of the gas concentration to be measured into the trained model and output the prediction result.

2. The method according to claim 1, characterized in that The temporal convolutional network includes multiple layers of residual blocks, and each layer of residual block contains the following operations: Perform dilated causal convolution operations on the input vector, and the dilation coefficient doubles hierarchically to gradually expand the time perception range; Nonlinearly activate the convolution output through the Gaussian error linear unit, and the function is defined as: GELU(x) = x·Φ(x); where x is the input value and Φ(x) is the cumulative distribution function of the standard Gaussian distribution; The original input is added to the activated features through a residual connection to avoid the degradation of deep network training. The formula is: y out = W d · X in + F(X in , W i ); where X in is the input vector, W i is the convolutional kernel weight matrix in the dilated causal convolution operation, which is used to perform feature transformation on X in ; W d is the dimension adaptation matrix, and F represents the transformation operation of dilated convolution and non-linear activation.

3. The method according to claim 2, characterized in that, The dilated causal convolution output of the said model is calculated as follows: k is the convolution kernel size, d is the dilation coefficient, which controls the stride of the convolution kernel; w k is the convolution kernel weight; is the historical input data; the dimension adaptation matrix W in the residual connection d uses a 1×1 convolution to achieve channel alignment when the input and output dimensions are inconsistent.

4. The method according to claim 1, characterized in that The gated recurrent unit is implemented through the following gating mechanism: The update gate calculates the retention ratio of the current input to the historical state, and the formula is: z t = σ(W z ·[h t-1 , x t ); Reset the forgetting degree of the door control history information, with the formula: r t = σ(W r · [h t-1 , x t ); where r t is the reset gate, z t is the update gate; W z and W r are weight matrices, σ is the Sigmoid function, h t-1 is the previous hidden state, and x t is the current input; The candidate state is generated after filtering historical information through a reset gate, and the formula is: The final hidden state is fused with the historical and candidate states by the update gate, and the formula is: Among them, is the candidate hidden state; h t is the final hidden state; W h is the weight matrix; ⊙ represents element-wise multiplication.

5. The method according to claim 1, wherein The temporal attention mechanism is implemented through the following steps: Map the input sequence to query vector Q, key vector K, and value vector V; Calculate the similarity matrix between the query vector and the key vector, and generate attention weights through scaled dot product. The formula is as follows: where Q = X P W Q ; K = X P W K ; V = X P W V ; X P is the input data after position encoding; W Q , W K and W V are weight matrices; d k is the dimension of the key vector, used to scale the gradient; the Softmax activation function is used to normalize the attention weights into a probability distribution, ensuring that the sum of the weights at all time points is 1. The specific formula is as follows: where z i is the i-th element of the input vector, and N is the vector dimension; Weighted sum the weight matrix and the value vector to strengthen the feature expression of the highly correlated time points.

6. The method according to claim 1, characterized in that, The method extracts the gas concentration data segment of the past 30 - 90 minutes as the model input through a sliding window to detect the gas concentration value at the current moment in real time.

7. The method according to claim 1, wherein The preprocessing includes normalization processing, adopting the maximum-minimum normalization, and the formula is: where x min and x max are respectively the minimum value and the maximum value of the original data column, and the mapping interval is [-1, 1].

8. The method according to claim 1, wherein During the training process of the hybrid model, the Adam optimization algorithm is used, and the learning rate decays according to an exponential law: lr t = lr0 × 0.98 peoch ; where lr0 is the initial learning rate, epoch is the current training round; five-fold cross-validation is used to optimize hyperparameters; the loss function is the mean squared error.

9. The method according to claim 2, wherein The expansion coefficient d is dynamically adjusted according to the autocorrelation of the input sequence, and the formula is d l = d b ·(1 + log(1 + ρ l )); where ρ l is the Pearson autocorrelation coefficient of the input sequence of the l-th layer, and d b is the reference expansion coefficient.

10. The method according to claim 4, characterized in that The gated recurrent unit is extended to a dual-time-scale architecture, including a fast GRU and a slow GRU. The fast GRU captures the instantaneous changes at a 1-minute step, and the slow GRU extracts the trend features at a 5-minute step. The final state fusion formula is: h = βh1+(1-β)h2; where β is the dynamic weight generated by sigmoid; h1 is the output of the GRU at a 1-minute step; h2 is the output of the GRU at a 5-minute step.

Citation Information

Cited By

  • Time series data monitoring method and device, electronic equipment and nonvolatile storage medium

    CN116821661A

  • Time series data monitoring method and device, electronic equipment and nonvolatile storage medium

    CN116821661B

  • Prediction method for monitoring residual life of integrated solar street lamp

    CN120847664A

  • Urban environment quality monitoring method based on deep learning

    CN121188743A

  • Fusion casting furnace data interpolation method fusing time sequence convolutional network and self-attention mechanism

    CN121327349A