Gas detection method, device, program product and medium with intelligently improved accuracy
Through the combination of time series prediction model and pattern recognition model, the output deviation of gas detection equipment is dynamically evaluated and corrected, which solves the problem of reduced accuracy of gas detection equipment and achieves high-precision real-time detection and prediction.
Patent Information
- Application Number
- CN202411036684.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-31
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2044-07-31
AI Technical Summary
The accuracy of existing gas detection equipment gradually decreases as the sensor usage time increases, and it is difficult to accurately evaluate and correct the output deviation of the gas detection equipment, resulting in an increase in detection errors.
Using a combination of time series prediction model and pattern recognition model, through data preprocessing, error assessment optimization model and feature extraction, the output deviation of gas detection equipment is dynamically evaluated and corrected, and the model is periodically optimized to reduce the impact of sensor drift and achieve high-precision real-time measurement of gas concentration. detection and prediction.
It effectively solves the problem of reduced accuracy of gas detection equipment, achieves high-precision real-time detection and prediction of gas concentration, and improves detection accuracy and reliability.
Smart Images

Figure CN118566443B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer systems based on specific computing models, and in particular to gas detection methods, devices, program products and media that intelligently improve accuracy. Background Art
[0002] With the development of industrial modernization, the demand for gas leak detection in industrial production processes is growing. Timely and accurate detection of the concentration of harmful or combustible gases is essential to ensure worker safety, avoid property loss and environmental pollution. Therefore, the development of efficient and reliable gas detection equipment has always been a focus of attention in the industrial field.
[0003] Existing gas detection equipment generally uses electrochemical sensors or catalytic combustion sensors to detect gas concentration. These sensors convert gas concentration into electrical signal output, and then determine the gas type and concentration through signal processing and pattern recognition. In practical applications, gas detection equipment usually needs to periodically calibrate the sensor with standard gas to ensure detection accuracy.
[0004] However, the accuracy of existing gas detection equipment will gradually decrease as the sensor is used for a longer time. This is mainly due to the drift and aging defects of the sensor itself. Changes in ambient temperature, humidity and other factors will also affect the sensor characteristics, resulting in increased detection errors. In addition, due to the complex composition of the gas, there may be cross-interference between different gases, and a single sensor is difficult to accurately distinguish. Frequent calibration not only increases maintenance costs, but also cannot fundamentally solve the problem of sensor performance degradation. Summary of the invention
[0005] The present application provides a gas detection method, device, program product and medium for intelligently improving accuracy, which are used to alleviate the defect of reduced detection accuracy caused by sensor drift in gas detection equipment and achieve high-precision real-time detection and prediction of gas concentration.
[0006] In the first aspect, the present application provides a gas detection method for intelligently improving accuracy, which is applied to a gas detection device, wherein the gas detection device includes a host computer and a slave computer, wherein the slave computer includes multiple gas sensors and environmental detection sensors, and the method includes: the slave computer periodically sends the raw data collected by the multiple gas sensors and the environmental detection sensors to the host computer, and the host computer performs data preprocessing on the raw data to obtain preprocessed collected data; at a first moment, the host computer inputs the preprocessed collected data at the first moment into a trained time series prediction model to obtain predicted sensor sampling values corresponding to multiple future sampling moments after the first moment, as the time series prediction output for the first moment; the first moment is a sampling moment; the host computer combines the preprocessed collected data before the first moment and the time series prediction output of the first moment to perform feature extraction to obtain the preprocessed feature data for the first moment; the host computer uses an error evaluation optimization model to compare the first moment and the time series prediction output. The preprocessed acquisition data at the previous moment and the timing prediction output at the corresponding moment are used to obtain the current pattern recognition output deviation vector value and the current sensor working time characteristic vector; the host computer inputs the preprocessed characteristic data at the first moment and the current sensor working time characteristic vector into the trained pattern recognition model to obtain an initial pattern recognition output; the initial pattern recognition output includes the gas detection concentration values at the first moment and the multiple future sampling moments; the host computer uses the current pattern recognition output deviation vector value to correct the initial pattern recognition output to obtain the current final pattern recognition output; the current final pattern recognition output includes the updated gas detection concentration values at the first moment and the multiple future sampling moments; when the current pattern recognition output deviation vector value at the first moment accumulates and exceeds the preset threshold, the timing prediction model is optimized and trained using the preprocessed acquisition data at the first moment and the previous moments to obtain a timing prediction model for the next sampling moment.
[0007] By adopting the above technical solution, the gas detection device periodically sends the raw data to the host computer for preprocessing, obtains the predicted sensor sampling value at the future sampling time through the time series prediction model, and then combines the historical data for feature extraction and input into the pattern recognition model to obtain the initial gas detection concentration value. At the same time, the host computer uses the error evaluation optimization model to compare the historical data with the predicted output, obtains the pattern recognition output deviation vector value to correct the initial output, and when the cumulative deviation value of the pattern recognition output exceeds the threshold, the historical data is used to optimize the time series prediction model. Through the above steps, this method can dynamically evaluate and correct the output deviation of the gas detection equipment, continuously optimize the prediction and recognition model, reduce the accuracy reduction problem caused by sensor drift, and achieve high-precision real-time detection and prediction of gas concentration.
[0008] In some embodiments, the host computer first calculates error statistics such as average error, root mean square error, error variance, and average differential value of error based on historical collected data and predicted output data using preset parameter calculation formulas to comprehensively characterize the deviation characteristics between the actual output and the predicted output. Then, these error statistics are converted into pattern recognition output deviation vector values using the deviation calculation formula to quantitatively characterize the prediction error size of the time series prediction model. At the same time, the host computer also calculates the sensor working time characteristic vector using the time calculation formula based on the sensor working time, capturing the dynamic characteristics changes of the gas sensor during long-term operation. By finely characterizing the output deviation characteristics and changes in the working state of the sensor, a reliable basis is provided for subsequent deviation correction and model optimization training, which can more accurately evaluate and correct the output results of the gas detection equipment and improve the accuracy of gas concentration detection.
[0009] In some embodiments, the deviation calculation formula comprehensively considers factors such as model coefficients, sensor coefficients, multiple error statistics, and deviation compensation values, and can accurately calculate the pattern recognition output deviation of each output task. Among them, the model coefficients and sensor coefficients reflect the characteristics of different tasks and sensors, which help to distinguish the deviation characteristics of different tasks and sensors; multiple error statistics characterize the statistical laws of output deviations from different aspects; and the deviation compensation value further corrects the deviation calculation results. In addition, the duration calculation formula cleverly uses parameters such as cumulative working time, equipment startup record time, number of training iterations, and sensor life constant to reasonably describe the attenuation, adjustment, and recovery characteristics of each sensor over time. By constructing a sophisticated and reasonable calculation formula, this method can more accurately evaluate the output deviation of gas detection equipment and changes in sensor working conditions, laying the foundation for optimizing detection results.
[0010] In some embodiments, based on the standard BiLSTM time series prediction model, the input layer adds a one-dimensional CNN layer in the time domain direction, which can automatically extract local features of time series data, mine feature information on different time scales, and enhance the model's ability to characterize the changing trend of time series. At the same time, the output layer adds a one-dimensional Convolutional Self-Attention mechanism in the time domain direction, giving the model the ability to adaptively adjust feature weights according to task objectives, making the prediction results more accurate and reliable. In addition, the introduction of CNN layers and attention mechanisms also expands the receptive field of the model and enhances the model's ability to process long time series. By improving the BiLSTM model structure and making full use of spatiotemporal features, the time series prediction model can better capture the dynamic changes of gas sensor data, improve the prediction accuracy of future sensor sampling values, and provide high-quality input for subsequent pattern recognition and bias correction.
[0011] In some embodiments, the pattern recognition model uses a support vector machine regression model. During the construction process, the correlation and weight between features in the feature set are first calculated to reveal the importance and internal connection of the features; then the features are randomly combined according to the feature weights for model training and evaluation, and the best feature combination is found through repeated trial and error to obtain the feature subset with the best performance; finally, the final feature combination is used to establish a pattern recognition model, and the sparrow search algorithm is used to optimize the model parameters to further improve the model performance. Through systematic feature analysis and selection, and using advanced optimization algorithms to adjust parameters, the pattern recognition model can construct an accurate regression decision function in the optimal feature subspace, efficiently and accurately identify gas types and concentrations, and provide reliable guarantees for the intelligent correction of gas detection results.
[0012] In some embodiments, the final feature combination includes multiple sliding pane statistics of the sensor response sequence, including integral values, differential values, average differential values, and maximum values. These statistics characterize the dynamic characteristics of the sensor response sequence from different angles, such as the cumulative change, instantaneous change rate, average change speed, and peak level, and comprehensively reflect the change information of gas composition and concentration. At the same time, the response values at two preset moments in the sliding pane are selected as features to capture the instantaneous response characteristics at different time points. In addition, the characteristic vector of the sensor working time is also included in the feature combination, taking into account the impact of the dynamic working state of the sensor on the detection results. By selecting information-rich and complementary multi-domain features, the pattern recognition model can characterize the key characteristics of the gas detection process from multiple angles such as the time domain and the working state domain, providing a solid foundation for the accurate identification of gas types and concentrations.
[0013] In some embodiments, the host computer first performs Kalman filtering on the original collected data, uses the Kalman filter to recursively estimate the state of the data, and dynamically adjusts the Kalman gain according to the estimated error, which can remove high-frequency noise and external interference in the data online, and achieve a smooth and reliable noise suppression effect. Then, the host computer performs Savitzky-Golay polynomial smoothing on the data after Kalman filtering, and smoothes the data by local polynomial regression fitting, while retaining the data trend characteristics. Remove random noise and further improve data quality. Through the cascade preprocessing of Kalman filtering and Savitzky-Golay smoothing, this method can give full play to the advantages of the two filtering algorithms, purify the gas sensor collected data from the two dimensions of time domain and amplitude domain, provide high-quality input for subsequent feature extraction, time series prediction and pattern recognition, and improve the overall accuracy and reliability of gas detection.
[0014] In a second aspect, the present application provides a gas detection device, which includes: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the gas detection device to perform the method described in the first aspect and any possible implementation method of the first aspect.
[0015] In a third aspect, the present application provides a computer program product comprising instructions, which, when executed on a gas detection device, enables the gas detection device to execute the method described in the first aspect and any possible implementation manner of the first aspect.
[0016] In a fourth aspect, the present application provides a computer-readable storage medium comprising instructions, which, when executed on a gas detection device, causes the gas detection device to execute the method described in the first aspect and any possible implementation of the first aspect.
[0017] One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages:
[0018] 1. By adopting technical means such as inputting preprocessed data into the time series prediction model and pattern recognition model, and using the error evaluation optimization model to perform deviation correction and model optimization on the output results, the technical problem that the accuracy of existing gas detection equipment gradually decreases with the increase of sensor usage time is effectively solved, thereby achieving the technical effect of high-precision real-time detection and prediction of gas concentration.
[0019] 2. Due to the use of innovative formula design technical means such as using the deviation calculation formula to convert error statistics into pattern recognition output deviation vector values, and using the duration calculation formula to calculate the sensor working duration characteristic vector, the technical problem of difficulty in accurately evaluating the output deviation of gas detection equipment and changes in sensor working conditions has been effectively solved, thereby achieving a more accurate evaluation and correction of gas detection equipment output results and improving the technical effect of gas concentration detection accuracy.
[0020] 3. Due to the use of innovative network structure design technologies such as the one-dimensional CNN layer and Convolutional Self-Attention mechanism that integrate the time domain direction in the BiLSTM model, the technical problem that the standard BiLSTM model is difficult to fully explore the spatiotemporal characteristics of gas sensor data and process long time series is effectively solved, thereby achieving a significant improvement in the prediction accuracy of future sensor sampling values and providing high-quality input for subsequent pattern recognition and bias correction. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 It is an exemplary data flow diagram of a gas detection method for intelligently improving accuracy in an embodiment of the present application;
[0022] Figure 2 It is a flow chart of a gas detection method for intelligently improving accuracy in an embodiment of the present application;
[0023] Figure 3 It is an exemplary data flow diagram of the improved BiLSTM time series prediction model in the embodiment of the present application;
[0024] Figure 4 is a schematic diagram of an exemplary connection relationship of system components for obtaining training data in an embodiment of the present application;
[0025] Figure 5 is an exemplary flow chart of feature selection and pattern recognition model optimization in the embodiments of the present application;
[0026] Figure 6 It is a flow chart of optimizing SVR using ISSA in the embodiment of the present application;
[0027] Figure 7 It is another flow chart of the gas detection method for intelligently improving accuracy in the embodiment of the present application;
[0028] Figure 8 It is a structural diagram of the host computer in the gas detection device in the embodiment of the present application. DETAILED DESCRIPTION
[0029] During the production and actual detection process of some gas detection equipment, the performance of gas sensors often changes over time. Thermal conductivity sensors, metal semiconductor oxide sensors, electrochemical sensors, etc. may have obvious temperature drift, zero drift and dynamic error changes caused by aging, which brings difficulties to real-time gas detection. In addition, due to the differences in batch and individual performance of gas sensors, the production and use costs are also increased during production calibration and later maintenance. Therefore, how to build a model system that can adapt to the dynamic error changes of sensors has become the key to improving the real-time detection accuracy of gas detection equipment.
[0030] In the specific implementation process, the dynamic error change characteristics of different types of gas sensors are different. For example, electrochemical sensors, thermal conductivity sensors, and metal oxide semiconductor sensors will have obvious error changes with the use time and environmental changes; while infrared gas sensors and ultraviolet light ionization sensors may produce detection errors due to long-term lack of cleaning or light source loss.
[0031] The intelligent gas detection method for improving accuracy provided in the embodiments of the present application can greatly improve the detection accuracy after long-term use.
[0032] Combine the following Figure 1 The exemplary data flow diagram shown and Figure 2 A flow chart of a method for intelligently improving the accuracy of gas detection in an embodiment of the present application is shown, and an exemplary description of the method for intelligently improving the accuracy of gas detection in an embodiment of the present application is given:
[0033] The gas detection equipment includes a host computer and a slave computer:
[0034] Assume that after the device is turned on at time A0, there are three moments A1, A2, and A3 on the timeline with equal duration intervals (equal to the preset predicted duration), and there are other moments between these three moments.
[0035] S201, the lower computer controls the periodic collection of raw data of the sensor and then sends it to the upper computer;
[0036] S202, the host computer performs data preprocessing on the original data to obtain preprocessed collected data;
[0037] S203, at time A2, the pre-processed collected data at time A2 is sent to the time series prediction model to obtain the time series prediction output from time A2 to A3;
[0038] S204, based on the preprocessed collected data within the first preset time before time A2 and the time series prediction output from time A2 to A3, extract the preprocessed feature data by setting a sliding pane;
[0039] S205, using the error evaluation optimization model to compare and analyze the preprocessed collected data and the time series prediction output at the time A2 and the second preset time period before, to obtain the current pattern recognition output deviation vector value B and the current sensor working time feature vector C;
[0040] S206, sending the preprocessing characteristic data and the characteristic vector C of the working time of the sensor to the pattern recognition model to obtain an initial pattern recognition output; the initial pattern recognition output includes the detected concentration values of each gas at time A2 and the predicted concentration values of each gas between time A2 and A3;
[0041] S207, using the current pattern recognition output deviation vector B to correct the initial pattern recognition output to obtain the current final pattern recognition output;
[0042] S208. When the accumulation of the deviation vector output by the current pattern recognition exceeds a preset threshold, all preprocessed collected data before time A2 are used to optimize the time series prediction model.
[0043] In some embodiments, the data preprocessing in step S202 may specifically be: performing a mixed filtering of Kalman filtering and Savitzky-Golay filtering on the multi-channel detection data of the sensor (ie, the original data of the sensor) to obtain multi-channel real-time filtered data as the preprocessed acquisition data. Specifically:
[0044] First, Kalman filtering can be performed on the multi-channel detection data of the sensor to obtain Kalman filtering data;
[0045] Kalman filtering is like an intelligent data cleaner. Its task is to remove noise from the raw data and leave the real signal. It works in two steps:
[0046] 1. Prediction: It will guess what the true value at the current moment might be based on the optimal estimate at the previous moment and the control amount at the current moment, as the predicted value.
[0047] 2. Update: When it gets the actual measurement value at the current moment, it will compare the predicted value with the measured value to see how big the error is. Then it will correct the predicted value based on the error to get the best estimate at the current moment.
[0048] This best estimate combines the results of predictions and measurements and is more accurate than either prediction or measurement alone.
[0049] Second, the Kalman filter data is then smoothed using Savitzky-Golay filtering.
[0050] Savitzky-Golay filtering, also known as polynomial smoothing filtering, is a data smoothing technique. Its basic idea is to perform polynomial fitting on the data points in a moving window, and then replace the data points in the center of the window with the fitted polynomial function value. By processing the entire data sequence with a moving window, a smooth data sequence can be obtained.
[0051] Since Kalman filtering is a recursive estimation method, it updates the state estimate based on the measured value at each time step. Although Kalman filtering can effectively suppress measurement noise, its output may still contain some high-frequency fluctuations. Savitzky-Golay filtering can further smooth the output of Kalman filtering. By performing polynomial fitting on the Kalman filtering results, the residual high-frequency fluctuations can be removed to obtain a smoother data curve. And Savitzky-Golay filtering can better maintain the characteristics of the data, so while smoothing, it will not significantly change the trend and characteristics of the Kalman filtering results.
[0052] In the embodiment of the present application, applying Savitzky-Golay filtering to the output of Kalman filtering can further improve the smoothness of the data while maintaining the main features of the data. This hybrid filtering method combines the noise suppression ability of Kalman filtering and the smoothing ability of Savitzky-Golay filtering, and can obtain a higher quality data sequence, providing a better basis for subsequent analysis and application.
[0053] In some embodiments, the time series prediction model in step S203 can be an improved BiLSTM time series prediction model. Specifically, a one-dimensional CNN layer in the time domain direction can be added to the input layer of the standard BiLSTM time series prediction model, and the input data can be convolved, pooled, and node expanded in sequence, and input to the BiLSTM layer; and a one-dimensional Convolutional Self-Attention mechanism in the time domain direction can be added to the output layer of the standard BiLSTM time series prediction model to improve the time series prediction effect.
[0054] The standard BiLSTM (Bidirectional Long Short-Term Memory) is a commonly used time series prediction model. It uses a bidirectional LSTM layer to capture long-term dependencies in time series data to predict future time steps. However, the standard BiLSTM model may have some limitations when processing sensor signals, such as sensitivity to noise and outliers, and insufficient generalization ability.
[0055] Add a one-dimensional convolutional neural network (CNN) layer in the time domain to the input layer of the BiLSTM model. CNN is good at extracting local features and can effectively capture local patterns in time series data. Through convolution, pooling, and node expansion operations, the CNN layer can transform the original time series data into a more abstract and robust feature representation, which is then input into the BiLSTM layer for further processing. Add a one-dimensional convolutional self-attention mechanism in the time domain to the output layer of the BiLSTM model. The attention mechanism can help the model adaptively focus on the key parts of the time series and improve the accuracy of the prediction. Through the one-dimensional convolutional self-attention mechanism, the model can dynamically adjust the weights of different time steps in the time dimension to better capture the time dependency. The improved BiLSTM time series prediction model improves the stability and accuracy of the prediction.
[0056] like Figure 3As shown, it is an exemplary data flow diagram of the improved BiLSTM time series prediction model in the embodiment of the present application. First, the pre-processed collected data after data pre-processing of each sensor data is received as input, and then the data is passed to the one-dimensional CNN layer for convolution operation to extract local features. Then, the convolved features are downsampled through the pooling layer to reduce the spatial dimension of the data. The output of the pooling layer will undergo a dimensionality reduction and expansion operation to convert the two-dimensional feature map into a one-dimensional feature vector to adapt to the input format of the subsequent BiLSTM layer. Then, the extracted features are sent to the multi-layer BiLSTM for forward and backward sequence learning to capture the long-term dependencies in the time series. The output of the BiLSTM is then passed through a one-dimensional Convolutional Self-Attention attention mechanism layer to adaptively adjust the weights of different time steps, highlight key information to obtain prediction output, and generate prediction results corresponding to future time steps.
[0057] In some embodiments, the preprocessing feature data is extracted in step S204. Specifically, the extracted features may include the sliding pane integral value, sliding pane differential value, sliding pane average differential value, sliding pane maximum value, sliding pane T value, and sliding pane T value of each sensor response sequence. A S.T. 实时 S is the response value at two moments.
[0058] The calculation formula of the sliding pane integral value can be:
[0059] ;
[0060] Where T is the acquisition time of the sensor in the sliding window; x i is the response value at the i-th second; Δt is the time interval between two adjacent sampling points.
[0061] The calculation formula of the sliding pane difference value can be:
[0062] ;
[0063] Where, X max is the maximum response value in the sliding pane; X min The minimum response value within the sliding pane.
[0064] The calculation formula of the average differential value of the sliding pane can be:
[0065] ;
[0066] Where T is the acquisition time of the sensor on the sliding window pane; X i is the response value at the i-th second; Δt is the interval between two adjacent sampling points.
[0067] Among them, the sliding pane T A S is a preset position in the middle of the curve, and the sliding window T 实时 Time S is the current time.
[0068] After extracting each feature, you can first normalize each feature before performing subsequent operations. The normalization formula can be:
[0069] ;
[0070] In the formula, is the original data eigenvalue; is the minimum value of the original feature; is the maximum value of the original feature.
[0071] In some embodiments, the lower computer includes a gas sensor array, an environmental detection sensor group, a gas collection control device, and a lower computer main controller. The lower computer main controller can realize the gas flow process control of the collection end. The lower computer main controller can collect the real-time detection signals of the gas sensor array and the detection environment sensor group, and transmit the multi-channel detection data of the sensor to the upper computer.
[0072] In some embodiments, the sensor multi-channel detection data may include detecting the temperature and humidity inside and outside the air chamber, the air pressure inside the air chamber, the air flow rate, the air pressure outside the air chamber, the power supply voltage, the multi-sensor AD sequence, the equipment working time, etc., which are not limited here.
[0073] The time series prediction model and pattern recognition model involved in the method are all trained in advance using training data. The collection of training data can simulate the acquisition and marking of the actual use status of gas detection equipment.
[0074] like Figure 4 As shown, it is a schematic diagram of an exemplary connection relationship of the system components for obtaining training data in an embodiment of the present application. The solid line is the gas path, and the dotted line is the circuit. The system includes zero gas and multiple standard gases (standard gas 1 to standard gas n), which are connected to the gas distribution system through the gas path. The gas distribution system receives zero gas and standard gas and outputs them to the gas chamber. The gas chamber contains a temperature and humidity sensor, a pressure sensor, and a gas sensor, which receives gas from the gas distribution system and outputs the gas to the filter. The filter filters the gas. The temperature and humidity sensor monitors the temperature and humidity data in the gas distribution system and the gas chamber, and the pressure sensor monitors the pressure data in the gas chamber and is connected to the lower computer through the circuit. The gas sensor detects the gas composition, the lower computer receives data from the pressure sensor and the temperature and humidity sensor, and is connected to the upper computer through the circuit, and the upper computer receives the data processed by the lower computer.
[0075] In some embodiments, in step S205, the error evaluation optimization model is used to compare and analyze the preprocessed collected data and the time series prediction output within the second preset time period before the time A2, and the specific process of obtaining the current pattern recognition output deviation vector value B and the current sensor working time characteristic vector C can be:
[0076] 1. First calculate the average error of the preprocessed data collected at time A2 and before and the time series prediction output , Root Mean Square Error , Error Variance and the mean differential error ;
[0077] (1) Average error :
[0078] ;
[0079] In the formula, S is the number of gas sensors; F is the cumulative number of detections of the sensor equipment; To predict the number of steps; is the proportional coefficient of the jth gas sensor; , are the time series predicted value and actual sampling value of the j-th gas sensor for the i-th sampling respectively; For error.
[0080] This formula calculates the average value of the difference between the predicted value of the sensor time series and the actual sampling value within the prediction step, reflecting the average error level of the prediction.
[0081] (2) Root mean square error :
[0082] ;
[0083] The parameters in the formula are the same as above.
[0084] This formula calculates the root mean square of the difference between the predicted value of the sensor time series and the actual sampled value within the prediction step, reflecting the overall size of the prediction error.
[0085] (3) Error variance :
[0086] ;
[0087] The parameters in the formula are the same as above. is the mean error.
[0088] This formula calculates the variance of the difference between the predicted value and the actual sampled value of the sensor time series within the prediction step minus the average error, reflecting the degree of discreteness of the prediction error.
[0089] (4) Average differential error :
[0090] ;
[0091] The parameters in the formula are the same as above. , are the time series predicted value and actual sampling value of the j-th gas sensor for the i+1-th sampling, respectively, and Δt is the interval between two adjacent sampling points.
[0092] Among them, the above average error , Root Mean Square Error , Error Variance The parameters involved in time series model prediction can be adjusted by The parameters realize the calculation of multi-step detection accuracy.
[0093] 2. Then, based on these data, the output deviation vector value B of this pattern recognition and the characteristic vector C of the working time of this sensor are calculated.
[0094] (1) The calculation formula of the pattern recognition output deviation vector B is:
[0095] ;
[0096] In the formula, Identify output deviation for the nth output task mode; is the model coefficient of the nth output task; is the sensor coefficient of the nth output task; is the error variance; is the root mean square error; is the average error; is the mean differential value of the error; Deviation compensation value output for the nth task;
[0097] (2) Calculation formula of sensor working time characteristic vector C:
[0098] ;
[0099] The parameters in the formula are the same as above. is the attenuation coefficient of the nth sensor; is the adjustment coefficient of the nth sensor; is the restitution coefficient of the nth sensor; To accumulate working hours; It is a record of the cumulative working hours when the equipment is turned on; The number of training iterations for the time series model; is the sensor life constant.
[0100] In some embodiments, when constructing and training the pattern recognition model used in step S206, since there are too many sensor features, feature selection may be performed first, and then the pattern recognition model may be trained and optimized.
[0101] like Figure 5 The figure is a schematic diagram of an exemplary process for feature selection and pattern recognition model optimization in an embodiment of the present application.
[0102] S501, calculating the correlation between features and feature weights;
[0103] Specifically, the correlation between features can be calculated using the following formula:
[0104] ;
[0105] in, is the Pearson correlation coefficient between eigenvalue x and eigenvalue y; x i is the eigenvalue x For i The relative change value of samples; y i is the eigenvalue y For i The relative change value of samples; is the eigenvalue x The mean of all samples; is the eigenvalue y The mean of all samples; n is the total number of samples.
[0106] Then the absolute cumulative value of the correlation coefficient can be calculated using the following formula;
[0107] ;
[0108] in, It is the cumulative value of the absolute value of the Pearson correlation coefficient between a certain feature and other features; N is the total number of sample feature dimensions.
[0109] Finally, the weight value of each feature can be calculated using the following formula:
[0110] ;
[0111] in, is a certain feature weight value.
[0112] S502, randomly combining features according to feature weights to perform pattern recognition model training and evaluation to obtain a final feature combination;
[0113] The features can be randomly combined by weights to calculate the root mean square error (RMSE) of the detection index of the pattern recognition model, and the final feature combination can be gradually determined by the detection index. Preferably, the pattern recognition model is a support vector machine regression model (SVR). Specifically:
[0114] 1. Set the number of features K of the feature combination;
[0115] 2. Randomly combine features according to feature weights, select thresholds based on weights, change the randomness of feature combinations, and determine feature combinations with less correlation;
[0116] Among them, the weight selection threshold is:
[0117] ;
[0118] In the formula, ST is the weight selection threshold; K is the number of features; N is the total number of features; Select the relaxation coefficient for the feature. Features with weights less than the weight selection threshold ST will not be selected for the combination.
[0119] 3. Train the SVR model of multi-task output for each feature combination and calculate the root mean square error (RMSE) as follows:
[0120] ;
[0121] In the formula, is the true value output by the model; is the predicted value output by the model; n is the total number of samples in the test set.
[0122] 4. Sort the RMSE, take the union of the feature combinations that improve the RMSE, take the difference of the feature combinations that weaken the RMSE, obtain the optimal feature combination for each task, and then take the union to get the final feature combination.
[0123] In some embodiments, the final feature combination includes: the sliding pane integral value of each sensor response sequence, the sliding pane differential value, the sliding pane average differential value, the sliding pane maximum value, the response value at two preset moments in the sliding pane, and the characteristic vector of the sensor working time this time.
[0124] S503: Optimize the pattern recognition model using the improved sparrow search algorithm and the obtained final feature combination.
[0125] 1. Based on the final feature combination, a support vector machine regression model SVR is established as a pattern recognition model;
[0126] The support vector machine regression model has good modeling performance for small samples, data with nonlinear relationships and noise. In actual training, the input space is transformed through a nonlinear function. Mapped to a high-dimensional feature space;
[0127] ;
[0128] In the formula, is the weight; is the sample characteristics; For deviation.
[0129] The SVR regression problem can be expressed as solving the minimum value of structural risk under constraints;
[0130] ;
[0131] In the formula, c is the penalty factor; is the relaxation factor; is the tolerance margin; yi is the actual output value.
[0132] The final SVR prediction model is:
[0133] ;
[0134] In the formula, is the weight value; for deviation; In this embodiment, it is a radial basis kernel function, and the formula is as follows:
[0135] ;
[0136] In the formula, represents the input vector; is the center of the i-th radial basis function; is the standardized parameter; For vector The norm of .
[0137] 2. Use the improved sparrow search algorithm (ISSA) to optimize the parameters of SVR .
[0138] Combine the following Figure 6 The flowchart of using ISSA to optimize SVR is shown in Figure 2, which describes the optimization process:
[0139] (1) Determine the parameter values;
[0140] The parameters of the SVR model that need to be optimized, such as the penalty factor c, the kernel function type and its related parameters Wait for initialization value and set value range.
[0141] (2) Population initialization: Introduce cubic chaos mapping to improve the quality of the initial sparrow population and maintain population diversity. The formula is as follows:
[0142] ;
[0143] In the formula, is the position of the i-th sparrow in the j-dimension; is the upper limit of the search; The lower limit of the search.
[0144] (3) Calculate the individual fitness function value;
[0145] For each individual sparrow, the parameter value corresponding to its position is substituted into the SVR model for training, and the root mean square error RMSE is calculated on the test set as the fitness value of the individual. The RMSE formula is:
[0146] ;
[0147] In the formula, is the true value output by the model; is the predicted value output by the model; n is the total number of samples in the test set.
[0148] (4) Update the individual’s position and fitness value;
[0149] According to the different roles of individuals in the sparrow population (producer, follower, early warning), different position updating strategies are adopted.
[0150] Producer position update introduces nonlinear weight factor , select the current optimal position as the producer. The update formula is as follows:
[0151] ;
[0152] Where t represents the current iteration number; represents the position of the i-th sparrow in the j-th dimension in the t-th generation; is the maximum number of iterations; is the alarm value; is the safety threshold; is a random number that follows a normal distribution.
[0153] Introducing the elite individual strategy into the producer position update formula, the current individual position is compared with the previous individual position during the algorithm iteration process, and the better position is selected as the producer, which makes it easier to obtain the global optimal solution. The update formula is as follows:
[0154] ;
[0155] In this embodiment, η is 6 and φ is 3.
[0156] The follower updates its position based on the producer's position and the best and worst positions in the population, combined with the Gaussian mutation strategy. The follower position update formula is as follows:
[0157] ;
[0158] In the formula, is the optimal position of the producer in dimension j; is the worst position of the population; A is a 1-row d-column matrix of -1 or 1, and A + =A T (AA T ) -1 ; L represents a 1-row and d-column matrix, and all elements in the matrix are 1.
[0159] The position of the alerter is randomly generated in each iteration. The update formula of the alerter position is as follows:
[0160] In each iteration, 10% to 20% of the sparrows that are able to sense danger will be used as early warnings, and the positions of these sparrows are randomly generated according to the following formula:
[0161] ;
[0162] In the formula, is the step length control coefficient with a mean of 0, a variance of 1, and a normal distribution; K Any value in the range of -1 to 1; f i The individual fitness value of the sparrow’s current position; f g is the fitness value of the sparrow’s global best position; f w is the fitness value of the sparrow’s global worst position; Ɛ is a constant to prevent the denominator from being 0.
[0163] In order to prevent the rapid assimilation of sparrow individuals in the late iteration of the algorithm, which leads to the stagnation of local optimality, the Cauchy-Gauss mutation strategy is adopted to select the individual with the best current fitness for mutation, compare its position before and after mutation, and select the better position to substitute for the next iteration. The formula is as follows:
[0164] ;
[0165] In the formula, Represents the position of the optimal individual after mutation; is the standard deviation of the Cauchy-Gaussian mutation strategy; is a random variable that satisfies the Cauchy distribution; is a random variable that satisfies Gaussian distribution; , As the number of iterations , maximum number of iterations Dynamic parameters for adaptive adjustment.
[0166] The individual fitness value is recalculated after each position update.
[0167] (5) Determine whether the termination conditions are met;
[0168] The termination condition of the ISSA algorithm is:
[0169] The maximum number of iterations is reached or the fitness value reaches the preset threshold.
[0170] If it is not reached, return to step (4) and continue iterating.
[0171] (6) Output the position of the optimal individual;
[0172] After reaching the termination condition, the SVR model parameters corresponding to the individual with the best fitness value in the population are output, and finally the optimized pattern recognition model is obtained.
[0173] (7) Verification of feature fitness value;
[0174] Retrain the SVR model with the optimized parameters and verify it on the test set. If the new fitness value (such as RMSE) is better than that before optimization, the ISSA optimization is considered to be effective. Otherwise, consider adjusting the relevant parameters of the ISSA algorithm, such as the maximum number of iterations, and return to step (1) for re-optimization.
[0175] (8) Output optimal parameters;
[0176] Finally, the optimal SVR model parameter combination obtained by ISSA optimization is output.
[0177] In some embodiments, when the determined feature combination changes, or when the value of an important feature in the feature combination (eg, the sensor working time feature vector C) changes, step S503 may be performed again to train and optimize the pattern recognition model.
[0178] In some embodiments, step S207 specifically uses the current pattern recognition output deviation vector B plus the initial pattern recognition output as the current final pattern recognition output.
[0179] In some embodiments, in step S208, when the output deviation vector accumulation of this pattern recognition exceeds a preset threshold, all pre-processed collected data before time A2 are used to optimize the time series prediction model, specifically:
[0180] After each calculation to obtain the output deviation vector B of this pattern recognition, instead of simply replacing the old deviation value with the new deviation value, they are accumulated to obtain the cumulative value.
[0181] The cumulative formula is:
[0182] ;
[0183] In the formula, is the accumulated value of the actual output deviation vector after iteration; is the actual output deviation vector accumulation value before iteration; Output the deviation vector for this pattern recognition; The number of training iterations for the time series model; is the deviation compensation value vector.
[0184] By accumulating historical deviation information, the model update process can be smoothed to a certain extent to avoid drastic fluctuations in the model. At the same time, by introducing the variation of the deviation compensation value, the deviation correction capability of the model can be dynamically adjusted.
[0185] The accumulated value is then compared with the preset threshold. If the accumulated value is greater than the preset threshold, it means that the prediction performance of the current model is not good enough and it is necessary to trigger the update of the time series prediction model.
[0186] In some embodiments, during the time series model training upgrade, update, restart, or device restart phase, the average error , Root Mean Square Error , Error Variance , mean differential error Cumulative number of detections of sensor devices in F Perform zero reset initialization and re-accumulate to reflect the actual working status of the current model and equipment. This initialization process can avoid the interference of historical error data on the new working environment and improve the adaptability of the model.
[0187] In some embodiments, when actually writing code to implement the gas detection system, two optimization measures can be taken to improve computing efficiency and startup performance. First, when calculating various error indicators and eigenvectors at the current detection moment, all historical data may not be used. Instead, a cumulative data is maintained, and the current sampling value is calculated with the cumulative data, which avoids repeated calculations of historical data and significantly reduces computing overhead. Second, considering that the sensor may be in a non-standard working state when the device is just started, and there is a deviation between the output value and the value under normal working conditions, the system can use the recovery coefficient of the sensor during the startup phase to calculate the error index and the characteristic vector. and equipment cumulative working hours record , adjust the output value of the sensor to make the sensor reach normal working state as soon as possible and improve the detection accuracy after startup. These optimization measures can improve the calculation efficiency of the system, reduce resource overhead, and ensure the accuracy of the detection data.
[0188] In conjunction with the description of the above embodiments, please refer to Figure 7 , is another flow chart of the gas detection method for intelligently improving accuracy in the embodiment of the present application:
[0189] S701, the lower computer periodically sends the raw data collected by the multiple gas sensors and the environment detection sensor to the upper computer, and the upper computer performs data preprocessing on the raw data to obtain preprocessed collected data;
[0190] Among them, raw data refers to the data directly collected by multiple gas sensors and environmental detection sensors without any processing, which usually contains various noises and interferences. Periodicity refers to the process of data collection and transmission repeated by the lower computer at a preset time interval, such as every second or every minute. Data preprocessing refers to the use of mathematical or signal processing methods to denoise, smooth, normalize, etc. the raw data to improve data quality and facilitate subsequent analysis. Preprocessed collected data refers to the relatively clean and standardized data obtained after preprocessing.
[0191] Specifically, during the operation of the gas detection equipment, the lower computer obtains raw data reflecting the current environment and gas status, such as gas concentration, temperature and humidity, through various sensors connected to it. Due to the characteristics of the sensor itself and external interference, these raw data are usually mixed with various noises and the data quality is poor. In order to facilitate subsequent analysis and judgment, the lower computer needs to upload these raw data to the upper computer regularly and continuously. After receiving the raw data, the upper computer will immediately perform a series of preprocessing operations on it, and improve the reliability and availability of the data by removing noise, correcting drift and other measures, and finally obtain preprocessed collected data. These preprocessed collected data will provide data support for various functions of the gas detection equipment, such as concentration prediction and alarm.
[0192] Optionally, in some embodiments, the host computer first filters the raw data, for example, using a Kalman filter or a low-pass filter to remove high-frequency noise and pulse interference, and then performs smoothing, using a moving average or Savitzky-Golay smoothing algorithm to eliminate spikes and mutations in the data. Finally, the data of each sensor is normalized and mapped to the [0, 1] interval for unified processing.
[0193] Optionally, in some embodiments, the host computer first performs outlier detection on the raw data of each sensor, eliminates data points that obviously deviate from the normal range, and then performs polynomial curve fitting to remove random noise. The Z-score normalization method is then used to unify the data of different sensors to the same scale. Finally, data synchronization is performed to align the data of each sensor to the same time point.
[0194] S702, at a first moment, the host computer inputs the preprocessed collected data at the first moment into the trained time series prediction model to obtain predicted sensor sampling values corresponding to multiple future sampling moments after the first moment as the time series prediction output at the first moment; the first moment is a sampling moment;
[0195] Among them, the first moment refers to a sampling point during the operation of the gas detection equipment, usually the current time. The sampling moment represents the discrete time point at which the host computer collects and analyzes data, which is determined by the preset sampling frequency. The predicted sensor sampling value refers to the value obtained by estimating the data that the sensor may output at a certain moment in the future using the time series prediction model. The time series prediction output refers to the set of predicted sensor sampling values for multiple future sampling moments obtained at the current moment.
[0196] Specifically, when the gas detection equipment runs to the sampling point of the first moment, the upper computer will input the collected data that has been preprocessed at that moment into the pre-trained time series prediction model. The model can predict the sensor sampling values in the future period based on current and past data. For example, if the current moment is 10:00, the model can predict the sensor sampling values at future moments such as 10:01, 10:02, and 10:03. These predicted values reflect the model's estimate of the trend of changes in sensor readings and can be used as a reference for subsequent pattern recognition and gas concentration judgment. The vector composed of all the predicted values for future sampling moments obtained at the first moment is called the time series prediction output at that moment.
[0197] S703, the host computer combines the preprocessed collected data before the first moment and the time series prediction output at the first moment and performs feature extraction to obtain preprocessed feature data at the first moment;
[0198] Feature extraction refers to the process of discovering and selecting key information from raw data that can effectively characterize the inherent laws and essential properties of the data. Preprocessed feature data refers to a set of refined and efficient feature representations obtained after feature extraction of preprocessed collected data and time series prediction output, usually in the form of vectors or matrices.
[0199] Specifically, after completing the time series prediction at the first moment, the host computer needs to integrate the prediction results at that moment with the historical data in order to mine the valuable information contained in the data. The host computer first arranges the preprocessed collected data in a period of time before the first moment and the time series prediction output at the first moment into a complete time series in chronological order. Then, the host computer performs feature extraction operations on the time series. Common time series features include statistical features (such as mean, variance, maximum and minimum values, etc.), frequency domain features (such as Fourier transform coefficients), and time series pattern features (such as rising and falling trends). By calculating these feature indicators, the host computer can convert the original high-dimensional time series data into relatively low-dimensional preprocessed feature data, which not only reduces the computational overhead of subsequent analysis, but also retains the key information of the time series data. These preprocessed feature data can be used as direct input of the pattern recognition model.
[0200] Optionally, in some embodiments, the host computer first performs moving window slicing on the integrated time series data, and then calculates the mean, variance, kurtosis and other statistics for the subsequences in each time window, and extracts the amplitude and timestamp information of the local maximum and minimum points, and finally splices these statistical features and key point features into a vector as the feature representation of the time window. Moving window slicing can effectively avoid the problem of feature distortion caused by the unsteady time series data.
[0201] Optionally, in other embodiments, the host computer may first perform piecewise linear fitting on the integrated time series data to obtain multiple linear functions, then perform cluster analysis on the parameters such as the slope and intercept of each linear function, and finally use the coordinate value of each cluster center point as a feature dimension to obtain the piecewise linear feature representation of the time series data. Piecewise linear fitting can capture the multi-scale change trend of time series data and has good feature expression capabilities.
[0202] S704, the host computer uses the error evaluation optimization model to compare the preprocessed collected data at the first moment and the previous moment with the time series prediction output at the corresponding moment, and obtains the current pattern recognition output deviation vector value and the current sensor working time feature vector;
[0203] Among them, the error assessment optimization model is a set of mathematical models for estimating the degree of deviation between actual collected data and predicted data, which is composed of multiple mathematical formulas. For details, please refer to the description in the above embodiment.
[0204] After obtaining the initial pattern recognition results, the host computer needs to further evaluate the accuracy and reliability of the results. The host computer can first retrieve the pre-processed acquisition data of the first moment and several previous sampling moments and the time series prediction output of the corresponding moment from the historical database, and can pair them two by two to form actual value-predicted value tuples. Then, the host computer can input these tuples into the error evaluation optimization model to calculate the deviation vector value of the pattern recognition output as a quantitative indicator of the credibility of the initial pattern recognition output. At the same time, the host computer also calculates the characteristic vector of the working time of the sensor to characterize the health level of the sensor, providing a basis for subsequent judgment of whether the sensor needs calibration or maintenance.
[0205] S705, the host computer inputs the preprocessed feature data of the first moment and the feature vector of the working time of the sensor this time into the trained pattern recognition model to obtain an initial pattern recognition output; the initial pattern recognition output includes the gas detection concentration values of the first moment and the multiple future sampling moments;
[0206] The host will combine the preprocessed feature data and the feature vector of the sensor working time as the feature output pattern recognition model to obtain the initial pattern recognition output. The preprocessed feature data and the feature vector of the sensor working time are a set of feature values calculated based on the sensor's cumulative working time and other information, which are used to characterize the dynamic characteristics of the gas sensor during long-term operation.
[0207] Among them, the pattern recognition model refers to a mathematical model trained by a machine learning algorithm that can classify or regress input data. The gas detection concentration value represents the estimated value of the concentration level of a certain gas in the current environment, usually in ppm (parts per million). The initial pattern recognition output refers to the original prediction result given by the model after the feature is input into the pattern recognition model, including the judgment of the gas concentration at the first moment and multiple sampling moments in the future.
[0208] S706, the host computer uses the current pattern recognition output deviation vector value to correct the initial pattern recognition output to obtain the current final pattern recognition output; the current final pattern recognition output includes the updated gas detection concentration values at the first moment and the multiple future sampling moments;
[0209] After obtaining the initial pattern recognition output at a certain sampling moment (the first moment), the host machine will use the error evaluation optimization model to compare the preprocessed acquisition data and the time series prediction output at that moment and the previous period, and quantitatively calculate the deviation vector value that reflects the prediction deviation of the time series prediction model. The deviation vector value is then used to correct the initial pattern recognition output to obtain the final pattern recognition output with less noise and error. Compared with the original output, the accuracy and reliability of the gas detection concentration values at the first moment and future sampling moments contained in the final output are improved.
[0210] Optionally, in some embodiments, the initial pattern recognition output may be represented as a vector, and the current pattern recognition output deviation vector value may be represented as another vector of the same size, and the corrected final pattern recognition output vector may be obtained by adding corresponding elements of the two vectors;
[0211] Optionally, in some embodiments, the initial pattern recognition output and the current pattern recognition output deviation vector value may be respectively input into a pre-trained neural network model, and the corrected final pattern recognition output may be directly output through the forward propagation calculation process of the neural network.
[0212] It is understandable that other mathematical transformations or mapping methods may also be used to implement the deviation correction process of the initial output, which is not specifically limited here.
[0213] S707. When the cumulative output deviation vector value of the current pattern recognition at the first moment exceeds a preset threshold, the time series prediction model is optimized and trained using the preprocessed collected data at the first moment and previous moments to obtain a time series prediction model for the next sampling moment.
[0214] The preset threshold refers to a pre-set critical value that triggers the optimization training of the time series prediction model when the accumulated pattern recognition output deviation vector value exceeds the threshold.
[0215] It is executed after each sampling moment, but not every time it triggers the optimization training of the timing prediction model. The model optimization process will only be started when the deviation vector value of the pattern recognition output at the current moment exceeds the preset threshold. This is because the dynamic response characteristics of the gas sensor usually change slowly with the increase of working time. Only when the offset change reaches a certain level, the timing prediction model needs to be updated to adapt to the new sensor characteristics.
[0216] Specifically, the host computer can continuously track the sensor working time feature vector calculated at each sampling moment and accumulate it. When the accumulated value exceeds the preset threshold, the host computer will collect the preprocessed acquisition data at that moment and the previous period as training samples to retrain the existing time series prediction model. By optimizing the model with new data that can reflect the current sensor status, the time series prediction model can dynamically adapt to changes in sensor characteristics, thereby improving the prediction accuracy under long-term operation. The new model obtained by optimized training will be put into use at the next sampling moment to provide more reliable prediction information for subsequent pattern recognition tasks.
[0217] Optionally, a fixed preset threshold can be determined based on experience or preliminary experiments, and when the pattern recognition output deviation vector accumulates and exceeds the fixed threshold, a model optimization training is triggered; optionally, the preset threshold can be dynamically calculated through an adaptive algorithm, and the threshold size can be automatically adjusted according to the rate of change of the pattern recognition output deviation vector, so that the frequency of model optimization training is adapted to the speed of sensor characteristic changes. Other heuristic rules or machine learning methods can also be used to control the triggering conditions and frequency of model optimization training to achieve a balance between sensor state tracking and computing resource usage, which is not specifically limited here.
[0218] The above describes the gas detection method for intelligently improving accuracy in the embodiment of the present application. The following introduces the host computer 100 in the gas detection device provided in the embodiment of the present application.
[0219] Figure 8 It is a schematic diagram of an exemplary hardware structure of the host computer 100 provided in an embodiment of the present application.
[0220] In some embodiments, the host computer 100 is a computer device. The computer device includes a processor, a memory and a network interface connected by a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The network interface of the computer device is used to communicate with other external terminals or servers through a network connection. In some embodiments, the network interface can be a wired network interface, and in some embodiments, the network interface can also be a wireless network interface. When the computer program is executed by the processor, the method in the embodiment of the present application is implemented.
[0221] Those skilled in the art will understand that Figure 8The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
Claims
1. A gas detection method with intelligently improved accuracy, applied to gas detection equipment, characterized in that: The gas detection device comprises an upper computer and a lower computer, wherein the lower computer comprises a plurality of gas sensors and an environment detection sensor, and the method comprises: The lower computer periodically sends the raw data collected by the multiple gas sensors and the environment detection sensor to the upper computer, and the upper computer performs data preprocessing on the raw data to obtain preprocessed collected data; At a first moment, the host computer inputs the preprocessed collected data at the first moment into the trained time series prediction model to obtain predicted sensor sampling values corresponding to multiple future sampling moments after the first moment as the time series prediction output at the first moment; the first moment is a sampling moment; The host computer combines the preprocessed collected data before the first moment and the time series prediction output at the first moment to perform feature extraction to obtain preprocessed feature data at the first moment; The host computer uses the error evaluation optimization model to compare the preprocessed collected data at the first moment and the previous moment with the time series prediction output at the corresponding moment to obtain the current pattern recognition output deviation vector value and the current sensor working time feature vector; The host computer inputs the preprocessed feature data at the first moment and the feature vector of the working time of the sensor this time into the trained pattern recognition model to obtain an initial pattern recognition output; the initial pattern recognition output includes the gas detection concentration values at the first moment and the multiple future sampling moments; The host computer uses the current pattern recognition output deviation vector value to correct the initial pattern recognition output to obtain the current final pattern recognition output; the current final pattern recognition output includes the updated first moment and each gas detection concentration value at the multiple future sampling moments; When the cumulative output deviation vector value of the current pattern recognition at the first moment exceeds a preset threshold, the time series prediction model is optimized and trained using the preprocessed acquisition data at the first moment and previous moments to obtain a time series prediction model for the next sampling moment; The host computer uses the error evaluation optimization model to compare the preprocessed collected data at the first moment and the previous moment with the time series prediction output at the corresponding moment, and obtains the current pattern recognition output deviation vector value and the current sensor working time feature vector, specifically including: The host computer calculates the average error, root mean square error, error variance and average differential value of error between the actual collected data and the predicted data based on the preprocessed collected data at the first moment and the previous moment and the time series prediction output at the corresponding moment, using the preset parameter calculation formula in the error evaluation optimization model; The host computer calculates the output deviation vector value of the current pattern recognition according to the average error, root mean square error, error variance and average differential value of the error using the deviation calculation formula in the error evaluation optimization model; the output deviation vector value of the current pattern recognition is used to characterize the prediction error size of the time series prediction model; The host computer calculates the sensor working time characteristic vector according to the sensor working time using the time calculation formula in the error evaluation optimization model, and the sensor working time characteristic vector is used to characterize the dynamic characteristic change of the gas sensor in the long-term working process; The deviation calculation formula in the error assessment optimization model is: ; in, Identify output deviation for the nth output task mode; is the model coefficient of the nth output task; is the sensor coefficient of the nth output task; is the error variance; is the root mean square error; is the average error; is the mean differential value of the error; Deviation compensation value output for the nth task; The duration calculation formula in the error evaluation optimization model is: ; in, is the attenuation coefficient of the nth sensor; is the adjustment coefficient of the nth sensor; is the restitution coefficient of the nth sensor; To accumulate working hours; It is a record of the cumulative working hours when the equipment is turned on; The number of training iterations for the time series model; is the sensor life constant.
2. The method according to claim 1, characterized in that: The time series prediction model is an improved BiLSTM time series prediction model that is based on the standard BiLSTM time series prediction model, by adding a one-dimensional CNN layer in the time domain direction to the input layer and adding a one-dimensional Convolutional Self-Attention mechanism in the time domain direction to the output layer.
3. The method according to claim 1, characterized in that The pattern recognition model is a support vector machine regression model, and the construction process of the pattern recognition model is: Calculate the correlation and feature weights between features in the feature set; The features are randomly combined according to the feature weights to train and evaluate the pattern recognition model to obtain the final feature combination; A pattern recognition model is established using the final feature combination, and the parameters in the pattern recognition model are optimized using a sparrow search algorithm.
4. The method according to claim 3, characterized in that The final feature combination includes the sliding pane integral value, sliding pane differential value, sliding pane average differential value, sliding pane maximum value, response values at two preset moments in the sliding pane, and the current sensor working time feature vector of each sensor response sequence.
5. The method according to claim 1, characterized in that The host computer performs data preprocessing on the raw data to obtain preprocessed collected data, specifically including: The host computer performs Kalman filtering on the raw data to obtain Kalman filtering data; The host computer performs Savitzky-Golay polynomial smoothing filtering on the Kalman filter data to obtain the pre-processed acquisition data.
6. A gas detection device, characterized in that: The host computer in the gas detection device includes: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the gas detection device to execute the method described in any one of claims 1-5.
7. A computer program product comprising instructions, characterized in that When the computer program product is run on a gas detection device, the gas detection device is enabled to perform the method according to any one of claims 1 to 5.
8. A computer-readable storage medium comprising instructions, characterized in that: When the instruction is executed on the gas detection device, the gas detection device is caused to perform the method according to any one of claims 1 to 5.
Citation Information
Cited By
Volatile organic compound concentration detection signal processing method based on sliding window timing filtering
CN122930243A
