A detection model training method suitable for optical gas imaging
By combining cross-modal interaction and multi-frame aggregation of appearance and optical flow features, the problem of differences between appearance and motion feature domains in optical gas imaging is solved, improving the detection accuracy and generalization ability of the model and achieving more accurate gas leak identification.
Patent Information
- Application Number
- CN202410180481.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-18
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2044-02-18
AI Technical Summary
In existing optical gas imaging technologies, the domain differences between appearance and motion features result in insufficient model generalization ability, making it difficult to accurately identify gas leaks, especially in the case of small leaks. Existing domain adaptation methods fail to fully utilize the complementarity of appearance and motion features, affecting detection accuracy.
By combining appearance and optical flow features, cross-modal interaction and multi-frame aggregation are performed. First, preliminary domain adaptation of appearance features is performed, then feature aggregation is performed under the guidance of optical flow, and finally cross-modal fusion is performed, followed by further domain adaptation processing to improve the cross-domain alignment capability of the model.
It significantly improves the detection accuracy and portability of the model in real-world scenarios, reduces the domain differences between synthetic and real data, and enhances the accuracy and generalization ability of gas leak detection.
Smart Images

Figure CN118038322B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of gas detection technology and machine vision, and in particular to a method for training a detection model suitable for optical gas imaging. Background Technology
[0002] In the field of gas detection, especially in the detection of various gas leaks (including but not limited to volatile organic compounds (VOCs), methane, sulfur hexafluoride, etc.), accurately identifying leak events and their locations is crucial. Optical Gas Imaging (OGI) technology utilizes the absorption characteristics of gases to infrared radiation of specific wavelengths to visually display the distribution of gas leaks. Due to its wide monitoring range, rapid response, high safety, and flexibility and efficiency, it is widely used in gas leak detection. In recent years, OGI-based automated leak detection, as a target detection problem within machine vision, has received considerable attention.
[0003] With the rapid development of deep learning technology, the performance of object detection algorithms has been significantly improved. However, deep learning-based object detection algorithms rely on large amounts of image data and accurate bounding box annotations. In gas imaging, due to the special imaging mechanism, gas plumes are often translucent, amorphous, and have blurred boundaries, especially in the case of small leaks, making accurate annotation extremely difficult and requiring significant manpower and resources. To alleviate this burden, researchers have attempted to use computer-synthesized infrared videos instead of real videos for training. However, the inter-domain differences between synthetic and real videos lead to insufficient generalization ability of models trained on synthetic videos.
[0004] Unsupervised domain adaptation-based object detection algorithms can reduce this discrepancy and improve the model's applicability in real-world environments. The basic idea is to measure a certain distance between feature distributions in different domains and train a feature extractor to minimize this distance. Based on different network structures, current unsupervised domain adaptation-based object detection algorithms are mainly divided into two categories: domain adaptation algorithms based on generative adversarial networks (GANs) and domain adaptation algorithms based on self-trained networks. The former trains the domain classifier and feature extractor in an adversarial manner, much like training a GAN, aiming to align the feature distribution of the target with that of the source. The latter utilizes a teacher network to generate corresponding pseudo-labels in the unlabeled target domain, using these pseudo-labels as supervisory information for the target domain to improve the target detection performance of the student network in the target domain.
[0005] Significant differences exist in image appearance features between simulated and real optical gas imaging, such as brightness, texture, and noise. These differences stem from various factors, including varying background radiation conditions, differences in imaging equipment, and variations in ambient temperature. These appearance differences make accurate identification difficult. Therefore, domain adaptation of these appearance features is necessary to reduce the discrepancies between simulated and real imaging and improve the accuracy of leak detection models trained on simulated data.
[0006] However, relying solely on appearance features for domain adaptation is insufficient because optical gas imaging quality is inherently poor, with low contrast and blurred details, making it difficult to capture even subtle gas leaks based on appearance alone. To overcome this problem, introducing motion features has become an effective solution. In particular, optical flow features can reveal turbulent gas motion, providing crucial dynamic information such as the flickering of plume boundaries and frame-by-frame diffusion of textures in video. Such motion features complement the limitations of appearance features, providing additional and critical information for plume identification, thereby enhancing the overall performance of the detection system.
[0007] Unfortunately, motion features also exhibit domain variability, caused by varying wind speeds, measurement environments, distances, and viewing angles. Turbulence, as a complex form of random motion, is difficult to fully capture the dynamic changes of real-world scenes in simulated videos. This necessitates considering domain adaptation for both appearance and motion features simultaneously when training gas leak detection models. The natural approach is to either perform domain adaptation separately for these two types of features or perform overall domain adaptation after feature fusion. However, both methods have drawbacks: separate domain adaptation may fail to fully utilize the interrelationship between appearance and motion features, while domain adaptation after fusion may result in poor adaptation performance due to improper feature fusion. This hinders the direct application of current domain adaptation methods to plume detection tasks.
[0008] Therefore, how to fully utilize the complementarity between appearance and motion information to significantly improve the detection accuracy of the detection model in real-world scenarios has become a technical problem that needs to be solved. Summary of the Invention
[0009] The purpose of this invention is to overcome the shortcomings of the prior art and provide a detection model training method suitable for optical gas imaging. It uses cross-modal interaction of appearance and optical flow to more effectively complete cross-domain alignment, thereby significantly improving the portability of the leak detection model.
[0010] The objective of this invention can be achieved through the following technical solutions:
[0011] According to one aspect of the present invention, a detection model training method suitable for optical gas imaging is provided. The method is based on two modal features of video: appearance and optical flow. First, the appearance features are subjected to preliminary domain adaptation processing. Second, under the guidance of optical flow, the adapted appearance features are aggregated into multiple frames to enhance the transferability of appearance features. Finally, the enhanced features and optical flow features are fused across modalities and further subjected to domain adaptation processing.
[0012] As a preferred technical solution, the method includes the following steps:
[0013] Step S1: Obtain synthetic data and real data;
[0014] Step S2: Randomly input a video segment from synthetic data or real data, and calculate the optical flow from the reference frame to the current frame;
[0015] Step S3: Input the current frame and the reference frame from step S2 into the image feature extraction network to obtain the appearance feature maps of the two frames.
[0016] Step S4: Input the appearance feature maps of the current frame and the reference frame into the appearance feature domain classifier and calculate the appearance feature domain classification loss.
[0017] Step S5: The appearance feature map of the reference frame is deformed according to the optical flow from the reference frame to the current frame obtained in step S2, so that it is aligned with the feature map of the current frame, and the two feature maps are fused to obtain the appearance enhancement feature map of the current frame.
[0018] Step S6: Input the appearance enhancement feature map of the current frame and the optical flow from the reference frame to the current frame obtained in step S2 into the multimodal fusion network to obtain the multimodal fusion feature map;
[0019] Step S7: Feed the fused multimodal features into the multimodal feature domain classifier and calculate the domain classification loss of the multimodal features;
[0020] Step S8: When the randomly input video is synthetic data, the multimodal fusion feature map is fed into the detection network to obtain the detection loss; when the randomly input video is real data, the detection loss is not calculated.
[0021] Step S9: Perform iterative calculations and calculate the total loss. Based on the total loss, adjust the model parameters of the gas leak detection model to be trained.
[0022] Step S10: Based on the adjusted model parameters and the multiple synthesized frame sequences and real frame sequences, continue the process of adjusting the model parameters until the number of iterations reaches the preset number.
[0023] Step S11: Use the model parameters obtained when the number of iterations reaches a preset number as the model parameters of the trained gas leak detection model.
[0024] As a preferred technical solution, the synthetic data in step S1 includes multiple computer-generated frame sequences with dynamic leaking plumes and backgrounds, and detection box markers indicating the location of the leaking plumes on each frame.
[0025] As a preferred technical solution, the real data in step S1 includes only infrared gas imaging frame sequences from real leak scenarios.
[0026] As a preferred technical solution, the current frame in step S2 is any frame in the video, and the reference frame is an adjacent frame that has a certain interval from the current frame.
[0027] As a preferred technical solution, the calculation of the appearance feature domain classification loss in step S4 is specifically as follows:
[0028]
[0029]
[0030]
[0031] Among them l app Let this be the loss function for the appearance feature domain classifier, which consists of the synthetic domain classification loss. And the real domain classification loss To find the mean value, D app (·) represents the prediction of the appearance feature domain classifier that the data point belongs to the true domain, F1(·) represents the layer 1 feature, xc s and XR s Indicates the current frame and reference frame of the composition domain, xc t and XR t Representing the current frame and reference frame in the real domain, W and H are the width and length of the feature map, respectively, and n s and n t Let i represent the number of synthetic domain videos and the number of real domain videos in the same batch of training data, and let i, w, and h be indicators of the changes in number, width, and height, respectively.
[0032] As a preferred technical solution, the calculation of the appearance enhancement feature map in step S5 is as follows:
[0033]
[0034] F4 r→c =W(F4(xr),M r→c )
[0035] F4En This indicates enhanced appearance features; F4(xr) represents layer 4 of the reference frame. r→c M represents the alignment feature obtained by warping layer 4 of the reference frame to layer 4 of the current frame. r→c W(·) represents the optical flow from the reference frame obtained in step S2 to the current frame, W(·) represents the bilinear interpolation distortion operation performed on all positions of each channel on layer 4, and α represents the importance of the reference frame.
[0036] As a preferred technical solution, the multimodal fusion feature map calculation in step S6 is as follows:
[0037] F M =Fusion(F4) En ,Μ r→c )
[0038] F M F4 represents the multimodal fusion characteristics of appearance and optical flow. En M represents the enhanced appearance feature obtained from step 5. r→c This represents the optical flow from the reference frame obtained in step S2 to the current frame, and Fusion(·) represents a multimodal fusion network.
[0039] As a preferred technical solution, step S7, calculating the domain classification loss of multimodal features, specifically involves:
[0040]
[0041]
[0042]
[0043] Among them l mm The loss function for the multimodal fusion feature domain classifier is composed of the synthetic domain classification loss. And the real domain classification loss To find the mean value, n s and n t These represent the number of synthetic domain videos and real domain videos in the same batch of training data, respectively. and D represents the multimodal fusion features of the i-th video in the synthetic and real domains, respectively; mm (·) represents the prediction value of the multimodal fusion feature domain classifier that the data point belongs to the true domain. γ γ represents the weight, where γ > 0. The larger γ is, the greater the weight assigned to similar samples.
[0044] As a preferred technical solution, the calculation of the total loss in step S9 is specifically as follows:
[0045] Each iteration includes inputting a synthetic frame sequence and inputting a real frame sequence, and calculating the detection loss, appearance feature domain classification loss, and multimodal feature domain classification loss of the synthetic frame sequence, respectively, and calculating the appearance feature domain classification loss and multimodal feature domain classification loss of the real frame sequence, and summing all the above losses to obtain the total loss.
[0046] Compared with the prior art, the present invention has the following advantages:
[0047] 1) The unsupervised domain transfer training method provided by this invention can significantly reduce the domain difference between synthetic data and real data, and improve the portability and generalization of the leakage detection model;
[0048] 2) This invention avoids the difficulty of annotating optical gas imaging data by solving the performance degradation problem under domain shift. Attached Figure Description
[0049] Figure 1 This is a flowchart of the training method of the present invention;
[0050] Figure 2 This is a schematic diagram of the network architecture of the present invention;
[0051] Figure 3 Visualization of the results of various video object detection algorithms. Detailed Implementation
[0052] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0053] This invention proposes a novel unsupervised domain adaptation-based plume detection training method. This method particularly emphasizes multiple cross-modal interactions between appearance and optical flow to more effectively achieve cross-domain alignment. Specifically, it first performs preliminary domain adaptation on appearance features, then aggregates the adapted appearance features across multiple frames under the guidance of optical flow to enhance feature representation. Subsequently, it fuses the enhanced features with optical flow features across modalities, followed by further domain adaptation processing. The advantage of this method lies in its ability to fully utilize the complementarity between appearance and motion information, thereby significantly improving the model's detection accuracy in real-world scenarios and enhancing the application value of synthetic data in the field of gas detection.
[0054] This invention jointly considers the complementarity and transferability of appearance and optical flow modal features in video. First, it uses optical flow-guided feature aggregation to enhance the transferability of appearance features, and then leverages the consensus of "appearance-optical flow" cross-modal feature combinations to emphasize the most transferable feature combinations.
[0055] Appendix Figure 1 The attached diagram shows the training method flowchart of the present invention. Figure 2 This is a schematic diagram of the network architecture of the present invention. The following describes... Figure 1 The steps in the process are described in detail:
[0056] Step 1. Acquire synthetic and real data. In this embodiment, the synthetic data consists of computer-simulated optical gas imaging videos based on the imaging mechanism, containing 5000 scenes, one video segment per scene, and 20 frames per video segment, with each frame labeled with a gas plume target. The real data comes from videos captured on-site using a handheld optical gas imaging device, containing 40 scenes, one video segment per scene, with a different number of frames per video segment, and without labels.
[0057] Step 2. Randomly input a video segment from either synthetic or real data, and calculate the optical flow from the reference frame to the current frame. The current frame is any frame in the video, and the reference frame is a neighboring frame at an interval of k from the current frame. In this embodiment, k∈[-5,+5], meaning the reference frame is any frame located within the range of 5 frames before or 5 frames after the current frame. In this embodiment, the optical flow network FlowNet2 is used to calculate the optical flow from the reference frame to the current frame.
[0058] Step 3. Feed the current frame and the reference frame into the image feature extraction network to obtain the appearance feature maps of the two frames. In this embodiment, ResNet-101 is used as the image feature extraction network, and its convolutional part is divided into 4 layers, namely layer1, layer2, layer3 and layer4.
[0059] Step 4. Input the layer1 of the current frame and the reference frame into the appearance feature domain classifier and calculate the appearance feature domain classification loss. Layer1 contains local features such as image texture and grayscale. Since the synthetic domain cannot fully simulate the complex situation of the response curve and noise distribution of the optical gas imager in the real domain, there are significant differences between the layer1 of the current frame or the reference frame and the real domain. In order to reduce the domain difference in layer1, this embodiment adopts a pixel-wise alignment strategy based on adversarial learning. Pixel-wise alignment can align the layer1 features of the synthetic domain and the real domain without changing the object-level semantics. The adversarial learning strategy is to add a gradient reversal layer (GRL) between the feature extraction network and the domain classifier. During backpropagation, the gradient is inverted, and the influence of the domain classifier on the parameters of the feature extraction network is used to confuse the data of the synthetic domain and the real domain, thereby extracting domain-invariant features. The appearance feature domain classifier uses least squares loss to ensure the stability of training. In this embodiment, the appearance feature domain classification loss is defined as follows:
[0060]
[0061] In formula (1), l app Let this be the loss function for the appearance feature domain classifier, which consists of the synthetic domain classification loss. And the real domain classification loss To find the mean value, D app (·) represents the prediction of the appearance feature domain classifier that the data point belongs to the true domain, F1(·) represents the layer 1 feature, xc s and XR s Indicates the current frame and reference frame of the composition domain, xc t and XR t Representing the current frame and reference frame in the real domain, W and H are the width and length of the feature map, respectively, and n s and n t Let i represent the number of synthetic domain videos and the number of real domain videos in the same batch of training data, and let i, w, and h be indicators of the changes in number, width, and height, respectively.
[0062] Step 5. First, deform the layer 4 feature map of the reference frame according to the optical flow from the reference frame to the current frame obtained in Step 2, so as to align it with the layer 4 feature map of the current frame. Then, by fusing the layer 4 feature maps of the reference frame and the current frame, the enhanced appearance feature of the current frame is constructed. This method of integrating information from multiple time points using optical flow technology helps to mitigate the impact of environmental noise (such as changes in background radiation, occlusions, defocus, etc.) that may affect the appearance features of a single frame image, generating a more stable and reliable appearance feature representation, thereby improving the transferability of appearance features. The calculation of the enhanced appearance feature can be expressed by the following formula:
[0063]
[0064] F4 in formula (2) En This indicates enhanced appearance features; F4(xr) represents layer 4 of the reference frame. r→c M represents the alignment feature obtained by warping layer 4 of the reference frame to layer 4 of the current frame. r→c Let W(·) represent the optical flow from the reference frame obtained in step 2 to the current frame. W(·) represents the bilinear interpolation distortion operation performed on all positions of each channel on layer 4. α represents the importance of the reference frame; if the features of the distorted reference frame are closer to the features of the current frame, it is given a larger weight (0 ≤ α ≤ 1). α takes different weights at different spatial locations, but shares the same weight among all feature channels at the same spatial location. In this embodiment, α is the correlation coefficient between the feature channels of the current frame and the reference frame at the same spatial location.
[0065] Step 6. Input the appearance enhancement features of the current frame and the optical flow from the reference frame to the current frame obtained in Step 2 into the multimodal fusion network to obtain the multimodal fusion feature map:
[0066] F M =Fusion(F4) En ,Μ r→c (3)
[0067] In formula (3) F M F4 represents the multimodal fusion characteristics of appearance and optical flow. En M represents the enhanced appearance feature obtained from step 5. r→c This represents the optical flow from the reference frame obtained in step 2 to the current frame, and Fusion(·) represents the multimodal fusion network. In this embodiment, the multimodal fusion network adopts an attention-based fusion network.
[0068] Step 7. Feed the fused multimodal features into the multimodal feature domain classifier and calculate the domain classification loss of the multimodal features. For plume detection tasks, attempting to completely align the distributions of the synthetic and ground domains at the full modality level may not yield the desired results. This is because leaking plumes from different domains may exhibit differences due to variations in motion characteristics and background environments. The aim of this method is to identify the cross-domain instances with the greatest transfer potential by comparing the similarity of full modality features. These instances are not only similar in plume category but also exhibit high cross-domain similarity in plume motion patterns and scene layout, which helps to effectively improve the domain adaptability of the model. To emphasize these instances with the greatest transfer potential during training, we define a weighted cross-entropy loss function, where the weights reflect the cross-domain similarity of the samples; that is, cross-domain samples with more similar multimodal features are assigned higher weights. This embodiment employs a global adversarial learning strategy for multimodal feature alignment, and the specific loss function expression is as follows:
[0069]
[0070] In formula (4), l mm The loss function for the multimodal fusion feature domain classifier is composed of the synthetic domain classification loss. And the real domain classification loss To find the mean value, n s and n t These represent the number of synthetic domain videos and real domain videos in the same batch of training data, respectively. and Let D represent the multimodal fusion features of the i-th video in the synthetic and real domains, respectively. mm (·) represents the prediction value of the multimodal fusion feature domain classifier that the data point belongs to the true domain. γ γ represents the weight, where γ > 0. The larger γ is, the greater the weight assigned to similar samples. It can be seen that when instances come from the real domain, D... mm A smaller value indicates that the domain classifier has a harder time making a correct distinction, meaning that the multimodal features of the instance have a higher similarity across different domains and should be given greater weight. Conversely, when the instance comes from a synthetic domain, D... mm The larger the value, the greater the similarity of the multimodal features of the instance across different domains, and the greater the weight it should be given.
[0071] Step 8. When the randomly input video is synthetic data, the multimodal fusion feature map is fed into the detection network to obtain the detection loss. When the randomly input video is real data, no detection loss is calculated. In this embodiment, a Faster-RCNN detector is used, and the objective function of the detector is as follows:
[0072]
[0073] In formula (5), l detection This represents the classification and regression loss of the detector. This represents the multimodal fusion feature of the i-th video in the synthesis domain. Represents the label of the i-th video in the synthesis domain, n s This represents the number of synthetic domain videos in the same batch of training data.
[0074] Step 9. Each iteration includes inputting a synthetic frame sequence and a real frame sequence, and calculating the detection loss, appearance feature domain classification loss, and multimodal feature domain classification loss for the synthetic frame sequence, respectively. The appearance feature domain classification loss and multimodal feature domain classification loss for the real frame sequence are also calculated. All losses are summed to obtain the total loss. Based on the total loss, the model parameters of the gas leak detection model to be trained are adjusted. The expression for the total loss is:
[0075] l total =l det +λ1l app +λ2l mm (6)
[0076] In formula (6), λ1 and λ2 are two adjustment factors, both of which are 1 in this embodiment.
[0077] Step 10. Based on the adjusted model parameters and the multiple synthesized frame sequences and real frame sequences, continue the process of adjusting the model parameters until the number of iterations reaches the preset number;
[0078] Step 11. Use the model parameters obtained when the number of iterations reaches the preset number as the model parameters of the trained gas leak detection model.
[0079] Effects of the Implementation Examples
[0080] To evaluate the performance of the gas leak detection model constructed in this embodiment, a labeled, real-world optical gas imaging database was used as the test set. This database contains 14 scenes and a total of 2015 images. All experiments were conducted on an Ubuntu 18.04 system, using an NVIDIA GeForce GTX 2080Ti GPU for training and inference, with 8GB of dedicated memory, sufficient for the training and inference of the algorithm in this chapter. The algorithm framework was developed using PyTorch. The input image size for the network was 375*300 pixels. The model's accuracy was evaluated using mAP (mean Average Precision), and its performance was evaluated using inference time. The inference time was obtained by averaging the inference times across the entire test set.
[0081] Table 1 compares the performance of different gas leak detection algorithms based on optical gas imaging. TBLD and FFBGD are both leak gas detection methods based on background removal. TBLD extracts the foreground of the image using an online tensor method, and then uses the extracted foreground to crop the target location in the original image for classification and detection. FFBGD, on the other hand, uses the TBLD algorithm to acquire the foreground image, trains it together with the original image, and fuses the features of the foreground and the original image through a feature fusion module to guide the target detection process. Both TBLD and FFBGD require foreground-background separation before detection. Although this increases the adaptability of the method across different domains, it only performs well in videos captured from a fixed viewpoint. For data acquired by a handheld optical gas imager, background removal is not easy to extract the foreground, resulting in lower accuracy compared to this embodiment. Furthermore, the background removal process requires a large amount of information from previous and subsequent frames, and involves complex calculations such as tensor decomposition, which greatly reduces the inference speed.
[0082] Table 1
[0083] OGI Leakage Detection Method mAP(%) backbone network Inference time (ms) TBLD 19.71 R-101 92 FFBGD 24.44 R-101 871 This embodiment 35.46 R-101 163
[0084] Table 2 compares the performance of this embodiment with general video target detection algorithms, including MEGA, HVRNet, Temporal ROI Align, and SELSA. The results in Table 2 show that the method in this embodiment still has the best performance, and its accuracy is significantly higher than the methods shown in the table. It achieves the best performance in current leak gas detection tasks. For a more intuitive comparison of the performance of each algorithm, see the appendix... Figure 3 The detection results of each algorithm are visualized in the document. The first row is the label, rows 2 to 6 are the detection results of the general video target detection algorithm, and row 7 is the inference result of the algorithm in this embodiment. It can not only accurately locate the location of the leaking gas, but also avoid the problem of missed detection.
[0085] Table 2
[0086] Video object detection methods mAP(%) backbone network Inference time (ms) HVRNet 29.74 R-101 391 MEGA 29.25 R-101 357 Temporal ROI Align 30.10 X-101 490 SELSA 23.30 R-101 419 RDN 29.39 R-101 277 FGFA 29.31 R-101 146 This embodiment 35.46 R-101 163
[0087] Table 3 analyzes the effectiveness of each stage in this embodiment. It can be seen that the strategies at each stage significantly improve the accuracy of the model, especially the multimodal domain adaptation strategy, which significantly improves the model's performance.
[0088] Table 3
[0089] Module mAP(%) Appearance domain adaptation 30.25 Appearance domain adaptation + appearance feature enhancement 31.25 Appearance domain adaptation + appearance feature enhancement + multimodal fusion 32.61 Appearance domain adaptation + appearance feature enhancement + multimodal fusion + multimodal domain adaptation 35.46
[0090] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for training a detection model suitable for optical gas imaging, characterized in that, This method is based on two modal features of video: appearance and optical flow. First, the appearance features are subjected to preliminary domain adaptation processing. Second, under the guidance of optical flow, the adapted appearance features are aggregated across multiple frames to enhance the transferability of appearance features. Finally, the enhanced features and optical flow features are fused across modalities and further domain adaptation processing is performed. The method includes the following steps: Step S1: Obtain synthetic data and real data; Step S2: Randomly input a video segment from synthetic data or real data, and calculate the optical flow from the reference frame to the current frame; Step S3: Input the current frame and the reference frame from step S2 into the image feature extraction network to obtain the appearance feature maps of the two frames. Step S4: Input the appearance feature maps of the current frame and the reference frame into the appearance feature domain classifier and calculate the appearance feature domain classification loss. Step S5: The appearance feature map of the reference frame is deformed according to the optical flow from the reference frame to the current frame obtained in step S2, so that it is aligned with the feature map of the current frame, and the two feature maps are fused to obtain the appearance enhancement feature map of the current frame. Step S6: Input the appearance enhancement feature map of the current frame and the optical flow from the reference frame to the current frame obtained in step S2 into the multimodal fusion network to obtain the multimodal fusion feature map; Step S7: Feed the fused multimodal features into the multimodal feature domain classifier and calculate the domain classification loss of the multimodal features; Step S8: When the randomly input video is synthetic data, the multimodal fusion feature map is fed into the detection network to obtain the detection loss; when the randomly input video is real data, the detection loss is not calculated. Step S9: Perform iterative calculations and calculate the total loss. Based on the total loss, adjust the model parameters of the gas leak detection model to be trained. Step S10: Based on the adjusted model parameters and the multiple synthesized frame sequences and real frame sequences, continue the process of adjusting the model parameters until the number of iterations reaches the preset number. Step S11: Use the model parameters obtained when the number of iterations reaches a preset number as the model parameters of the trained gas leak detection model.
2. The detection model training method for optical gas imaging according to claim 1, characterized in that, The synthetic data in step S1 includes multiple computer-generated frame sequences with dynamic leaking plumes and backgrounds, and detection box markers indicating the location of the leaking plumes in each frame.
3. The detection model training method for optical gas imaging according to claim 1, characterized in that, The real data in step S1 includes only infrared gas imaging frame sequences from real leak scenarios.
4. The detection model training method for optical gas imaging according to claim 1, characterized in that, In step S2, the current frame is any frame in the video, and the reference frame is an adjacent frame that has a certain interval from the current frame.
5. The detection model training method for optical gas imaging according to claim 1, characterized in that, The calculation of the appearance feature domain classification loss in step S4 is specifically as follows: in Let this be the loss function for the appearance feature domain classifier, which consists of the synthetic domain classification loss. And the real domain classification loss The average value is obtained. This represents the prediction by the appearance feature domain classifier that a data point belongs to the true domain. Represents layer 1 features. and Indicates the current frame and reference frame of the composition domain. and Represents the current frame and reference frame in the real domain. and For the width and length of the feature map, and The number of synthetic domain videos and the number of real domain videos in the same batch of training data. , and These are indicators of changes in quantity, width, and height, respectively.
6. The detection model training method for optical gas imaging according to claim 1, characterized in that, The calculation of the appearance enhancement feature map in step S5 is as follows: Indicates enhanced appearance features, This represents layer 4 of the reference frame. This represents the alignment feature obtained by warping layer 4 of the reference frame to layer 4 of the current frame. This represents the optical flow from the reference frame obtained in step S2 to the current frame. This indicates a bilinear interpolation distortion operation performed on all positions of each channel in layer 4. This indicates the importance of the reference frame.
7. The detection model training method for optical gas imaging according to claim 1, characterized in that, The multimodal fusion feature map calculation in step S6 is as follows: This represents the multimodal fusion characteristics of appearance and optical flow. This represents the enhanced appearance features obtained from step 5. This represents the optical flow from the reference frame obtained in step S2 to the current frame. This represents a multimodal fusion network.
8. The detection model training method for optical gas imaging according to claim 1, characterized in that, The specific steps in step S7 for calculating the domain classification loss of multimodal features are as follows: in The loss function for the multimodal fusion feature domain classifier is composed of the synthetic domain classification loss. And the real domain classification loss The average value is obtained. and These represent the number of synthetic domain videos and real domain videos in the same batch of training data, respectively. and Represent the first and second domains of the composition domain and the real domain, respectively. Multimodal fusion features of a video; This represents the prediction by the multimodal fusion feature domain classifier that a data point belongs to the true domain. Indicates weight, , The larger the value, the greater the weight assigned to similar samples.
9. The detection model training method for optical gas imaging according to claim 1, characterized in that, The calculation of the total loss in step S9 is specifically as follows: Each iteration includes inputting a synthetic frame sequence and inputting a real frame sequence, and calculating the detection loss, appearance feature domain classification loss, and multimodal feature domain classification loss of the synthetic frame sequence, respectively, and calculating the appearance feature domain classification loss and multimodal feature domain classification loss of the real frame sequence, and summing all the above losses to obtain the total loss.
Citation Information
Patent Citations
Multi-scene moving target detection method and device based on sample generation and domain adaptation
CN112183456A
Liquid leakage detection method based on three-frame difference method and VGG-16
CN112241681A
