Intelligent detection device and method for natural gas leakage
By acquiring infrared video frame sequences in the natural gas pipeline area, establishing a grayscale histogram and initializing a background sample set, extracting foreground membership, and generating an anti-interference mask, the problem of fine-grained identification of natural gas leaks under background noise was solved, and efficient identification of natural gas leaks was achieved.
Patent Information
- Application Number
- CN202511232212.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-01
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2045-09-01
AI Technical Summary
Existing natural gas leak detection technologies struggle to achieve fine-grained identification under background noise. Environmental thermal radiation noise and infrared sensor noise interference cause even minor leaks to be easily masked by background noise, making it impossible to effectively identify leaks in natural gas pipelines.
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 recognition area is extracted based on the foreground membership degree, and an anti-interference mask is generated by combining the area change features of adjacent frames. Pixel-level temporal integration is then performed to screen out the natural gas leak area.
It enables fine-grained identification of natural gas leaks under background noise, effectively distinguishing between real leaks and transient interference, enhancing the reliability and accuracy of detection, and is able to identify weak signals in environmental noise.
Smart Images

Figure CN120740863B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of natural gas leakage detection, and more particularly to an intelligent detection device and method for natural gas leakage. BACKGROUND
[0002] Natural gas, as an important energy source, 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 been expanding. However, due to factors such as aging, corrosion, and human damage, leakage events of natural gas pipelines occur frequently. The economic loss caused by natural gas leakage worldwide reaches billions of dollars every year. Once natural gas leaks, it not only leads to energy waste, but also seriously threatens life and property safety and environmental stability, and easily causes fires, explosions and other accidents. Therefore, it is urgent to develop efficient and accurate natural gas leakage detection technology.
[0003] In the existing natural gas leakage detection, natural gas leakage detection is mainly based on the change of physical or chemical characteristics caused by leakage. For example, a sensor is used to capture abnormal fluctuations in the concentration of methane in the leaked gas. When the concentration exceeds the set threshold, an alarm is triggered. In addition, an acoustic device is used to identify the frequency sound waves generated by the friction between high-speed gas flow and the pipeline during leakage to achieve non-contact detection. In addition, an infrared imaging technology is used to capture the light intensity attenuation image of the leakage area according to the absorption characteristics of methane to the specific band infrared light to intuitively locate the leakage point. However, in the infrared detection of natural gas leakage, environmental thermal radiation noise (such as sunlight reflection and ground heat dissipation) and infrared sensor noise will cause abnormal fluctuations in the pixel-level gray value. These interference features have similarities with the infrared features of real natural gas leakage in a short time domain. The existing natural gas leakage detection only relies on the difference between adjacent frames and cannot effectively accumulate the time sequence features of the natural gas leakage signal. Therefore, small leaks are easily overwhelmed by background noise, making it impossible to identify natural gas leakage in natural gas pipelines in detail. Therefore, how to identify natural gas leakage in detail under background noise has become a difficult problem in the industry. SUMMARY
[0004] The present application provides an intelligent detection device and method for natural gas leakage, which can identify natural gas leakage in detail under background noise.
[0005] In a first aspect, the present application provides a natural gas leakage infrared detection method for an intelligent detection device for natural gas leakage to perform infrared detection of natural gas leakage. The method comprises the following steps:
[0006] An infrared video frame sequence of a natural gas pipeline area is collected, and a corresponding gray histogram is established for each pixel position in the infrared video frame within a set time sequence range;
[0007] constructing an initialization background sample set for natural gas leakage detection based on the gray scale histogram of each pixel position, and then determining the foreground membership of each pixel point in each infrared video frame according to the gray scale difference relationship between the background reference value of each pixel position in the initialization background sample set and the gray scale of the corresponding pixel of each infrared video frame;
[0008] extracting a foreground recognition area of each infrared video frame according to the foreground membership of each pixel point in each infrared video frame, and then performing foreground pre-recognition on the current natural gas pipeline region according to the area change characteristics of the foreground recognition areas between adjacent infrared video frames in combination with the initialization background sample set to obtain a foreground pre-recognition area of the natural gas leakage at the current time;
[0009] performing a pixel-level time domain integration operation on the sequence of infrared video frames to obtain a time domain gray scale feature map of the gray scale cumulative change in the natural gas pipeline region, and then generating an anti-interference mask in the natural gas leakage detection process through the time domain gray scale feature map;
[0010] performing region screening under anti-interference feature constraint on the foreground pre-recognition area based on the anti-interference mask to obtain a natural gas leakage detection result of the natural gas pipeline region.
[0011] In some embodiments, establishing a corresponding gray scale histogram for each pixel position in the infrared video frame within a set time sequence range specifically includes:
[0012] setting a time sequence range for establishing a gray scale histogram, and extracting a sequence of infrared video frames contained in the time sequence range;
[0013] traversing each infrared video frame in the sequence of infrared video frames to determine all pixel positions in each infrared video frame;
[0014] selecting a pixel position as a selected pixel position, extracting the pixel gray scale values corresponding to the selected pixel position in all infrared video frames within the time sequence range to form a gray scale value sequence corresponding to the selected pixel position;
[0015] counting the occurrence frequency of each gray scale value in the gray scale value sequence to generate a gray scale histogram corresponding to the selected pixel position;
[0016] continuing to determine the gray scale histogram corresponding to the remaining pixel positions.
[0017] In some embodiments, constructing an initialization background sample set for natural gas leakage detection based on the gray scale histogram of each pixel position specifically includes:
[0018] calculating the gray scale probability density distribution of each gray scale histogram based on the gray scale histogram of each pixel position;
[0019] determining a gray scale distribution center value of each pixel position in the gray scale space according to all the gray scale probability density distributions, and taking the gray scale distribution center value as a background reference value of the corresponding pixel position;
[0020] centering on the background reference value of each pixel position, combining the dispersion of the corresponding gray scale probability density distribution to determine a background gray scale tolerance range of each pixel position;
[0021] integrating the background reference value of each pixel position and the corresponding background gray scale tolerance range to obtain an initialization background sample set in natural gas leakage detection.
[0022] In some embodiments, determining the foreground membership of each pixel point in each infrared video frame according to the gray scale difference relationship between the background reference value of each pixel position in the initialization background sample set and the gray scale of the corresponding pixel of each infrared video frame specifically comprises:
[0023] calculating the gray scale difference value between the gray scale 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 describing the gray scale difference relationship between the background reference value and the corresponding pixel by the gray scale difference value;
[0024] comparing the gray scale difference value of each pixel with the background gray scale tolerance range of the corresponding pixel position, and then determining the deviation degree of the gray scale value of each pixel from the background reference value;
[0025] constructing a foreground membership function, and inputting the deviation degree of each pixel into the foreground membership function to determine the corresponding foreground membership of each pixel point, and then obtaining the foreground membership of each pixel point in each infrared video frame.
[0026] In some embodiments, extracting the foreground recognition area of each infrared video frame according to the foreground membership of each pixel point in each infrared video frame specifically comprises:
[0027] comparing the foreground membership of each pixel point in each infrared video frame with a preset membership threshold, and determining the pixel point whose foreground membership is greater than the membership threshold as a foreground pixel;
[0028] For each infrared video frame, the pixel points determined as foreground pixels in the infrared video frame are classified into a foreground recognition area, and then the foreground recognition area of each infrared video frame is obtained.
[0029] In some embodiments, according to the area change characteristics of the foreground recognition area between adjacent infrared video frames, combining the initialization background sample set to pre-recognize the foreground of the current natural gas pipeline area, and obtaining the foreground pre-recognized area of the current natural gas leakage specifically comprises:
[0030] Calculate the area change feature of the foreground recognition area between adjacent infrared video frames;
[0031] Update the initialization background sample set based on all the area change features to obtain a confidence background sample set for natural gas leakage detection at the current time;
[0032] Perform foreground recognition on the current infrared video frame of the natural gas pipeline area according to the confidence background sample set to obtain a foreground pre-recognition area of natural gas leakage at the current time.
[0033] In some embodiments, performing a pixel-level time-domain integration operation on the sequence of infrared video frames to obtain a time-domain grayscale feature map of the cumulative change in grayscale value in the natural gas pipeline area specifically includes:
[0034] Extract the background reference value of each pixel position in the initialization background sample set;
[0035] For each pixel position of each infrared video frame in the sequence of infrared video frames, calculate the absolute difference between the current grayscale value of the pixel position and the corresponding background reference value to obtain a grayscale difference time sequence for each pixel position;
[0036] Perform an accumulation sum operation on the grayscale difference time sequence of each pixel position along the time axis to obtain the cumulative change amount of grayscale for each pixel position;
[0037] Map the cumulative change amount of grayscale for all pixel positions to a two-dimensional image to obtain a time-domain grayscale feature map of the cumulative change in grayscale value in the natural gas pipeline area.
[0038] In some embodiments, the natural gas pipeline area is continuously photographed by an infrared thermal imager to collect a sequence of infrared video frames of the natural gas pipeline area.
[0039] In some embodiments, the sequence of infrared video frames includes infrared video frames at different time nodes.
[0040] In a second aspect, the present application provides an intelligent detection device for natural gas leakage, which includes a natural gas leakage infrared detection unit, and the natural gas leakage infrared detection unit includes:
[0041] The acquisition module is configured to collect a sequence of infrared video frames of the natural gas pipeline area and establish a corresponding grayscale histogram for each pixel position in the infrared video frames within a set time range;
[0042] The processing module is configured to construct an initial background sample set for natural gas leakage detection based on a gray scale histogram of each pixel position, and then determine a foreground membership of each pixel point in each infrared video frame based on a difference between a background reference value of each pixel position in the initial background sample set and a gray scale of a corresponding pixel of each infrared video frame.
[0043] The processing module is further configured to extract a foreground recognition area of each infrared video frame according to the foreground membership of each pixel point in each infrared video frame, and then perform foreground pre-recognition on a current natural gas pipeline region based on an area change feature of the foreground recognition area between adjacent infrared video frames and the initial background sample set, to obtain a foreground pre-recognition area of natural gas leakage at a current time.
[0044] The processing module is further configured to perform a pixel-level time-domain integration operation on the sequence of infrared video frames to obtain a time-domain gray scale feature map of a cumulative change in a gray scale value in the natural gas pipeline region, and then generate an anti-interference mask in a natural gas leakage detection process through the time-domain gray scale feature map.
[0045] The execution module is configured to perform region screening under anti-interference feature constraint on the foreground pre-recognition area based on the anti-interference mask, to obtain a natural gas leakage detection result of the natural gas pipeline region.
[0046] In a third aspect, a computer device is provided, which includes a memory and a processor. The memory stores a code. The processor is configured to acquire the code and execute the natural gas leakage infrared detection method described above.
[0047] In a fourth aspect, a computer readable storage medium is provided, which stores a computer program. The computer program is executed by a processor to implement the natural gas leakage infrared detection method described above.
[0048] The technical scheme provided by the embodiments of the present application has the following beneficial effects:
[0049] The intelligent detection device and method for natural gas leakage provided by the application first collect an infrared video frame sequence of a natural gas pipeline area, and establish a corresponding gray level histogram for each pixel position in the infrared video frame within a set timing range; secondly, an initialization background sample set for natural gas leakage detection is constructed based on the gray level histogram of each pixel position, and then the background reference value of each pixel position in the initialization background sample set and the gray level difference relationship of the corresponding pixels of each infrared video frame are used to determine the foreground membership of each pixel point in each infrared video frame; further, the foreground recognition area of each infrared video frame is extracted according to the foreground membership of each pixel point in each infrared video frame, and then the current natural gas pipeline area is pre-recognized according to the area change characteristics of the foreground recognition area between adjacent infrared video frames in combination with the initialization background sample set, to obtain the foreground pre-recognized area of the natural gas leakage at the current time; then, a pixel-level time domain integration operation is performed on the infrared video frame sequence to obtain a time domain gray level feature map of the gray level cumulative change in the natural gas pipeline area, and then an anti-interference mask in the natural gas leakage detection process is generated through the time domain gray level feature map; finally, the anti-interference feature constraint region screening is performed on the foreground pre-recognized area based on the anti-interference mask, to obtain the natural gas leakage detection result of the natural gas pipeline area.
[0050] It can be seen that the application can perform fine-grained identification of natural gas leakage under background noise. First, by establishing a time sequence gray histogram for each pixel position in the natural gas pipeline area, the pixel-level gray distribution feature is captured, which provides basic data that fits the characteristics of each pixel itself for subsequent background modeling, avoiding the neglect of individual differences of pixels by traditional global background model. Second, based on the initialization background sample set constructed by the gray histogram, the initialization background sample set contains the background reference value and tolerance range determined by the gray probability density distribution, so that the background model can adapt to the gray distribution law of the pixel, and provide accurate pixel-level reference for foreground membership calculation. Further, the foreground recognition area is extracted by foreground membership, which quantifies the possibility of pixels belonging to the foreground as a continuous value rather than a binary judgment, retains the intermediate state information, and improves the fine granularity of foreground area extraction. Further, the background sample is updated by combining the area change of the adjacent frame foreground recognition area to obtain the foreground pre-recognition area, which effectively integrates the time sequence dynamic analysis, can effectively distinguish the continuous change of real leakage from the instantaneous interference, enhances the reliability of pre-recognition, and avoids the abnormal fluctuation of pixel-level gray value caused by environmental thermal radiation noise and infrared sensor noise. Then, the time domain gray feature map is generated by pixel-level time domain integration, which amplifies the weak signal in the early stage of leakage by accumulating gray change, suppresses the instantaneous noise, effectively accumulates the time sequence characteristics of natural gas leakage signal, and provides effective time sequence characteristic basis for anti-interference mask generation. Finally, based on the anti-interference feature constraint screening of the anti-interference mask, the effective area is further focused, and the background noise interference is removed, so that the final detection result can consider the individual differences of pixels, time sequence dynamic change and anti-interference ability at the same time, and realize fine-grained identification of natural gas leakage area. In summary, the technical scheme provided by the application can perform fine-grained identification of natural gas leakage under background noise. BRIEF DESCRIPTION OF DRAWINGS
[0051] Figure 1 is an application scenario architecture schematic diagram of a natural gas leakage infrared detection method according to some embodiments of the application;
[0052] Figure 2 is an example flowchart of a natural gas leakage infrared detection method according to some embodiments of the application;
[0053] Figure 3 is an example flowchart of determining an initialization background sample set according to some embodiments of the application;
[0054] Figure 4 is a structure schematic diagram of a natural gas leakage infrared detection unit according to some embodiments of the application;
[0055] Figure 5FIG. 1 is a structural schematic diagram of a computer device for implementing a natural gas leakage infrared detection method according to some embodiments of the present application. DETAILED DESCRIPTION
[0056] In order to better understand the technical solutions of the present application, the technical solutions of the present application will be described in detail below in combination with the drawings of the specification and specific embodiments.
[0057] Reference Figure 1 FIG. 1 is a structural schematic diagram of a computer device for implementing a natural gas leakage infrared detection method according to some embodiments of the present application. The application scenario architecture of the natural gas leakage infrared detection method includes a collection terminal, a communication network and a server end. The collection terminal and the server end are directly or indirectly connected through the communication network. The collection terminal collects a sequence of infrared video frames of a natural gas pipeline area and uploads them to the server terminal. The server end establishes a corresponding gray level histogram for each pixel position in the infrared video frames within a set time range. An initialization background sample set for natural gas leakage detection is constructed based on the gray level histograms of each pixel position. Then, the background reference values of each pixel position in the initialization background sample set and the gray level differences of the corresponding pixels of each infrared video frame are used to determine the foreground membership of each pixel point in each infrared video frame. The foreground recognition area of each infrared video frame is extracted according to the foreground membership of each pixel point in each infrared video frame. Then, the initialization background sample set is used to pre-recognize the foreground of the current natural gas pipeline area according to the area change characteristics of the foreground recognition areas between adjacent infrared video frames, to obtain the foreground pre-recognition area of the natural gas leakage at the current time. A pixel-level time domain integration operation is performed on the sequence of infrared video frames to obtain a time domain gray level feature map of the gray level cumulative change in the natural gas pipeline area. Then, an anti-interference mask in the natural gas leakage detection process is generated through the time domain gray level feature map. Based on the anti-interference mask, region screening under anti-interference feature constraint is performed on the foreground pre-recognition area to obtain the natural gas leakage detection result of the natural gas pipeline area.
[0058] Reference Figure 2 FIG. 2 is an exemplary flowchart of a natural gas leakage infrared detection method according to some embodiments of the present application. The natural gas leakage infrared detection method mainly includes the following steps:
[0059] In step 101, a sequence of infrared video frames of a natural gas pipeline area is collected, and a corresponding gray level histogram is established for each pixel position in the infrared video frames within a set time range.
[0060] In a specific implementation, the infrared video frame sequence of the natural gas pipeline area can be collected by continuously photographing the natural gas pipeline area with an infrared thermal imager. The infrared video frame sequence includes infrared video frames at different time nodes.
[0061] It should be noted that the infrared video frame in the 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, and the single static infrared image contains infrared radiation information of the pipeline scene at a specified time, and is stored in the form of a gray scale or pseudo-color matrix, wherein the value of each pixel point represents the thermal radiation intensity at the position.
[0062] In some embodiments, establishing a corresponding gray scale histogram for each pixel position in the infrared video frame within a set time range can be achieved by the following steps:
[0063] Set a time range for establishing a gray scale histogram, and extract a sequence of infrared video frames contained in the time range;
[0064] Traverse each infrared video frame in the sequence of infrared video frames, and determine all pixel positions in each infrared video frame;
[0065] Select a pixel position as a selected pixel position, extract the pixel gray scale values corresponding to the selected pixel position in all infrared video frames within the time range, and form a sequence of gray scale values corresponding to the selected pixel position;
[0066] Count the occurrence frequency of each gray scale value in the sequence of gray scale values to generate a gray scale histogram corresponding to the selected pixel position;
[0067] Continue to determine the gray scale histograms corresponding to the remaining pixel positions.
[0068] In a specific implementation, first, a time sequence range for establishing a gray scale histogram can be set according to actual requirements. In this embodiment, the first 2 / 3 of the time sequence range is set for establishing a gray scale histogram. The start and end frames of the time sequence range can be adjusted according to actual detection requirements (such as the potential change rate of a pipeline leakage), which are not limited here. Continuous infrared video frames in the time sequence range are extracted to obtain an infrared video frame sequence, where the infrared video frame sequence represents a set of infrared video frames arranged in time sequence within the time sequence range. Second, a scanning algorithm in an 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 row by row, the pixel position of all pixels in each infrared video frame on a two-dimensional plane is determined. The pixel position refers to the coordinate value of a single pixel in the infrared video frame in the image coordinate system. Further, a pixel position is selected as a selected pixel position. The gray scale value corresponding to the selected pixel position is extracted from each infrared video frame in the time sequence range, and the extracted gray scale values are arranged in time sequence to form a gray scale value sequence corresponding to the selected pixel position. The gray scale value sequence represents a set of gray scale values corresponding to the same pixel position in each infrared video frame within the time sequence range. Then, a histogram statistical algorithm is used to traverse the gray scale value sequence, count the number of occurrences of each gray scale value in the gray scale value sequence, and construct a gray scale histogram with the gray scale value as the horizontal axis and the occurrence frequency as the vertical axis according to the counting result. Finally, the gray scale histogram corresponding to the remaining pixel positions is determined by the determination method of "counting the occurrence frequency of each gray scale value in the gray scale value sequence to generate the gray scale histogram corresponding to the selected pixel position".
[0069] It should be noted that the gray scale histogram in this application represents a statistical graph describing the correspondence between the pixel position and all gray scale values and their occurrence frequencies within the set time sequence range. By establishing a gray scale histogram for different pixel positions, the gray scale value distribution characteristics of each pixel within the set time sequence range can be accurately captured. This distribution characteristic can be used to distinguish whether the pixel belongs to the background or the foreground (i.e., the natural gas leakage area), because the gray scale values of the background pixels usually present a stable distribution pattern in time sequence, while the pixel gray scale values of the abnormal areas such as leakage deviate from this stable pattern.
[0070] In step 102, an initialization background sample set for natural gas leakage detection is constructed based on the gray scale histograms of each pixel position, and then the foreground membership of each pixel point in each infrared video frame is determined according to the gray scale 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.
[0071] In some embodiments, the reference Figure 3As shown, the figure is an exemplary flow chart for determining the initialization background sample set according to some embodiments of the present application, and the initialization background sample set for natural gas leakage detection based on the gray level histogram of each pixel position can be implemented by the following steps:
[0072] Firstly, in step 1021, the gray level probability density distribution of each gray level histogram is calculated based on the gray level histogram of each pixel position;
[0073] Secondly, in step 1022, the gray level distribution center value of each pixel position in the gray level space is determined according to all the gray level probability density distributions, and the gray level distribution center value is taken as the background reference value of the corresponding pixel position;
[0074] Then, in step 1023, the background gray level tolerance range of each pixel position is determined by taking the background reference value of each pixel position as the center and combining the dispersion of the corresponding gray level probability density distribution;
[0075] Finally, in step 1024, the background reference value of each pixel position and the corresponding background gray level tolerance range are integrated to obtain the initialization background sample set for natural gas leakage detection.
[0076] In specific implementation, firstly, for the gray level histogram of each pixel position, the frequency of each gray level value in the gray level histogram is divided by the total number of pixels of the corresponding pixel position within the set time range by using histogram normalization method to obtain the probability value corresponding to each gray level value, and then the gray level probability density distribution of each gray level histogram is formed, wherein the gray level probability density distribution represents the distribution state of the probability of the gray level value of a pixel position within a set range changing with the gray level value; secondly, for the gray level probability density distribution corresponding to each pixel position, the weighted average algorithm is used to calculate with each gray level value as the variable and the probability density corresponding to the gray level value as the weight, and the result after weighted average is taken as the gray level distribution center value, and the gray level distribution center value is taken as the background reference value of the corresponding pixel position, wherein the background reference value represents a value that can reflect the distribution of the gray level value of the pixel position under the background state; then, the standard deviation of the gray level probability density distribution is calculated to measure its dispersion degree (i.e. dispersion), and the background gray level tolerance range of the corresponding pixel position is determined by taking the background reference value of each pixel position as the center, adding and subtracting 3 times the standard deviation to form a gray level interval, and then the background gray level tolerance range of each pixel position is obtained, wherein the background gray level tolerance range represents the interval range that allows the gray level value of the pixel position to change under the normal background fluctuation; finally, the background reference value corresponding to all pixel positions and the corresponding background gray level tolerance range are stored according to the pixel coordinates to obtain the initialization background sample set for natural gas leakage detection.
[0077] It should be noted that the initialization background sample set in the present application represents the sum of parameters for describing the background characteristics of all pixels in the natural gas pipeline area in the initial state, which provides a benchmark reference for the detection of natural gas leakage in the infrared video. By quantifying the gray level characteristics of each pixel position in the normal state (i.e. background reference value) and the allowed fluctuation range (i.e. background gray tolerance range), it constructs the basic standard for distinguishing between normal background and abnormal area. This set serves as a reference for subsequent foreground recognition, and can determine whether the pixel deviates from the normal background state by comparing the real-time pixel gray value with the background reference value and the tolerance range, thereby providing a quantitative basis for screening out the foreground area containing leakage, ensuring the consistency of the analysis of pixels at different positions in the subsequent detection steps, and thus improving the accuracy and reliability of the overall detection.
[0078] In some embodiments, determining the foreground membership of each pixel point in each infrared video frame according to the gray difference relationship between the background reference value of each pixel position in the initialization background sample set and the gray value of the corresponding pixel of each infrared video frame can be achieved by the following steps, i.e.:
[0079] calculating the gray difference value between the gray 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 describing the gray difference relationship between the background reference value and the corresponding pixel by the gray difference value;
[0080] comparing the gray difference value of each pixel with the background gray tolerance range of the corresponding pixel position, and then determining the deviation degree of the gray value of each pixel from the background reference value;
[0081] constructing a foreground membership function, and inputting the deviation degree of each pixel into the foreground membership function to determine the corresponding foreground membership of each pixel point, thereby obtaining the foreground membership of each pixel point in each infrared video frame.
[0082] In specific implementation, firstly, based on the background reference value of each pixel position in the initialized background sample set, a pixel-by-pixel grayscale 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. This grayscale difference represents the numerical difference between the grayscale value of a pixel in the infrared video frame and the background reference value at that 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 versus the tolerance range. The ratio of half-width is used to determine the deviation. If the grayscale difference exceeds the background grayscale tolerance range, the deviation is defined as 1 plus the ratio of the excess portion to the tolerance range half-width. Here, the tolerance range half-width is the difference between the upper limit of the background grayscale tolerance range and the corresponding background reference value. The deviation refers to the degree of deviation of the pixel grayscale value from 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 of each pixel, thereby obtaining the foreground membership of each pixel in each infrared video frame.
[0083] In some embodiments, a foreground membership function is constructed, wherein the foreground membership function is:
[0084]
[0085] in, The foreground membership degree, ranging from [0,1]; The degree to which the grayscale value of a pixel deviates from the background reference value; As an adjustable parameter, it controls the deviation range from 0 to 1 in the membership degree. The principle of this foreground membership function is: when the deviation... When the grayscale value is within the background tolerance range, the pixel is considered to belong entirely to the background, and its membership degree is 0. When the deviation degree exceeds 1 but does not exceed 1, the pixel is considered to belong entirely to the background. At that time, the membership degree increases linearly with the deviation degree, and when the deviation degree... At that time, the pixel is considered to belong entirely to the foreground, with a membership degree of 1, and the adjustable parameter is... The choice needs to be adjusted according to the actual scenario; no restrictions are made here.
[0086] It should be noted that the foreground membership degree in the present application represents an index for measuring whether a pixel belongs to a natural gas leakage foreground region. In the natural gas leakage detection, the prior art usually uses a fixed threshold or a single background model to make a foreground binary judgment, which is easy to cause missed detection or false detection due to environmental interference (such as light fluctuation and equipment noise). However, the present method constructs a background sample through a pixel-level time-series gray histogram, so that the background reference value and tolerance range of each pixel are more consistent with its own dynamic characteristics, thereby realizing adaptive characterization of the background fluctuation. Further, the deviation quantifies the relative deviation degree of the gray value from the background reference value, and the deviation is mapped to a foreground membership degree in the continuous interval of 0-1 by combining the foreground membership function, instead of binary segmentation. This not only retains the intermediate state information of different deviations, but also realizes the foreground membership comparability across pixels, especially has higher sensitivity to the weak gray change in the initial stage of natural gas leakage, and forms a foreground quantification mechanism that is more suitable for the diffusion characteristics of natural gas leakage.
[0087] In step 103, the foreground recognition area of each infrared video frame is extracted according to the foreground membership of each pixel point in each infrared video frame, and then the foreground pre-recognition of the current natural gas pipeline region is performed 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-recognition area of the natural gas leakage at the current time.
[0088] In some embodiments, the extraction of the foreground recognition area of each infrared video frame according to the foreground membership of each pixel point in each infrared video frame can be realized by the following steps, that is:
[0089] The foreground membership of each pixel point in each infrared video frame is compared with a preset membership threshold, and the pixel point whose foreground membership is greater than the membership threshold is determined as a foreground pixel.
[0090] For each infrared video frame, the pixel points determined as foreground pixels in the infrared video frame are classified into a foreground recognition area, and then the foreground recognition area of each infrared video frame is obtained.
[0091] In specific implementation, first, based on the foreground membership of each pixel point in each infrared video frame, a threshold segmentation algorithm is used to compare the foreground membership of each pixel point with a preset membership threshold (the membership threshold is determined by experiment according to the typical difference characteristics of natural gas leakage and background in the infrared scene, which will not be described here) one by one, and the pixel point whose foreground membership is greater than the membership threshold is determined as a foreground pixel, which represents a pixel determined as belonging to a natural gas leakage foreground region in a single infrared video frame. Then, for each infrared video frame, the pixel points determined as foreground pixels in the infrared video frame are classified into a foreground recognition area, and then the foreground recognition area of each infrared video frame is obtained.
[0092] It should be noted that the foreground recognition area in the present application represents an image area containing natural gas leakage. In natural gas leakage detection, the abnormal areas existing in the infrared image can be captured frame by frame by determining the foreground recognition area of different infrared image frames. These abnormal areas are embodied by the difference between the infrared radiation characteristics formed by temperature change when natural gas leaks and the background area. The foreground recognition areas of continuous multiple frames can reflect the spatial position change, morphological evolution and range expansion trend of the abnormal areas. By tracking these dynamic information, the real natural gas leakage diffusion process and the temporary interference factors in the environment can be effectively distinguished.
[0093] In some embodiments, the foreground pre-recognition area of the current natural gas pipeline area is obtained by combining the area change characteristics of the foreground recognition area between adjacent infrared video frames with the initialization background sample set, which can be achieved by the following steps, that is:
[0094] calculating the area change characteristics of the foreground recognition area between adjacent infrared video frames;
[0095] updating the initialization background sample set based on all the area change characteristics to obtain the confidence background sample set for the current natural gas leakage detection;
[0096] performing foreground recognition on the current infrared video frame of the natural gas pipeline area according to the confidence background sample set to obtain the foreground pre-recognition area of the current natural gas leakage.
[0097] In a specific implementation, first, for the foreground recognition area of each infrared video frame, the pixel count method is used to count the number of pixels contained in the foreground recognition area to represent the foreground area, and then the foreground area of each infrared video frame is obtained, the foreground area difference of the foreground recognition area between adjacent infrared video frames is calculated, and the area change feature is obtained, which represents the change degree 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; second, based on all the area change features, the initial background sample set is updated to obtain the confidence background sample set of the natural gas leakage detection at the current moment, that is, the variance of all the area change features is calculated, and the variance calculation result is taken 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, which is not limited here, the pixel position alternately determined as foreground background (or background foreground) in the infrared video frame sequence is extracted (the pixel position may exist background drift), for each infrared video frame, the average gray value in the eight fields is taken as the relative gray value of the extracted pixel position, and then the background reference value and the background gray tolerance range of the extracted pixel position are determined again through the method of determining the background reference value and the background gray tolerance range of the pixel position in the above step 102, which is not described here, and then the confidence background sample set of the natural gas leakage detection at the current moment is obtained, which represents the background feature set more suitable for the current scene after adjusting the initial background sample set.
[0098] It should be noted that the foreground pre-recognition area in the present application represents the initial natural gas leakage area obtained after the foreground recognition of the current infrared video frame based on the confidence background sample set, and in the natural gas leakage detection, the determination of the foreground pre-recognition area can preliminarily screen out suspicious areas with natural gas leakage from the infrared video stream, which are marked due to the deviation of the gray feature from the background reference after the comparison between the confidence background sample set and the current frame, and its role is to narrow the scope of subsequent analysis and avoid indiscriminate processing of the entire infrared image frame. At the same time, as an intermediate area between the original image and the final leakage judgment result, the area can be further excluded from the false area caused by background temporary fluctuation, noise interference, etc. through the spatio-temporal correlation analysis with the foreground recognition area of the historical frame, and then provide a focused and reliable analysis object for subsequent accurate positioning of the leakage source, and ensure the pertinence and accuracy of the detection process.
[0099] 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 accumulated change in grayscale value in the natural gas pipeline region, and then an anti-interference mask in the natural gas leakage detection process is generated through the time-domain grayscale feature map.
[0100] In some embodiments, the pixel-level time-domain integration operation performed on the infrared video frame sequence to obtain the time-domain grayscale feature map of the accumulated change in grayscale value in the natural gas pipeline region can be implemented by the following steps, namely:
[0101] Extracting the background reference value of each pixel position in the initialization background sample set;
[0102] For each pixel position of each infrared video frame in the infrared video frame sequence, calculating the absolute difference value between the current grayscale value of the pixel position and the corresponding background reference value to obtain the grayscale difference time sequence of each pixel position;
[0103] Performing an accumulation sum operation on the grayscale difference time sequence of each pixel position along the time axis to obtain the grayscale cumulative change amount of each pixel position;
[0104] Mapping the grayscale cumulative change amount of all pixel positions to a two-dimensional image to obtain the time-domain grayscale feature map of the accumulated change in grayscale value in the natural gas pipeline region.
[0105] In specific implementation, first, the background reference value of each pixel position in the initialization background sample set is extracted; second, for each infrared video frame in the infrared video frame sequence, the absolute difference value between the current grayscale value of each pixel position in the infrared video frame and the corresponding background reference value is calculated, and the absolute difference values of the same pixel position in different infrared video frames are arranged in time sequence to form a grayscale difference time sequence of the pixel position changing with time, and then the grayscale difference time sequence of each pixel position is obtained, the grayscale difference time sequence representing a sequence composed of the absolute difference values of the same pixel position in each frame of the infrared video frame sequence in time sequence; then, for the grayscale difference time sequence of each pixel position, all absolute difference values in the grayscale difference time sequence are traversed along the time axis and summed using the accumulation sum algorithm, and the sum calculation result is taken as the grayscale cumulative change amount of the pixel position, and then the grayscale cumulative change amount of each pixel position is obtained, the grayscale cumulative change amount representing the accumulation degree of the grayscale change of the pixel within the time sequence range; finally, the grayscale cumulative change amounts of all pixel positions are normalized by minimum-maximum normalization, and the normalized grayscale cumulative change amounts of all pixel positions are spatially arranged according to their two-dimensional coordinates in the infrared video frame using coordinate mapping technology to obtain the time-domain grayscale feature map of the accumulated change in grayscale value in the natural gas pipeline region.
[0106] It should be noted that the time domain gray scale feature map in the present application represents the cumulative change characteristics of the gray scale value in the natural gas pipeline region within the set time sequence range. In the natural gas leakage detection, the prior art relies on single-frame gray scale difference or limited inter-frame difference for analysis, which is easily disturbed by instantaneous noise, environmental fluctuations and the like, and it is difficult to capture the weak and continuous gray scale change formed by the slow diffusion at the initial stage of natural gas leakage. The present method, through pixel-level time domain integration operation, accumulates the absolute difference between the gray scale value of each pixel position and the background reference value of itself along the time axis, and forms the cumulative change amount which not only retains the spatial pixel position information, but also condenses the continuous change characteristics in time sequence, avoiding the problem of insufficient adaptability caused by the traditional fixed global background. At the same time, the integral accumulation amplifies the gray scale anomaly existing in the leakage region (the gray scale difference of the leakage region will increase with time due to continuous heat release or gas diffusion), solves the defects of low sensitivity to slow leakage signals and weak anti-interference ability in the prior art, and makes the feature map not only accurately locate the continuous abnormal region, but also effectively suppress random noise, providing a more robust spatiotemporal fusion feature basis for subsequent leakage identification.
[0107] In some embodiments, the anti-interference mask in the natural gas leakage detection process generated by the time domain gray scale feature map can be realized by the following steps, that is:
[0108] determining a segmentation threshold in the natural gas leakage detection process according to the gray scale cumulative change amount of all pixel points in the time domain gray scale feature map;
[0109] comparing the gray scale cumulative change amount of each pixel point in the time domain gray scale feature map with the segmentation threshold, marking the pixels greater than the segmentation threshold as foreground candidate regions, and marking the pixels less than or equal to the segmentation threshold as background regions, to obtain the segmentation result of the time domain gray scale feature map;
[0110] constructing an anti-interference mask in the natural gas leakage detection process according to the segmentation result.
[0111] In a specific implementation, first, based on the gray level cumulative change of all pixel points in the time domain gray level feature map, the optimal segmentation threshold is calculated by using the maximum inter-class variance method. The maximum inter-class variance method calculates the inter-class variance when the pixels are divided into two classes by traversing all the gray level cumulative change values, selects the gray level cumulative change with the maximum inter-class variance as the segmentation threshold, and the segmentation threshold represents the gray level cumulative change critical value for distinguishing the natural gas leakage region and the normal background region in the time domain gray level feature map. Second, the gray level cumulative change of each pixel point in the time domain gray level feature map is compared with the segmentation threshold one by one by using the pixel-by-pixel comparison method. The pixel points with a gray level cumulative change greater than the segmentation threshold are marked as the natural gas leakage region (i.e., the foreground candidate region), and the pixel points with a gray level cumulative change less than or equal to the segmentation threshold are marked as the region belonging to the normal background (i.e., the background region), thereby forming a binary labeling result (i.e., a segmentation result) composed of the foreground candidate region and the background region. The foreground candidate region represents a pixel region preliminarily determined as a natural gas leakage region, the background region represents a pixel region determined as a normal background region, and the segmentation result represents a binary image composed of the foreground candidate region and the background region. Finally, based on the segmentation result, the pixel positions corresponding to the foreground candidate region are set as the effective region (represented by the value 1) of the anti-interference mask, and the pixel positions corresponding to the background region are set as the invalid region (represented by the value 0) of the anti-interference mask, thereby forming the anti-interference mask in the natural gas leakage detection process.
[0112] It should be noted that the anti-interference mask in the present application represents a binary image for shielding the normal background region and retaining the natural gas leakage region in the natural gas leakage detection. In the natural gas leakage detection, the prior art usually uses a fixed region mask or a static mask generated based on the features of a single frame image, which is difficult to adapt to the dynamic changes of interference factors in a complex scene and is prone to cause the effective leakage region to be mistakenly shielded or the interference region to be not excluded. However, the anti-interference mask generated based on the time domain gray level feature map in the present method can dynamically lock the regions (i.e., potential leakage or continuous interference regions) with a gray level cumulative change exceeding the threshold by capturing the cumulative change characteristics of the pixel gray level values in the time sequence, and construct the mask based on the same. The mask creatively uses the time sequence accumulation of the gray level change of the leakage region and the time characteristics difference between the static interference and the transient noise, so that the mask can retain the leakage candidate region with a continuous abnormal change and shield the background region without cumulative change, avoiding the missed detection or redundant calculation caused by the insufficient scene adaptability of the traditional static mask, and forming an adaptive anti-interference mechanism matching the dynamic characteristics of the leakage.
[0113] In step 105, based on the anti-interference mask, region screening under anti-interference feature constraint is performed on the foreground pre-identified region, and a natural gas leakage detection result of the natural gas pipeline region is obtained.
[0114] In some embodiments, the step of performing region screening under anti-interference feature constraint on the foreground pre-identified region based on the anti-interference mask to obtain the natural gas leakage detection result of the natural gas pipeline region can be implemented by the following steps, i.e.:
[0115] mapping each pixel position in the foreground pre-identified region with a corresponding pixel position in the anti-interference mask;
[0116] judging whether the corresponding pixel position in the foreground pre-identified region belongs to a valid identification value according to the identification value of each pixel position in the anti-interference mask;
[0117] retaining the pixel position in the foreground pre-identified region belonging to the valid identification value to form a set of effective leakage regions after anti-interference constraint;
[0118] taking the set of effective leakage regions as the natural gas leakage detection result of the natural gas pipeline region.
[0119] In a specific implementation, firstly, the two-dimensional coordinates of each pixel in the foreground pre-identified region are associated with the pixels at the same coordinate position in the anti-interference mask one by one through coordinate mapping technology to ensure accurate matching of the two regions in spatial position, i.e. mapping each pixel position in the foreground pre-identified region with a corresponding pixel position in the anti-interference mask, wherein the mapping means that the pixels at the same spatial position in the foreground pre-identified region and the anti-interference mask are associated with each other through coordinate matching; secondly, based on the identification value (0 represents an invalid region and 1 represents a valid region) of each pixel position in the anti-interference mask, the identification value of each pixel position in the foreground pre-identified region corresponding to the anti-interference mask is checked one by one to judge whether the pixel of the pixel position belongs to the valid identification value (i.e. the region with an identification value of 1) marked as needing to be retained, wherein the valid identification value represents the pixel identification value used to mark the valid region in the anti-interference mask; then, all the pixel positions in the foreground pre-identified region determined to belong to the valid identification value are spatially aggregated by using the existing region merging algorithm to eliminate the pixels not belonging to the valid identification value, and thus a set of effective leakage regions after anti-interference constraint is obtained, wherein the set of effective leakage regions represents the region formed by the pixel positions belonging to the valid identification value retained after the foreground pre-identified region is screened by the anti-interference mask; finally, the set of effective leakage regions is taken as the natural gas leakage detection result of the natural gas pipeline region.
[0120] It should be noted that the natural gas leakage detection result in the present application represents the specific regional information of the finally determined natural gas pipeline region in which leakage exists after the region screening under the anti-interference feature constraint; the anti-interference feature constraint in the present application refers to a mechanism for limiting and regulating the foreground pre-identified region according to the feature information contained in the anti-interference mask in the region screening process of natural gas leakage detection, the core of which is to use the region features divided by the effective and invalid identification values marked in the anti-interference mask to constrain the screening range to only keep the pixel positions in the foreground pre-identified region corresponding to the mask effective identification value region, and exclude the pixel positions corresponding to the invalid identification value, so as to eliminate background interference and non-target region, and ensure that the finally screened region focuses on the effective range where natural gas leakage exists, which essentially realizes the filtering of interference information and the accurate locking of effective region through the feature definition of the mask.
[0121] In addition, another aspect of the present application, in some embodiments, the present application provides an intelligent detection device for natural gas leakage, which comprises a natural gas leakage infrared detection unit, referring to Figure 4 The figure is a structural schematic diagram of a natural gas leakage infrared detection unit according to some embodiments of the present application, which comprises a collection module 201, a processing module 202 and an execution module 203, which are described as follows:
[0122] The collection module 201 is mainly used for collecting a sequence of infrared video frames of the natural gas pipeline region, and establishing a corresponding gray level histogram for each pixel position in the infrared video frame within a set timing range in the present application;
[0123] The processing module 202 is mainly used for constructing an initialization background sample set for natural gas leakage detection based on the gray level histogram of each pixel position in the present application, and then determining the foreground membership of each pixel point in each infrared video frame according to the gray 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;
[0124] The processing module 202 is also used for extracting the foreground recognition area of each infrared video frame according to the foreground membership of each pixel point in each infrared video frame, and then pre-identifying the foreground of the current natural gas pipeline region according to the area change characteristics of the foreground recognition area between adjacent infrared video frames combined with the initialization background sample set, to obtain the foreground pre-identified region of the current natural gas leakage;
[0125] 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 gray feature map of the accumulated change of the gray value in the natural gas pipeline region, and further generate an anti-interference mask in the natural gas leakage detection process through the time-domain gray feature map.
[0126] The execution module 203 is mainly configured to perform region screening under anti-interference feature constraint on the foreground pre-identified region based on the anti-interference mask to obtain a natural gas leakage detection result of the natural gas pipeline region.
[0127] In addition, the present application further provides a computer device, which comprises a memory and a processor, the memory stores code, and the processor is configured to acquire the code and execute the natural gas leakage infrared detection method described above.
[0128] In some embodiments, with reference to Figure 5 The figure is a structural schematic diagram of a computer device for implementing the natural gas leakage infrared detection method according to some embodiments of the present application. The natural gas leakage infrared detection method in the above embodiments can be implemented by the computer device shown in the figure, which comprises at least one processor 301, a communication bus 302, a memory 303, and at least one communication interface 304. Figure 5
[0129] The processor 301 can be a general central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more circuits for controlling the execution of the natural gas leakage infrared detection method in the present application.
[0130] The communication bus 302 can be used to transmit information between the above components.
[0131] The memory 303 can be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM), or other type of dynamic storage device that can store information and instructions, an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disk storage, a magneto-optical disk, a magnetic disk or other magnetic storage device, or any other medium capable of storing desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited thereto. The memory 303 can exist independently of the processor 301 and be connected to the processor 301 through the communication bus 302. The memory 303 can also be integrated with the processor 301.
[0132] The memory 303 is configured to store program codes for implementing the solutions of the present application, and the processor 301 is configured to execute the program codes stored in the memory 303. The program codes can include one or more software modules. The determination of the natural gas leakage infrared detection method in the above embodiments can be implemented by one or more software modules in the program codes of the processor 301 and the memory 303.
[0133] The communication interface 304 is configured to communicate with other devices or communication networks, such as an Ethernet, a radio access network (RAN), a wireless local area network (WLAN), etc., using any transceiver-like mechanism.
[0134] In a specific implementation, as an example, the computer device can include a plurality of processors, each of which can be a single-CPU processor or a multi-CPU processor. The processor herein can refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0135] The computer device described above can be a general-purpose computer device or a special-purpose computer device. In a specific implementation, the computer device can be a desktop computer, a laptop 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 the present application do not limit the type of the computer device.
[0136] In addition, the present application also provides a computer readable storage medium, which stores a computer program. The computer program is executed by a processor to implement the natural gas leakage infrared detection method.
[0137] Although the preferred embodiments of the present application have been described, those skilled in the art who are familiar with the basic inventive concept can make additional changes and modifications to the embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0138] Obviously, those skilled in the art can make various modifications and variations to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application also intends to include these modifications and variations.
Claims
1. A method for infrared detection of natural gas leaks, used in intelligent detection devices for natural gas leaks, characterized in that, The method includes the following steps: Collect 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 range; An initial background sample set for natural gas leak detection is constructed based on the gray-level histogram of each pixel location. Then, the foreground membership degree of each pixel in each infrared video frame is determined according to the relationship between the background reference value of each pixel location in the initial background sample set and the gray-level difference of the corresponding pixel in each infrared video frame. Based on the foreground membership of each pixel in each infrared video frame, the foreground recognition region of each infrared video frame is extracted. Then, based on the area change characteristics of the foreground recognition region between adjacent infrared video frames and the initial background sample set, the foreground pre-identification of the current natural gas pipeline area is performed to obtain the foreground pre-identification region of the natural gas leak at the current moment. A pixel-level temporal integration operation is performed on the infrared video frame sequence to obtain a temporal grayscale feature map of the cumulative change of grayscale values in the natural gas pipeline area. Then, an anti-interference mask is generated in the natural gas leak detection process through the temporal grayscale feature map. Based on the anti-interference mask, region screening under anti-interference feature constraints is performed on the foreground pre-identification region to obtain the natural gas leak detection results of the natural gas pipeline area; Specifically, determining the foreground membership degree of each pixel in each infrared video frame based on the relationship between the background reference value of each pixel position in the initialized background sample set and the grayscale difference of the corresponding pixel in each infrared video frame includes: Calculate the grayscale difference between the grayscale value of each pixel in each infrared video frame and the background reference value at the corresponding pixel position in the initialized background sample set, and use the grayscale difference to describe the grayscale difference relationship between the background reference value and the corresponding pixel. The grayscale difference of each pixel is compared with the grayscale tolerance range of the corresponding pixel position to determine the degree of deviation 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 of each pixel, thereby obtaining the foreground membership of each pixel in each infrared video frame.
2. The method as described in claim 1, characterized in that, Creating a grayscale histogram for each pixel location in an infrared video frame within a set time frame specifically includes: Define the time range for building the grayscale histogram, and extract the infrared video frame sequence contained within the time range; Traverse each infrared video frame in the infrared video frame sequence to determine the position of all pixels in each infrared video frame; Select a pixel location as the selected pixel location, extract the pixel grayscale value corresponding to the selected pixel location in all infrared video frames within the time range, and form a grayscale value sequence corresponding to the selected pixel location. Count the frequency of occurrence of each gray value in the gray value sequence, and 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 as described in claim 1, characterized in that, The initial background sample set for natural gas leak detection, constructed based on the grayscale histograms of each pixel location, specifically includes: Based on the gray-level histograms at each pixel location, calculate the gray-level probability density distribution of each gray-level histogram; Based on all gray-level probability density distributions, determine the gray-level distribution center value of each pixel location in the gray-level space, and use the gray-level distribution center value as the background reference value of the corresponding pixel location; The background grayscale tolerance range for each pixel location is determined by taking the background baseline value at each pixel location as the center and combining it with the dispersion of the corresponding grayscale probability density distribution. By integrating the background baseline value and the corresponding background grayscale tolerance range at each pixel location, an initial background sample set for natural gas leak detection is obtained.
4. The method as described in claim 1, characterized in that, Extracting the foreground recognition region for each infrared video frame based on the foreground membership of each pixel in each frame specifically includes: The foreground membership degree of each pixel in each infrared video frame is compared with a preset membership degree threshold, and the pixels with a foreground membership degree greater than the membership degree threshold are determined as foreground pixels. For each infrared video frame, the pixels identified as foreground pixels in the infrared video frame are classified as foreground recognition areas, thereby obtaining the foreground recognition areas of each infrared video frame.
5. The method as described in claim 1, characterized in that, Based on the area change characteristics of the foreground recognition region between adjacent infrared video frames and combined with the initialized background sample set, the foreground pre-identification of the current natural gas pipeline area is performed, and the foreground pre-identification region of the natural gas leak at the current moment specifically includes: Calculate the area change characteristics of the foreground recognition region between adjacent infrared video frames; The initial background sample set is updated based on all area change features to obtain the confidence background sample set for natural gas leak detection at the current moment; Based on the confidence background sample set, foreground recognition is performed on the current infrared video frame of the natural gas pipeline area to obtain the foreground pre-identification area of the natural gas leak at the current moment.
6. The method as described in claim 1, characterized in that, Performing pixel-level temporal integration on the infrared video frame sequence to obtain a temporal grayscale feature map of the cumulative grayscale value changes in the natural gas pipeline area specifically includes: Extract the background reference value of each pixel position in the initialized background sample set; For each pixel position in each infrared video frame in the infrared video frame sequence, calculate the absolute difference between the current gray value of the pixel position and the corresponding background reference value to obtain the gray value difference time sequence of each pixel position; The gray-level difference time series of each pixel position is accumulated and summed along the time axis to obtain the cumulative gray-level change of each pixel position; By mapping the cumulative grayscale changes of all pixel locations to a two-dimensional image, a temporal grayscale feature map of the cumulative grayscale changes in the natural gas pipeline area is obtained.
7. The method as described in claim 1, characterized in that, The natural gas pipeline area was continuously photographed using an infrared thermal imager to collect a sequence of infrared video frames of the natural gas pipeline area.
8. The method as described in claim 1, characterized in that, The infrared video frame sequence contains infrared video frames at different time points.
9. A smart detection device for natural gas leaks, comprising a natural gas leak infrared detection unit, wherein the device uses the method described in any one of claims 1 to 8 for natural gas leak infrared detection, characterized in that, The natural gas leak infrared detection unit includes: The acquisition module is used to acquire infrared video frame sequences of the natural gas pipeline area and to build a corresponding grayscale histogram for each pixel position in the infrared video frame within a set time range. The processing module is used to construct an initial background sample set for natural gas leak detection based on the grayscale histogram of each pixel position, and then determine the foreground membership degree of each pixel in each infrared video frame according to the relationship between the background reference value of each pixel position in the initial background sample set and the grayscale difference of the corresponding pixel in each infrared video frame. The processing module is also used to extract the foreground recognition area of each infrared video frame based on the foreground membership degree of each pixel 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 recognition area between adjacent infrared video frames and the initial background sample set, so as to obtain the foreground pre-identification area of the natural gas leak at the current moment. The processing module is also used to perform pixel-level time-domain integration 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 in the natural gas leak detection process through the time-domain grayscale feature map. The execution module is used to perform region screening under anti-interference feature constraints on the foreground pre-identification region based on the anti-interference mask, so as to obtain the natural gas leak detection result of the natural gas pipeline area.
Citation Information
Patent Citations
Petrochemical leakage video monitoring identification method
CN117037047A
Image segmentation method and image segmentation system
CN119229107A