CN-121995001-A - Gas concentration anomaly detection method, system, electronic equipment and storage medium
Abstract
The invention discloses a gas concentration abnormality detection method, a system, an electronic device and a storage medium, wherein the method comprises the steps of detecting gas concentration abnormality at each moment in a current gas concentration sequence based on historical gas concentration data; the method comprises the steps of detecting abnormal gas concentration change trend at each moment in a current gas concentration sequence based on historical gas concentration change trend data, reconstructing the current gas concentration sequence by adopting a self-encoder model of a bidirectional gating circulation unit embedded with an attention mechanism, calculating a square error sequence of the reconstruction sequence and the current gas concentration sequence, detecting abnormal gas concentration change modes in the square error sequence based on historical square error data, counting abnormal moment number in the current gas concentration sequence, and alarming when the proportion of the abnormal moment number in the total moment number of the current gas concentration sequence exceeds a threshold value. The invention can reduce errors caused by random faults of the sensor and improve the accuracy and reliability of gas concentration anomaly detection.
Inventors
- CHEN XIAOXU
- CHEN JIAZHENG
- WU TAO
- WU QIANJIN
Assignees
- 华安星辰(北京)传感科技有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20251212
Claims (10)
- 1.A gas concentration abnormality detection method, characterized by comprising: Acquiring a current gas concentration sequence of a target area; detecting abnormal gas concentration at each moment in the current gas concentration sequence based on the historical gas concentration data of the target area; Detecting abnormal gas concentration change trend at each moment in the current gas concentration sequence based on the historical gas concentration change trend data of the target area; reconstructing the current gas concentration sequence by adopting a self-encoder model of a bidirectional gating circulation unit embedded with an attention mechanism to obtain a reconstruction sequence; calculating a square error sequence of the reconstruction sequence and the current gas concentration sequence, wherein the square error sequence comprises square errors of each moment; detecting a gas concentration variation pattern anomaly in the square error sequence based on historical square error data of the target region; Counting the number of abnormal moments in the current gas concentration sequence, wherein if any moment in the current gas concentration sequence is judged to have at least one of the abnormality of the gas concentration, the abnormality of the gas concentration change trend or the abnormality of the gas concentration change mode, the moment is counted as an abnormal moment; And alarming when the proportion of the abnormal time quantity in the total time quantity of the current gas concentration sequence exceeds a preset alarm threshold value.
- 2. The gas concentration abnormality detection method according to claim 1, characterized in that the step of detecting a gas concentration abnormality at each time in the current gas concentration sequence based on the historical gas concentration data of the target region includes: judging whether any moment in the current gas concentration sequence meets a first preset condition, if so, judging that the gas concentration is abnormal at the moment, wherein the first preset condition is as follows: Or (b) ; Representing the first of the current gas concentration sequences The actual gas concentration value at the moment in time, Represents a concentration mean calculated based on the historical gas concentration data, Representing a concentration standard deviation calculated based on the historical gas concentration data; And repeatedly executing the step of judging whether any moment in the current gas concentration sequence meets the first preset condition or not until the detection of the abnormal gas concentration at each moment in the current gas concentration sequence is completed.
- 3. The gas concentration abnormality detection method according to claim 2, characterized in that the step of detecting a gas concentration variation trend abnormality at each time in the current gas concentration sequence based on the historical gas concentration variation trend data of the target region includes: Calculating a gas concentration change trend value at any moment in the current gas concentration sequence, judging whether the gas concentration change trend value at the moment meets a second preset condition, if so, judging that the gas concentration change trend is abnormal at the moment, wherein the second preset condition is as follows: Or (b) ; Representing the first of the current gas concentration sequences The trend value of the gas concentration change at the moment, ; Represents a change trend mean value calculated based on the historical gas concentration change trend data, Representing a variation trend standard deviation calculated based on the historical gas concentration variation trend data; and repeatedly executing the step of calculating the gas concentration change trend value at any moment in the current gas concentration sequence, and judging whether the gas concentration change trend value at the moment meets a second preset condition or not until the detection of the abnormality of the gas concentration change trend at each moment in the current gas concentration sequence is completed.
- 4. The method for detecting abnormal gas concentration according to claim 1, wherein the step of reconstructing the current gas concentration sequence by using a self-encoder model of a bi-directional gating cycle unit embedded with an attention mechanism to obtain a reconstructed sequence comprises: processing the current gas concentration sequence through a bidirectional gating circulation unit in an encoder of the self-encoder model to obtain hidden states of the encoder at all moments; Taking the hidden state of the decoder of the self-encoder model at the last moment as a query, taking the hidden state of the encoder at all moments as a key, and calculating attention weights through an attention mechanism in the self-encoder model; weighting hidden states of the encoder at all moments based on the attention weights to generate context vectors; Processing by a bi-directional gating circulation unit in the decoder in combination with the context vector and the hidden state of the encoder to obtain the hidden state of the decoder at all moments; and processing the hidden states of the decoder at all moments through a multi-layer perceptron in the self-encoder model to obtain the reconstruction sequence.
- 5. A gas concentration abnormality detection method according to claim 3, characterized in that said step of calculating a square error sequence of said reconstructed sequence and said current gas concentration sequence includes: Calculating the square of the difference between the reconstructed gas concentration value at any moment in the reconstruction sequence and the actual gas concentration value at the moment in the current gas concentration sequence as the square error of the moment; Repeating the step of calculating the square of the difference between the reconstructed gas concentration value at any time in the reconstruction sequence and the actual gas concentration value at that time in the current gas concentration sequence as the square error at that time until the square error at each time is obtained; The square errors of all the moments are arranged in time sequence to form the square error sequence.
- 6. The gas concentration abnormality detection method according to claim 5, characterized in that the step of detecting a gas concentration variation pattern abnormality in the square error sequence based on the historical square error data of the target region includes: Judging whether the square error at any moment in the square error sequence meets a third preset condition or not, if yes, judging that the gas concentration change mode is abnormal at the moment, wherein the third preset condition is as follows: Or (b) ; Representing the first of the squared error sequences The square error of the time of day, Represents a mean square error calculated based on the historical square error data, Representing a standard deviation of square error calculated based on the historical square error data; And repeating the step of judging whether the square error at any moment in the square error sequence meets a third preset condition or not until the detection of the abnormality of the gas concentration change mode at each moment in the square error sequence is completed.
- 7. The gas concentration abnormality detection method according to any one of claims 1 to 6, characterized in that the step of alarming when a proportion of the number of abnormal times to the total number of times of the current gas concentration sequence exceeds a preset alarm threshold value, includes: calculating the ratio of the abnormal time quantity to the total time quantity of the current gas concentration sequence to obtain the current abnormal proportion; And when the current abnormal proportion is larger than the preset alarm threshold value, generating an alarm signal and outputting the alarm signal, wherein the current gas concentration sequence is a continuously acquired monitoring data sequence with fixed time length.
- 8. The gas concentration abnormality detection system is characterized by comprising an acquisition module, a first detection module, a second detection module, a reconstruction module, a calculation module, a third detection module, a statistics module and an early warning module; the acquisition module is used for acquiring a current gas concentration sequence of a target area; the first detection module is used for detecting that the gas concentration of each moment in the current gas concentration sequence is abnormal based on the historical gas concentration data of the target area; The second detection module is used for detecting that the gas concentration change trend at each moment in the current gas concentration sequence is abnormal based on the historical gas concentration change trend data of the target area; The reconstruction module is used for reconstructing the current gas concentration sequence by adopting a bidirectional gating circulation unit self-encoder model embedded with an attention mechanism to obtain a reconstruction sequence; The calculation module is used for calculating a square error sequence of the reconstruction sequence and the current gas concentration sequence, wherein the square error sequence comprises square errors of each moment; The third detection module is used for detecting that the gas concentration change mode in the square error sequence is abnormal based on the historical square error data of the target area; the statistics module is used for counting the number of abnormal moments in the current gas concentration sequence, wherein if any moment in the current gas concentration sequence is judged to have at least one of the abnormality of the gas concentration, the abnormality of the gas concentration change trend or the abnormality of the gas concentration change mode, the moment is counted as an abnormal moment; The early warning module is used for warning when the proportion of the abnormal time quantity in the total time quantity of the current gas concentration sequence exceeds a preset warning threshold value.
- 9. An electronic device comprising a processor coupled to a memory, the memory having stored therein at least one computer program that is loaded and executed by the processor to cause the electronic device to implement the gas concentration anomaly detection method of any one of claims 1 to 7.
- 10. A computer-readable storage medium, wherein at least one computer program is stored in the computer-readable storage medium, which when executed by a processor, implements the gas concentration abnormality detection method according to any one of claims 1 to 7.
Description
Gas concentration anomaly detection method, system, electronic equipment and storage medium Technical Field The present invention relates to the field of gas concentration detection technologies, and in particular, to a method, a system, an electronic device, and a storage medium for detecting a gas concentration abnormality. Background In the field of gas concentration detection, time-series anomaly detection techniques play an important role. The technology judges whether the current sequence has abnormal conditions or not by learning the change mode of the historical time sequence data. However, the existing detection method has two defects that on one hand, the statistical discrimination method can only monitor the gas concentration and the obvious abnormality of the simple trend, and the abnormality of the complex change mode is difficult to identify, and on the other hand, the deep learning method is excellent in capturing the complex mode, but cannot accurately monitor the abnormality of the simple trend. In addition, most of the existing methods judge the gas concentration at a single moment, and neglect detection errors possibly caused by random faults of the sensor, so that the reliability of the algorithm is reduced. Accordingly, there is a need to provide a solution to the above-mentioned problems. Disclosure of Invention In order to solve the technical problems, the invention provides a method, a system, electronic equipment and a storage medium for detecting gas concentration abnormality. In a first aspect, the present invention provides a method for detecting abnormal gas concentration, which has the following technical scheme: Acquiring a current gas concentration sequence of a target area; detecting abnormal gas concentration at each moment in the current gas concentration sequence based on the historical gas concentration data of the target area; Detecting abnormal gas concentration change trend at each moment in the current gas concentration sequence based on the historical gas concentration change trend data of the target area; reconstructing the current gas concentration sequence by adopting a self-encoder model of a bidirectional gating circulation unit embedded with an attention mechanism to obtain a reconstruction sequence; calculating a square error sequence of the reconstruction sequence and the current gas concentration sequence, wherein the square error sequence comprises square errors of each moment; detecting a gas concentration variation pattern anomaly in the square error sequence based on historical square error data of the target region; Counting the number of abnormal moments in the current gas concentration sequence, wherein if any moment in the current gas concentration sequence is judged to have at least one of the abnormality of the gas concentration, the abnormality of the gas concentration change trend or the abnormality of the gas concentration change mode, the moment is counted as an abnormal moment; And alarming when the proportion of the abnormal time quantity in the total time quantity of the current gas concentration sequence exceeds a preset alarm threshold value. The gas concentration anomaly detection method has the beneficial effects that: The method can effectively reduce errors caused by random faults of the sensor and improve the accuracy and reliability of gas concentration anomaly detection. On the basis of the scheme, the gas concentration abnormality detection method can be improved as follows. In an optional manner, the step of detecting the abnormality of the gas concentration at each moment in the current gas concentration sequence based on the historical gas concentration data of the target area includes: judging whether any moment in the current gas concentration sequence meets a first preset condition, if so, judging that the gas concentration is abnormal at the moment, wherein the first preset condition is as follows: Or (b) ;Representing the first of the current gas concentration sequencesThe actual gas concentration value at the moment in time,Represents a concentration mean calculated based on the historical gas concentration data,Representing a concentration standard deviation calculated based on the historical gas concentration data; And repeatedly executing the step of judging whether any moment in the current gas concentration sequence meets the first preset condition or not until the detection of the abnormal gas concentration at each moment in the current gas concentration sequence is completed. In an optional manner, the step of detecting the abnormality of the gas concentration variation trend at each moment in the current gas concentration sequence based on the historical gas concentration variation trend data of the target area includes: Calculating a gas concentration change trend value at any moment in the current gas concentration sequence, judging whether the gas concentration change trend value at the moment meets a second p