Infrared imaging gas leakage detection method based on YOLOV8
By introducing StarBlock, CAA and HS-FPN networks into the YOLOv8 model, combined with the Vibe algorithm, the problem of insufficient multi-scale detection and timing information processing is solved, and accurate and real-time gas leakage detection is achieved in the context of industrial pipelines.
Patent Information
- Application Number
- CN202411191007.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2044-08-28
AI Technical Summary
The YOLOv8 model has shortcomings in multi-scale object detection and video frame timing information processing, resulting in inaccurate detection and high false alarm rate.
By improving the YOLOv8 model, the multi-scale feature extraction capability of the C2f module is enhanced using StarBlock and CAA modules, and the HS-FPN network is replaced by the SFPN network, combined with the Vibe algorithm to reduce the false alarm rate.
It improves the multi-scale feature extraction capability and global feature capture capability, reduces the false alarm rate, and achieves accurate and real-time gas leakage detection in the context of industrial complex pipelines.
Smart Images

Figure CN119169305A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of target detection in special scenarios, and specifically to an infrared imaging gas leakage detection method based on an improved YOLOv8 model. Background Art
[0002] The main components of leaked gas in the petrochemical industry are volatile organic compounds (VOCs) such as alkanes, alkenes, and cyclic hydrocarbons, which are not only harmful to the human body, but also cause air pollution and even cause major safety accidents such as fires and explosions. Gas leak detection can find the leak point in time and reduce the possibility of the above accidents. Therefore, how to quickly and accurately detect gas leaks is the current research focus.
[0003] Refrigerated infrared thermal imagers can effectively identify VOCs gases, and infrared thermal imagers can be mounted on motion robots to replace manual inspections in industrial parks. Compared with traditional gas sensors for leak detection, gas leak detection based on infrared thermal imaging has the advantages of fast response, long distance, large range, dynamic and intuitive; compared with traditional infrared gas recognition algorithms, deep learning methods automatically extract features through end-to-end learning, capture the contextual relationship between targets to improve detection accuracy, and use hardware acceleration such as GPU to achieve real-time requirements, which can accurately and quickly discover and locate the source of leakage for early warning.
[0004] YOLO (You Only Look Once) is a mainstream target detection algorithm in deep learning, which takes into account both detection accuracy and detection time. Among them, YOLOv8 uses the C2f module with richer gradient flow, and the head part uses the Anchor-Free anchor box method. These features make YOLOv8 more suitable for detecting irregular gas leaks. However, YOLOv8 still has the following defects: 1) It is not accurate enough for multi-scale target detection. 2) The lack of timing information between video frames leads to a high false alarm rate.
[0005] To this end, an infrared imaging gas leak detection method based on an improved YOLOv8 model was proposed. Summary of the invention
[0006] The purpose of the present invention is to provide infrared imaging gas leak detection based on the improved YOLOv8 model to solve the problem of accurate and real-time detection of leaking gas in the context of complex industrial pipelines. In order to achieve the above purpose, the technical solution adopted by the present invention is:
[0007] A YOLO-based infrared imaging gas leak detection method comprises the following steps:
[0008] S1: Constructing a dataset: Based on the public dataset GasVid, images with more diverse air mass shapes and richer pipeline scenes are obtained through simulated scene shooting and image fusion, thus obtaining a dataset consisting of 4,873 infrared gas images.
[0009] S2: Build and improve the neural network model of YOLOv8:
[0010] Establish a YOLOv8 neural network model, configure the required environment, and adjust the corresponding parameters of the model;
[0011] Improve the YOLOv8 neural network model to improve the model's ability to extract multi-scale features:
[0012] StarBlock and CAA (Context Anchor Attention) are used to improve the C2f module, HS-FPN (Hierarchical Scale-based Feature Pyramid Network) is used to replace the original SFPN network, and the improved YOLOv8 model is named SCH-YOLO.
[0013] S3: Train the SCH-YOLO network model on the dataset constructed in S1:
[0014] The constructed data set is input into the SCH-YOLO network model and trained to obtain the best weight file best.pt which has the best effect on infrared gas leak recognition.
[0015] S4: Overall algorithm for infrared gas target recognition:
[0016] The SCH-YOLO model outputs the target prediction box and confidence of a single frame image, and the Vibe algorithm outputs the foreground pixel distribution of a single frame image. The two are combined to identify infrared gas targets by judging the threshold of the foreground pixel ratio in the prediction box. This reduces the false alarm rate and enables more accurate detection of gas leaks in infrared scenes.
[0017] The step S1 specifically includes the following steps:
[0018] S11: The dataset GasVid is a dataset for target detection of methane gas leaks captured under infrared thermal imaging. GasVid has a leakage flow range of 5.3-2051.6 g / cm3. 4 / h, different scenes were filmed at a distance of 4.6-15.6m, and a total of 31 videos were collected;
[0019] The IOD dataset is an infrared gas dataset consisting of 600 videos;
[0020] S12: Find real videos taken by humans using infrared thermal imagers for factory inspections;
[0021] S13: Self-build pipeline model, simulate real pipeline gas leakage and take photos. Use methane and propane as leakage gases. The shooting schemes include: different distances of 1M, 3M, 7M, 10M, different lighting conditions, different shooting angles, and pedestrian interference.
[0022] S14: Use the CycleGAN network to transfer the style of the visible light pipeline scene to generate the infrared pipeline scene, and use OpenCV to fuse the real air mass and the infrared scene to obtain the final image;
[0023] S15: The video is cropped into video frames, and finally a data set consisting of 4873 infrared VOCs gas leakage images is obtained. The data set is divided into a training set and a test set according to an 8:2 ratio.
[0024] Step S2 specifically includes the following steps:
[0025] Establish a YOLOv8 neural network model, configure the required environment, and adjust the corresponding parameters of the model;
[0026] Improve the YOLOv8 neural network model, use StarBlock and CAA to improve the C2f module, use HS-FPN to replace the original SFPN network, and name the improved YOLOv8 model SCH-YOLO, as follows:
[0027] S21: Use StarBlock in StarNet to improve the Bottleneck part in C2f, and use CAA in PKINet network to enhance the features after splicing;
[0028] S22:StarBlock for multi-scale feature extraction:
[0029] StarBlock extracts features by replacing the original bottleneck layer convolution with parallel convolution kernels of different scales: 3x3, 5x5, and 7x7:
[0030] Multi-scale convolution:
[0031] Y 1 =Conv 3×3 (X),Y 2 =Conv 5×5 (X),Y 3 =Conv 7×7 (X)
[0032] Conv 3×3 (), Conv 5×5 (), Conv7×7 () represent 3x3, 5x5, and 7x7 convolutions respectively;
[0033] Fusion of convolution results of different scales:
[0034] X star =Concat(Y 1 ,Y 2 ,Y 3 )
[0035] Concat() means Concat feature fusion;
[0036] S23: Feature enhancement after CAA improvement splicing:
[0037] The CAA module further improves the C2f module by capturing long-range dependencies, capturing the relationship between distant pixels through global average pooling and one-dimensional strip convolution, and enhancing the features of the central area:
[0038] Global Average Pooling:
[0039] X global =GlobalAveragePooling(X concat )
[0040] GlobalAveragePooling() represents global average pooling;
[0041] 1D strip convolution:
[0042] X strip =Conv 1×k (X global )+Conv k×1 (X global )
[0043] Conv 1×k (), Conv k×1 () represent one-dimensional strip convolution in depth and width directions respectively;
[0044] The CAA module uses the attention mechanism to dynamically adjust the important information in the feature map and enhance the feature representation of the key areas:
[0045] X attn =σ(Conv 1×1 (X strip ))⊙X star +X star
[0046] σ represents the Sigmoid activation function, ⊙ represents element-by-element multiplication;
[0047] S24: The HS-FPN network principle consists of two parts: feature selection module and feature fusion module:
[0048] S25: Feature selection module:
[0049] The feature selection module uses the channel attention CA and dimension matching DM mechanism to screen feature maps of different scales, dividing them into low-level features and high-level features, and extracts important information in each channel through pooling operations and weight calculations;
[0050] S26: Feature fusion module:
[0051] The feature fusion module combines the filtered low-level features with high-level features through the selective feature fusion (SFF) mechanism. After the high-level features are expanded, they are resized through bilinear interpolation and transposed convolution, and then fused with the low-level features, thereby enhancing the model's ability to express features.
[0052] S27: Selective feature fusion is to fuse feature maps of different scales, and the process is as follows:
[0053] Given an input high-level feature:
[0054] X high ⊙R C*H*W
[0055] C represents the number of channels of the feature map, H represents the height of the feature map, and W represents the width of the feature map;
[0056] An input low-scale feature:
[0057]
[0058] W 1 Indicates the width of the low-scale feature map;
[0059] The high-level features are first expanded using a transposed convolution T-Conv of size 2 and kernel size 3x3, resulting in a feature size of:
[0060] X high ∈R C*2H*2W
[0061] In order to unify the dimensions of high-level features and low-scale features, bilinear interpolation is used to up- or down-sample high-level features to obtain the following features:
[0062]
[0063] H 1 Represents the height of the low-scale feature map;
[0064] The CA module is used to convert high-level features into corresponding attention weights to filter low-scale features, and the filtered low-scale features are fused with high-level features to enhance the feature representation of the model:
[0065]
[0066] Equations (1) and (2) illustrate the fusion process of feature selection:
[0067] X att =BL(T-Conv(X high )) (1)
[0068] X att =X low *CA(X att )+X att (2)
[0069] S3 specifically includes:
[0070] Use the SCH-YOLO model to train 200 rounds on the training set and obtain the trained weight file best.pt.
[0071] S4 specifically includes:
[0072] S41: Vibe foreground extraction algorithm:
[0073] The background sample set of pixels is selected from the first frame image to establish the background model, the Euclidean distance between the pixels of the next frame image and each pixel in the sample set is calculated to determine the foreground pixel, and the background sample model is updated using a random strategy;
[0074] S411: first establish background samples, and randomly select N pixels from the S*S neighborhood of each pixel in the first frame image as the background sample set of the pixel;
[0075] S412: Perform foreground pixel detection based on the background samples, calculate the Euclidean distance between the pixel point of the next frame image and each pixel point in the sample set, if it is less than the radius R, it is an approximate sample point, and if the number of approximate sample points in the sample set is greater than the threshold P, then the pixel point is classified as a background pixel point, otherwise it is a foreground pixel point;
[0076] Take P = 2, R is the adaptive threshold, and the formula is:
[0077] R(x) is the radius threshold of the newly read pixel; R′(x) is the radius threshold of the previous pixel, S2(x) is the variance between the newly read pixel and the pixel in the sample set, θ is the measurement factor, when the variance is greater than the measurement factor, it means that the scene has changed significantly, increase the R threshold, otherwise reduce the R threshold;
[0078] S413: The background model will be updated accordingly as the scene changes. The background may change in the next video frame read, and the sample set needs to be continuously updated. Each background pixel has a probability of 1 / σ to update its own sample set, where σ is the update factor.
[0079] S42: The SCH-YOLO model and the Vibe algorithm are executed in parallel, and the single frame image is subjected to the SCH-YOLO model based on step S3, and the judgment of the single frame image is output, including the prediction box and the confidence level;
[0080] S43: At the same time, the Vibe algorithm obtains the foreground pixel distribution of the same single-frame image through step S41;
[0081] S44: Making a judgment based on the prediction box, confidence, and foreground pixel distribution;
[0082] If the confidence level of a single frame image is > 0.4, it is identified as gas;
[0083] If the confidence of a single frame image is ≤0.4 and the proportion of foreground pixels in the prediction frame is >0.35, it is identified as gas;
[0084] If the confidence of a single frame image is ≤0.4 and the proportion of foreground pixels in the prediction frame is ≤0.35, it is considered a misidentification.
[0085] The final algorithm combines timing information to reduce the false alarm rate and detect infrared gas leaks more accurately.
[0086] The present invention proposes an infrared imaging gas leakage detection method based on an improved YOLOv8 model. YOLOv8 is improved by using StarBlock and CAA to improve C2f and HS-FPN to replace SFPN network. Then, it is combined with Vibe for leakage detection, thereby ensuring the high efficiency of detection and achieving real-time detection.
[0087] The advantages of the present invention are:
[0088] 1) In order to meet the needs of global feature capture, StarBlock is used to improve the Bottleneck part, and multi-scale convolution and feature fusion are performed to enhance the ability to extract multi-scale features. CAA feature enhancement is also performed to make the global feature capture capability more prominent.
[0089] 2) For multi-level feature fusion in complex scenes, the present invention uses HS-FPN to replace the original SFPN network, divides feature screening into high-level features and low-level features, and effectively filters irrelevant or redundant features. The SFF mechanism is used for fusion, and features at different levels complement each other, which further enhances the multi-scale feature extraction capability.
[0090] 3) In view of the problem that SCH-YOLO is based on video frames for detection and lacks the timing information between video frames, the present invention combines SCH-YOLO with the Vibe algorithm. SCH-YOLO can detect targets in single-frame images with high precision, and Vibe can detect moving targets. The single-frame recognition results output by SCH-YOLO are handed over to Vibe to judge the motion attributes, which can reduce the false alarm rate of SCH-YOLO recognition. At the same time, Vibe consumes very little memory and computing power, which can make the entire algorithm have better robustness while ensuring real-time detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0091] Figure 1 The overall process of the present invention;
[0092] Figure 2 is the data set of the present invention;
[0093] Figure 3 is SCH-YOLO of the present invention;
[0094] Figure 4 This is the overall algorithm flow of the present invention. DETAILED DESCRIPTION
[0095] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention.
[0096] like Figure 1 As shown, the embodiment of the present invention provides an infrared imaging gas leakage detection method based on an improved YOLOv8 model, comprising the following steps:
[0097] S1: Since the public datasets GasVid and IOD are mostly VOCs gas leakage videos with simple backgrounds, which cannot truly reflect the complex pipeline scenes of the factory, we use simulation experiments and other methods to expand the images based on the public datasets to obtain a dataset consisting of 4873 infrared gas leakage images, such as Figure 2 As shown;
[0098] S11: For the datasets GasVid and IOD disclosed in S1;
[0099] In 2019, Jingfan Wang, Lyne P. Tchapmi, Arvind P. Ravikumar and others published a paper titled Machine vision for natural gas methane emissions detection using an infrared camera in the journal Applied Energy, and released their dataset GasVid. This dataset is a dataset specifically for detecting methane gas leaks captured under infrared thermal imaging. GasVid detects leaks in the range of 5.3-2051.6 g / cm3. 4 / h, different scenes were filmed at a distance of 4.6-15.6m, and a total of 31 videos were collected;
[0100] In 2022, Kailai Zhou, Yibo Wang, Tao Lv and others published the paper Explore Spatio-temporal Aggregation for Insubstantial Object Detection: Benchmark Dataset and Baseline in the journal Computer Vision and Pattern Recognition, and made their dataset IOD public. This dataset is an infrared gas dataset consisting of 600 videos, covering various distances, sizes, visibility, and spectral ranges of scenes shot differently;
[0101] S12: Search the Internet and manufacturer promotional videos to find real videos shot by humans using infrared thermal imagers for factory inspections;
[0102] S13: Self-build pipeline model, simulate real pipeline gas leakage and conduct self-filming. Use methane and propane as leakage gas. Design solutions include: different distances of 1M, 3M, 7M, 10M, different lighting conditions, different shooting angles, pedestrian interference, etc.
[0103] S14: In order to enrich the scene diversity, the CycleGAN network is used to transfer the style of the visible light pipeline scene to generate the infrared pipeline scene. OpenCV is used to fuse the real air mass and the infrared scene to obtain the final image;
[0104] S15: The video is cropped into video frames, and finally a dataset consisting of 4873 infrared VOCs gas leakage images is obtained. The dataset is divided into a training set and a test set according to an 8:2 ratio.
[0105] S2: Due to the insufficient multi-scale feature extraction capability of YOLOv8, StarBlock and CAA are used to improve the C2f module, and HS-FPN is used to replace the original SFPN network to enhance the multi-scale feature extraction capability of YOLOv8. The improved model is named SCH-YOLO. Its network structure is as follows: Figure 3 shown.
[0106] S21: C2f can retain more feature information while reducing the amount of calculation. However, C2f's feature expression is not rich enough, and its ability to capture global context information is still insufficient. Use StarBlock in StarNet to improve the Bottleneck part of C2f, and use CAA in the PKINet network to enhance the features after splicing. This will enhance the ability to extract multi-scale features and capture global context information:
[0107] S22:StarBlock for multi-scale feature extraction:
[0108] StarBlock replaces the original bottleneck layer convolution with parallel convolution kernels of different scales (3x3, 5x5, 7x7) to extract features, which is used to enhance the model's ability to recognize objects of different sizes. It not only relies on local convolution, but also introduces larger convolution kernels to improve the ability to extract multi-scale features.
[0109] Multi-scale convolution:
[0110] Y 1 =Conv 3×3 (X),Y 2 =Conv 5×5 (X),Y 3 =Conv 7×7 (X)
[0111] The convolution results of different scales are fused to improve the expressiveness and richness of features:
[0112] X star =Concat(Y 1 ,Y 2 ,Y 3 )
[0113] S23: Feature enhancement after CAA improvement splicing:
[0114] The CAA module further improves the C2f module by capturing long-range dependencies, capturing the relationship between distant pixels through global average pooling and one-dimensional strip convolution, and enhancing the features of the central area. This design can effectively supplement the shortcomings of C2f in capturing global information.
[0115] Global Average Pooling:
[0116] X global =GlobalAveragePooling(X concat )
[0117] 1D strip convolution:
[0118] X strip =Conv 1×k (X global )+Conv k×1 (X global )
[0119] The CAA module uses the attention mechanism to dynamically adjust the important information in the feature map and enhance the feature representation of the key areas:
[0120] X attn =σ(Conv 1×1 (X strip ))⊙X star +X star
[0121] S24: Since HS-FPN uses advanced feature screening and multi-level feature fusion, it is more accurate and efficient in feature extraction and fusion of complex backgrounds, so HS-FPN is used to replace the original SFPN network to improve the recognition accuracy in complex scenes. The HS-FPN network principle consists of two parts: feature selection module and feature fusion module:
[0122] S25: Feature selection module:
[0123] This module uses the channel attention (CA) and dimension matching (DM) mechanisms to filter feature maps of different scales and divide them into low-level features and high-level features. Through pooling operations and weight calculations, it extracts important information in each channel;
[0124] S26: Feature fusion module:
[0125] This module combines the filtered low-level features with high-level features through a selective feature fusion mechanism. After the high-level features are expanded, they are resized through bilinear interpolation and transposed convolution, and then fused with the low-level features, thereby enhancing the model's ability to express features;
[0126] S27:SFF is a key component in the HS-FPN network. Its main function is to fuse feature maps of different scales. The process is as follows:
[0127] Given an input high-level feature:
[0128] X high ∈R C*H*W
[0129] An input low-scale feature:
[0130]
[0131] The high-level features are first expanded using a transposed convolution (T-Conv) of size 2 and kernel size 3x3, resulting in a feature size of:
[0132] X high ∈R C*2H*2W
[0133] In order to unify the dimensions of high-level features and low-scale features, bilinear interpolation is used to up- or down-sample high-level features to obtain the following features:
[0134]
[0135] The CA module is used to convert high-level features into corresponding attention weights to filter low-scale features. The filtered low-scale features are fused with high-level features to enhance the feature representation of the model:
[0136]
[0137] Equations (1) and (2) illustrate the fusion process of feature selection:
[0138] X att =BL(T-Conv(X high )) (1)
[0139] X att =X low *CA(X att )+X att (2)
[0140] S3: Use the SCH-YOLO model to train 200 rounds on the training set to obtain the trained weight file best.pt;
[0141] Test and evaluate the recognition model using indicators such as accuracy, recall, and mAP@0.5;
[0142] Precision refers to the proportion of detected targets that actually belong to the category. It is the ratio of the amount of correctly classified data in the test set to the amount of data in the test set. The following is the formula for calculating accuracy:
[0143]
[0144] Recall refers to the probability of being predicted as a positive sample among samples that are actually positive. The following is the formula for calculating the recall rate:
[0145]
[0146] AP is the area under the precision-recall curve. The average of the APs of all categories is used to get mAP.
[0147] S4: Since SCH-YOLO only recognizes objects based on a single video frame, it lacks the timing information between video frames. And since methods such as 3DCNN will greatly increase the number of algorithm parameters and computing power requirements, a parallel method combined with Vibe is adopted. The algorithm flow is as follows Figure 4 ,SCH-YOLO and Vibe are combined to increase the timing information while taking into account the accuracy of SCH-YOLO to reduce the false alarm rate;
[0148] S41: Vibe can extract dynamic foreground and propose foreground pixels with motion attributes. It is more robust than the inter-frame difference method and simpler than the optical flow method.
[0149] S41 specifically includes:
[0150] S411: First, establish background samples. Randomly select N pixels in the S*S neighborhood of each pixel in the first frame image as the background sample set of the pixel;
[0151] S412: Perform foreground pixel detection based on background samples. Calculate the Euclidean distance between the next frame image pixel and each pixel in the sample set. If it is less than the radius R, it is an approximate sample point. If the number of approximate sample points in the sample set is greater than the threshold P, then the pixel is classified as a background pixel, otherwise it is a foreground pixel;
[0152] Take P = 2, R is the adaptive threshold, and the formula is:
[0153] R(x) is the radius threshold of the newly read pixel; R′(x) is the radius threshold of the previous pixel, S2(x) is the variance between the newly read pixel and the pixel in the sample set, θ is the measurement factor, and θ=2. When the variance is greater than the measurement factor, it means that the scene has changed significantly, and the R threshold is increased, otherwise it is reduced;
[0154] S413: The background model will be updated accordingly as the scene changes. The background may change in the next video frame read, and the sample set needs to be continuously updated. Each background pixel has a probability of 1 / σ to update its own sample set. σ is the update factor, and σ=16;
[0155] S42: SCH-YOLO and Vibe algorithms are executed in parallel. A single frame image is passed through the SCH-YOLO model based on S3, and the judgment of the single frame image is output, including the prediction box and confidence.
[0156] S43: At the same time, the Vibe algorithm obtains the foreground pixel distribution of the same single frame image through S41;
[0157] S44: Making a judgment based on the prediction box, confidence, and foreground pixel distribution;
[0158] If the confidence level of a single frame image is > 0.4, it is identified as gas;
[0159] If the confidence of a single frame image is ≤0.4 and the proportion of foreground pixels in the prediction frame is >0.35, it is identified as gas;
[0160] If the confidence of a single frame image is ≤0.4 and the proportion of foreground pixels in the prediction frame is ≤0.35, it is considered a misidentification.
[0161] The infrared imaging gas leak detection method proposed in the present invention improves YOLOv8, uses StarBlock and CAA to improve the C2f module, and uses HS-FPN to replace the original SFPN network to obtain SCH-YOLO. SCH-YOLO is used in conjunction with the Vibe algorithm for parallel operation and judgment to solve the problem of lack of timing information between video frames, thereby reducing the false alarm rate of the algorithm.
[0162] The preferred embodiments of the present invention are described in detail above in conjunction with the accompanying drawings. The embodiments described in the present invention are merely descriptions of the preferred embodiments of the present invention, and do not limit the concept and scope of the present invention. The various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction, and such combinations should also be regarded as the contents disclosed in the present disclosure as long as they do not violate the concept of the present invention. In order to avoid unnecessary repetition, the present invention will not further describe various possible combinations.
[0163] The present invention is not limited to the specific details of the above-mentioned embodiments. Within the technical concept of the present invention and without departing from the design concept of the present invention, various modifications and improvements made to the technical solution of the present invention by technical personnel in this field should fall within the protection scope of the present invention. The technical contents for which protection is sought in the present invention have been fully recorded in the claims.
Claims
1. A YOLOv8-based infrared imaging gas leak detection method. It is characterized in that The specific steps include: S1: Constructing a dataset: Based on the public datasets GasVid and IOD, a dataset consisting of 4873 infrared gas images was obtained through simulated scene shooting and image fusion; S2: Establish and improve the neural network model of YOLOv8, and name the improved YOLOv8 model SCH-YOLO; S3: Train the SCH-YOLO network model on the dataset constructed in step S1: Input the constructed data set into the SCH-YOLO network model and train it to obtain the weight file best.pt that can identify infrared gas leaks; S4: Overall algorithm for infrared gas target recognition: The SCH-YOLO model outputs the target prediction box and confidence of a single-frame image, and the Vibe algorithm outputs the foreground pixel distribution of a single-frame image. The two are combined to identify infrared gas targets by judging the threshold of the foreground pixel ratio in the prediction box.
2. According to the infrared imaging gas leakage detection method based on YOLOv8 according to claim 1, It is characterized in that The step S1 specifically includes the following steps: S11: The dataset GasVid is a dataset for target detection of methane gas leaks captured under infrared thermal imaging. GasVid has a leakage flow range of 5.3-2051.6 g / cm3. 4 / h, different scenes were filmed at a distance of 4.6-15.6m, and a total of 31 videos were collected; The IOD dataset is an infrared gas dataset consisting of 600 videos; S12: Find real videos taken by humans using infrared thermal imagers for factory inspections; S13: Self-build pipeline model, simulate real pipeline gas leakage and take photos. Use methane and propane as leakage gases. The shooting schemes include: different distances of 1M, 3M, 7M, 10M, different lighting conditions, different shooting angles, and pedestrian interference. S14: Use the CycleGAN network to transfer the style of the visible light pipeline scene to generate the infrared pipeline scene, and use OpenCV to fuse the real air mass and the infrared scene to obtain the final image; S15: The video is cropped into video frames, and finally a data set consisting of 4873 infrared VOCs gas leakage images is obtained. The data set is divided into a training set and a test set according to an 8:2 ratio.
3. According to the infrared imaging gas leakage detection method based on YOLOv8 according to claim 1, It is characterized in that The step S2 specifically includes the following steps: Establish a YOLOv8 neural network model, configure the required environment, and adjust the corresponding parameters of the model; Improve the YOLOv8 neural network model, use StarBlock and CAA to improve the C2f module, use HS-FPN to replace the original SFPN network, and name the improved YOLOv8 model SCH-YOLO, as follows: S21: Use StarBlock in StarNet to improve the Bottleneck part in C2f, and use CAA in PKINet network to enhance the features after splicing; S22:StarBlock for multi-scale feature extraction: StarBlock extracts features by replacing the original bottleneck layer convolution with parallel convolution kernels of different scales: 3x3, 5x5, and 7x7: Multi-scale convolution: Y 1 =Conv 3×3 (X),Y 2 =Conv 5×5 (X),Y 3 =Conv 7×7 (X) Conv 3×3 ( ), Conv 5×5 ( ), Conv 7×7 ( ) represent 3x3, 5x5, and 7x7 convolutions respectively; Fusion of convolution results of different scales: X star =Concat(And 1 ,AND 2 ,AND 3 ) Concat() means Concat() feature fusion; S23: Feature enhancement after CAA improvement splicing: The CAA module further improves the C2f module by capturing long-range dependencies, capturing the relationship between distant pixels through global average pooling and one-dimensional strip convolution, and enhancing the features of the central area: Global Average Pooling: X global =GlobalAveragePooling(X concat ) GlobalAveragePooling() represents global average pooling; 1D Strip Convolution: X strip =Conv 1×k (X global )+Conv k×1 (X global ) Conv 1×k ( ), Conv k×1 ( ) represent one-dimensional strip convolution in depth and width directions respectively; The CAA module uses the attention mechanism to dynamically adjust the important information in the feature map and enhance the feature representation of the key areas: X attn =σ(Conv 1×1 (X strip ))⊙X star +X star σ represents the Sigmoid activation function, ⊙ represents element-by-element multiplication; S24: The HS-FPN network principle consists of two parts: feature selection module and feature fusion module: S25: Feature selection module: The feature selection module uses the channel attention CA and dimension matching DM mechanism to screen feature maps of different scales, dividing them into low-level features and high-level features, and extracts important information in each channel through pooling operations and weight calculations; S26: Feature fusion module: The feature fusion module combines the filtered low-level features with high-level features through the Selective Feature Fusion (SFF) mechanism. After the high-level features are expanded, they are resized through bilinear interpolation and transposed convolution, and then fused with the low-level features, thereby enhancing the model's ability to express features. S27: Selective feature fusion is to fuse feature maps of different scales, and the process is as follows: Given an input high-level feature: X high ⊙R C*H*W C represents the number of channels of the feature map, H represents the height of the feature map, and W represents the width of the feature map; An input low-scale feature: W 1 Indicates the width of the low-scale feature map; The high-level features are first expanded using a transposed convolution T-Conv of size 2 and kernel size 3x3, resulting in a feature size of: X high ∈R C*2H*2W In order to unify the dimensions of high-level features and low-scale features, bilinear interpolation is used to up- or down-sample high-level features to obtain the following features: H 1 Represents the height of the low-scale feature map; The CA module is used to convert high-level features into corresponding attention weights to filter low-scale features, and the filtered low-scale features are fused with high-level features to enhance the feature representation of the model: Equations (1) and (2) illustrate the fusion process of feature selection: X att =BL(T-Conv(X high )) (1) X att =X low *CA(X att )+X att (2) 4. The infrared imaging gas leak detection method based on YOLOv8 according to claim 1, It is characterized in that The step S3 specifically includes the following steps: Use the SCH-YOLO model to train 200 rounds on the training set and obtain the trained weight file best.pt.
5. The infrared imaging gas leak detection method based on YOLOv8 according to claim 1, It is characterized in that The step S4 specifically includes the following steps: S41: Use Vibe algorithm to extract dynamic foreground and propose foreground pixels with motion attributes: S411: first establish background samples, and randomly select N pixels from the S*S neighborhood of each pixel in the first frame image as the background sample set of the pixel; S412: Perform foreground pixel detection based on the background samples, calculate the Euclidean distance between the pixel point of the next frame image and each pixel point in the sample set, if it is less than the radius R, it is an approximate sample point, and if the number of approximate sample points in the sample set is greater than the threshold P, then the pixel point is classified as a background pixel point, otherwise it is a foreground pixel point; Take P = 2, R is the adaptive threshold, and the formula is: R(x) is the radius threshold of the newly read pixel point; R′(x) is the radius threshold of the previous pixel point, S 2 (x) is the variance between the newly read pixel and the pixel in the sample set, θ is the measurement factor. When the variance is greater than the measurement factor, it means that the scene has changed significantly, and the R threshold is increased, otherwise the R threshold is reduced; S413: The background model will be updated accordingly as the scene changes. The background may change in the next video frame read, and the sample set needs to be continuously updated. Each background pixel has a probability of 1 / σ to update its own sample set, where σ is the update factor. S42: The SCH-YOLO model and the Vibe algorithm are executed in parallel, and the single-frame image is subjected to the SCH-YOLO model based on step S3, and the judgment of the single-frame image is output, including the prediction box and the confidence level; S43: At the same time, the Vibe algorithm obtains the foreground pixel distribution of the same single-frame image through step S41; S44: Making a judgment based on the prediction box, confidence, and foreground pixel distribution; If the confidence level of a single frame image is > 0.4, it is identified as gas; If the confidence of a single frame image is ≤0.4 and the proportion of foreground pixels in the prediction frame is >0.35, it is identified as gas; If the confidence of a single frame image is ≤0.4 and the proportion of foreground pixels in the prediction box is ≤0.35, it is considered a misidentification.
Citation Information
Patent Citations
Flame detection method for improving YOLOv7 and fusing two-way routing attention mechanism
CN116844109A
Image processing apparatus and method
EP3675031A1
Cited By
Image processing method, device and equipment based on gas imaging
CN119478330A
Image processing method, device and equipment based on gas imaging
CN119478330B
On-load tap-changer fault diagnosis method based on lightweight YOLO11
CN119556128A
Method for identifying coal flow blocking state of scraper conveyor on fully mechanized coal mining face of coal mine
CN119851093A
Electric power high-altitude operation safety belt wearing identification method based on YOLOv10n and product
CN120107744A
