Intelligent detection device and method for natural gas leakage

By collecting infrared video frame sequences in the natural gas pipeline area, establishing a grayscale histogram and initializing a background sample set, calculating the foreground membership, and combining time domain integration to generate an anti-interference mask, the problem of fine-grained recognition of natural gas leaks under background noise is solved, and accurate detection of natural gas leaks is achieved.

CN120740863AActive Publication Date: 2025-10-03ZHEJIANG JIARAN MUNICIPAL ENGINEERING CO LTD
View PDF 12 Cites 0 Cited by

Patent Information

Application Number
CN202511232212.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-01
Publication Date
2025-10-03
Estimated Expiration
2045-09-01

AI Technical Summary

Technical Problem

Existing natural gas leak detection technology has difficulty achieving fine-grained identification when surrounded by background noise, resulting in tiny leaks being easily drowned out by background noise and making it impossible to effectively identify leaks in natural gas pipelines.

Method used

By collecting infrared video frame sequences of the natural gas pipeline area, a grayscale histogram is established, an initial background sample set is constructed, the foreground membership is calculated, the foreground recognition area is extracted, and an anti-interference mask is generated through pixel-level time domain integration. Finally, regional screening is performed to achieve fine-grained recognition.

Benefits of technology

It can effectively identify natural gas leaks under background noise, improve the fine-grainedness of foreground area extraction, enhance the reliability of pre-identification, distinguish real leaks from instantaneous interference, amplify weak signals and suppress noise, and achieve fine-grained identification of natural gas leakage areas.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120740863A_ABST
    Figure CN120740863A_ABST
Patent Text Reader

Abstract

The invention provides an intelligent detection device and method for natural gas leakage. The method comprises the following steps: acquiring an infrared video frame sequence of a natural gas pipeline area; an initialized background sample set is constructed based on a gray level histogram of each pixel position in an infrared video frame, the foreground membership degree of each pixel point in each infrared video frame is determined according to the initialized background sample set, and then a foreground identification area of each infrared video frame is extracted. Recognizing and obtaining a foreground pre-recognition area of the natural gas leakage at the current moment according to the area change characteristics of the foreground recognition area between the adjacent infrared video frames in combination with the initialized background sample set; determining an anti-interference mask in the natural gas leakage detection process based on the time domain gray feature map of gray value cumulative change in the natural gas pipeline region; and determining a natural gas leakage detection result of the natural gas pipeline area based on the anti-interference mask and the foreground pre-identification area. According to the technical scheme provided by the invention, fine-grained recognition can be carried out on natural gas leakage under background noise submergence.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of natural gas leakage detection, and more specifically, to an intelligent detection device and method for natural gas leakage. Background Art

[0002] As an important energy source, natural gas accounts for a large proportion in the energy structure. In recent years, the use of natural gas has increased sharply and the pipeline network has continued to expand. However, due to factors such as aging, corrosion, and human damage, natural gas pipelines have frequently leaked. The global economic losses caused by natural gas leaks amount to billions of dollars each year. Once natural gas leaks, it not only leads to energy waste, but also seriously threatens the safety of life and property and environmental stability, and is prone to fires, explosions and other accidents. Therefore, the development of efficient and accurate natural gas leak detection technology is imminent.

[0003] Existing natural gas leak detection methods often focus on changes in physical or chemical properties caused by leaks. For example, sensors are used to detect abnormal fluctuations in methane concentration in leaking gas, triggering an alarm when the concentration exceeds a set threshold. Acoustic equipment is also used to identify the frequency sound waves generated by friction between high-speed airflow and pipelines during leaks, enabling non-contact detection. Furthermore, infrared imaging technology, based on methane's absorption characteristics of infrared light in specific wavelengths, captures images of light intensity attenuation in the leak area to visually locate the leak. However, in infrared detection of natural gas leaks, environmental thermal radiation noise (such as sunlight reflection and ground heat dissipation) and infrared sensor noise can cause abnormal fluctuations in pixel-level grayscale values. These interference features are similar to the infrared characteristics of real natural gas leaks in the short-term domain. Existing natural gas leak detection relies solely on the difference between adjacent frames, which cannot effectively accumulate the temporal characteristics of natural gas leak signals. As a result, small leaks are easily drowned out by background noise, making it impossible to perform fine-grained identification of natural gas leaks in natural gas pipelines. Therefore, how to achieve fine-grained identification of natural gas leaks in the presence of background noise has become a challenge facing the industry. Summary of the Invention

[0004] The present application provides an intelligent detection device and method for natural gas leaks, which can perform fine-grained identification of natural gas leaks under background noise.

[0005] In a first aspect, the present application provides a natural gas leak infrared detection method for a natural gas leak intelligent detection device to perform infrared detection of natural gas leaks, the method comprising the following steps: Collect infrared video frame sequences of the natural gas pipeline area and create a corresponding grayscale histogram for each pixel position in the infrared video frame within a set time range; An initialization background sample set for natural gas leak detection is constructed based on the grayscale histogram of each pixel position, and the foreground membership of each pixel point in each infrared video frame is determined based on the grayscale difference relationship between the background reference value of each pixel position in the initialization background sample set and the corresponding pixel of each infrared video frame; Extracting the foreground identification area of ​​each infrared video frame based on the foreground membership of each pixel point in each infrared video frame, and then performing foreground pre-identification of the current natural gas pipeline area based on the area change characteristics of the foreground identification area between adjacent infrared video frames in combination with the initialized background sample set to obtain the foreground pre-identification area of ​​the natural gas leak at the current moment; Performing a pixel-level time-domain integration operation on the infrared video frame sequence to obtain a time-domain grayscale feature map of cumulative grayscale value changes in the natural gas pipeline area, and then generating an anti-interference mask for natural gas leak detection using the time-domain grayscale feature map; Based on the anti-interference mask, region screening is performed on the foreground pre-identified region under anti-interference feature constraints to obtain a natural gas leak detection result for the natural gas pipeline region.

[0006] In some embodiments, establishing a corresponding grayscale histogram for each pixel position in the infrared video frame within a set time sequence range specifically includes: Setting a time sequence range for establishing a grayscale histogram, and extracting an infrared video frame sequence contained in the time sequence range; Traversing each infrared video frame in the infrared video frame sequence, and determining all pixel positions in each infrared video frame; Selecting a pixel position as a selected pixel position, extracting pixel grayscale values ​​corresponding to the selected pixel position in all infrared video frames within the time sequence range, and forming a grayscale value sequence corresponding to the selected pixel position; Counting the occurrence frequency of each gray value in the gray value sequence to generate a gray histogram corresponding to the selected pixel position; Continue to determine the grayscale histogram corresponding to the remaining pixel positions.

[0007] In some embodiments, constructing an initialization background sample set for natural gas leak detection based on the grayscale histogram of each pixel position specifically includes: Based on the grayscale histogram of each pixel position, calculate the grayscale probability density distribution of each grayscale histogram; Determine the grayscale distribution center value of each pixel position in the grayscale space based on all grayscale probability density distributions, and use the grayscale distribution center value as the background reference value of the corresponding pixel position; Taking the background reference value of each pixel position as the center, the background grayscale tolerance range of each pixel position is determined in combination with the discreteness of the corresponding grayscale probability density distribution; The background reference value of each pixel position and the corresponding background grayscale tolerance range are integrated to obtain the initialization background sample set for natural gas leak detection.

[0008] In some embodiments, determining the foreground membership of each pixel point in each infrared video frame according to the grayscale difference relationship between the background reference value of each pixel position in the initialization background sample set and the corresponding pixel of each infrared video frame specifically includes: Calculate the grayscale difference between the grayscale value of each pixel in each infrared video frame and the background reference value of the corresponding pixel position in the initialization background sample set, and use the grayscale difference to describe the grayscale difference relationship between the background reference value and the corresponding pixel; Compare the grayscale difference of each pixel with the background grayscale tolerance range of the corresponding pixel position, and then determine the deviation degree of the grayscale value of each pixel from the background reference value; A foreground membership function is constructed, and the deviation of each pixel is input into the foreground membership function to determine the foreground membership corresponding to each pixel point, thereby obtaining the foreground membership of each pixel point in each infrared video frame.

[0009] In some embodiments, extracting the foreground identification area of ​​each infrared video frame according to the foreground membership of each pixel point in each infrared video frame specifically includes: Compare the foreground membership of each pixel in each infrared video frame with a preset membership threshold, and determine the pixel whose foreground membership is greater than the membership threshold as a foreground pixel; For each infrared video frame, the pixel points determined as foreground pixels in the infrared video frame are classified into a foreground recognition area, thereby obtaining the foreground recognition area of ​​each infrared video frame.

[0010] In some embodiments, based on the area change characteristics of the foreground recognition area between adjacent infrared video frames and the initialization background sample set, the foreground pre-recognition of the current natural gas pipeline area is performed, and the foreground pre-recognition area of ​​the natural gas leak at the current moment is obtained. Specifically, the foreground pre-recognition area includes: Calculate the area change characteristics of the foreground recognition area between adjacent infrared video frames; The initialized background sample set is updated based on all area change features to obtain a confidence background sample set for natural gas leak detection at the current moment; The foreground of the current infrared video frame of the natural gas pipeline area is recognized based on the confidence background sample set to obtain a foreground pre-recognized area of ​​the natural gas leak at the current moment.

[0011] In some embodiments, performing a pixel-level time-domain integration operation on the infrared video frame sequence to obtain a time-domain grayscale feature map of cumulative grayscale value changes in the natural gas pipeline area specifically includes: Extracting a background reference value of each pixel position in the initialization background sample set; For each pixel position of each infrared video frame in the infrared video frame sequence, calculating the absolute difference between the current grayscale value of the pixel position and the corresponding background reference value to obtain a grayscale difference time series sequence of each pixel position; Perform cumulative summation on the grayscale difference time series of each pixel position along the time axis to obtain the cumulative grayscale change of each pixel position; The cumulative grayscale changes of all pixel positions are mapped into a two-dimensional image to obtain a time-domain grayscale feature map of the cumulative grayscale value changes in the natural gas pipeline area.

[0012] In some embodiments, the natural gas pipeline area is continuously photographed by an infrared thermal imager to acquire an infrared video frame sequence of the natural gas pipeline area.

[0013] In some embodiments, the infrared video frame sequence includes infrared video frames at different time points.

[0014] In a second aspect, the present application provides an intelligent detection device for natural gas leaks, which includes a natural gas leak infrared detection unit, wherein the natural gas leak infrared detection unit includes: An acquisition module is used to acquire infrared video frame sequences of the natural gas pipeline area and to establish a corresponding grayscale histogram for each pixel position in the infrared video frame within a set time sequence range; a processing module for constructing an initialization background sample set for natural gas leak detection based on the grayscale histogram of each pixel position, and then determining the foreground membership of each pixel point in each infrared video frame based on the grayscale difference relationship between the background reference value of each pixel position in the initialization background sample set and the corresponding pixel in each infrared video frame; The processing module is further configured to extract a foreground identification area of ​​each infrared video frame based on the foreground membership of each pixel point in each infrared video frame, and then perform foreground pre-identification of the current natural gas pipeline area based on the area change characteristics of the foreground identification area between adjacent infrared video frames in combination with the initialized background sample set to obtain a foreground pre-identification area of ​​natural gas leakage at the current moment; The processing module is further configured to perform a pixel-level time-domain integration operation on the infrared video frame sequence to obtain a time-domain grayscale feature map of the cumulative change of grayscale values ​​in the natural gas pipeline area, and then generate an anti-interference mask for natural gas leak detection using the time-domain grayscale feature map; An execution module is used to perform area screening under anti-interference feature constraints on the foreground pre-identified area based on the anti-interference mask to obtain a natural gas leak detection result in the natural gas pipeline area.

[0015] In a third aspect, the present application provides a computer device, comprising a memory and a processor, wherein the memory stores a code, and the processor is configured to obtain the code and execute the above-mentioned natural gas leak infrared detection method.

[0016] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned infrared detection method for natural gas leaks is implemented.

[0017] The technical solutions provided by the embodiments disclosed in this application have the following beneficial effects: In the intelligent detection device and method for natural gas leaks provided in the present application, first, a sequence of infrared video frames of a natural gas pipeline area is collected, and a corresponding grayscale histogram is established for each pixel position in the infrared video frame within a set time sequence range; secondly, an initialization background sample set for natural gas leak detection is constructed based on the grayscale histogram of each pixel position, and then the foreground membership of each pixel point in each infrared video frame is determined according to the grayscale difference relationship between the background reference value of each pixel position in the initialization background sample set and the corresponding pixel of each infrared video frame; further, the foreground membership of each infrared video frame is extracted according to the foreground membership of each pixel point in each infrared video frame. Foreground recognition area, and then the current natural gas pipeline area is pre-identified according to the area change characteristics of the foreground recognition area between adjacent infrared video frames combined with the initialized background sample set to obtain the foreground pre-identification area of ​​natural gas leakage at the current moment; then, a pixel-level time-domain integration operation is performed on the infrared video frame sequence to obtain a time-domain grayscale feature map of the cumulative change of grayscale values ​​in the natural gas pipeline area, and then an anti-interference mask in the natural gas leak detection process is generated through the time-domain grayscale feature map; finally, based on the anti-interference mask, the foreground pre-identification area is screened under the anti-interference feature constraint to obtain the natural gas leak detection result of the natural gas pipeline area.

[0018] It can be seen that the present application can perform fine-grained identification of natural gas leaks under background noise. First, by establishing a time-series grayscale histogram for each pixel position in the natural gas pipeline area, the grayscale distribution feature capture at the pixel level is achieved, which provides basic data that fits the characteristics of each pixel itself for subsequent background modeling, avoiding the traditional global background model's neglect of individual pixel differences. Secondly, based on the grayscale histogram, the initialized background sample set is constructed, and the initialized background sample set contains the background reference value and tolerance range determined by the grayscale probability density distribution, so that the background model can adapt to the grayscale distribution law of the pixel, providing an accurate pixel-level reference for the foreground membership calculation. Furthermore, the foreground identification area is extracted through the foreground membership, and the possibility of the pixel belonging to the foreground is quantified as a continuous value rather than a binary judgment, which retains the intermediate state information and improves the fine-grainedness of the foreground area extraction. In the first step, the background samples are updated in combination with the area changes of the foreground recognition areas of adjacent frames and the foreground pre-recognition area is obtained. This effectively incorporates temporal dynamic analysis, can effectively distinguish between the continuous changes of real leaks and instantaneous interference, enhances the reliability of pre-recognition, and avoids abnormal fluctuations in pixel-level grayscale values ​​caused by environmental thermal radiation noise and infrared sensor noise; then, a temporal grayscale feature map is generated through pixel-level time domain integration, and the weak signal at the early stage of the leak is amplified by accumulating grayscale changes, while suppressing instantaneous noise, effectively accumulating the temporal characteristics of the natural gas leakage signal, and providing an effective temporal feature basis for the generation of anti-interference masks; finally, based on the anti-interference feature constraint screening of the anti-interference mask, the effective area is further focused and background noise interference is eliminated, so that the final detection result takes into account individual pixel differences, temporal dynamic changes and anti-interference capabilities, while achieving fine-grained recognition of the natural gas leakage area. In summary, the technical solution provided by this application can perform fine-grained recognition of natural gas leaks under background noise. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 This is a schematic diagram of an application scenario architecture of a natural gas leak infrared detection method according to some embodiments of the present application; Figure 2 is an exemplary flow chart of a natural gas leak infrared detection method according to some embodiments of the present application; Figure 3 is an exemplary flowchart of determining an initialization background sample set according to some embodiments of the present application; Figure 4 is a schematic structural diagram of a natural gas leak infrared detection unit according to some embodiments of the present application; Figure 5 It is a structural diagram of a computer device for implementing a natural gas leak infrared detection method according to some embodiments of the present application. DETAILED DESCRIPTION

[0020] In order to better understand the technical solution of the present application, the technical solution of the present application will be described in detail below with reference to the accompanying drawings and specific implementation methods.

[0021] refer to Figure 1 , this figure is a schematic diagram of an application scenario architecture of a natural gas leak infrared detection method according to some embodiments of the present application. The application scenario architecture includes an acquisition terminal, a communication network, and a server. The acquisition terminal and the server are directly or indirectly connected through the communication network. The acquisition terminal acquires an infrared video frame sequence of the natural gas pipeline area and uploads it to the server terminal. The server establishes a corresponding grayscale histogram for each pixel position in the infrared video frame within a set time sequence range; based on the grayscale histogram of each pixel position, an initialization background sample set for natural gas leak detection is constructed, and then the grayscale difference relationship between the background reference value of each pixel position in the initialization background sample set and the corresponding pixel of each infrared video frame is determined. The method comprises the following steps: extracting the foreground membership of each pixel in each infrared video frame according to the foreground membership of each pixel; extracting the foreground recognition area of ​​each infrared video frame according to the foreground membership of each pixel in each infrared video frame, and then performing foreground pre-identification on the current natural gas pipeline area according to the area change characteristics of the foreground recognition area between adjacent infrared video frames in combination with the initialized background sample set to obtain the foreground pre-identification area of ​​the natural gas leakage at the current moment; performing a pixel-level time-domain integration operation on the infrared video frame sequence to obtain a time-domain grayscale feature map of the cumulative change of grayscale values ​​in the natural gas pipeline area, and then generating an anti-interference mask in the natural gas leak detection process through the time-domain grayscale feature map; performing regional screening under the anti-interference feature constraint on the foreground pre-identification area based on the anti-interference mask to obtain the natural gas leakage detection result of the natural gas pipeline area.

[0022] refer to Figure 2 , which is an exemplary flow chart of a natural gas leak infrared detection method according to some embodiments of the present application. The natural gas leak infrared detection method mainly includes the following steps: In step 101, a sequence of infrared video frames of a natural gas pipeline area is collected, and a corresponding grayscale histogram is established for each pixel position in the infrared video frame within a set time sequence range.

[0023] In a specific implementation, the natural gas pipeline area can be continuously photographed by an infrared thermal imager to collect an infrared video frame sequence of the natural gas pipeline area, and the infrared video frame sequence includes infrared video frames at different time nodes.

[0024] It should be noted that the infrared video frame in this embodiment represents a single static infrared image captured by the infrared thermal imager at a fixed time interval when continuously shooting the natural gas pipeline area. The single static infrared image contains the infrared radiation information of the pipeline scene at a specified moment and is stored in the form of a grayscale or pseudo-color matrix, where the value of each pixel represents the thermal radiation intensity at that location.

[0025] In some embodiments, the following steps may be used to establish a corresponding grayscale histogram for each pixel position in the infrared video frame within a set time sequence range, namely: Setting a time sequence range for establishing a grayscale histogram, and extracting an infrared video frame sequence contained in the time sequence range; Traversing each infrared video frame in the infrared video frame sequence, and determining all pixel positions in each infrared video frame; Selecting a pixel position as a selected pixel position, extracting pixel grayscale values ​​corresponding to the selected pixel position in all infrared video frames within the time sequence range, and forming a grayscale value sequence corresponding to the selected pixel position; Counting the occurrence frequency of each gray value in the gray value sequence to generate a gray histogram corresponding to the selected pixel position; Continue to determine the grayscale histogram corresponding to the remaining pixel positions.

[0026] In specific implementation, first, the time range for establishing the grayscale histogram can be set according to actual needs. In this embodiment, the first 2 / 3 of the time range is set to establish the grayscale histogram, and the start and end frames of the time range can be adjusted according to actual detection needs (such as the potential change rate of pipeline leakage), which is not limited here, and continuous infrared video frames within the time range are extracted to obtain an infrared video frame sequence, wherein the infrared video frame sequence represents a collection of infrared video frames arranged in chronological order within the time range; secondly, the scanning algorithm in the image processing tool OpenCV is used to traverse each infrared video frame in the infrared video frame sequence, that is, by scanning the pixel matrix of the infrared video frame line by line, the pixel positions of all pixels in each infrared video frame on the two-dimensional plane are determined, and the pixel position refers to a single pixel in the infrared video frame. Coordinate value in the image coordinate system; further, select a pixel position as the selected pixel position, extract the grayscale value corresponding to the selected pixel position from each infrared video frame within the time series range, and arrange the extracted grayscale values ​​in chronological order to form a grayscale value sequence corresponding to the selected pixel position, and the grayscale value sequence represents the set of grayscale values ​​corresponding to the same pixel position in each infrared video frame within the time series range; then, use a histogram statistical algorithm to traverse the grayscale value sequence, count the number of times each grayscale value in the grayscale value sequence appears, and construct a grayscale histogram with the grayscale value as the horizontal axis and the frequency of occurrence as the vertical axis according to the counting result; finally, continue to determine the grayscale histograms corresponding to the remaining pixel positions by "counting the frequency of occurrence of each grayscale value in the grayscale value sequence to generate a grayscale histogram corresponding to the selected pixel position".

[0027] It should be noted that the grayscale histogram in this application represents a statistical graph that describes the correspondence between all grayscale values ​​of pixel positions within a set time series range and their frequency of occurrence. By establishing grayscale histograms for different pixel positions, the grayscale value distribution characteristics of each pixel within the set time series range can be accurately captured. This distribution feature can be used to distinguish whether the pixel belongs to the background or foreground (i.e., the natural gas leakage area), because the grayscale values ​​of background pixels usually present a stable distribution pattern in time series, while the grayscale values ​​of pixels in abnormal areas such as leakage will deviate from this stable pattern.

[0028] In step 102, an initialization background sample set for natural gas leak detection is constructed based on the grayscale histogram of each pixel position, and then the foreground membership of each pixel point in each infrared video frame is determined according to the background reference value of each pixel position in the initialization background sample set and the grayscale difference relationship between the corresponding pixel of each infrared video frame.

[0029] In some embodiments, reference Figure 3As shown in FIG. 1 , this figure is an exemplary flow chart for determining an initialization background sample set according to some embodiments of the present application. In this embodiment, constructing an initialization background sample set for natural gas leak detection based on the grayscale histogram of each pixel position can be implemented using the following steps: First, in step 1021, based on the grayscale histogram of each pixel position, the grayscale probability density distribution of each grayscale histogram is calculated; Next, in step 1022, the grayscale distribution center value of each pixel position in the grayscale space is determined based on all grayscale probability density distributions, and the grayscale distribution center value is used as the background reference value of the corresponding pixel position; Then, in step 1023, the background grayscale tolerance range of each pixel position is determined based on the background reference value of each pixel position and the discreteness of the corresponding grayscale probability density distribution; Finally, in step 1024, the background reference value of each pixel position and the corresponding background grayscale tolerance range are integrated to obtain an initialization background sample set for natural gas leak detection.

[0030] In the specific implementation, first, for the grayscale histogram of each pixel position, the histogram normalization method is used to divide the frequency of occurrence of each grayscale value in the grayscale histogram by the total number of pixels in the corresponding pixel position within the set time series range to obtain the probability value corresponding to each grayscale value, and then form the grayscale probability density distribution of each grayscale histogram, wherein the grayscale probability density distribution represents the distribution state of the probability of the grayscale value of a certain pixel position appearing within the set range as the grayscale value changes; secondly, for the grayscale probability density distribution corresponding to each pixel position, the weighted average algorithm is used to calculate with each grayscale value as a variable and the probability density corresponding to the grayscale value as the weight, and the result after weighted average is used as the center value of the grayscale distribution, and the center value of the grayscale distribution is used as the corresponding The background reference value of the pixel position is determined, and the background reference value represents a value that can reflect the concentrated distribution of grayscale values ​​at the pixel position under the background state. Then, the standard deviation of the grayscale probability density distribution is calculated to measure its dispersion (i.e., dispersion). The grayscale interval formed by adding or subtracting three times the standard deviation of the background reference value is determined as the background grayscale tolerance range of the corresponding pixel position, with the background reference value of each pixel position as the center. The background grayscale tolerance range represents the interval range within which the grayscale value of the pixel position is allowed to vary under normal background fluctuations. Finally, the background reference values ​​and corresponding background grayscale tolerance ranges corresponding to all pixel positions are stored according to pixel coordinates to obtain the initialization background sample set for natural gas leak detection.

[0031] It should be noted that the initialized background sample set in this application represents the sum of parameters used to describe the background characteristics of all pixels in the natural gas pipeline area in the initial state. The initialized background sample set provides a benchmark reference for the detection of natural gas leaks in infrared videos. It constructs a basic standard for distinguishing normal background from abnormal areas by quantifying the grayscale characteristics of each pixel position in the normal state (i.e., the background benchmark value) and the allowed fluctuation range (i.e., the background grayscale tolerance range). This set serves as a reference for subsequent foreground identification. By comparing the real-time pixel grayscale value with the background benchmark value and the tolerance range, it can determine whether the pixel deviates from the normal background state, thereby providing a quantitative basis for screening out foreground areas containing leaks, ensuring the consistency of the analysis of pixels at different positions in subsequent detection steps, thereby improving the accuracy and reliability of the overall detection.

[0032] In some embodiments, determining the foreground membership of each pixel in each infrared video frame according to the grayscale difference relationship between the background reference value of each pixel position in the initialization background sample set and the corresponding pixel in each infrared video frame can be achieved by the following steps, namely: Calculate the grayscale difference between the grayscale value of each pixel in each infrared video frame and the background reference value of the corresponding pixel position in the initialization background sample set, and use the grayscale difference to describe the grayscale difference relationship between the background reference value and the corresponding pixel; Compare the grayscale difference of each pixel with the background grayscale tolerance range of the corresponding pixel position, and then determine the deviation degree of the grayscale value of each pixel from the background reference value; A foreground membership function is constructed, and the deviation of each pixel is input into the foreground membership function to determine the foreground membership corresponding to each pixel point, thereby obtaining the foreground membership of each pixel point in each infrared video frame.

[0033] In the specific implementation, first, according to the background reference value of each pixel position in the initialized background sample set, a pixel-by-pixel grayscale value subtraction operation is used to calculate the grayscale difference between the grayscale value of each pixel in each infrared video frame and the corresponding background reference value. The grayscale difference represents the numerical difference between the grayscale value of the pixel in the infrared video frame and the background reference value of the pixel position in the initialized background sample set; then, the grayscale difference is compared with the background grayscale tolerance range corresponding to the pixel position. If the grayscale difference is within the background grayscale tolerance range, the deviation can be defined as the grayscale difference and the tolerance range. If the grayscale difference exceeds the background grayscale tolerance range, the deviation is defined as 1 plus the ratio of the excess part to the half-width of the tolerance range, wherein the half-width of the tolerance range is the difference between the upper limit value of the background grayscale tolerance range and the corresponding background reference value, and the deviation refers to an indicator of the degree of deviation of the pixel grayscale value relative to its background reference value; finally, a foreground membership function is constructed, and the deviation of each pixel is input into the foreground membership function to determine the foreground membership corresponding to each pixel point, thereby obtaining the foreground membership of each pixel point in each infrared video frame.

[0034] In some embodiments, a foreground membership function is constructed, and the foreground membership function is:

[0035] in, is the foreground membership, ranging from [0,1]; is the deviation of the pixel's grayscale value from the background reference value; is an adjustable parameter that controls the deviation range of membership from 0 to 1. The principle of the foreground membership function is that when the deviation When the gray value is within the background tolerance range, the pixel is considered to belong entirely to the background and the membership is 0. When the deviation exceeds 1 but does not exceed When the degree of membership increases linearly with the degree of deviation, When , the pixel is considered to belong entirely to the foreground, the membership degree is 1, and the adjustable parameter The choice needs to be adjusted according to the actual scenario and is not limited here.

[0036] It should be noted that the foreground membership in this application represents an indicator for measuring whether a pixel belongs to the foreground area of ​​a natural gas leak. In natural gas leak detection, existing technologies often use a fixed threshold or a single background model for foreground binary judgment, which is prone to missed detection or false detection due to environmental interference (such as light fluctuations and equipment noise). However, this method constructs background samples through pixel-level time-series grayscale histograms, so that the background reference value and tolerance range of each pixel are more in line with its own dynamic characteristics, achieving adaptive characterization of background fluctuations. The relative deviation degree of the grayscale value from the background reference value is further quantified through the deviation metric. The deviation is mapped to a foreground membership in the continuous interval of 0-1 in combination with the foreground membership function, rather than binary segmentation. This not only retains the intermediate state information of different deviations, but also achieves comparability of foreground membership across pixels. In particular, it has higher sensitivity to the slight grayscale changes in the early stage of a natural gas leak, forming a foreground quantification mechanism that is more suitable for the diffusion characteristics of natural gas leaks.

[0037] In step 103, the foreground identification area of ​​each infrared video frame is extracted based on the foreground membership of each pixel point in each infrared video frame, and then the foreground pre-identification of the current natural gas pipeline area is performed based on the area change characteristics of the foreground identification area between adjacent infrared video frames combined with the initialized background sample set to obtain the foreground pre-identification area of ​​the natural gas leak at the current moment.

[0038] In some embodiments, extracting the foreground identification area of ​​each infrared video frame according to the foreground membership of each pixel point in each infrared video frame can be achieved by the following steps, namely: Compare the foreground membership of each pixel in each infrared video frame with a preset membership threshold, and determine the pixel whose foreground membership is greater than the membership threshold as a foreground pixel; For each infrared video frame, the pixel points determined as foreground pixels in the infrared video frame are classified into a foreground recognition area, thereby obtaining the foreground recognition area of ​​each infrared video frame.

[0039] In a specific implementation, first, based on the foreground membership of each pixel in each infrared video frame, a threshold segmentation algorithm is used to compare the foreground membership of each pixel with a preset membership threshold (the membership threshold is determined through experimental calibration based on the typical difference characteristics between natural gas leakage and background in infrared scenes, and will not be repeated here). Pixels whose foreground membership is greater than the membership threshold in the comparison results are determined as foreground pixels. The foreground pixels represent pixels determined to belong to the foreground area of ​​the natural gas leak in a single infrared video frame. Then, for each infrared video frame, the pixels determined to be foreground pixels in the infrared video frame are classified as foreground identification areas, thereby obtaining the foreground identification areas of each infrared video frame.

[0040] It should be noted that the foreground recognition area in this application represents the image area containing natural gas leakage. In natural gas leak detection, by determining the foreground recognition area of ​​different infrared image frames, the abnormal areas existing in the infrared image can be captured frame by frame. These abnormal areas are reflected by the difference between the infrared radiation characteristics formed by temperature changes during natural gas leakage and the background area. The foreground recognition areas of multiple consecutive frames can reflect the spatial position changes, morphological evolution and range expansion trends of the abnormal areas. By tracking these dynamic information, the real natural gas leakage diffusion process can be effectively distinguished from short-term interference factors in the environment.

[0041] In some embodiments, the foreground pre-identification of the current natural gas pipeline area is performed based on the area change characteristics of the foreground identification area between adjacent infrared video frames in combination with the initialization background sample set. The foreground pre-identification area of ​​the natural gas leak at the current moment can be obtained by the following steps, namely: Calculate the area change characteristics of the foreground recognition area between adjacent infrared video frames; The initialized background sample set is updated based on all area change features to obtain a confidence background sample set for natural gas leak detection at the current moment; The foreground of the current infrared video frame of the natural gas pipeline area is recognized based on the confidence background sample set to obtain a foreground pre-recognized area of ​​the natural gas leak at the current moment.

[0042] In the specific implementation, first, for the foreground recognition area of ​​each infrared video frame, the pixel counting method is used to count the number of pixels contained in the foreground recognition area to characterize the foreground area, and then the foreground area of ​​each infrared video frame is obtained, and the foreground area difference of the foreground recognition area between adjacent infrared video frames is calculated to obtain the area change feature. The area change feature represents the degree of numerical change of the area of ​​the foreground recognition area in adjacent infrared video frames, and is used to describe the expansion, contraction or stable state of the foreground area; secondly, based on all the area change features, the initialized background sample set is updated to obtain the confidence background sample set for natural gas leak detection at the current moment, that is: variance calculation is performed on all the area change features, and the variance calculation result is used as the area change fluctuation index of the foreground area. When the area change fluctuation index is greater than the fluctuation index threshold, the fluctuation index threshold can be set according to actual needs or according to expert knowledge, and is not limited here. The area change features that are alternately extracted in the infrared video frame sequence are extracted. For pixel positions determined to be foreground background (or background foreground) (the pixel positions may have background drift), for each infrared video frame, the grayscale mean within the eight regions is used as the relative grayscale value of the extracted pixel position, and then the background reference value and background grayscale tolerance range of the extracted pixel position are re-determined by the method of determining the background reference value and background grayscale tolerance range for the pixel position in the above step 102. This method will not be repeated here, thereby obtaining a confident background sample set for natural gas leak detection at the current moment. The confident background sample set represents a background feature set that is more suitable for the current scene after adjusting the initialized background sample set. Finally, based on the confident background sample set, the pixel grayscale value of each pixel point in the current infrared video frame is compared with the background reference value and background grayscale tolerance range of the corresponding pixel position in the confident background sample set using the method of extracting the foreground recognition area of ​​the infrared video frame in the above step 103, thereby obtaining a foreground pre-recognition area of ​​the natural gas leak at the current moment.

[0043] It should be noted that the foreground pre-identification area in this application represents the area of ​​initial natural gas leakage obtained after foreground identification of the current infrared video frame based on the confidence background sample set. In natural gas leak detection, the determination of the foreground pre-identification area can preliminarily screen out suspicious areas of natural gas leakage from the infrared video stream. These areas are marked because the grayscale features deviate from the background baseline after comparing the dynamically updated confidence background sample set with the current frame. Its function is to narrow the scope of subsequent analysis and avoid indiscriminate processing of the entire infrared image frame. At the same time, this area, as an intermediate area between the original image and the final leak judgment result, can be further eliminated by performing spatiotemporal correlation analysis with the foreground identification area of ​​the historical frame, thereby providing a focused and reliable analysis object for the subsequent precise positioning of the leakage source, thereby ensuring the pertinence and accuracy of the detection process.

[0044] In step 104, a pixel-level time-domain integration operation is performed on the infrared video frame sequence to obtain a time-domain grayscale feature map of the cumulative change of grayscale values ​​in the natural gas pipeline area, and then an anti-interference mask for natural gas leak detection is generated through the time-domain grayscale feature map.

[0045] In some embodiments, performing a pixel-level temporal integration operation on the infrared video frame sequence to obtain a temporal grayscale feature map of cumulative grayscale value changes in the natural gas pipeline area can be achieved by the following steps, namely: Extracting a background reference value of each pixel position in the initialization background sample set; For each pixel position of each infrared video frame in the infrared video frame sequence, calculating the absolute difference between the current grayscale value of the pixel position and the corresponding background reference value to obtain a grayscale difference time series sequence of each pixel position; Perform cumulative summation on the grayscale difference time series of each pixel position along the time axis to obtain the cumulative grayscale change of each pixel position; The cumulative grayscale changes of all pixel positions are mapped into a two-dimensional image to obtain a time-domain grayscale feature map of the cumulative grayscale value changes in the natural gas pipeline area.

[0046] In the specific implementation, first, the background reference value of each pixel position in the initialized background sample set is extracted; secondly, for each infrared video frame in the infrared video frame sequence, the absolute difference between the current grayscale value and the corresponding background reference value of each pixel position in the infrared video frame is calculated, and the absolute difference values ​​of the same pixel position in different infrared video frames are arranged in chronological order to form a grayscale difference time series sequence of the pixel position changing with time, and then the grayscale difference time series sequence of each pixel position is obtained, and the grayscale difference time series sequence represents a sequence composed of the absolute difference between the grayscale value of each frame in the infrared video frame sequence and the corresponding background reference value of the same pixel position in chronological order; then, for each pixel position The grayscale difference time series sequence of the pixel position is obtained by traversing all the absolute differences in the grayscale difference time series sequence along the time axis using the cumulative summation algorithm and performing a sum operation. The summation result is used as the grayscale cumulative change of the pixel position, and then the grayscale cumulative change of each pixel position is obtained. The grayscale cumulative change represents the cumulative degree of grayscale change of the pixel within the time series range. Finally, the grayscale cumulative changes of all pixel positions are normalized by minimum and maximum normalization, and the coordinate mapping technology is used to spatially arrange the normalized grayscale cumulative changes of all pixel positions according to their two-dimensional coordinates in the infrared video frame to obtain the time domain grayscale feature map of the cumulative change of grayscale values ​​in the natural gas pipeline area.

[0047] It should be noted that the temporal grayscale feature map in this application represents the cumulative variation characteristics of grayscale values ​​within a natural gas pipeline area within a set time series range. In natural gas leak detection, existing technologies often rely on single-frame grayscale differences or limited inter-frame differences for analysis. These analyses are susceptible to interference from transient noise, environmental fluctuations, and other factors, making it difficult to capture the subtle and persistent grayscale variations caused by the slow diffusion of a natural gas leak in its early stages. However, this method, through pixel-level temporal integration, accumulates the absolute difference between the grayscale value at each pixel position and its own background baseline along the time axis. The resulting cumulative variation not only preserves spatial pixel position information but also concentrates on the characteristics of continuous temporal variation, avoiding the lack of adaptability caused by the traditional fixed global background. Furthermore, the integration and accumulation amplifies persistent grayscale anomalies in the leak region (grayscale differences in the leak region accumulate over time due to continuous heat release or gas diffusion). This overcomes the shortcomings of existing technologies, such as low sensitivity to slow leak signals and weak resistance to transient interference, enabling the feature map to accurately locate persistent anomaly areas while effectively suppressing random noise, providing a more robust spatiotemporal fusion feature basis for subsequent leak identification.

[0048] In some embodiments, generating an anti-interference mask in a natural gas leak detection process using the time-domain grayscale feature map may be achieved by using the following steps, namely: Determine the segmentation threshold in the natural gas leak detection process according to the grayscale cumulative change of all pixels in the time domain grayscale feature map; Comparing the grayscale cumulative change of each pixel in the temporal grayscale feature map with the segmentation threshold, marking pixels whose grayscale value is greater than the segmentation threshold as foreground candidate areas, and marking pixels whose grayscale value is less than or equal to the segmentation threshold as background areas, thereby obtaining a segmentation result of the temporal grayscale feature map; An anti-interference mask for natural gas leak detection is constructed according to the segmentation result.

[0049] In the specific implementation, first, based on the grayscale cumulative change of all pixels in the time domain grayscale feature map, the maximum inter-class variance method is used to calculate the optimal segmentation threshold. The maximum inter-class variance method traverses all grayscale cumulative change values, calculates the inter-class variance when the corresponding value divides the pixels into two categories, and selects the grayscale cumulative change with the largest inter-class variance as the segmentation threshold. The segmentation threshold represents the critical value of the grayscale cumulative change used to distinguish the natural gas leakage area from the normal background area in the time domain grayscale feature map; secondly, the pixel-by-pixel comparison method is used to compare the grayscale cumulative change of each pixel in the time domain grayscale feature map with the segmentation threshold one by one, and the pixel whose grayscale cumulative change is greater than the segmentation threshold is marked as the natural gas leakage area (i.e., the foreground candidate area). Pixels whose grayscale cumulative change is less than or equal to the segmentation threshold are marked as belonging to the normal background area (i.e., the background area), thereby forming a binary labeling result (i.e., the segmentation result) consisting of a foreground candidate area and a background area. The foreground candidate area represents a pixel area preliminarily determined to be a natural gas leak, and the background area represents a pixel area determined to be a normal background. The segmentation result represents a binary image consisting of the foreground candidate area and the background area. Finally, based on the segmentation result, a binary image construction method is adopted to set the pixel positions corresponding to the foreground candidate area as the valid area of ​​the anti-interference mask (represented by a value of 1), and the pixel positions corresponding to the background area are set as the invalid area of ​​the anti-interference mask (represented by a value of 0), thereby forming an anti-interference mask for the natural gas leak detection process.

[0050] It should be noted that the anti-interference mask in this application refers to a binary image used to mask normal background areas and retain natural gas leak areas in natural gas leak detection. Existing techniques for natural gas leak detection often use fixed area masks or static masks generated based on single-frame image features. These masks are difficult to adapt to the dynamic changes of interference factors in complex scenes, easily resulting in valid leak areas being mistakenly masked or interference areas not being eliminated. This method, however, generates an anti-interference mask based on a temporal grayscale feature map. By capturing the cumulative temporal changes in pixel grayscale values, it dynamically targets areas where the cumulative grayscale change exceeds a threshold (i.e., potential leaks or persistent interference areas) and constructs a mask based on this. This method uniquely exploits the temporal cumulative nature of grayscale changes in leak areas, and the temporal characteristics of static interference and transient noise. This allows the mask to retain true leak candidates with persistent abnormal changes while masking background areas without cumulative changes. This avoids missed detections or redundant calculations caused by the lack of scene adaptability of traditional static masks, thus forming an adaptive anti-interference mechanism that matches the dynamic characteristics of leaks.

[0051] In step 105, region screening under anti-interference feature constraints is performed on the foreground pre-identified region based on the anti-interference mask to obtain a natural gas leak detection result for the natural gas pipeline region.

[0052] In some embodiments, performing region screening under anti-interference feature constraints on the foreground pre-identified region based on the anti-interference mask to obtain a natural gas leak detection result for the natural gas pipeline region can be achieved by the following steps, namely: Mapping each pixel position in the foreground pre-identification area to a corresponding pixel position of the anti-interference mask; According to the identification value of each pixel position in the anti-interference mask, determining whether the corresponding pixel position in the foreground pre-identification area belongs to a valid identification value; Retain pixel positions in the foreground pre-identification area that have valid identification values ​​to form a set of valid leakage areas after anti-interference constraints; The effective leakage area set is used as the natural gas leakage detection result of the natural gas pipeline area.

[0053] In the specific implementation, first, the coordinate mapping technology is used to associate the two-dimensional coordinates of each pixel in the foreground pre-identification area with the pixels at the same coordinate position in the anti-interference mask in a one-to-one correspondence to ensure the precise matching of the two areas in spatial position, that is, each pixel position in the foreground pre-identification area is mapped to the corresponding pixel position of the anti-interference mask, wherein mapping refers to establishing a correspondence between the foreground pre-identification area and the pixels at the same spatial position in the anti-interference mask through coordinate matching; secondly, based on the identification value of each pixel position in the anti-interference mask (0 represents an invalid area and 1 represents a valid area), the identification value corresponding to each pixel position in the foreground pre-identification area in the anti-interference mask is checked one by one, and the identification value is judged. The method further comprises the following steps: determining whether the pixel at the pixel position belongs to a valid identification value marked as needing to be retained (i.e., an area with an identification value of 1), wherein the valid identification value represents the pixel identification value used to mark the valid area in the anti-interference mask; then, the existing area merging algorithm is used to spatially aggregate all pixel positions in the foreground pre-identification area that are determined to belong to the valid identification value, and eliminate pixels that do not belong to the valid identification value, thereby obtaining a set of valid leakage areas after anti-interference constraints, wherein the set of valid leakage areas represents the entire area composed of pixel positions with valid identification values ​​retained in the foreground pre-identification area after screening by the anti-interference mask; finally, the set of valid leakage areas is used as the natural gas leakage detection result of the natural gas pipeline area.

[0054] It should be noted that the natural gas leak detection result in this application represents the specific area information of the natural gas pipeline area where the leak exists, which is finally determined after the area screening under the anti-interference feature constraint; the anti-interference feature constraint in this application refers to a mechanism for restricting and regulating the foreground pre-identification area based on the feature information contained in the anti-interference mask during the area screening process of natural gas leak detection. Its core is to use the regional features divided by the valid identification values ​​and invalid identification values ​​marked in the anti-interference mask, and constrain the screening range to only retain the pixel positions corresponding to the valid identification value area of ​​the mask in the foreground pre-identification area, and exclude the pixel positions corresponding to the invalid identification values, thereby eliminating background interference and non-target areas, ensuring that the final screened area focuses on the effective range where the natural gas leak exists. In essence, it is to filter the interference information and accurately lock the effective area through the feature definition of the mask.

[0055] In addition, in another aspect of the present application, in some embodiments, the present application provides an intelligent detection device for natural gas leakage, the device including a natural gas leakage infrared detection unit, Figure 4 This figure is a schematic diagram of the structure of a natural gas leak infrared detection unit according to some embodiments of the present application. The natural gas leak infrared detection unit includes: an acquisition module 201, a processing module 202 and an execution module 203, which are described as follows: The acquisition module 201 in this application is mainly used to acquire infrared video frame sequences of the natural gas pipeline area and establish a corresponding grayscale histogram for each pixel position in the infrared video frame within a set time sequence range; Processing module 202, in the present application, is mainly used to construct an initialization background sample set for natural gas leak detection based on the grayscale histogram of each pixel position, and then determine the foreground membership of each pixel point in each infrared video frame based on the grayscale difference relationship between the background reference value of each pixel position in the initialization background sample set and the corresponding pixel of each infrared video frame; The processing module 202 is further configured to extract a foreground identification area of ​​each infrared video frame based on the foreground membership of each pixel point in each infrared video frame, and then perform foreground pre-identification of the current natural gas pipeline area based on the area change characteristics of the foreground identification areas between adjacent infrared video frames in combination with the initialized background sample set to obtain a foreground pre-identification area of ​​natural gas leakage at the current moment; In addition, the processing module 202 is further configured to perform a pixel-level time-domain integration operation on the infrared video frame sequence to obtain a time-domain grayscale feature map of the cumulative change of grayscale values ​​in the natural gas pipeline area, and then generate an anti-interference mask for natural gas leak detection using the time-domain grayscale feature map; The execution module 203 in this application is mainly used to perform area screening under anti-interference feature constraints on the foreground pre-identified area based on the anti-interference mask to obtain a natural gas leak detection result in the natural gas pipeline area.

[0056] In addition, the present application also provides a computer device, which includes a memory and a processor, wherein the memory stores a code, and the processor is configured to obtain the code and execute the above-mentioned natural gas leak infrared detection method.

[0057] In some embodiments, reference Figure 5 , which is a schematic diagram of the structure of a computer device for implementing a natural gas leak infrared detection method according to some embodiments of the present application. The natural gas leak infrared detection method in the above embodiment can be Figure 5 The computer device shown in FIG3 is implemented as shown in FIG3 , which includes at least one processor 301 , a communication bus 302 , a memory 303 and at least one communication interface 304 .

[0058] The processor 301 may be a general-purpose central processing unit (CPU), or an application-specific integrated circuit (ASIC) or one or more processors for controlling the execution of the natural gas leak infrared detection method of the present application.

[0059] The communication bus 302 may be used to transmit information between the aforementioned components.

[0060] Memory 303 may be, but is not limited to, a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, a random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, an optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), a magnetic disk or other magnetic storage device, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer. Memory 303 may be independent and connected to processor 301 via communication bus 302. Memory 303 may also be integrated with processor 301.

[0061] Memory 303 is used to store program code for implementing the present invention, and is controlled by processor 301 for execution. Processor 301 is configured to execute the program code stored in memory 303. The program code may include one or more software modules. The determination of the infrared natural gas leak detection method in the above embodiment can be implemented by processor 301 and one or more software modules in the program code stored in memory 303.

[0062] The communication interface 304 uses any device such as a transceiver to communicate with other devices or communication networks, such as Ethernet, radio access network (RAN), wireless local area network (WLAN), etc.

[0063] In a specific implementation, as an example, a computer device may include multiple processors, each of which may be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. A processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).

[0064] The aforementioned computer device can be a general-purpose computer device or a dedicated computer device. In a specific implementation, the computer device can be a desktop computer, a portable computer, a network server, a personal digital assistant (PDA), a mobile phone, a tablet computer, a wireless terminal device, a communication device, or an embedded device. The embodiments of this application do not limit the type of computer device.

[0065] In addition, the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the above-mentioned natural gas leak infrared detection method.

[0066] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present application.

[0067] Obviously, those skilled in the art may make various changes and modifications to this application without departing from the spirit and scope of this application. Thus, if these modifications and variations of this application fall within the scope of the claims of this application and their equivalents, this application is intended to include these modifications and variations.

Claims

1. A natural gas leak infrared detection method, used for natural gas leak intelligent detection device to perform infrared detection of natural gas leaks, characterized in that: The method comprises the following steps: Collect infrared video frame sequences of the natural gas pipeline area and create a corresponding grayscale histogram for each pixel position in the infrared video frame within a set time range; An initialization background sample set for natural gas leak detection is constructed based on the grayscale histogram of each pixel position, and the foreground membership of each pixel point in each infrared video frame is determined based on the grayscale difference relationship between the background reference value of each pixel position in the initialization background sample set and the corresponding pixel of each infrared video frame; Extracting the foreground identification area of ​​each infrared video frame based on the foreground membership of each pixel point in each infrared video frame, and then performing foreground pre-identification of the current natural gas pipeline area based on the area change characteristics of the foreground identification area between adjacent infrared video frames in combination with the initialized background sample set to obtain the foreground pre-identification area of ​​the natural gas leak at the current moment; Performing a pixel-level time-domain integration operation on the infrared video frame sequence to obtain a time-domain grayscale feature map of cumulative grayscale value changes in the natural gas pipeline area, and then generating an anti-interference mask for natural gas leak detection using the time-domain grayscale feature map; Based on the anti-interference mask, region screening is performed on the foreground pre-identified region under anti-interference feature constraints to obtain a natural gas leak detection result for the natural gas pipeline region.

2. The method according to claim 1, wherein The method of establishing a corresponding grayscale histogram for each pixel position in the infrared video frame within a set time sequence range specifically includes: Setting a time sequence range for establishing a grayscale histogram, and extracting an infrared video frame sequence contained in the time sequence range; Traversing each infrared video frame in the infrared video frame sequence, and determining all pixel positions in each infrared video frame; Selecting a pixel position as a selected pixel position, extracting pixel grayscale values ​​corresponding to the selected pixel position in all infrared video frames within the time sequence range, and forming a grayscale value sequence corresponding to the selected pixel position; Counting the occurrence frequency of each gray value in the gray value sequence to generate a gray histogram corresponding to the selected pixel position; Continue to determine the grayscale histogram corresponding to the remaining pixel positions.

3. The method according to claim 1, wherein The initialization background sample set for natural gas leak detection based on the grayscale histogram of each pixel position specifically includes: Based on the grayscale histogram of each pixel position, calculate the grayscale probability density distribution of each grayscale histogram; Determine the grayscale distribution center value of each pixel position in the grayscale space based on all grayscale probability density distributions, and use the grayscale distribution center value as the background reference value of the corresponding pixel position; Taking the background reference value of each pixel position as the center, the background grayscale tolerance range of each pixel position is determined in combination with the discreteness of the corresponding grayscale probability density distribution; The background reference value of each pixel position and the corresponding background grayscale tolerance range are integrated to obtain the initialization background sample set for natural gas leak detection.

4. The method according to claim 1, wherein Determining the foreground membership of each pixel point in each infrared video frame according to the grayscale difference relationship between the background reference value of each pixel position in the initialization background sample set and the corresponding pixel of each infrared video frame specifically includes: Calculate the grayscale difference between the grayscale value of each pixel in each infrared video frame and the background reference value of the corresponding pixel position in the initialization background sample set, and use the grayscale difference to describe the grayscale difference relationship between the background reference value and the corresponding pixel; Compare the grayscale difference of each pixel with the background grayscale tolerance range of the corresponding pixel position, and then determine the deviation degree of the grayscale value of each pixel from the background reference value; A foreground membership function is constructed, and the deviation of each pixel is input into the foreground membership function to determine the foreground membership corresponding to each pixel point, thereby obtaining the foreground membership of each pixel point in each infrared video frame.

5. The method according to claim 1, wherein Extracting the foreground identification area of ​​each infrared video frame according to the foreground membership of each pixel point in each infrared video frame specifically includes: Compare the foreground membership of each pixel in each infrared video frame with a preset membership threshold, and determine the pixel whose foreground membership is greater than the membership threshold as a foreground pixel; For each infrared video frame, the pixel points determined as foreground pixels in the infrared video frame are classified into a foreground recognition area, thereby obtaining the foreground recognition area of ​​each infrared video frame.

6. The method according to claim 1, wherein Based on the area change characteristics of the foreground recognition area between adjacent infrared video frames and the initialization background sample set, the foreground pre-recognition of the current natural gas pipeline area is performed, and the foreground pre-recognition area of ​​the natural gas leakage at the current moment is obtained. Specifically, it includes: Calculate the area change characteristics of the foreground recognition area between adjacent infrared video frames; The initialized background sample set is updated based on all area change features to obtain a confidence background sample set for natural gas leak detection at the current moment; The foreground of the current infrared video frame of the natural gas pipeline area is recognized based on the confidence background sample set to obtain a foreground pre-recognized area of ​​the natural gas leak at the current moment.

7. The method according to claim 1, wherein Performing a pixel-level time-domain integration operation on the infrared video frame sequence to obtain a time-domain grayscale feature map of the cumulative change of grayscale values ​​in the natural gas pipeline area specifically includes: Extracting a background reference value of each pixel position in the initialization background sample set; For each pixel position of each infrared video frame in the infrared video frame sequence, calculating the absolute difference between the current grayscale value of the pixel position and the corresponding background reference value to obtain a grayscale difference time series sequence of each pixel position; Perform cumulative summation on the grayscale difference time series of each pixel position along the time axis to obtain the cumulative grayscale change of each pixel position; The cumulative grayscale changes of all pixel positions are mapped into a two-dimensional image to obtain a time-domain grayscale feature map of the cumulative grayscale value changes in the natural gas pipeline area.

8. The method according to claim 1, wherein The natural gas pipeline area is continuously photographed by an infrared thermal imager to acquire an infrared video frame sequence of the natural gas pipeline area.

9. The method according to claim 1, wherein The infrared video frame sequence includes infrared video frames at different time nodes.

10. An intelligent detection device for natural gas leaks, comprising a natural gas leak infrared detection unit, characterized in that: The natural gas leak infrared detection unit comprises: An acquisition module is used to acquire infrared video frame sequences of the natural gas pipeline area and to establish a corresponding grayscale histogram for each pixel position in the infrared video frame within a set time sequence range; a processing module for constructing an initialization background sample set for natural gas leak detection based on the grayscale histogram of each pixel position, and then determining the foreground membership of each pixel point in each infrared video frame based on the grayscale difference relationship between the background reference value of each pixel position in the initialization background sample set and the corresponding pixel in each infrared video frame; The processing module is further configured to extract a foreground identification area of ​​each infrared video frame based on the foreground membership of each pixel point in each infrared video frame, and then perform foreground pre-identification of the current natural gas pipeline area based on the area change characteristics of the foreground identification area between adjacent infrared video frames in combination with the initialized background sample set to obtain a foreground pre-identification area of ​​natural gas leakage at the current moment; The processing module is further configured to perform a pixel-level time-domain integration operation on the infrared video frame sequence to obtain a time-domain grayscale feature map of the cumulative change of grayscale values ​​in the natural gas pipeline area, and then generate an anti-interference mask for natural gas leak detection using the time-domain grayscale feature map; An execution module is used to perform area screening under anti-interference feature constraints on the foreground pre-identified area based on the anti-interference mask to obtain a natural gas leak detection result in the natural gas pipeline area.

Citation Information

Patent Citations

  • Multi-temporal unmanned aerial vehicle video image change area detection and classification method

    CN111079556A

  • Valve cooling system pipeline leakage visual detection method, computer and storage medium

    CN114782734A

  • Gas leakage infrared imaging automatic alarm method

    CN115966063A

  • Petrochemical leakage video monitoring identification method

    CN117037047A

  • Non-refrigeration infrared video sequence hazardous gas imaging leakage detection method

    CN117788466A