Physical guidance-based gas detection method, device, equipment and storage medium

By constructing a background benchmark in infrared image processing and combining it with bi-branch feature extraction, the problem of feature extraction for gas detection in complex environments is solved, and high-precision identification and stable detection of weak gases are achieved.

CN122492689APending Publication Date: 2026-07-31NORTHEASTERN UNIV CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NORTHEASTERN UNIV CHINA
Filing Date
2026-06-29
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing gas detection technologies based on passive infrared imaging combined with deep learning vision algorithms are difficult to effectively isolate weak gas signals in complex industrial environments, leading to difficulties in feature extraction. Furthermore, they lack targeted modeling for amorphous and dynamically diffusing gases, resulting in missed or false alarms.

Method used

A background estimation and residual compensation mechanism based on spatial scale separation effect is adopted. A background benchmark is constructed by low-pass filtering operator, the signal-to-noise ratio of the image is enhanced by differential operation, and the physical gradient features and global spatial dependence features are extracted by utilizing the dual-branch structure of the gas detection model. The features are then modulated by combining physical attention weights.

Benefits of technology

It significantly improves the accuracy of gas detection in complex environments, enables high-precision identification of weak and amorphous gases, and ensures stable detection of gas leaks throughout their entire lifecycle.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122492689A_ABST
    Figure CN122492689A_ABST
Patent Text Reader

Abstract

This application discloses a physically guided gas detection method, apparatus, device, and storage medium, belonging to the field of gas detection technology. The method includes: performing background estimation and residual compensation on the original infrared image based on the spatial scale separation effect to obtain an enhanced image; employing a gas detection model to perform the following operations: extracting multi-scale feature maps from the enhanced image; using a first feature extraction branch, based on a physical diffusion prior, extracting physical gradient features from the multi-scale feature maps, and determining the physical attention weights of each pixel in the multi-scale feature maps according to the physical gradient features; using a second feature extraction branch, extracting global spatial dependency features from the multi-scale feature maps; modulating the global spatial dependency features using the physical attention weights to obtain target fusion features; and outputting the gas detection result for the region to be detected based on the target fusion features.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of gas detection technology, and in particular to physical-guided gas detection methods, apparatus, equipment and storage media. Background Technology

[0002] In industrial production and storage, hazardous gas leak detection is crucial for safety assurance. Currently, optical gas imaging technology based on passive infrared imaging combined with deep learning vision algorithms has become the mainstream detection method. However, this technology still faces significant challenges in practical applications: On the one hand, passive infrared images are usually accompanied by a large amount of thermal noise and low contrast, while leaked gases have characteristics such as blurred edges and semi-transparency. Directly inputting low-quality raw images into general detection networks makes it difficult to effectively extract weak gas signals, resulting in difficulties in feature extraction. On the other hand, general target detection networks are mainly designed for rigid entities with clear geometric contours and lack targeted modeling for the amorphous and dynamic diffusion properties of gases. This makes it difficult to accurately focus on essential features when processing amorphous gas clouds with smooth and gradual boundary changes, easily leading to missed or false alarms, and failing to meet the stringent industrial safety monitoring requirements. Summary of the Invention

[0003] This invention provides a physically guided gas detection method, apparatus, computer equipment, and storage medium to at least address the problem of insufficient accuracy in infrared gas leak detection under complex industrial environments in related technologies. The technical solution of this invention is as follows: According to a first aspect of the present invention, a physics-guided gas detection method is provided, the method comprising: acquiring an original infrared image of a region to be detected; performing background estimation and residual compensation on the original infrared image based on a spatial scale separation effect to obtain an enhanced image; using a pre-trained gas detection model to perform preset processing on the enhanced image to obtain a gas detection result of the region to be detected; the gas detection model includes a first feature extraction branch and a second feature extraction branch; the preset processing includes: extracting a multi-scale feature map of the enhanced image; using the first feature extraction branch, extracting physical gradient features from the multi-scale feature map based on a physical diffusion prior, and determining the physical attention weight of each pixel in the multi-scale feature map according to the physical gradient features; using the second feature extraction branch, extracting global spatial dependency features from the multi-scale feature map; modulating the global spatial dependency features using the physical attention weights to obtain a target fusion feature; and outputting the gas detection result of the region to be detected based on the target fusion feature.

[0004] The above scheme achieves high-fidelity enhancement of single-frame images by using the spatial scale separation effect for background estimation and residual compensation at the input end, preserving the true physical morphology of the gas. At the same time, a dual-branch structure is constructed at the feature extraction end, and the global features are modulated by physical attention weights that characterize the gas diffusion law. This breaks the pure data-driven black box mode, enabling the network to accurately focus on gas regions that conform to physical laws, thereby significantly improving the detection accuracy in complex environments.

[0005] As a technical solution, based on the spatial scale separation effect, background estimation and residual compensation are performed on the original infrared image to obtain an enhanced image. The process includes: filtering the original infrared image using a low-pass filter operator to filter out mid-to-high frequency signals to extract the background radiation distribution and obtain a background estimation map; performing a difference operation between the original infrared image and the background estimation map to obtain a residual signal; and linearly superimposing the residual signal onto the original infrared image according to a preset gain coefficient to obtain an enhanced image.

[0006] This scheme utilizes the difference in spatial frequency between gas signals and background radiation to construct a pure background benchmark through low-pass filtering. Then, through differential and linear compensation mechanisms, it non-destructively enhances the edge saliency of weak gas signals while suppressing background noise, providing a data foundation with high signal-to-noise ratio and complete scene semantics for subsequent networks.

[0007] As a technical solution, before filtering the original infrared image using a low-pass filter operator, the following steps are also included: obtaining the width and height of the original infrared image; calculating the initial span based on the width, height, and a preset scale factor; and rounding the initial span upwards to an odd number to obtain the window size of the low-pass filter operator; determining the standard deviation of the low-pass filter operator based on the window size and a preset attenuation criterion; and performing a difference operation between the original infrared image and the background estimation image to obtain a residual signal, including: subtracting the pixel grayscale value at each coordinate position in the original infrared image from the estimated radiance value at the corresponding coordinate position in the background estimation image; and when the difference result is less than zero, setting the difference result to zero to obtain the residual signal.

[0008] This scheme establishes an adaptive mapping relationship between image resolution and filtering window, ensuring the rationality of background estimation scale under different detectors, and avoids phase shift during convolution by odd-number processing; at the same time, non-negative truncation of the residual signal effectively eliminates negative interference caused by cold spot noise, ensuring the physical authenticity of the enhancement results.

[0009] As a technical solution, feature extraction is performed through the first and second feature extraction branches in the gas detection model, including: performing spatial second derivative operations on the input multi-scale feature map through the first feature extraction branch to extract the physical gradient matrix characterizing the local dispersion characteristics of the gas, and generating physical attention weights based on the physical gradient matrix; performing self-attention mechanism operations on the multi-scale feature map through the second feature extraction branch to extract global spatial dependency features; and modulating the global spatial dependency features using the physical attention weights, including: performing element-wise weighting of the global spatial dependency features using the physical attention weights to obtain the target fusion features.

[0010] This scheme integrates diffusion priors from fluid mechanics into deep learning. The first branch simulates physical operators to extract local diffusion gradients, while the second branch captures long-range spatial dependencies. The two are deeply integrated through an attention mechanism, forcing the network to accurately focus on regions that conform to the physical properties of the gas while retaining a global perspective, thus solving the problem of feature fracture of amorphous targets.

[0011] As a technical solution, the first feature extraction branch performs spatial second derivative operations on the input multi-scale feature map to extract the physical gradient matrix characterizing the local dispersion characteristics of the gas, and generates physical attention weights based on the physical gradient matrix. This includes: performing a two-dimensional convolution operation on the multi-scale feature map using a preset discrete Laplacian convolution kernel, calculating the second difference between the pixel value and its neighboring pixel value in the multi-scale feature map after the two-dimensional convolution operation to obtain the physical gradient matrix; and normalizing the physical gradient matrix through an activation function to generate spatial-dimensional physical attention weights.

[0012] Based on Fick's second law, this scheme uses the discrete Laplace operator to explicitly model the concentration gradient change of the gas, transforming the abstract physical law into a computable gradient matrix, and then generating a spatial attention map through normalization, providing clear physical guidance for the network.

[0013] As a technical solution, a self-attention mechanism is performed on the multi-scale feature map through a second feature extraction branch to extract global spatial dependency features. This includes: flattening the multi-scale feature map in the spatial dimension to map it into a one-dimensional sequence feature; performing linear projection on the one-dimensional sequence feature to generate a query matrix, a key matrix, and a value matrix; calculating the attention weight distribution based on the query matrix and the key matrix, and using the attention weight distribution to perform a weighted summation on the value matrix to obtain the attention output sequence; and spatially rearranging the attention output sequence to restore it to the same dimensional space as the multi-scale feature map to obtain the global spatial dependency features.

[0014] This scheme breaks through the limitations of the receptive field of traditional convolution and establishes pixel-level associations across the entire image through a self-attention mechanism. It can effectively capture the topological connectivity of large-area sparse gas clouds, and even if some regional features are weak, it can achieve complete morphological extraction through semantic association with high-concentration regions.

[0015] As a technical solution, based on target fusion features, the gas detection results of the area to be detected are output, including: performing deconvolution upsampling on multi-scale images based on target fusion features, and performing horizontal concatenation of the sampled deep physical features and shallow physical features to obtain a fusion feature map; wherein, the multi-scale feature map includes target fusion features; predicting the fusion feature map by decoupling the detection head, and outputting the target's bounding box offset, class confidence, and centrality weight respectively; when the class confidence is greater than a preset safety threshold, outputting gas leak alarm information including the bounding box offset.

[0016] This scheme achieves complementarity between deep, strong semantic information and shallow, high-resolution details through top-down multi-scale feature interaction, ensuring stable detection throughout the entire lifecycle from small initial leaks to large-scale spreading clouds, and improving the accuracy of localization and classification by decoupling the detection head.

[0017] According to a second aspect of the present invention, a physics-guided gas detection device is provided, which is configured to perform a physics-guided gas detection method as described in the first aspect and any possible technical solution thereof; the device includes: an image acquisition module for acquiring an original infrared image of a region to be detected; a fidelity enhancement module for performing background estimation and residual compensation on the original infrared image based on spatial scale separation effect to obtain an enhanced image; and a feature decoupling modulation module for performing preset processing on the enhanced image using a pre-trained gas detection model to obtain a gas detection result for the region to be detected; the gas detection model includes a first feature extraction branch and a second feature extraction branch; the preset processing includes: extracting a multi-scale feature map of the enhanced image; using the first feature extraction branch, extracting physical gradient features from the multi-scale feature map based on physical diffusion prior, and determining the physical attention weight of each pixel in the multi-scale feature map according to the physical gradient features; using the second feature extraction branch, extracting global spatial dependency features from the multi-scale feature map; modulating the global spatial dependency features using the physical attention weights to obtain target fusion features; and outputting the gas detection result for the region to be detected based on the target fusion features.

[0018] According to a third aspect of the present invention, a physical-guided gas detection system is provided, the system being configured to perform a physical-guided gas detection method as described in the first aspect and any of its possible technical solutions.

[0019] According to a fourth aspect of the present invention, a computer device is provided, comprising: a processor and a memory for storing processor-executable instructions; wherein the processor is configured to execute the executable instructions to implement a physical-guided gas detection method as described in the first aspect and any possible technical solution thereof.

[0020] According to a fifth aspect of the present invention, a computer-readable storage medium is provided, on which instructions are stored, which, when executed by a processor of a computer device, enable the computer device to perform a physically guided gas detection method as described in the first aspect and any possible technical solution thereof.

[0021] According to a sixth aspect of the present invention, a computer program product is provided, the computer program product including computer instructions, which, when executed on a computer device, cause the computer device to perform the physical-guided gas detection method of the first aspect and any possible technical solution thereof.

[0022] The technical solution provided by this invention offers at least the following beneficial effects: First, it achieves high-fidelity enhancement and dynamic background robustness for single-frame infrared images. By employing a background estimation and residual compensation mechanism based on spatial scale separation effects, it decouples the target and background using spatial frequency differences within a single frame image, completely avoiding the temporal ghosting and modeling failure problems caused by traditional temporal domain algorithms when the camera pan-tilt rotates or the scene changes abruptly. While significantly suppressing thermal noise in complex environments and improving the image signal-to-noise ratio, this method accurately preserves and enhances the true physical morphology and background scene semantics of the semi-transparent, blurred edges of the leaked gas through a non-destructive linear superposition method, providing a high-quality data benchmark for the backend detection network.

[0023] Secondly, the detection accuracy of amorphous targets is improved through the deep coupling of physical priors and deep learning. This invention breaks away from the purely data-driven black-box mapping mode and innovatively integrates a physically guided dual-branch structure in the feature extraction stage. On the one hand, the discrete Laplace operator is used to mathematically model Fick's second law, enabling the network to perceive the local diffusion gradient of gas; on the other hand, the global modeling advantages of Transformer are combined to effectively solve the problem of broken edge features in large-area rarefied gases. This physically driven, globally perceptive feature modulation mechanism forces the network to focus on regions that conform to the gas diffusion law, significantly improving the accuracy and robustness of the model in recognizing ambiguous targets in complex industrial environments.

[0024] Finally, the stability of gas leak detection throughout its entire lifecycle was ensured. A top-down, multi-scale feature interaction mechanism enabled the efficient injection and complementarity of deep, strong semantic information with shallow, high-resolution details. This mechanism ensures that the system can both keenly capture small, highly concentrated gas clouds in the early stages of a leak and stably track large, sparse clouds in the later stages of diffusion, meeting the stringent requirements of industrial safety monitoring for reliability throughout the entire process.

[0025] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0026] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application, and do not constitute an undue limitation of this application.

[0027] Figure 1 This is a flowchart illustrating a physical-guided gas detection method according to an exemplary embodiment; Figure 2 This is a block diagram illustrating a physically guided gas detection device according to an exemplary embodiment; Figure 3 This is a schematic diagram of a computer device according to an exemplary embodiment. Detailed Implementation

[0028] To enable those skilled in the art to better understand the technical solutions of this application, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings.

[0029] It should be noted that the terms "first," "second," etc., used in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. The implementations described in the following exemplary embodiments do not represent all implementations consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application.

[0030] For ease of understanding, the physical-guided gas detection method provided in this application will be described in detail below with reference to the accompanying drawings.

[0031] like Figure 1 As shown, this embodiment provides a physically guided gas detection method, which is mainly applied to the automated monitoring of hazardous gas leaks in industrial settings. This physically guided gas detection method includes the following steps.

[0032] Step S100: Obtain the original infrared image of the area to be detected.

[0033] Specifically, the raw infrared image is typically acquired in real time by passive infrared imaging equipment deployed at the industrial site. Due to the absorption or emission characteristics of gas molecules to infrared radiation in specific wavelengths, the leaked gas exhibits a different thermal radiation distribution in the infrared image compared to the background environment. However, limited by sensor performance and complex environmental thermal interference, the raw infrared image often suffers from low contrast, poor signal-to-noise ratio, and blurred gas edges, making it highly susceptible to false negatives or missed detections when used directly for detection. Therefore, this invention does not directly feed the raw data into the recognition network, but instead designs a subsequent physical guidance enhancement and feature decoupling mechanism.

[0034] Step S200: Based on the spatial scale separation effect, background estimation and residual compensation are performed on the original infrared image to obtain an enhanced image.

[0035] In this embodiment, the spatial scale separation effect refers to the physical mechanism of signal decoupling by utilizing the significant differences in the spatial frequency distribution between the background environment and the leaked gas. Specifically, background heat sources such as equipment and pipelines in industrial sites typically exhibit a continuous and gently changing macroscopic thermal radiation field, belonging to low-frequency components; while the leaked gas cloud exhibits localized and relatively intense radiation anomalies or texture fluctuations, belonging to mid-to-high-frequency components. Based on this physical characteristic, this step extracts the pure background radiation reference from a single frame of the original infrared image using specific signal processing techniques, and non-destructively superimposes the extracted gas residual signal onto the original image. The advantage of this processing method is that it relies entirely on the spatial information within a single frame image, without depending on historical frame sequences, thus completely avoiding the temporal ghosting and model failure problems caused by traditional temporal background modeling methods under camera pan-tilt rotation, field-of-view switching, or dynamic scenes. At the same time, by using residual compensation instead of direct replacement, the structural semantics of background equipment such as pipelines and valves can be completely preserved while significantly improving the gas signal-to-noise ratio, providing a high-fidelity data foundation for the subsequent network understanding of the relative positional relationship between gas and equipment.

[0036] Step S300: Input the enhanced image into the pre-trained gas detection model, and extract features from the multi-scale feature map extracted from the enhanced image through the first feature extraction branch and the second feature extraction branch in the gas detection model, respectively.

[0037] The first feature extraction branch extracts physical gradient features and generates physical attention weights based on physical diffusion priors, while the second feature extraction branch extracts global spatial dependency features.

[0038] Specifically, the pre-trained gas detection model is an inference model that has been trained offline with a large number of labeled samples and converged. In the actual deployment phase, only forward computation is performed.

[0039] To address the lack of fixed geometric contours in amorphous gas targets, this invention abandons the common single feature extraction path and instead employs a parallel dual-branch architecture to achieve feature complementarity and decoupling. The first feature extraction branch explicitly incorporates prior knowledge of physical diffusion from fluid mechanics (e.g., the gradient distribution of gas concentration gradually diluting from the center outwards, as described by Fick's law), aiming to extract local physical gradient features from the enhanced image that conform to the true diffusion characteristics of gas, and transform them into physical attention weights representing what might be gas in that location. In parallel, the second feature extraction branch focuses on capturing long-range spatial dependencies across the entire image to address feature fragmentation caused by extremely blurred gas edges or partial occlusion.

[0040] It should be understood that although this embodiment describes two parallel branches, in other implementations, the execution order or interaction method of the branches can be adjusted according to computing resources or accuracy requirements, as long as the function of extracting physical local features and global semantic features respectively is satisfied.

[0041] Step S400: Modulate the global spatial dependency features using physical attention weights to obtain the target fusion features.

[0042] In this embodiment, modulation has a specific functional definition: using local features that conform to physical laws to filter and reshape global features. Specifically, this is not a simple feature concatenation or addition, but rather using the physical attention weights generated by the first branch as a gating signal to perform element-wise weighted processing on the global spatial dependency features extracted by the second branch. Through this modulation mechanism, the network is forced to focus on regions that possess both global contextual relevance and conform to local physical diffusion laws, thereby effectively suppressing thermal noise interference in the background that, while having similar textures, does not conform to gas diffusion characteristics. This physics-driven, globally perceptive deep fusion strategy breaks through the black-box limitations of purely data-driven models and significantly improves the model's accuracy in distinguishing weak, amorphous gas targets.

[0043] Step S500: Based on the target fusion features, output the gas detection results of the area to be detected.

[0044] Understandably, the above steps S300 to S500 are performed based on a pre-trained gas detection model.

[0045] Specifically, a pre-trained gas detection model is used to perform pre-processing on the enhanced image to obtain the gas detection result of the region to be detected. The gas detection model includes a first feature extraction branch and a second feature extraction branch. The pre-processing includes: extracting multi-scale feature maps of the enhanced image; using the first feature extraction branch, based on the physical diffusion prior, extracting physical gradient features from the multi-scale feature maps, and determining the physical attention weights of each pixel in the multi-scale feature maps according to the physical gradient features; using the second feature extraction branch, extracting global spatial dependency features from the multi-scale feature maps; using the physical attention weights, modulating the global spatial dependency features to obtain target fusion features; and outputting the gas detection result of the region to be detected based on the target fusion features.

[0046] Specifically, the gas detection results can include information such as the bounding box coordinates of the gas leak area, the category confidence level, and the leak level. When the detected confidence level exceeds a preset safety threshold, the system can automatically trigger an audible and visual alarm or link control devices.

[0047] This embodiment constructs a complete detection closed loop from single-frame image fidelity enhancement to physical guidance feature decoupling modulation through the above steps S100 to S500, achieving high-precision and robust detection of gas leaks in complex industrial environments while ensuring real-time performance.

[0048] In this embodiment, the image processing process based on spatial scale separation effect mentioned in step S200 of the above embodiment will be elaborated in detail.

[0049] As one implementation method, based on the spatial scale separation effect, background estimation and residual compensation are performed on the original infrared image to obtain an enhanced image. This includes: filtering the original infrared image using a low-pass filter operator to filter out mid-to-high frequency signals to extract the background radiation distribution and obtain a background estimation map; performing a difference operation between the original infrared image and the background estimation map to obtain a residual signal; and linearly superimposing the residual signal onto the original infrared image according to a preset gain coefficient to obtain an enhanced image.

[0050] The above processing flow constitutes a complete closed loop of background stripping, feature extraction, and fidelity enhancement data processing.

[0051] Firstly, the core purpose of using a low-pass filter operator to filter the original infrared image, removing mid-to-high frequency signals to extract the background radiation distribution and obtain a background estimation map, is not traditional image denoising or smoothing, but rather to construct a pure background radiation benchmark based on the spatial scale separation effect at the physical level. In industrial infrared scenarios, background heat sources such as pipes, tanks, and walls typically have large spatial spans and continuous, gradual temperature changes, manifesting as low-frequency components in the frequency domain; while leaked gas clouds, due to turbulent diffusion, often exhibit relatively intense local radiation fluctuations and edge textures, belonging to mid-to-high frequency components.

[0052] Therefore, by configuring a wide-window low-pass filter operator with specific parameters, mid-to-high frequency signals containing gas characteristics can be selectively filtered out, retaining only low-frequency components reflecting the macroscopic thermodynamic distribution of the environment. The resulting background estimation map visually appears as a highly smooth grayscale gradient image that removes all edge details and gas cloud morphology, and mathematically, it successfully reconstructs the pure background environmental thermal radiation reference surface within the current field of view that does not contain target gas characteristics.

[0053] It is important to emphasize that this process is based entirely on the spatial information within a single frame image and does not rely on statistical modeling of historical frame sequences. This completely avoids the problems of temporal ghosting and model failure caused by traditional temporal background modeling methods in situations such as camera pan-tilt rotation, field of view switching, or dynamic scenes.

[0054] Secondly, the step of performing a difference operation between the original infrared image and the estimated background image to obtain the residual signal essentially uses algebraic difference to suppress the background baseline. Since the estimated background image has already removed the gas signal while retaining the environmental radiation trend, subtracting it from the original infrared image makes the weak gas signal, which was originally submerged by the strong background, stand out. The resulting residual signal mainly contains gas plume characteristics that exhibit thermal or cold anomalies relative to the environment, as well as a small amount of random noise. This difference processing greatly enhances the contrast between the target and the background, making gas edges, which were previously difficult to detect against a semi-transparent background, clearly discernible.

[0055] Finally, regarding the step of linearly superimposing the residual signal onto the original infrared image according to a preset gain coefficient to obtain the enhanced image, this invention specifically adopts a strategy of linear superposition rather than direct replacement. This is a key design feature to ensure the accuracy of subsequent detection. If the residual signal is directly used as the network input, although the contrast of the gas target is maximized, the structural outline and spatial location information of background equipment such as pipes, flanges, and valves are completely lost. For gas leak detection tasks, the relative positional relationship between the gas and the equipment (e.g., whether the gas is escaping from the valve) is an important semantic clue for determining the authenticity of the leak. Without this background semantic information, the network is very likely to misjudge other non-gas high-frequency noise in the image as leak targets.

[0056] Therefore, this embodiment multiplies the residual signal by a preset gain coefficient. The original infrared image was then re-injected to generate an enhanced image. ;in, Represents the original infrared image. Represents the residual signal. To enhance the gain coefficient.

[0057] The gain coefficient The enhancement intensity used to control gas characteristics can typically be set from 0.5 to 2.0, and the specific value can be adaptively adjusted or preset according to the dynamic range of the site environment and the gas concentration.

[0058] Through this non-destructive linear compensation mechanism, the image enhancement significantly improves the saliency of the semi-transparent gas edges and the signal-to-noise ratio, while fully preserving the background structure and device semantics of the original scene. This provides a high-quality data foundation for the backend deep neural network, which combines high-contrast target features with rich contextual information.

[0059] It should be understood that although this embodiment uses linear superposition as an example, in other embodiments, nonlinear mapping or other forms of feature fusion strategies can also be used, as long as a balance between gas feature enhancement and background semantic preservation can be achieved.

[0060] In this embodiment, the method for determining the parameters of the low-pass filter operator and the residual signal processing procedure mentioned in the above embodiments are specifically defined.

[0061] As one implementation method, before filtering the original infrared image using a low-pass filter operator, the method further includes: obtaining the width and height of the original infrared image; calculating the initial span based on the width, height, and a preset scale factor; and rounding the initial span upwards to an odd number to obtain the window size of the low-pass filter operator; and determining the standard deviation of the low-pass filter operator based on the window size and a preset attenuation criterion.

[0062] Specifically, the aforementioned adaptive parameter determination mechanism aims to address the issue of inconsistent background estimation scales under detectors of different resolutions. In industrial settings, the resolution of infrared thermal imagers can range from 384×288 to 640×512 or even higher. If a fixed filtering window is used, it can easily lead to incomplete gas filtration at high resolutions or excessively smoothed backgrounds at low resolutions.

[0063] Therefore, this invention introduces a scale factor. This establishes the mapping relationship between the image's geometric dimensions and the filtering span. The scale factor is used to... The physical meaning of is the maximum relative span that the gas cloud to be detected may occupy in the current field of view. In practical applications, considering the typical diffusion range of industrial gas leak clouds, The preferred value range is 0.05 to 0.12. When When the value is too small (e.g., less than 0.05), the calculated filter window may not be sufficient to completely cover large gas clouds, resulting in residual gas signals in the background estimation image, which in turn causes the residual signal obtained by subsequent differencing to contain unstripped background components; conversely, when... When the value is too large (e.g., greater than 0.12), the filter window becomes too large, which will cause small-scale background heat sources such as pipes and valves to be filtered out as low-frequency background, resulting in the loss of key equipment structural semantics in the enhanced image. Extensive experimental verification shows that when... When the value is 0.08, it can achieve the best balance between background suppression and detail preservation in most industrial scenarios.

[0064] After calculating the initial span Then, it must be rounded up to an odd number to obtain the final window size. W and H are the resolution parameters of the current infrared image, which are known intrinsic parameters; The scale factor represents the maximum relative span of the gas cloud in the image (typically 0.05-0.12).

[0065] This step is of critical engineering necessity. In two-dimensional discrete convolution operations, a definite geometric center pixel exists only when the convolution kernel size is odd, thus ensuring precise spatial alignment between the filtered output feature map and the input image. If an even-sized window is used, the convolution operation will produce a phase shift of half a pixel. This tiny misalignment, after being amplified by subsequent difference operations and feature extraction networks, may lead to inaccurate gas target localization or blurred edges.

[0066] Specific window size The calculation formula is At the same time, set a lower limit constraint. This ensures basic low-pass smoothing and prevents window failure due to low image resolution.

[0067] Furthermore, the standard deviation is determined based on the window size and the preset attenuation criterion. At that time, the present invention follows a Gaussian distribution. Criteria, i.e., setting The physical mechanism behind this setting is to ensure that the weights of the Gaussian kernel function at the window edges decay smoothly to near zero, avoiding the Gibbs phenomenon or ringing artifacts caused by hard truncation. If the standard deviation is too large, the weight distribution within the window becomes too flat, degenerating into mean filtering and losing the gradual trend of the background; if the standard deviation is too small, the weights are concentrated in the central minimum neighborhood, failing to effectively integrate large-scale background radiation information. The parameter combination determined by the criteria can construct an optimal background estimation operator that conforms to the continuous distribution characteristics of thermal radiation and has good frequency domain cutoff characteristics.

[0068] As one implementation method, based on spatial scale separation of the image to be detected, the background field is adaptively estimated and the residual is obtained. The residual is then compensated to the image to be detected with a gain coefficient to generate an enhanced image. Specifically, the parameters of the spatial low-pass smoothing operator are adaptively determined based on the scale of the image to be detected. The spatial low-pass smoothing operator is used to perform spatial convolution operations on the image to be detected to estimate the background field. The difference between the image to be detected and the background field is calculated to obtain the residual. The residual is then compensated to the image to be detected with a gain coefficient to generate an enhanced image.

[0069] The method for determining the parameters of a spatial low-pass smoothing operator based on the scale adaptation of the image to be detected includes the following steps: calculating the original window size of the spatial low-pass smoothing operator based on the diagonal length and normalization coefficient of the image to be detected; rounding the original window size up to an odd number to determine the final window size; and determining the standard deviation parameter of the spatial low-pass smoothing operator based on the final window size and the 3σ criterion.

[0070] Among them, the spatial low-pass smoothing operator is a two-dimensional Gaussian kernel matrix. The weight coefficients at any coordinate offset within the two-dimensional Gaussian kernel matrix are calculated based on the standard deviation parameter and the coordinate offset. The two-dimensional Gaussian kernel matrix is ​​then normalized to ensure energy conservation.

[0071] As a technical solution, a differential operation is performed between the original infrared image and the background estimation image to obtain a residual signal. This includes: subtracting the pixel gray value at each coordinate position in the original infrared image from the estimated radiation value at the corresponding coordinate position in the background estimation image; when the difference result is less than zero, the difference result is set to zero to obtain the residual signal.

[0072] Specifically, the zeroing process in this step is a targeted design based on the physical characteristics of infrared imaging. In passive infrared imaging, in addition to thermal anomalies caused by gas leaks, there is also common cold spot interference caused by sensor defects, electronic noise, or environmental cold reflections (such as sky reflections or low-temperature metal surfaces). These cold spots appear as localized low emissivity values ​​in the original image, and often produce a significant negative response after subtracting from the smoothed background estimation map.

[0073] However, for most volatile organic compounds (VOCs) and industrial hazardous gases, their absorption or emission characteristics in specific infrared bands typically exhibit positive radiation contrast relative to the background (or are transformed into positive features after preprocessing enhancement). Therefore, the negative components in the residual signal are most likely non-gas noise interference.

[0074] Furthermore, standard deviation. The process of determining it is as follows.

[0075] The decay rate of spatial weights follows a Gaussian distribution. The criteria are set, that is This ensures that the weights at the edges of the filtering window transition smoothly to near zero.

[0076] Based on the determined parameters, initialize a discrete two-dimensional Gaussian kernel matrix of size k in memory. The offset of any coordinate within this matrix is... The formula for calculating the weight coefficient at a given location is as follows.

[0077]

[0078] Variable definition: The local spatial relative coordinates with the center of the filter operator as the origin have a range of values. ,and ; This is the global energy normalization coefficient.

[0079] Operator normalization: To ensure the conservation of overall radiant energy in the image before and after filtering, the generated matrix needs to be forcibly normalized, that is, by dividing all elements in the matrix by their sum, to ensure... .

[0080] Furthermore, the spatial convolution operation is decoupled from the background as follows.

[0081] Infrared images With the constructed two-dimensional Gaussian kernel matrix The following formula is used to perform a two-dimensional discrete spatial convolution operation.

[0082]

[0083] This is an estimated value output after the convolution operation.

[0084] When the convolution kernel slides to the edge of the image, an edge pixel copying boundary strategy is used to fill it in, in order to prevent boundary estimation distortion from causing artificial artifacts in the subsequent images.

[0085] By performing a weighted average by sliding the wide window operator across the entire image, the signal that fluctuates wildly in space (such as abrupt gas plumes or sensor shot noise) is forced to flatten out, retaining only the continuous and gently changing macroscopic thermodynamic distribution in space.

[0086] Through the original image Background estimation map By subtraction, a response signal containing gas details is obtained. Force the difference of less than zero to zero, that is, execute... This operation can effectively remove these negative cold spot noises, preventing them from being amplified and injected into the enhanced image by subsequent linear superposition steps, thereby significantly improving the signal-to-noise ratio of the final input detection model.

[0087] If the difference is less than 0, it is uniformly set to zero. This is done to eliminate negative interference in the background caused by cold spot noise. Because environmental radiation is canceled out, the residual signal... Only the gas plume characteristics that appear as thermal or cold anomalies relative to the environment are retained, greatly enhancing the contrast between the target and the background.

[0088] It should be understood that although this embodiment takes zeroing as an example, in some special gas detection scenarios (such as cryogenic liquefied gas leakage), it is also possible to adjust to retain negative values ​​or take absolute values ​​according to the thermodynamic characteristics of the target gas, as long as the suppression of non-target signals can be achieved.

[0089] Extracted residual signal As a compensation term, the feedback is superimposed onto the original image to generate a high-quality preprocessed output image. .

[0090]

[0091] Variable definition: To enhance the gain coefficient, the value is set to [0.5, 2.0], which is preset according to the dynamic range of the field environment.

[0092] While simple residual plots offer high contrast, they lose the structural outlines of background equipment such as pipes and flanges, hindering subsequent network understanding of the relative positions of gas and equipment. By scaling the residual terms with a factor... Reinjecting the original image significantly enhances the edges of the translucent gas while preserving the device background. This enhances the edge salience of the faint gas, providing high signal-to-noise ratio input data with complete scene semantics for subsequent deep neural networks.

[0093] In this embodiment, the dual-branch feature extraction and modulation process mentioned in step S300 of the above embodiment will be elaborated in detail.

[0094] As a technical solution, feature extraction is performed through the first feature extraction branch and the second feature extraction branch in the gas detection model, including: performing spatial second derivative operation on the input feature map through the first feature extraction branch to extract the physical gradient matrix characterizing the local dispersion characteristics of the gas, and generating physical attention weights based on the physical gradient matrix; and performing self-attention mechanism operation on the multi-scale feature map through the second feature extraction branch to extract global spatially dependent features.

[0095] The process employs a parallel dual-branch data processing architecture. The input feature map is simultaneously fed into the first feature extraction branch on the left and the second feature extraction branch on the right, which are functionally complementary and independent. The first feature extraction branch acts as a physical verifier, and its core task is to identify texture structures that conform to the gas concentration gradient variation law from the local neighborhood based on diffusion priors in fluid mechanics (such as Fick's law).

[0096] By performing spatial second derivative operations on the feature map, this branch can keenly capture the diffusion characteristics of gas clouds, which are high at the center and low at the edges, and encode this physical property into a physical gradient matrix, which is then transformed into normalized physical attention weights. In parallel, the second feature extraction branch acts as a global perceptron, using a self-attention mechanism to overcome the limitations of the convolutional receptive field, establishing pixel-level long-range associations across the entire image, thereby extracting global spatial dependency features containing complete morphological information. This parallel design ensures that the network can perceive both local physical realism and grasp the overall spatial continuity, avoiding feature loss from a single perspective.

[0097] As one implementation method, the global spatial dependency features are modulated using physical attention weights, including: using physical attention weights to perform element-wise weighting of the global spatial dependency features to obtain target fusion features.

[0098] It is particularly important to emphasize that the modulation in this invention is fundamentally different from the feature fusion commonly found in related technologies. Traditional feature fusion typically employs addition or concatenation, assuming that the features of the two branches have equal importance or complementarity. However, in gas detection scenarios, global features often contain a large amount of background noise that does not conform to the physical properties of the gas (such as thermal reflection, device edges, etc.). If directly fused, this noise will interfere with the model's judgment. The element-wise weighting used in this embodiment is essentially a gating mechanism, that is, the physical attention weights generated by the first branch are used as dynamic filters or spotlights, applied to the global spatial dependency features of the second branch.

[0099] In this process, only those regions that have both global contextual relevance and conform to local physical diffusion laws will be preserved and enhanced, while background responses that do not conform to physical laws will be suppressed or even filtered out.

[0100] Through this physically guided modulation strategy, the network is forced to express features within a subspace that conforms to the real physical properties of the gas. This effectively solves the problem that amorphous gas targets are easily confused with complex backgrounds due to blurred boundaries, and significantly improves the confidence and robustness of the detection results.

[0101] It should be understood that although this embodiment uses element-wise weighting as the preferred implementation of modulation, in other embodiments, physical weight-based adaptive convolution or other forms of feature recalibration methods can also be used, as long as the function of using physical priors to filter global features can be achieved.

[0102] In this embodiment, the specific implementation of the first feature extraction branch mentioned in the above embodiments is described in detail.

[0103] As a technical solution, the first feature extraction branch performs spatial second derivative operations on the input feature map to extract the physical gradient matrix characterizing the local dispersion characteristics of the gas, and generates physical attention weights based on the physical gradient matrix. This includes: performing a two-dimensional convolution operation on the feature map using a preset discrete Laplacian convolution kernel, calculating the second difference between the pixel and its neighboring pixel values ​​to obtain the physical gradient matrix; and normalizing the physical gradient matrix using an activation function to generate spatial physical attention weights.

[0104] Multiscale feature maps are also called input feature maps, or simply feature maps.

[0105] The input feature map is first processed by a Laplacian convolution kernel to generate a physical gradient attention weight map. This process is not ordinary image edge detection, but rather explicitly embeds Fick's Second Law from fluid dynamics into the feature extraction stage of deep learning. According to Fick's Law, the diffusion flux of gas molecules is proportional to the concentration gradient, and under steady-state or quasi-steady-state diffusion conditions, the spatial distribution of gas concentration is directly mathematically related to its second derivative. In passive infrared imaging, leaking gas clouds typically exhibit a smooth, gradual field where temperature or radiation intensity gradually decreases from the center outwards. This diffusion characteristic, high at the center and low at the edges, mathematically corresponds precisely to a significant second derivative response. Therefore, this embodiment uses the discrete Laplacian operator as the carrier of physical priors, aiming to force the network to extract local structural features that conform to the actual physical diffusion laws of gases.

[0106] The preset discrete Laplacian convolution kernel is essentially a filter used to approximate the second-order partial derivatives in two-dimensional space. In a preferred embodiment, the convolution kernel can be a 3×3 matrix.

[0107]

[0108] This matrix measures the local curvature of an image by calculating the weighted sum of the center pixel and its four immediate neighbors (top, bottom, left, and right). When the operator passes over the central region of a gas cloud, the convolution result shows a large positive value because the center pixel value is significantly higher than its neighbors. However, when the operator is located in a uniform background region, the convolution result approaches zero. When the operator is located on the sharp edge of a rigid object such as a pipe, although a response is still generated, the spatial distribution pattern of the response differs significantly from the smooth, gradual field of the gas.

[0109] It should be understood that the above 3×3 matrix is ​​only a specific implementation example. In other implementations, an 8-neighborhood Laplacian kernel containing diagonal elements, the LoG (Laplacian of Gaussian) operator, or other differential operators that can characterize the second-order rate of change of space can also be used, as long as the function of extracting the local dispersion characteristics of gas can be achieved.

[0110] Furthermore, regarding the step of normalizing the physical gradient matrix using an activation function to generate spatial-dimensional physical attention weights, this invention can employ the Sigmoid function as the activation function. The choice of Sigmoid over other activation functions such as ReLU or Softmax is based on the following two profound considerations: First, the values ​​in the physical gradient matrix contain positive and negative fluctuations, and directly using them as weights would lead to instability in feature modulation. The Sigmoid function can non-linearly map gradient values ​​in any real number domain to the (0, 1) interval, giving it probabilistic attention properties; that is, the closer the value is to 1, the higher the probability that the region conforms to gas diffusion characteristics, and the closer it is to 0, the lower the probability. Second, the saturation characteristics at both ends of the Sigmoid function naturally constitute a soft thresholding mechanism, which can effectively suppress extreme gradient anomalies caused by sensor thermal noise or background clutter, preventing individual noise points from being over-amplified in subsequent modulation processes, thereby improving the robustness and purity of the physical attention weight map.

[0111] The physical attention weights generated through the above processing essentially construct a spatial mask representing physical compliance, providing precise physical guidance for the global feature modulation described in the above embodiments, ensuring that the detection model not only sees the global context, but also understands which regions are truly target regions that conform to the physical properties of the gas.

[0112] In this embodiment, the specific implementation of the second feature extraction branch mentioned in the above embodiments is described in detail.

[0113] As a technical solution, a self-attention mechanism is performed on the multi-scale feature map through a second feature extraction branch to extract global spatially dependent features. This includes: flattening the feature map in the spatial dimension to map it into a one-dimensional sequence feature; performing linear projection on the one-dimensional sequence feature to generate a query matrix, a key matrix, and a value matrix; calculating the attention weight distribution based on the query matrix and the key matrix, and using the attention weight distribution to perform a weighted summation on the value matrix to obtain the attention output sequence; and spatially rearranging the attention output sequence to restore it to the same dimensional space as the feature map to obtain the global spatially dependent features.

[0114] This process aims to overcome the limitation of the first feature extraction branch, which only focuses on local physical gradients, by establishing long-range dependencies across the entire map to capture the complete morphology of amorphous gas clouds.

[0115] First, the core purpose of flattening the feature map in space to map it into a one-dimensional sequence of features is to break the inherent local receptive field limitation of convolutional neural networks. The input feature map originally has a two-dimensional spatial structure ( The correlation between pixels is restricted to their adjacent neighborhoods. It is then reshaped into a shape of length [length missing] through a flattening operation. The one-dimensional sequence makes any two positions in the sequence mathematically directly reachable, thus laying the geometric foundation for subsequent calculations of spatial correlations across the entire field of view. This approach is particularly crucial for detecting gas leaks with blurred edges, irregular shapes, and that may span multiple areas of the image.

[0116] Secondly, regarding the step of performing linear projection on one-dimensional sequence features to generate the query matrix, key matrix, and value matrix, this invention endows these three matrices with specific physical semantics in the gas detection task. The query matrix (Query, Q) represents the query request from the current pixel to the entire image regarding the existence of relevant gas features; the key matrix (Key, K) represents the responsiveness or contextual matching degree of each position in the entire image to this query request; and the value matrix (Value, V) carries the actual radiation intensity or feature information of each position. Through a learnable weight matrix... By performing linear projection, the model can map the original features to a subspace suitable for measuring the spatial correlation of gases.

[0117] For example, when a pixel is located at the edge of a weak gas plume, its corresponding Query vector can be used to find a strong response in the core region of high-concentration gas in the Key space through dot product operation, thereby establishing a semantic connection between weak and strong signals.

[0118] Furthermore, the mathematical expression for the step of calculating the attention weight distribution based on the query matrix and key matrix, and then using the attention weight distribution to perform a weighted summation of the value matrix to obtain the attention output sequence, is typically as follows: .

[0119] in, The dot product operation quantifies the correlation between any two points, scaling factor To prevent the gradient from vanishing due to excessively large dot product results, the Softmax function normalizes the relevance scores into attention weights in the form of a probability distribution. In gas detection scenarios, this mechanism enables the network to automatically learn and focus on regions that, although spatially distant, share an inherent consistency in thermal radiation patterns. Even if some gas regions exhibit extremely weak features due to environmental interference or over-dilution, as long as they possess topological connectivity or similar texture patterns to the main gas mass, this attention mechanism can aggregate effective information from the global context, avoiding the feature fragmentation problem commonly found in traditional methods.

[0120] Finally, the step of spatially rearranging the attention output sequence to restore it to the same dimensional space as the feature map, thus obtaining globally spatially dependent features, is a crucial prerequisite for achieving dual-branch feature fusion. Since the modulation operation described in the above embodiments is based on element-wise weighting, it requires that the two feature tensors involved in the modulation must have completely identical spatial dimensions (i.e., ...). Therefore, the one-dimensional sequence after global interaction must be folded back into a two-dimensional feature map form. The resulting global spatial dependency features not only contain rich long-range context information, but also achieve precise alignment in spatial coordinates with the physical attention weight map generated in the above embodiment, ensuring the smooth progress of the subsequent physical guidance modulation process.

[0121] It should be understood that although this embodiment uses the standard self-attention mechanism as an example, in other implementations, linear attention, sparse attention, or other efficient Transformer variants can also be used to achieve global feature extraction, as long as it can establish pixel-level associations across the entire image and output global features of the same dimension as the input. These alternatives may be optimized in terms of computational complexity or memory usage, and are suitable for edge computing devices with different computing power conditions, all of which fall within the scope of protection of this invention.

[0122] In this embodiment, the specific implementation process of outputting gas detection results based on target fusion features mentioned in step S500 of Embodiment 1 is described in detail.

[0123] As a technical solution, based on target fusion features, the gas detection results of the area to be detected are output, including: based on target fusion features, deconvolution upsampling is performed on the multi-scale feature map to obtain deep layer physical features, and the deep layer physical features and shallow layer physical features are horizontally stitched together to obtain a fused feature map.

[0124] Because gas leaks in industrial settings exhibit extreme scale dynamics, they can manifest as tiny initial leaks at the pixel level at valve interfaces, or as large, thin clouds occupying half the field of view after diffusion. Single-scale features are insufficient to meet the detection requirements of both types of targets. Therefore, this invention constructs a top-down multi-scale feature interaction path. In this path, although the deep feature map containing target fusion features undergoes multiple downsampling and physical modulation, possessing rich high-level semantic information and anti-interference capabilities, its spatial resolution is low, losing the precise boundary details of weak gas leaks.

[0125] To compensate for this deficiency, this embodiment utilizes deconvolution upsampling operations to progressively recover the spatial dimensions of deep features. After upsampling at each level, these features are laterally concatenated with the shallow physical features of the corresponding layers in the backbone network. Here, shallow physical features refer to feature maps that have not undergone deep abstraction and retain the original spatial geometric information and fine texture.

[0126] Through this stitching operation, the fused feature map inherits both the strong semantic discriminative power of deep features and the high spatial resolution of shallow features, enabling the model to accurately identify that it is a gas and precisely delineate the gas's edge contours. It should be understood that although this embodiment uses horizontal stitching as an example, in other implementations, element-wise addition or other feature aggregation operators can also be used to achieve the complementarity of deep and shallow features, as long as the fusion of multi-scale information can be achieved.

[0127] As a technical solution, the fused feature map is predicted by decoupling the detection head, and the bounding box offset, class confidence and centrality weight of the target are output respectively.

[0128] Specifically, to address the common problem of inconsistency between localization and classification in the detection of amorphous gas targets, this invention employs a specialized decoupled head design. In traditional coupled head detection, the classification and regression tasks share the same set of convolution parameters. However, for semi-transparent gases, there is often a spatial misalignment between their visually salient region (usually used for classification) and their geometric center region (usually used for localization).

[0129] For example, a diffuse gas cloud may have the clearest texture and the highest classification confidence at its edges, but its geometric center may be located in a low-contrast region with blurred texture. Forcing the same feature response to perform two tasks simultaneously can easily lead to contradictory results such as high confidence but localization offset or accurate localization but low confidence.

[0130] Therefore, this embodiment splits the detection head into three parallel independent branches: the first branch focuses on the bounding box offset of the regressed target. The first branch predicts the offset of the bounding box center point relative to the grid cells and the aspect ratio; the second branch focuses on predicting the class confidence. The first branch represents the probability that the current region contains real gas; the second branch predicts the centerness weight, which measures the degree to which the center point of the predicted bounding box falls within the real gas region, thereby suppressing low-quality predicted bounding boxes that, although partially covering the gas, are severely off-center. These three branches each have independent convolutional layer parameters and do not interfere with each other, thus achieving a simultaneous improvement in classification accuracy and localization accuracy.

[0131] The process of outputting test results includes the following steps.

[0132] First, feature reconstruction and spatial alignment: The calculated attention output sequence is spatially rearranged to restore it to match the original feature map. In the same dimensional space, a global enhanced feature map is obtained. The corresponding final output is a global morphological dependency feature map. .

[0133] Ensure that the global semantic information extracted by the Transformer branch is spatially aligned with the local physical features extracted by the CNN branch, laying a coordinate consistency foundation for the next step of performing physical-guided feature integration.

[0134] Secondly, top-down bidirectional multi-scale feature connection: a path aggregation network structure is adopted to deconvolve and upsample deep high-dimensional semantic features and perform horizontal concatenation with shallow physical features.

[0135]

[0136] Variable definition: This represents the enhanced features of the i-th layer after fusion; This is the upsampling result for high-level features. This represents the convolution operation. This indicates a join operation.

[0137] Industrial gas leaks often encompass two scales: initial small leaks and large-scale clouds that spread afterward. This structure achieves a complementarity between strong semantic information and high-resolution details, ensuring that the model has a high detection rate for leak targets of different sizes.

[0138] Third, prediction head construction and state decoding: in multi-scale feature maps A decoupled detection head is deployed on top. The bounding box offset B, class confidence S, and centrality weight C of the target are predicted through three parallel convolutional branches.

[0139]

[0140] Variable definition: The coordinates of the target center; The width and height of the prediction box.

[0141] During the training phase, a composite loss function is used as the loss function in the model training process. .

[0142]

[0143] in, Classification loss represents the classification error between the model's predicted target class probability and the true labeled class; global intersection-union regression loss. This represents the geometric deformation and positioning error between the gas bounding box predicted by the model and the actual labeled box; and These are the dynamic weight balancing coefficients for the classification loss and the global intersection-union (GUC) regression loss, respectively. During multi-task training, the convergence speed and loss magnitude of the classification and regression tasks often differ. This can be addressed by configuring... and This can prevent a single task from converging too early or dominating the gradient direction, ensuring that the network achieves the global optimal solution in both "accurate localization" and "correct recognition".

[0144] Focal Loss is used to characterize the classification loss. Given the strong imbalance between positive and negative samples in gas detection, the classification loss penalizes incorrectly classified predicted boxes, representing the network's ability to learn to distinguish between industrial background radiation interference and real gas leak features. The IoU (Intersection over Union) commonly used in traditional object detection has a zero gradient when two bounding boxes do not intersect, making further optimization impossible. Considering the blurred edges and morphological diffusion of leaked gas, predicted boxes and ground truth boxes are highly likely to be disjoint in the early stages of training.

[0145] The Generalized Intersection over Union (GIoU) ​​in the Global Intersection over Union regression loss solves the gradient backpropagation problem in the case of non-intersection by introducing the minimum closure region surrounding the two boxes as a penalty term. This guides the network to overcome the boundaryless nature of gas and achieve stable and high-precision regression localization of the diffusion range of gas clouds.

[0146] The final output image contains the precise coordinates and probability scores of all suspected gas targets, completing the closed loop from the original image to the gas target detection task.

[0147] Specifically, the model training process strictly follows the following preprocessing logic and network architecture, and the specific steps include:

[0148] First, offline pre-enhancement: Enhancement preprocessing is performed on the original infrared images in the training set to generate corresponding high signal-to-noise ratio training samples, ensuring that the feature benchmarks learned by the model are consistent with those in the inference stage.

[0149] Secondly, network initialization: load the pre-trained ResNet-50 weights as the starting point of the backbone network and initialize the module parameters.

[0150] Third, loss function iteration: The enhanced image is input into the network, and the composite loss is calculated through the backpropagation algorithm. The key is to pass through The model's regression accuracy for non-substantial gas fuzzy boundaries is optimized, and the overfitting problem caused by pure data-driven approaches is corrected using a physics-guided module.

[0151] Fourth, weight solidification: After multiple iterations until the model converges, the optimal network weight file with physical perception capability is saved.

[0152] As a technical solution, when the category confidence level is greater than a preset safety threshold, a gas leak alarm message containing the bounding box offset is output.

[0153] Specifically, a preset security threshold It is a key hyperparameter for balancing the false alarm rate and the missed alarm rate. In a preferred embodiment of the present invention, considering the zero-tolerance characteristic of industrial safety monitoring for false alarms, and at the same time taking into account the "boy who cried wolf" effect caused by frequent alarms triggered by environmental thermal noise, this safety threshold is... The default value is 0.5. During actual deployment, the system performs non-maximum suppression (NMS) on all candidate boxes output by the decoupled detection head, removing redundant overlapping boxes and retaining only the class confidence score. The final detection result. Once a target that meets the conditions is detected, the system will immediately generate standardized gas leak alarm information. This information not only includes the precise bounding box coordinates of the leak area, but also associates the current timestamp, device ID, and leak severity level.

[0154] In typical industrial applications, this alarm information can be pushed in real time to the programmable logic controller (PLC) or distributed control system (DCS) in the field via industrial communication protocols such as Modbus, OPC UA, or MQTT. This automatically triggers the flashing and sounding of audible and visual alarms, starts the exhaust fan, or shuts off relevant valves, forming an automated safety closed loop from visual perception to physical action. It should be understood that safety thresholds... It is not fixed. Users can flexibly configure it according to the environmental complexity and safety level requirements of specific scenarios. For example, in high-risk chemical areas, the threshold can be lowered to 0.4 to improve sensitivity, while in non-critical areas with strong background interference, the threshold can be raised to 0.6 to reduce the false alarm rate.

[0155] To achieve the above functions, the physical-guided gas detection device includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art will readily recognize that, based on the algorithmic steps of the examples described in conjunction with the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0156] This disclosure also provides an embodiment such as Figure 2 The physical-guided gas detection device shown includes the following units: image acquisition module 21, fidelity enhancement module 22, and feature decoupling modulation module 23.

[0157] Image acquisition module 21 is used to acquire the original infrared image of the area to be detected.

[0158] The fidelity enhancement module 22 is used to perform background estimation and residual compensation on the original infrared image based on the spatial scale separation effect to obtain an enhanced image.

[0159] The feature decoupling modulation module 23 is used to perform preset processing on the enhanced image using a pre-trained gas detection model to obtain the gas detection result of the region to be detected; the gas detection model includes a first feature extraction branch and a second feature extraction branch.

[0160] The pre-processing includes: extracting multi-scale feature maps of the enhanced image; using the first feature extraction branch, based on the physical diffusion prior, extracting physical gradient features from the multi-scale feature maps, and determining the physical attention weights of each pixel in the multi-scale feature maps according to the physical gradient features; using the second feature extraction branch, extracting global spatial dependency features from the multi-scale feature maps; using the physical attention weights to modulate the global spatial dependency features to obtain target fusion features; and outputting the gas detection results of the region to be detected based on the target fusion features.

[0161] Furthermore, the image acquisition module 21, the fidelity enhancement module 22, and the feature decoupling modulation module 23 are respectively configured to implement the corresponding steps in different embodiments of the above method. To avoid repetition, the functional implementation steps of the corresponding modules will not be described again here.

[0162] Regarding the apparatus in the above embodiments, the specific manner in which each unit module performs its operations has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0163] Figure 3This is a schematic diagram of a computer device provided in this application. Figure 3 The computer device 30 may include at least one first processor 301 and a memory 303 for storing processor-executable instructions. The first processor 301 is configured to execute instructions in the memory 303 to implement the physical-guided gas detection method described in the following embodiments.

[0164] In addition, the computer device 30 may also include a communication bus 302, at least one communication interface 304, an input device 306, and an output device 305.

[0165] The first processor 301 may be a processor (central processing unit, CPU), a microprocessor unit, an ASIC, or one or more integrated circuits for controlling the execution of programs according to the present application.

[0166] The communication bus 302 may include a path for transmitting information between the aforementioned components.

[0167] Communication interface 304 uses any transceiver-like device for communicating with other devices or communication networks, such as Ethernet, radio access network (RAN), wireless local area network (WLAN), etc.

[0168] Input device 306 is used to receive input signals and output device 305 is used to output signals.

[0169] Memory 303 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital versatile optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, 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, but not limited thereto. Memory may exist independently and be connected to the processing unit via a bus. Memory may also be integrated with the processing unit.

[0170] The memory 303 stores instructions for executing the scheme of this application, and the execution is controlled by the first processor 301. The first processor 301 executes the instructions stored in the memory 303 to realize the functions of the method of this application.

[0171] In a specific implementation, as one example, the first processor 301 may include one or more CPUs, for example... Figure 3 CPU0 and CPU1 in the CPU.

[0172] In a specific implementation, as one example, the computer device 30 may include multiple processors, such as... Figure 3 The first processor 301 and the second processor 307 are described. Each of these processors may be a single-core processor or a multi-core processor. A processor here may refer to one or more devices, circuits, and / or processing cores used to process data (such as computer program instructions).

[0173] The computer device, such as Figure 3 The diagram includes a first processor 301 and a memory 303 for storing executable instructions of the first processor 301. The first processor 301 is configured to execute the executable instructions to implement a physical-guided gas detection method as described in any of the possible implementations above. Furthermore, it achieves the same technical effect, and to avoid repetition, it will not be described further here.

[0174] This application also provides a computer-readable storage medium, which, when the instructions in the computer-readable storage medium are executed by the processor of a physically guided gas detection device or computer device, enables the physically guided gas detection device or computer device to perform a physically guided gas detection method as described in any of the possible implementations above. And it can achieve the same technical effect; to avoid repetition, it will not be described again here.

[0175] This application also provides a computer program product, including a computer program or instructions, which are executed by a processor as a physical-guided gas detection method according to any of the possible implementations described above. It achieves the same technical effects, and to avoid repetition, will not be described again here.

[0176] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only and do not fully encompass the true scope and spirit of this application.

[0177] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope.

Claims

1. A physical guidance based gas detection method, characterized by, The method includes: Acquire the original infrared image of the area to be detected; Based on the spatial scale separation effect, background estimation and residual compensation are performed on the original infrared image to obtain an enhanced image; A pre-trained gas detection model is used to perform pre-processing on the enhanced image to obtain the gas detection result of the region to be detected. The gas detection model includes a first feature extraction branch and a second feature extraction branch. The pre-processing includes: extracting a multi-scale feature map of the enhanced image; using the first feature extraction branch, based on a physical diffusion prior, extracting physical gradient features from the multi-scale feature map, and determining the physical attention weight of each pixel in the multi-scale feature map according to the physical gradient features; using the second feature extraction branch, extracting global spatial dependency features from the multi-scale feature map; using the physical attention weights, modulating the global spatial dependency features to obtain target fusion features; and outputting the gas detection result of the region to be detected based on the target fusion features.

2. The method of claim 1, wherein, The enhancement image is obtained by performing background estimation and residual compensation on the original infrared image based on the spatial scale separation effect, including: The original infrared image is filtered using a low-pass filter operator to remove mid-to-high frequency signals in order to extract the background radiation distribution and obtain a background estimation map. The original infrared image and the estimated background image are subjected to a difference operation to obtain the residual signal; The residual signal is linearly superimposed onto the original infrared image according to a preset gain coefficient to obtain the enhanced image.

3. The method of claim 2, wherein, Before filtering the original infrared image using a low-pass filter operator, the process further includes: The width and height of the original infrared image are obtained. An initial span is calculated based on the width, the height, and a preset scale factor. The initial span is then rounded up to an odd number to obtain the window size of the low-pass filter operator. The standard deviation of the low-pass filter operator is determined based on the window size and a preset attenuation criterion. The step of performing a difference operation between the original infrared image and the estimated background image to obtain a residual signal includes: The pixel grayscale value at each coordinate position in the original infrared image is subtracted from the estimated radiation value at the corresponding coordinate position in the background estimation image. When the difference result is less than zero, the difference result is set to zero to obtain the residual signal.

4. The method of claim 3, wherein, The step of using the first feature extraction branch to extract physical gradient features from the multi-scale feature map based on physical diffusion prior, and determining the physical attention weights of each pixel in the multi-scale feature map according to the physical gradient features, includes: using the first feature extraction branch to perform spatial second derivative operation on the multi-scale feature map to extract the physical gradient matrix characterizing the local dispersion characteristics of the gas, and generating the physical attention weights based on the physical gradient matrix. The step of extracting global spatial dependency features using the second feature extraction branch includes: using the second feature extraction branch to perform a self-attention mechanism operation on the multi-scale feature map to extract the global spatial dependency features; The step of modulating the global spatial dependency features using the physical attention weights includes: using the physical attention weights to perform element-wise weighting on the global spatial dependency features to obtain the target fusion features.

5. The method of claim 4, wherein, The step of performing spatial second-order derivative operations on the multi-scale feature map using the first feature extraction branch to extract the physical gradient matrix characterizing the local dispersion properties of the gas, and generating the physical attention weights based on the physical gradient matrix, includes: The multi-scale feature map is subjected to a two-dimensional convolution operation using a preset discrete Laplacian convolution kernel, and the second-order difference between a pixel and its neighboring pixel values ​​is calculated to obtain the physical gradient matrix. The physical gradient matrix is ​​normalized by an activation function to generate the spatial dimension of the physical attention weights.

6. The method of claim 4, wherein, The step of performing a self-attention mechanism operation on the multi-scale feature map through the second feature extraction branch to extract the global spatial dependency features includes: The multi-scale feature map is flattened in the spatial dimension and mapped to a one-dimensional sequence feature. Perform linear projection on the one-dimensional sequence features to generate a query matrix, a key matrix, and a value matrix; The attention weight distribution is calculated based on the query matrix and the key matrix, and the value matrix is ​​weighted and summed using the attention weight distribution to obtain the attention output sequence; The attention output sequence is spatially rearranged to restore it to the same dimensional space as the multi-scale feature map, thus obtaining the global spatial dependency feature.

7. The method according to any one of claims 1 to 6, characterized in that, The step of outputting the gas detection result of the region to be detected based on the target fusion features includes: Based on the target fusion features, the multi-scale feature map is deconvolutionally upsampled, and the sampled deep physical features are horizontally concatenated with the shallow physical features to obtain the fusion feature map. The fused feature map is predicted by decoupling the detection head, and the bounding box offset, class confidence and centrality weight of the target are output respectively. When the confidence level of the category is greater than a preset safety threshold, a gas leak alarm message containing the bounding box offset is output.

8. A physically directed gas detection device, characterized by, include: The image acquisition module is used to acquire the original infrared image of the area to be detected; The fidelity enhancement module is used to perform background estimation and residual compensation on the original infrared image based on the spatial scale separation effect to obtain an enhanced image; The feature decoupling modulation module is used to perform preset processing on the enhanced image using a pre-trained gas detection model to obtain the gas detection result of the region to be detected. The gas detection model includes a first feature extraction branch and a second feature extraction branch; The preset processing includes: extracting multi-scale feature maps of the enhanced image; using the first feature extraction branch, extracting physical gradient features from the multi-scale feature maps based on physical diffusion priors, and determining the physical attention weights of each pixel in the multi-scale feature maps according to the physical gradient features; using the second feature extraction branch, extracting global spatial dependency features from the multi-scale feature maps; modulating the global spatial dependency features using the physical attention weights to obtain target fusion features; and outputting the gas detection results of the region to be detected based on the target fusion features.

9. A computer device, comprising: It includes a processor and a memory; the memory stores computer program instructions, which, when executed by the processor, implement the physical-guided gas detection method as described in any one of claims 1 to 7.

10. A computer-readable storage medium having stored thereon instructions, the instructions comprising, When the instructions in the computer-readable storage medium are executed by the processor of a computer device, the computer device is enabled to perform the physical-guided gas detection method as described in any one of claims 1-7.