An infrared gas partitioning and leak source time sequencing method and system
By combining dual-channel encoding and optical flow estimation of infrared images with extended Kalman filtering, the problem of accurate localization of gas plumes in infrared images was solved, enabling accurate leak source detection and time-series localization in complex backgrounds.
Patent Information
- Application Number
- CN202611688451.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-29
- Publication Date
- 2026-11-27
AI Technical Summary
In industrial settings, existing technologies struggle to accurately segment gas plumes in infrared images and pinpoint leak sources, especially under conditions of weak contrast, non-rigid changes, and background interference. Single-image segmentation masks are inaccurate, motion estimation is susceptible to noise, and temporal localization capabilities are lacking.
By acquiring current and historical infrared images, features are extracted using dual-channel coding and a gas segmentation network. Combined with optical flow estimation and extended Kalman filtering, a nonlinear observation relationship is established, directional evidence is aggregated and Gaussian propagation is performed, and the maximum posterior source location and reliable region are output.
It enables accurate localization of gas plumes in complex backgrounds, reduces background motion interference, provides temporal evidence and reliable area markers, and improves the accuracy and reliability of leak source detection.
Smart Images

Figure CN123181581A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of infrared image processing and industrial gas leak monitoring technology, specifically to an infrared gas segmentation and leak source time-series localization method and system. Background Technology
[0002] In industrial settings such as petrochemicals, gas transportation, storage, and electrical equipment maintenance, leaked gases can form visible plumes within the infrared band that matches their spectral characteristics. Automatically extracting the gas area and indicating the release location using infrared imaging helps on-site personnel identify the equipment areas requiring inspection. Different gases have different visible bands, so the imaging device used must match the infrared absorption or emission characteristics of the gas being measured.
[0003] Gas plumes exhibit weak contrast, non-rigid variations, and diffuse boundaries. Background changes and sensor noise can also produce grayscale variations similar to those of gas. Segmentation masks obtained from a single image may show discontinuities, boundary expansion, or missing near-source regions. The mask centroid is influenced by the downstream plume morphology and cannot usually be directly used as the actual release point; determining the source location solely based on the mask's principal axis or endpoints also presents geometric ambiguity under curved plumes or occlusion conditions.
[0004] Image motion information can provide gas diffusion trends, but camera shake can cause global displacement, and local optical flow is also affected by weak texture and brightness variations. Angles are periodic, and directly applying a simple linear average to the angle will produce discontinuities at the positive and negative half-cycle boundaries; smoothing only the lateral and longitudinal motion components makes it difficult to directly establish process variation models for direction and amplitude separately. Furthermore, single-frame direction voting does not utilize historical source locations and is prone to fluctuations with local flow field changes; if historical estimates are overly concentrated on erroneous locations, recovery may be difficult.
[0005] Furthermore, there are scaling, padding, and translation relationships between the segmentation network coordinates, the registered image coordinates, and the original image coordinates. If the coordinates are not unified, the correspondence between optical flow sampling positions, masks, and historical localization heatmaps may shift. Outputting only a single source point without outputting a spatially reliable region is also detrimental to distinguishing between frames with insufficient directional evidence and frames with relatively concentrated localization results. Therefore, it is necessary to combine causal segmentation, orientation estimation, and recoverable temporal source location inference, and output validity indicators and reliable regions. Summary of the Invention
[0006] The purpose of this section is to outline some aspects of the embodiments of the present invention and to briefly describe some preferred embodiments. Simplifications or omissions may be made in this section, as well as in the abstract and title of this application, to avoid obscuring the purpose of these documents; however, such simplifications or omissions should not be construed as limiting the scope of the invention.
[0007] To address the aforementioned technical problems, according to one aspect of the present invention, the present invention provides the following technical solution:
[0008] An infrared gas segmentation and leakage source timing localization method includes the following steps:
[0009] S1. Acquire current and historical infrared images, normalize the images using the same intensity range, and combine them with historical absolute difference images to form a dual-channel code. Combine multiple dual-channel codes into a causal input in chronological order.
[0010] S2. The causal input is fed into the gas segmentation network, and features are extracted through appearance branch and difference branch. The fusion gate is generated by using the context gathered along the image height and width. Then, the current feature and the feature difference of multiple historical intervals are causally fused according to the spatial location and channel group weights to obtain the current gas mask.
[0011] S3. Perform global translation registration on adjacent infrared images used for motion estimation, map the gas mask to a positioning reference coordinate system consistent with the registered image, and calculate and determine the effective optical flow;
[0012] S4. Establish a nonlinear observation relationship with motion direction and motion amplitude as states and optical flow horizontal and vertical components as observations, and perform extended Kalman filtering using the Jacobian matrix; aggregate by grid to obtain directional evidence;
[0013] S5. Expand the gas support mask to obtain a set of candidate source locations, calculate the expected direction of each candidate source location pointing to the sampling location, and construct a direction observation score map.
[0014] S6. Perform Gaussian propagation on the source position posterior saved by the previous valid update, restrict the propagation result to the current candidate source position set and normalize it, mix it with the uniform distribution on the set to obtain the prediction prior, multiply the prediction prior with the direction observation score map and normalize it to obtain the approximate posterior of the current source position.
[0015] S7. After converting the maximum posterior source location, posterior confidence region, and gas mask to the coordinate system of the displayed image, output the result; when the evidence is invalid, output a positioning invalidation flag.
[0016] As a preferred embodiment of the infrared gas segmentation and leakage source timing localization method of the present invention, in step S1, the intensity range is determined by the low and high quantiles of the infrared image in the pre-calibrated data or initialization buffer, and remains fixed during the same operation; Time-based dual-channel encoding ,in For image time indexing, For the normalized image at that moment, It is a dual-channel encoding. This indicates stitching along the channel dimension, with absolute values calculated pixel by pixel; Represents the current image time, causal input Depend on , , and Composed of eight channels, and dependent on to Five frames of images; at the beginning of the sequence, the earliest available frame is used to fill in the missing history, and after the buffer is initialized, online positioning and output begin.
[0017] As a preferred embodiment of the infrared gas segmentation and leakage source timing localization method described in this invention, in step S2, appearance features are obtained respectively. Sum of difference features The sum of the two is average pooled along the height and width directions respectively, and then gating is generated by a learnable map and the Sigmoid function. ,according to and To integrate, among which For element-wise multiplication, The learnable coefficients are constrained by the Sigmoid algorithm. Features are extracted using shared parameters at each time step, and the current projected feature is subtracted from the three historical projected features. The current projected feature, signed difference, and absolute difference are concatenated to generate a routing score. Softmax normalization is performed only along the historical interval dimension at each spatial location and channel group. Historical differences are aggregated based on normalization weights, and then added to the current feature through spatial gating and residual projection. Instance mask coefficients and shared prototype maps are output from the multi-scale segmentation head, and instance masks that meet the threshold are reconstructed and merged. As an intermediate feature for gating fusion, To preserve the output after the appearance residual, A is an element-wise fusion gating.
[0018] As a preferred embodiment of the infrared gas segmentation and leakage source temporal localization method described in this invention, in step S3, the two-dimensional translation of the current image relative to the received reference image is obtained using the enhanced correlation coefficient criterion. The translation is accepted only when the translation amplitude and the improvement of the registered image error simultaneously meet preset conditions. The accepted translation is synchronously applied to the current gas mask used for localization, and an effective field of view consistent with the image is adopted. On the registered image, Horn-Schunck optical flow estimation, which includes a brightness residual term and a spatial smoothing term, is used to exclude optical flow outside the gas support and effective field of view, and invalid observations are excluded according to preset upper and lower limits of motion amplitude. If registration fails and it cannot be confirmed that the current image and the historical state are in the same reference coordinate system, the observations of the current image are not used to update the localization posterior.
[0019] As a preferred embodiment of the infrared gas segmentation and leakage source timing localization method described in this invention, in step S4, the first... The filtering state of each pixel is Observation is The nonlinear observation function is The Jacobian matrix, obtained by taking the partial derivatives of the random walk state prediction and observation functions with respect to direction and amplitude, is used to calculate innovation, innovation covariance, Kalman gain, and state update sequentially. The state covariance is then updated using the Joseph form. The direction is constrained within a complete angular period, and negative amplitudes are inverted while the direction is increased. The equivalent transformation is performed, and the corresponding local state covariance is transformed synchronously; where i is the pixel index and t is the image time. and These are the orientation angle and the motion amplitude per frame, respectively. and denoted by , which represent the horizontal and vertical components of the observed optical flow, respectively; h is the nonlinear observation function; the superscript T indicates transpose; and π is the mathematical constant pi.
[0020] As a preferred embodiment of the infrared gas segmentation and leakage source timing localization method described in this invention, the effective optical flow is divided into non-overlapping grids, and only grids with the effective optical flow quantity and gas ratio reaching preset conditions are retained; the median of the circumference of the filtering direction within the grid is used as the representative direction, the median of the motion amplitude is used as the representative amplitude, the magnitude of the mean of the unit direction vector is used as the direction concentration, and the reliability weight is constructed by the product of the representative amplitude, direction concentration, and gas ratio, and the reliability weight of each effective grid is normalized to a sum of 1.
[0021] As a preferred embodiment of the infrared gas segmentation and leakage source timing localization method described in this invention, in step S5, the gas support mask selects the non-air volume mask mapped to the positioning reference coordinate system in the previous frame; when the mask in the previous frame is empty, the currently mapped gas mask is selected; and a candidate source location set is formed through morphological dilation. Indicates a valid location update number. This indicates the image frame number corresponding to the update, in order to Indicates a valid grid index. The two-dimensional coordinates of the center of the grid are represented by... Indicate the location of two-dimensional candidate sources; As a numerical expression of the expected direction, where For distance protection, Represents the Euclidean norm; multiplied by the dot product of the unit observed direction and the expected direction by the axial lumped parameter. The composite logarithm score is obtained by summing the results according to the normalized reliability weights. ;Will Subtract the maximum score from the current candidate set and then take the exponent to obtain the directional observation map. When the candidate position coincides with the sampling position, the corresponding dot product contribution is 0.
[0022] As a preferred embodiment of the infrared gas segmentation and leakage source timing localization method described in this invention, in step S6, with... Indicates a valid location update number. This indicates the location of a two-dimensional candidate source. When the total probability mass of the Gaussian propagation result within the current candidate set is not greater than a preset numerical threshold, the prediction prior is reset to a uniform distribution on that candidate set; when the total probability mass is greater than the threshold, a... ,in The propagation results are truncated and normalized after candidate set processing. For a uniform distribution on the current candidate set, To achieve a uniform recovery ratio, For mixed prediction priors; with This indicates the current direction observation map, according to... Multiply and normalize within the current candidate set to obtain a discrete approximate posterior. ; This indicates the proportional relationship before normalization.
[0023] In a preferred embodiment of the infrared gas segmentation and leakage source temporal localization method of the present invention, in step S7, the posterior probabilities of the current candidate positions are arranged in descending order, and the posterior probability corresponding to the first time the cumulative probability quality reaches the preset credible quality is used as the threshold. All candidate positions with posterior probabilities not lower than the threshold are retained to form the highest posterior density region. The first valid update adopts the uniform prior on the current candidate set. During the invalid update period, the most recent valid posterior is retained and the current positioning validity flag is set to invalid. After recovery, prediction is performed according to the valid update step.
[0024] An infrared gas segmentation and leak source timing localization system includes:
[0025] An infrared imaging device, a memory, a processor, and a display or alarm interface, wherein the processor is connected to the infrared imaging device, the memory, and the display or alarm interface;
[0026] The memory stores gas segmentation network parameters, historical images, filtering status, and source location posterior.
[0027] The processor includes a causal image coding module, a gas segmentation module, a registration and optical flow module, a direction amplitude filtering and mesh aggregation module, a candidate and direction scoring module, a posterior prediction update module, and a localization and reliable region output module.
[0028] The causal image encoding module caches at least five frames of normalized images to generate four-time-phase inputs with appearance difference pairs;
[0029] The gas segmentation module loads the trained and exported network parameters and outputs the original image mask.
[0030] The registration and optical flow module maintains the reference transformation and effective field of view;
[0031] The directional amplitude filtering and grid aggregation module saves the state, covariance and initialization flag of each reference pixel;
[0032] The candidate and direction scoring module constructs discrete candidates and current direction scores;
[0033] The posterior prediction update module saves the previous valid posterior and performs Gaussian propagation, candidate constraints, uniform recovery, and multiplicative normalization.
[0034] The positioning and trusted area output module calculates the source point, trusted area and status flag, and displays the results or sends a message to the host computer through the display or alarm interface.
[0035] The display or alarm interface is used to receive gas masks with validity indicators, image locations of leak sources, and posterior reliable regions.
[0036] Compared with existing technologies, the present invention has the following advantages: It preserves the infrared image structure through appearance residuals and uses spatial gating to control the injection of absolute differences; causal multi-interval routing aggregates past changes without reading future images, providing temporal evidence for low-contrast gas regions; it employs constrained translation registration and mask constraint screening to reduce the impact of global background motion on gas direction estimation; it unifies coordinates so that segmentation support, motion sampling, and historical posterior correspond to the same spatial location; it accumulates historical information using Gaussian prediction and uniform recovery terms within candidate regions, while providing non-zero prior quality for each retained candidate, enabling the estimation results to correct historical biases within the candidate regions; it outputs source points and reliable regions from the same posterior distribution, where reliable regions can consist of multiple disconnected regions, and explicitly marks frames with insufficient or invalid information, facilitating the display of positioning status on industrial monitoring interfaces. Attached Figure Description
[0037] To more clearly illustrate the technical solutions of the embodiments of the present invention, the present invention will be described in detail below with reference to the accompanying drawings and detailed embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Wherein:
[0038] Figure 1This is a flowchart illustrating the overall process of the infrared gas segmentation and leakage source timing localization method of the present invention.
[0039] Figure 2 This is a schematic diagram of the gas segmentation structure of appearance differential gating fusion and causal multi-history interval routing of the present invention;
[0040] Figure 3 This is a schematic diagram illustrating the relationship between candidate constraint direction scores and temporal posterior prediction updates in this invention.
[0041] Figure 4 This is a schematic diagram of the module composition of the infrared gas segmentation and leakage source timing location system of the present invention;
[0042] Figure 5 The images show the superimposed results of segmentation, grid direction, and leakage source timing location under three infrared gas plume morphologies according to the present invention. From left to right, the images show the superimposed results of the plume extending from right to left, the superimposed results of the plume expanding to the upper left, and the superimposed results of the plume expanding to the right and upper right. Detailed Implementation
[0043] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0044] The flowcharts, modules, and connections shown in the accompanying drawings are used to illustrate the data relationships between the various processing steps. The dimensions and layout in the drawings do not limit the physical structure of the actual device.
[0045] Example: The following describes the processor-executable computational steps, parameter meanings, and exception handling rules. The listed dimensions and thresholds are optional configurations and can be set after verification based on imaging resolution, frame interval, and scene conditions. This example estimates the two-dimensional image location of a single dominant leak source; gas segmentation may include multiple instances. General Conventions: and All are image time indexes, where Refers to the current frame. Used to traverse historical frames; This only indicates a valid location update number. In order to be with the first The image frame number corresponding to the first valid update; Pixel index only Only valid grid indexes, Index of candidate instances only. This is for prototype indexing only. The two time-numbering methods are associated with saved frame identifiers; invalid frames are not incremented. The top right corner of a vector or matrix The superscript and subscript indicate only transposition; the remaining text superscripts and subscripts are for illustrative purposes, and the full symbols with caps, hyphens, and tildes are defined according to their first appearance. Output pixel positions are not directly interpreted as unlabeled 3D coordinates, flow rates, or concentrations.
[0046] Example 1: Causal Gas Segmentation and Recursive Source Location Estimation
[0047] In S1, let the first... The 16-bit raw infrared image is ,in This represents the number of rows in the original image. The column number of the original image. This represents the real number field, with the superscript 16 indicating the storage bit depth. (Image x-axis) Corresponding column, vertical axis For the corresponding row, the positioning distance is expressed in pixels of the original image. A fixed intensity lower limit is determined using either the initial image or an independently calibrated image. and upper limit ,and Normalize using the following formula:
[0048] (1)
[0049] In the formula, For normalized images, To truncate the operator, This represents the input real number for the operator. and These represent the minimum and maximum values, respectively. One configuration statistically analyzes pixel values from no more than 60 frames of images, using the 1% and 99th percentiles as the lower and upper limits of intensity, respectively, and fixes this range after initialization; reinitialization occurs when the upper and lower limits are equal or when there is an image reading error. The 16-bit digital response is not directly considered as temperature or concentration.
[0050] Pixel-wise absolute difference and dual-channel coding are constructed from adjacent normalized frames:
[0051] (2)
[0052] In the formula, This is the absolute difference map of adjacent frames. Includes two channels: appearance and variation. Indicates splicing along the channel. For channel dimension labeling, for Time-normalized image. The dual-channel codes of four consecutive time points are further concatenated into a causal input:
[0053] (3)
[0054] In the formula, For batch size, and These are the network input height and width, respectively. The earliest differential also requires... Therefore, the four-time encoding actually relies on five frames of images during online inference. When historical data is insufficient, the earliest available frame is repeated. Each frame is scaled and padded uniformly, and the scaling factor and padded amount are recorded. One deployment configuration maps a 320-pixel wide, 240-pixel high image to an input of 640-pixel wide, 480-pixel high, with a padded value of 114 / 255. The network output is restored to the original image grid through the corresponding inverse geometric transformation.
[0055] In S2, the gas segmentation structure is as follows: Figure 2 As shown. The input tensor is from Rearranged as The same set of feature extraction parameters is used for all four time points. The shallow appearance branch and the difference branch are activated by convolution, batch normalization, and SiLU activation, respectively, and the parameters of the two branches are independent of each other.
[0056] (4)
[0057] In the formula, and The feature mapping for the two branches outputs the appearance features. Sum of difference features Having the same shape This is the result of adding the two elements one by one. Let... and These represent average pooling along the height and width, respectively; the former preserves the width position, and the latter preserves the height position. The pooling results along the height and width directions are then input into the learnable array. Axial mapping and The signals are broadcast, summed, and passed through the Sigmoid function to form a fusion gate:
[0058] (5)
[0059] In the formula, Element-wise fusion gating for broadcasting to branch feature shapes , It is a natural exponential function. The appearance residuals are preserved and differential injection is controlled using the following formula:
[0060] (6)
[0061] In the formula, As an intermediate feature for gating fusion, To preserve the output after the appearance residuals, For learnable scalars, These are the learnable coefficients constrained by the Sigmoid rule. This represents element-wise multiplication. The gated output layer is initialized to zero. ;Pick The initial value is 0.02, and the initial output is... The module formed by the above-mentioned gating fusion calculation is called the appearance differential gating fusion module, or SAMF for short.
[0062] For shared backbone at all times Output features Perform channel projection and execute causal routing at the higher resolution P3 layer. Let... For channel projection mapping, To construct a historical interval:
[0063] (7)
[0064] In the formula, For projection features, The signed difference between the current and historical projection features. It is a learnable feature transformation consisting of depthwise convolution, batch normalization, and SiLU. This represents the transformed difference features. For a training input with a width and height of 640, one configuration sets the P3 feature to have 128 channels and a spatial size of... The projected channel size is 32. The routing score is generated from the current projection features, signed differences, and their absolute values.
[0065] (8)
[0066] In the formula, Input tensor for routing, For routing scores, and These are the route convolution weights and biases, respectively. This represents convolution. The projection channels are divided into... Group, with For group index, For spatial locations on the feature map, normalization is performed only along the historical interval dimension:
[0067] (9)
[0068] In the formula, For the first Group history interval Routing weights The summation index is used for historical intervals of the same type; the weights are applied to the corresponding group difference features after being broadcast by channel. To obtain aggregation features One configuration option is... Each group has 8 channels. The groups are then spliced together along the channels. Obtain fusion difference features Then, through temporal spatial gating and output projection, the current feature is injected:
[0069] (10)
[0070] In the formula, For temporal spatial gating, For learnable space mapping, For output projection, For learnable scalars, For timing injection coefficients, This represents the current feature after injection. When the routing and gating outputs are initialized to zero, the weights of the three historical intervals are equal and... Output projection zero initialization Then, during training, time-series injection is learned. This module, called the Causal Multi-History Interval Differential Routing Module (CMLDR for short), only retains the current time-series output and restores the batch dimension to... .
[0071] Multi-scale features are used to output candidate boxes via a segmentation head. Instance score Masking coefficient and shared prototypes One configuration retains 32 prototypes and reconstructs the instance mask:
[0072] (11)
[0073] In the formula, The value is the binary mask value of the corresponding candidate instance in the current frame at the pixel coordinates of the original image. A value of 1 indicates that the instance belongs to the gas region, and a value of 0 indicates that it does not belong to the gas region. The inactive response map of the instance mask; As a geometric restoration operator, the fill in the prototype space is first removed, and then the original image size is interpolated back; the candidate boxes have also been converted to the original image coordinates. This is an indicator function that takes the value 1 if the condition is true and 0 otherwise. Let be the pixel mask threshold. Take the threshold that satisfies... The instance mask union is ,in A threshold is reserved for instances. One configuration takes... , At this point, the pixel threshold is equivalent to an inactive response greater than 0; after sorting the one-to-one exported header by instance score, a maximum of 300 candidates are retained, without adding any additional duplicate suppression steps.
[0074] The gas segmentation network can employ a YOLO26n-seg multi-scale backbone and segmentation head, replacing the corresponding input and P3 processing parts with the aforementioned dual-branch and temporal modules. Training only uses the gas region annotations of the current frame, without requiring source point annotations. The loss of each supervised branch and the total training loss can be expressed as:
[0075] (12)
[0076] In the formula, This represents the weighted loss of any supervisory branch. This represents the total training loss. , , , and The loss layers are, in order: CIoU bounding box loss, binary cross-entropy classification loss, L1 regression loss with normalized quad margins, binary cross-entropy loss for in-box instance masks, and auxiliary semantic loss, a weighted combination of binary cross-entropy and Dice. The auxiliary semantic objective is the union of the ground truth instance masks in the current frame. The corresponding outer weights... , , , and The values can be 7.5, 0.5, 1.5, 7.5, and 7.5 in sequence. and The losses for one-to-many and one-to-one supervision branches are respectively. and This represents the weight of the corresponding branch. Indicates the total number of training rounds. To indicate the number of training epochs counting from 0, you can use:
[0077] (13)
[0078] The sum of the weights of the two branches is 1. Training can be performed using 100 epochs, batch size 8, AdamW optimizer, and... The initial learning rate; loss matching, pixel area normalization, and training augmentation are fixed within the same run. After export, causal inference is performed on the processor; the input size must be consistent with the size supported by the exported computation graph.
[0079] In S3, a fixed positioning reference pixel grid is established. .make For the translation transformation from the original image to this grid, the registered image and the localization mask are as follows:
[0080] (14)
[0081] In the formula, For reference grid pixel coordinates, Inverse transformation, For the registered normalized image, A gas mask is used for synchronous mapping. The grayscale image is interpolated using bilinear interpolation, and the binary mask is interpolated using nearest neighbor interpolation. The field of view that can still be effectively sampled from the original image is recorded. The reference grid is fixed within a single run, and the accepted registered image, filter field, and source location posterior are all stored in this grid. The untransformed original image mask is not used for the registered optical flow.
[0082] The translation is obtained using the enhanced correlation coefficient criterion. Let... For the most recently retained, accepted registration images, The image to be registered is after translation. The horizontal and vertical translations to be determined are: To obtain the corresponding effective overlapping field of view, we need to find:
[0083] (15)
[0084] In the formula, and Let be the mean gray values of the two images within the same effective overlapping field of view, and sum them over that field of view; registration is invalid when the denominator is 0. Let , These represent the average absolute grayscale error before and after registration within the same overlapping region. One acceptable condition is... Pixels Pixels, and ,in To prevent division by zero, a protection threshold is set. For fixed cameras, the zero-transform can be directly used if it passes the consistency check; however, the desired translation is not accepted if the solution fails to converge or does not meet the acceptance criteria. If reference consistency under the zero-transform cannot be confirmed, only the segmentation result is output for this frame, without updating the positioning state.
[0085] For adjacent images on the same reference grid, gas support is selected according to the rule of prioritizing the non-empty mask of the previous frame:
[0086] (16)
[0087] In the formula, Support the mask for the selected gas. The intersection of the effective field of view of two frames. This indicates binary morphological dilation. To support the expansion radius of optical flow, To allow the preservation of the pixel set for optical flow observation; For the intersection of sets, the vertical lines on both sides of the binary mask or finite set represent the number of pixels. One configuration takes... Optical flow is retained only within the gas support; if This frame does not constitute location evidence.
[0088] Registered images Gaussian smoothing, obtaining spatial derivatives , and inter-frame time derivative ,in Label the time derivative. Solve the Horn–Schunck objective within the effective overlapping field of view:
[0089] (17)
[0090] In the formula, , It only represents the horizontal and vertical optical flow components, that is, the pixel displacement between two adjacent frames; Let the objective function be optical flow. The spatial smoothing coefficient is... This is a spatial gradient operator. The target employs a first-order approximation with constant local brightness, and does not interpret optical flow as a physically calibrated gas velocity. The optical flow iterations are numbered using the following formula:
[0091] (18)
[0092] In the formula, , The neighborhood weighted mean To normalize the brightness residuals, each of the four axial neighbors is weighted at 1 / 6, and each of the four diagonal neighbors is weighted at 1 / 12. At the boundaries, the weights of effective neighbors are renormalized; no observations are generated when there are no effective neighbors. (Option 1) The initial displacement is 0, and the iteration is 80 times. First, the optical flow is calculated within the effective field of view, then... Filter and retain only those with limited components. Pixel / frame observation. The mask is used to filter observations without changing the boundary conditions of the target optical flow.
[0093] In S4, a directional amplitude extended Kalman filter is established for each valid pixel to... For state, For observation purposes, the state covariance is uniformly denoted as . :
[0094] (19)
[0095] In the formula, The direction of motion is expressed in radians. For the motion amplitude of each frame, , To observe the optical flow component; This is a nonlinear observation function from the directional amplitude to the horizontal and vertical components. Wherein, For the direction angle of motion Non-negative motion amplitude per frame The general state vector is formed sequentially, with two components corresponding to... and The syntax after omitting pixels and time indices. and These are zero-mean process noise and observation noise, respectively. , Their covariances are respectively. This represents a Gaussian distribution. This filter describes the local orientation field at a fixed reference pixel, and does not interpret the same pixel as the same continuously tracked gas particle. The state prediction is:
[0096] (20)
[0097] In the formula, the capped state represents the estimated value, and the upper right corner represents the estimated value. This represents the predicted value before observation correction. Let $\mathbf{x}$ be the covariance of the previous preserved state for this pixel. Linearizing the observation function at the predicted state yields the Jacobian matrix:
[0098] (twenty one)
[0099] In the formula, for Observe the Jacobian matrix, , These are the two components of the current pixel prediction state. This represents the partial derivative; the columns of the matrix correspond to the direction and magnitude respectively, and the rows correspond to the horizontal and vertical components respectively. Because... ,and This matrix maps directional amplitude perturbations to lateral and longitudinal displacement perturbations. Innovation, innovation covariance, and Kalman gain are then calculated:
[0100] (twenty two)
[0101] In the formula, For innovation vectors, To innovate covariance, For Kalman gain, the top right corner This represents finding the inverse of a matrix. By taking a positive definite matrix, the actual solvability of linear equations can be achieved, replacing explicit inversion. The state and Joseph-style covariance correction are as follows:
[0102] (twenty three)
[0103] In the formula, It is a second-order identity matrix, with superscript... The markings have not yet undergone angle and amplitude normalization corrections. If its amplitude component... Using equivalent transformation and with Synchronously update covariance as Otherwise, the transformation is not performed. The Jacobian matrix is the equivalent transformation for negative magnitude. This indicates the construction of a diagonal matrix. π (pi). Finally, through... Map direction to ,in This indicates modulo operation; angular periodic normalization does not change the unit direction vector.
[0104] First effective observation Initialize the observed amplitude. To preserve quadrant information, the arctangent function can be initialized with the following values: One configuration option is... , The units of variance for the two processes are squared radians and squared displacement per frame, respectively. Invalid optical flow is not subject to observation correction and is not used as evidence of direction in the current frame; when it is restored to validity, it is predicted based on the preserved state, and can be reinitialized with new observations after a long interruption.
[0105] The reference grid was then divided into... Non-overlapping units of a pixel. The set of valid pixel indices of each unit is denoted as The corresponding set of filtering angles is denoted as Only retain pixels with at least 5 effective pixels and a gas support ratio. For each element, calculate the representative direction, representative amplitude, and direction concentration:
[0106] (twenty four)
[0107] In the formula, and For the normalized pixel state estimation, The center of the circle represents the direction. The median of the amplitude. This represents median operations. This refers to directional concentration. When the median of the circumference is parallel, it is selected according to a fixed pixel scanning order. The gas support ratio is equal to the number of supported pixels within the cell divided by the actual area of the cell; edge cells use their actual area. Indicate the unit center and establish directional evidence:
[0108] (25)
[0109] In the formula, As the representative of the unit, and These are the original and normalized reliability weights, respectively. Summation index for grids of the same type; The number of positive weighted grid cells to retain. This is the set of directional evidence for the current frame. Directional evidence is invalid when the number of grid cells is 0 or the sum of weights is not greater than a preset threshold. Normalization sets the total weight to 1 to prevent the overall scoring scale from increasing directly with the number of grid cells; directional concentration reflects the degree of consistency and is not interpreted as the exact reciprocal of the measurement variance.
[0110] In S5, with Indicates the first The hidden state of the two-dimensional source location updated by the next effective positioning. , The x and y coordinates are shown. The following updates are based on the current frame. Provides mask and orientation evidence to define candidate regions, candidate sets, and uniform probability mass on a discrete pixel grid:
[0111] (26)
[0112] In the formula, For two-dimensional candidate positions, The candidate expansion radius, For the reference mesh, the support expansion region after clipping. This is the set of candidate pixels within the region. For the number of candidates, To ensure its uniform distribution. One configuration is taken as follows: Pixels, preserving the complete dilation region; no normalization or posterior update is performed when the number of candidates is 0. If the true release point is excluded by the candidate region, its probability will be set to zero; therefore, the dilation radius should cover the reasonable error of the segmentation boundary and the near-source invisible region.
[0113] The expected propagation direction from the candidate source location to the center of the sampling grid is calculated using the following formula:
[0114] (27)
[0115] In the formula, The numerical vector represents the expected direction. For distances less than 1 pixel, a protection factor is applied. The distance must be at least [a certain value]. The length of the time vector is 1, and the vector is zero when they coincide. The von Mises direction model on a circle is used for the unit expected direction:
[0116] (28)
[0117] In the formula, For the direction model used, For direction-focused parameters, This represents a zero-order modified Bessel function of the first kind; vertical lines indicate conditional relationships. The dot product of two unit directions equals the cosine of the included angle; directions in the same order receive higher scores. Distance less than... When using the bounded numerical extension within the exponent, it is only regarded as a direction score, and the numerical value corresponding to the non-unit expected vector is not interpreted as the same normalized direction density.
[0118] The composite directional observation factor and composite logarithm score are generated based on reliability weights:
[0119] (29)
[0120] In the formula, For weighted composite directional observation factors, The composite logarithm score after removing candidate irrelevant constants. This represents a direct proportionality constant where the differences between candidates are independent. Taking the logarithm of the weighted product yields the weighted sum, and the constant is... Can be eliminated during candidate comparison and normalization. This represents the natural logarithm. Adjacent optical flows originating from the same image and having undergone smoothing and temporal filtering are typically not independent; therefore, this product is not interpreted as the true joint density of strictly independent samples. This configuration uses only directional evidence and does not impose additional distance attenuation.
[0121] To avoid exponential overflow, a numerically stable directional observation plot is constructed:
[0122] (30)
[0123] In the formula, This is a directional observation map. This represents another position coordinate during the traversal of the candidate set. Subtracting the common maximum value does not change the normalized estimate. One configuration takes... This directional model provides geometric constraints for propagation from near the source outwards, but does not force the actual plume path to be a straight line; strong curvature, backflow, or nearly parallel flow fields may form offset, multi-peak, or axially extended posteriors, which need to be reflected by credible regions and validity indicators, and cannot guarantee a unique true source point.
[0124] In S6, such as Figure 3 As shown, with This represents the discrete posterior of the last valid update; consecutive invalid frames do not increment the valid update number. Gaussian random walks are used to describe small-range source location perturbations or residual registration errors. Discrete transition kernels and propagation predictions are defined as follows:
[0125] (31)
[0126] In the formula, Discrete transition probabilities on a finite reference grid. In terms of propagation scale, For the traversal position of the kernel normalization, This is a propagation prediction for which current candidate constraints have not yet been applied. The fixed physical leak point can also be used to describe the image estimation error using a non-zero propagation scale. Propagation can be approximated far from the boundary using normalized Gaussian convolution; the boundary employs a fixed reflection spread and global normalization, which is an engineering approximation for finite mesh transfer. One configuration takes... Pixel and boundary rules are fixed within the same run.
[0127] make This represents the overall probability quality of the propagation prediction within the current candidate set, in terms of... To determine whether the quality is sufficient, the predictions are truncated and normalized:
[0128] (32)
[0129] In the formula, This is the normalized prediction after candidate constraints. When the original prediction and the current candidate region hardly overlap, a uniform reset is used to avoid dividing by a probability mass close to zero; when there is overlap, a uniform recovery term is further incorporated.
[0130] (33)
[0131] In the formula, For mixed prediction priors, To achieve a uniform recovery ratio, one configuration is taken as follows: The mixture prior for each candidate position is at least 1. Therefore, positions still within the candidate region will not be permanently excluded due to historically low probability; this mechanism does not guarantee recovery under any erroneous observation.
[0132] To illustrate the basis of the recursion, let's record... Record the direction and mask history up to the last valid update. For its theoretical posterior condition, Bayesian decomposition gives:
[0133] (34)
[0134] In the formula, This represents the conditional probability or corresponding observation density. The first factor is approximated by the current composite direction factor, and the second factor is approximated by the hybrid prediction prior under candidate constraints; the selected support mask is determined by the mask history, and the candidate constraints are included in the engineering prior. The actual maintained discrete approximate posterior is:
[0135] (35)
[0136] In the formula, To normalize the discrete approximate posterior, the probability of being outside the candidate region is 0. The first valid update is directly taken. The prediction is then performed according to equations (31) to (33). The same image provides both the mask and orientation, and the orientation is filtered across frames, therefore... This is an engineering approximation and is not equivalent to the exact posterior under strictly independent observations. It can be computed in the logarithmic domain. Normalize by subtracting its maximum value to avoid underflow of the product; if normalization fails, retain the most recent valid state and output an invalid flag.
[0137] In S7, the maximum a posteriori location, mean, and covariance are output based on the current approximate posterior:
[0138] (36)
[0139] In the formula, For the maximum a posteriori source location, The posterior mean is... for Posterior covariance of source location, in pixels squared; This indicates the location where the maximum value is obtained. When maximum values are in tandem, points are selected in a fixed pixel scanning order, preserving the complete and reliable region; the mean value may lie between probability peaks and is not automatically replaced by the maximum posterior point. The current candidate probabilities are sorted in descending order as follows: Define the region with the highest posterior density in 95% of cases:
[0140] (37)
[0141] In the formula, , For sorting sequence number, The minimum number of candidates required for the cumulative quality to first reach 0.95. For the corresponding probability threshold, To retain the highest posterior density regions among all candidates that meet the threshold, all adjacent points are retained, the probability quality within each region must be no less than 0.95, and the regions do not need to be connected. This 95% represents the probability quality within the maintained distribution, not the true source point coverage that has not been validated by independent source point labeled sequences.
[0142] When the posterior approximates a unimodal Gaussian and When the time is positive, an approximate elliptical profile can be output:
[0143] (38)
[0144] In the formula, The 0.95 quantile of the chi-square distribution with 2 degrees of freedom is approximated as 5.991; the left side represents the squared Mahalanobis distance of the candidate position relative to the posterior mean. This elliptical approximation is not used when the posterior is significantly non-Gaussian or the covariance is singular; instead, the region with the highest discrete posterior density is output first.
[0145] when In addition, it can also output auxiliary confidence scores for sorting:
[0146] (39)
[0147] In the formula, Let the discrete posterior entropy be defined as follows: ; , and These respectively reflect the degree of concentration of normalized entropy, the relative area of the credible region, and the degree of consistency of the overall direction. This is the auxiliary confidence score after weighted truncation of three terms. It is set separately when there is only one candidate. Candidates are marked as degraded. This score does not represent the probability of correct localization; alarm thresholds and the number of continuously valid frames should be determined through independent verification data and used in conjunction with validity indicators.
[0148] In the When the original image is displayed corresponding to the next effective update, the source point is... The mask and the reliable region are displayed through the same inverse transformation. A pure translation does not change the covariance; if extended to a calibrated affine display transformation, then... Indicate its The linear part displays the coordinate covariance as... The storage process includes recording the original frame number, valid update number, reference coordinate identifier, validity flag, maximum a posteriori position, trusted region, and processing timestamp.
[0149] Example 2: System Deployment and Status Maintenance
[0150] Figure 4 The system shown includes an infrared imaging device 201, a memory 202, a processor 203, and a display or alarm interface 204. The processor 203 includes a causal image encoding module 101, a gas segmentation module 102, a registration and optical flow module 103, a direction amplitude filtering and mesh aggregation module 104, a candidate and direction scoring module 105, a posterior prediction update module 106, and a localization and reliable region output module 107. These modules can be implemented as software functions within the same processor or collaboratively by multiple computing units; the diagram illustrates data and control relationships and does not limit the physical bus structure.
[0151] The causal image encoding module 101 caches at least five frames of normalized images and generates four-time-time inputs for appearance difference pairs; the gas segmentation module 102 loads the trained and exported parameters and outputs the original image mask; the registration and optical flow module 103 maintains the reference transformation and effective field of view; the orientation amplitude filtering and mesh aggregation module 104 saves the state, covariance, and initialization flag of each reference pixel; the candidate and orientation scoring module 105 constructs the candidate set and orientation score; the posterior prediction update module 106 saves the most recent effective posterior and performs Gaussian propagation, candidate constraint, uniform recovery, and multiplicative normalization; the localization and reliable region output module 107 calculates the source point, reliable region, and validity flag, and displays the results overlaid or sends a message to the host computer through the display or alarm interface 204.
[0152] An implementation uses a C++ program to organize image buffering and state updates, employs an inference engine supporting convolution and segmentation operators to execute the derived model, and uses an image computation library to perform morphological processing, translation registration, and optical flow iteration. The processor can be an industrial computer CPU, an edge CPU, or an accelerator with corresponding operator support. Frame rates on different processors need to be tested in practice; this embodiment does not use untested real-time frame rates as necessary parameters.
[0153] Upon startup, the mask history, optical flow validity flag, and source location posterior are cleared. After establishing the intensity range, online input is received. If there are no available adjacent motion observations in the first frame, segmentation is performed only, and the localization posterior is initialized only when the direction evidence is valid. At any time, if the image is missing, the registration reference is inconsistent, the gas support is empty, the number of valid grids is insufficient, or the candidate quality normalization fails, a localization invalid flag is output. The most recent valid posterior can be used as display information with a "history" mark, but it must not be marked as a new localization for this frame. If the image is missing or a frame fails to be mapped to the localization reference coordinate system, non-adjacent frames before and after the interruption are not directly used for inter-frame optical flow calculation; after recovery, new optical flow observations are formed only when two consecutive frames are successfully mapped to the same reference coordinate system.
[0154] EKF and source location recursion are maintained according to their respective valid observation rules. Source location propagation scale. Settings are updated based on a single valid location; propagation is not repeated during periods of consecutive invalid frames. If propagation is changed to be based on actual elapsed time, then the settings are based on timestamps. ,in The transfer variance for the corresponding interval. The variance per unit time. This represents the actual elapsed time between adjacent valid updates; time is measured in seconds, and the units for transition variance and unit-time process variance are pixel squares and pixel squares / second, respectively. Validation and deployment must use the same time definition, and step-by-step and actual-time propagation scales should not be mixed.
[0155] When a reference image must be changed, the historical posterior and gas support are mapped to the new grid through a known reference transformation. The posterior is then interpolated and renormalized. The filter field is synchronously shifted, and the initialization flags of newly appearing pixels are reset. If no reliable cross-reference transformation exists, the historical positioning and filter state are cleared, and the data is re-initialized from valid observations. The posterior under the old reference must not be directly multiplied with the candidate data under the new reference.
[0156] Example 3: Parameter Settings and Optional Implementation
[0157] The parameters described above are for illustrating a complete and feasible configuration and do not require the same settings for all imaging resolutions. When adjusting image resolution, the motion threshold, grid size, dilation radius, and Gaussian propagation scale should be verified simultaneously at the pixel scale; when adjusting the frame rate, the motion displacement threshold and process noise should be reset according to the sampling interval. The input width and height of the segmentation network must be consistent with the input constraints of the derived network.
[0158] After verification, the source location model can be changed to a static model, and a unit transfer kernel can be explicitly used to make... The process does not rely on the implicit processing of zero standard deviation by the image library; subsequent candidate truncation and uniform recovery are still performed according to Equations (32) and (33). Candidate dilation can use circular or rectangular structuring elements, but their shape and radius must be recorded.
[0159] While maintaining the processing relationships of steps S1 to S7, the underlying computation library, image storage format, or processor model for performing convolution can be replaced. Variations in gas type require that the infrared band, imaging conditions, and segmentation training data match the actual object. The output of this method is the location of the dominant source in the image plane; when multiple independent leakage sources occur simultaneously, candidate and historical states can be maintained separately for different instances, provided there is reliable instance or region association, without directly interpreting the single-source posterior as a multi-source joint estimate.
[0160] Example 4: Reasoning results show:
[0161] Figure 5 Three sets of infrared gas inference superposition results generated according to steps S1 to S7 of Example 1 are given. The left, center, and right sides represent plumes extending from right to left, plumes expanding to the upper left, and plumes expanding to the right and upper right, respectively. The grayscale background image is the infrared image used for display; the cyan outline represents the selected gas support; the yellow outer outline represents the candidate range supporting expansion; the white arrows represent the direction of motion of the effective grid; the green dotted markers represent the estimated source location; and the surrounding colored outline shows the spatial range of location uncertainty. All superposition elements are compared with the background image. Figure 1 Displayed after coordinate transformation.
[0162] During the segmentation phase, the processor constructs an appearance-absolute difference input from the current and historical infrared images. This is then processed through dual-branch gated fusion and causal multi-historical interval routing to obtain the current instance mask, which is then merged into a gas mask based on instance score and pixel threshold. A cyan outline is used to display the segmentation support; its geometric center cannot be directly interpreted as a leakage source. A yellow outline corresponds to the boundary of the candidate dilation support in step S5, allowing pixels located near the segmentation edge or in near-source invisible areas to participate in the scoring. When using the non-empty support from the previous frame, the displayed outline should clearly indicate that it comes from the selected support; if the current segmentation differs from the selected support, their identifiers are saved separately.
[0163] During the motion processing phase, adjacent images and masks are first synchronously registered, then optical flow is calculated and filtered, and directional amplitude filtering is performed on valid pixels. Only meshes that pass the checks for effective quantity and gas percentage generate white arrows. The arrows represent the unit representative direction after filtering and mesh aggregation, not the optical flow of each original pixel, nor the physically calibrated flow velocity; invalid meshes do not participate in direction scoring.
[0164] During the localization phase, the processor calculates the expected direction pointing to the sampling point for each location within the yellow candidate range and compares it with the white arrow according to reliability weights to obtain a direction score map. The score map is fused with the historical prior after Gaussian propagation, candidate truncation, and uniform recovery to form the current approximate posterior. The source point is marked to correspond to the maximum posterior position of the posterior; the posterior confidence region is calculated according to equation (37). When the posterior is close to a unimodal Gaussian and the covariance is positive, its spatial scale can be displayed by an approximate ellipse according to equation (38). The elliptical outline and the discrete highest posterior density region cannot be regarded as completely identical under arbitrary distributions.
[0165] The three sets of images use the same overlay rule, but their specific shapes and directions differ as follows.
[0166] Figure 5 In the left sub-image, the plume extends from the near-source region on the right to the left, exhibiting a locally curved shape. Although there are local differences in the grid orientation, it generally points downstream from the near-source end. After combining the orientation score with the historical posterior, the estimated source point is located on the right side of the plume, near the exit region of the release device. The source location is constrained by the orientations distributed within the plume, and is not directly taken as the geometric center of the mask.
[0167] Figure 5 In the middle sub-figure, the plume extends from the lower right near-source region to the upper left and then spreads out to both sides, with the grid orientation changing with position. The processor compares the expected direction to each grid with the corresponding observed direction, without requiring all arrows to be parallel or their reverse extensions to intersect strictly. After the time-series update, the source point is located at the lower right near-source end of the plume, and the surrounding contour shows its spatial uncertainty.
[0168] Figure 5In the right-hand subplot, the plume extends irregularly from left to right and upward to the right, with most grid lines pointing to the right or upward to the right. Candidates consistent with this trend receive higher directional scores, and combined with historical predictions, the source point is displayed in the near-source region on the left. The confidence region is still used to reflect the spatial uncertainty in the source location estimation.
[0169] The results above demonstrate the approach of using segmentation support, orientation evidence, and historical posterior to jointly constrain source location. Source point markers represent estimated locations, and the confidence region represents the spatial uncertainty of that estimate. The image examples themselves do not replace localization accuracy assessments on independently labeled data.
[0170] When the gas support, orientation evidence, reference consistency, or normalization check of a certain frame is invalid, the interface only displays the current segmentation and localization invalid status; if historical source points or historical reliable regions are displayed, they are marked as coming from the most recent valid update, and historical information is not used as new localization for this frame. Figure 5 The effective superposition results shown adopt the same processing relationship as the state maintenance rules in Example 2.
[0171] Although the present invention has been described above with reference to embodiments, various modifications can be made and components can be replaced with equivalents without departing from the scope of the invention. In particular, as long as there is no structural conflict, the features in the disclosed embodiments can be combined with each other in any manner. The lack of an exhaustive description of these combinations in this specification is merely for the sake of brevity and resource conservation. Therefore, the present invention is not limited to the specific embodiments disclosed herein, but includes all technical solutions falling within the scope of the claims.
Claims
1. A method for infrared gas segmentation and time-series localization of leakage sources, characterized in that, Includes the following steps: S1. Acquire current and historical infrared images, normalize the images using the same intensity range, and combine them with historical absolute difference images to form a dual-channel code. Combine multiple dual-channel codes into a causal input in chronological order. S2. The causal input is fed into the gas segmentation network, and features are extracted through appearance branch and difference branch. The fusion gate is generated by using the context gathered along the image height and width. Then, the current feature and the feature difference of multiple historical intervals are causally fused according to the spatial location and channel group weights to obtain the current gas mask. S3. Perform global translation registration on adjacent infrared images used for motion estimation, map the gas mask to a positioning reference coordinate system consistent with the registered image, and calculate and determine the effective optical flow; S4. Establish a nonlinear observation relationship with motion direction and motion amplitude as states and optical flow horizontal and vertical components as observations, and perform extended Kalman filtering using the Jacobian matrix; aggregate by grid to obtain directional evidence; S5. Expand the gas support mask to obtain a set of candidate source locations, calculate the expected direction of each candidate source location pointing to the sampling location, and construct a direction observation score map. S6. Perform Gaussian propagation on the source position posterior saved by the previous valid update, restrict the propagation result to the current candidate source position set and normalize it, mix it with the uniform distribution on the set to obtain the prediction prior, multiply the prediction prior with the direction observation score map and normalize it to obtain the approximate posterior of the current source position. S7. After converting the maximum posterior source location, posterior confidence region, and gas mask to the coordinate system of the displayed image, output the result; when the evidence is invalid, output a positioning invalidation flag.
2. The infrared gas segmentation and leakage source timing localization method according to claim 1, characterized in that, In S1, the intensity range is determined by the low and high quantiles of the infrared image in the pre-calibrated data or initialization buffer, and remains fixed during the same run; Time-based dual-channel encoding ,in For image time indexing, For the normalized image at that moment, It is a dual-channel encoding. This indicates stitching along the channel dimension, with absolute values calculated pixel by pixel; Represents the current image time, causal input Depend on , , and Composed of eight channels, and dependent on to Five frames of images; at the beginning of the sequence, the earliest available frame is used to fill in the missing history, and after the buffer is initialized, online positioning and output begin.
3. The infrared gas segmentation and leakage source timing localization method according to claim 1, characterized in that, In step S2, appearance features are obtained respectively. Sum of difference features The sum of the two is average pooled along the height and width directions respectively, and then gating is generated by a learnable map and the Sigmoid function. ,according to and To integrate, among which For element-wise multiplication, The learnable coefficients are constrained by Sigmoid. Features are extracted using shared parameters at each time step. The current projected features are subtracted from the three historical projected features respectively. The current projected features, signed differences, and absolute differences are concatenated to generate the routing score. Softmax normalization is performed only along the historical interval dimension at each spatial location and channel group. The historical differences are aggregated according to the normalization weights. Then, the current features are added through spatial gating and residual projection. The multi-scale segmentation head outputs instance mask coefficients and a shared prototype map, and then reconstructs and merges instance masks that meet the threshold. in As an intermediate feature for gating fusion, To preserve the output after the appearance residual, A is an element-wise fusion gating.
4. The infrared gas segmentation and leakage source timing localization method according to claim 1, characterized in that, In step S3, the two-dimensional translation of the current image relative to the already received reference image is obtained using the enhanced correlation coefficient criterion. The translation is accepted only when the translation magnitude and the improvement of the registered image error simultaneously meet the preset conditions. The received translation is synchronized and applied to the current gas mask used for localization, and an effective field of view consistent with the image is adopted; Horn-Schunck optical flow estimation with luminance residuals and spatial smoothing terms is applied to the registered image to exclude optical flow outside the gas support and effective field of view, and invalid observations are excluded according to the preset upper and lower limits of motion amplitude. If registration fails and it cannot be confirmed that the current image and the historical state are in the same reference coordinate system, the observations of the current image are not used to update the positioning posterior.
5. The infrared gas segmentation and leakage source timing localization method according to claim 1, characterized in that, In S4, the first The filtering state of each pixel is Observation is The nonlinear observation function is The Jacobian matrix, obtained by taking the partial derivatives of the random walk state prediction and observation functions with respect to direction and amplitude, is used to calculate innovation, innovation covariance, Kalman gain, and state update sequentially. The state covariance is then updated using the Joseph form. The direction is constrained within a complete angular period, and negative amplitudes are inverted while the direction is increased. The equivalent transformation is performed, and the corresponding local state covariance is transformed synchronously; where i is the pixel index and t is the image time. and These are the orientation angle and the motion amplitude per frame, respectively. and denoted by , which represent the horizontal and vertical components of the observed optical flow, respectively; h is the nonlinear observation function; the superscript T indicates transpose; and π is the mathematical constant pi.
6. The infrared gas segmentation and leakage source timing localization method according to claim 5, characterized in that, The effective optical flow is divided into non-overlapping grids, and only grids whose effective optical flow quantity and gas ratio meet the preset conditions are retained; The median of the filtering direction within the grid is used as the representative direction, the median of the motion amplitude is used as the representative amplitude, and the magnitude of the mean of the unit direction vector is used as the direction concentration. The reliability weight is constructed by multiplying the representative amplitude, direction concentration, and gas proportion, and the reliability weight of each effective grid is normalized to a sum of 1.
7. The infrared gas segmentation and leakage source timing localization method according to claim 1, characterized in that, In S5, the gas support mask selects the non-air volume mask mapped to the positioning reference coordinate system in the previous frame, and selects the gas mask after the current mapping when the mask in the previous frame is empty, and forms a set of candidate source positions through morphological dilation. by Indicates a valid location update number. This indicates the image frame number corresponding to the update, in order to Indicates a valid grid index. The two-dimensional coordinates of the center of the grid are represented by... Indicate the location of two-dimensional candidate sources; As a numerical expression of the expected direction, where For distance protection, Represents the Euclidean norm; multiplied by the dot product of the unit observed direction and the expected direction by the axial lumped parameter. The composite logarithm score is obtained by summing the results according to the normalized reliability weights. ;Will Subtract the maximum score from the current candidate set and then take the exponent to obtain the directional observation map. ; When the candidate position coincides with the sampling position, the corresponding dot product contribution is 0.
8. The infrared gas segmentation and leakage source timing localization method according to claim 1, characterized in that, In S6, with Indicates a valid location update number. This indicates the location of a two-dimensional candidate source. When the total probability mass of the Gaussian propagation result within the current candidate set is not greater than a preset numerical threshold, the prediction prior will be reset to a uniform distribution on that candidate set. When the total probability mass is greater than the threshold, a formation is formed. ,in The propagation results are truncated and normalized after candidate set processing. For a uniform distribution on the current candidate set, To achieve a uniform recovery ratio, For mixed prediction priors; with This indicates the current direction observation map, according to... Multiply and normalize within the current candidate set to obtain a discrete approximate posterior. ; This indicates the proportional relationship before normalization.
9. The infrared gas segmentation and leakage source timing localization method according to claim 1, characterized in that, In step S7, the posterior probabilities of the current candidate positions are sorted in descending order. The posterior probability corresponding to the first time the cumulative probability quality reaches the preset credible quality is used as the threshold. All candidate positions with posterior probabilities not lower than the threshold are retained to form the region with the highest posterior density. The first valid update adopts the uniform prior on the current candidate set. During the invalid update period, the most recent valid posterior is retained and the current positioning validity flag is set to invalid. After recovery, prediction is performed according to the valid update step.
10. An infrared gas segmentation and leakage source timing localization system, used to implement the infrared gas segmentation and leakage source timing localization method according to any one of claims 1-9, characterized in that, include: An infrared imaging device, a memory, a processor, and a display or alarm interface, wherein the processor is connected to the infrared imaging device, the memory, and the display or alarm interface; The memory stores gas segmentation network parameters, historical images, filtering status, and source location posterior. The processor includes a causal image coding module, a gas segmentation module, a registration and optical flow module, a direction amplitude filtering and mesh aggregation module, a candidate and direction scoring module, a posterior prediction update module, and a localization and reliable region output module. The causal image encoding module caches at least five frames of normalized images to generate four-time-phase inputs with appearance difference pairs; The gas segmentation module loads the trained and exported network parameters and outputs the original image mask. The registration and optical flow module maintains the reference transformation and effective field of view; The directional amplitude filtering and grid aggregation module saves the state, covariance and initialization flag of each reference pixel; The candidate and direction scoring module constructs discrete candidates and current direction scores; The posterior prediction update module saves the previous valid posterior and performs Gaussian propagation, candidate constraints, uniform recovery, and multiplicative normalization. The positioning and trusted area output module calculates the source point, trusted area and status flag, and displays the results or sends a message to the host computer through the display or alarm interface. The display or alarm interface is used to receive gas masks with validity indicators, image locations of leak sources, and posterior reliable regions.
