Long-distance video fire detection method based on dual-light fusion

Through the improved YOLOv5 and SVM algorithms combined with dual-light fusion technology, the problem of low accuracy of existing fire detection in complex backgrounds is solved, high-accuracy long-distance fire detection in complex environments is achieved, and fire prevention capabilities are enhanced.

CN118799800APending Publication Date: 2024-10-18XI'AN UNIVERSITY OF ARCHITECTURE AND TECHNOLOGY
View PDF 0 Cites 8 Cited by

Patent Information

Application Number
CN202410777753.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-17
Publication Date
2024-10-18

AI Technical Summary

Technical Problem

Existing fire detection technology does not have high fire detection accuracy in complex backgrounds, and there are problems of missed and false alarms. It is especially difficult to identify long-distance flames in outdoor scenes with open spaces.

Method used

A long-distance video fire detection method based on dual-light fusion is adopted, through the improved YOLOv5 algorithm and SVM framework, combined with visible and infrared thermal images, using Ghost module and BiFPN to enhance feature extraction, and combining circularity and filling rate to identify fire targets. Decision fusion to improve detection accuracy.

Benefits of technology

It improves the accuracy and real-time performance of fire detection, reduces the false alarm rate, can effectively identify long-distance fires in complex environments, and enhances fire prevention capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118799800A_ABST
    Figure CN118799800A_ABST
Patent Text Reader

Abstract

The invention discloses a long-distance video fire detection method based on dual-light fusion. The method comprises the following steps: S1, establishing a fire data set, and collecting visible light images and infrared thermal images of flames and smog; s2, labeling a data set; s3, establishing an improved YOLOv5 deep learning algorithm framework to carry out visible light image detection; s4, establishing an improved SVM framework to accurately segment the image, outputting a detection result in cooperation with the circularity and the filling rate of a segmented region, and performing infrared thermal image detection; s5, pre-training the improved YOLOv5 model through the visible light image data set, and training the improved SVM model through the infrared thermal image data set; and S6, establishing an algorithm framework of visible light and infrared detection result decision fusion, performing fusion of different weights on output results of infrared light and visible light, and finally giving whether a fire occurs or not and position information of the fire. According to the invention, initial fire and long-distance fire of the construction site are detected, and the fire prevention capability is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of fire detection, and in particular to a long-distance video fire detection method based on dual-light fusion. Background Art

[0002] There are safety hazards such as hot work, storage of combustible materials, and multiple cross-construction surfaces at construction sites, which are prone to fire accidents and seriously threaten the lives and property of construction workers. At present, one of the important measures to deal with such problems on construction sites is to improve the existing fire detection level so that fires can be accurately identified and alarmed at the early stage of occurrence.

[0003] The current fire detection technology mainly analyzes video images to determine whether a fire has occurred. Traditional video fire detection technology mainly distinguishes artificially set flame and smoke features from other interference features, but the ability to extract feature representation is limited, and the accuracy and false alarm rate do not meet the requirements. With the development of deep learning technology, it has shown excellent performance in computer vision tasks such as object detection and video tracking. Compared with artificial feature extractors, deep neural networks can extract more abstract and essential image features, and the accuracy and recall rates are significantly improved compared with the above methods. At present, most fire detection technologies only process visible light images or infrared images. However, the background of the construction site is complex, and the influence of light and occlusion will cause the flame and smoke features in the visible light image to be unclear, resulting in a decrease in detection accuracy. Secondly, the wavelength of infrared light is longer and the energy required is larger. The number of pixels contained in the same detector size will be reduced, resulting in a lower resolution than the same size visible light image, and the features contained in the image will also be fewer; finally, the scene space is open. Once a fire occurs farther away from the detector, it is difficult to identify and warn it with current technology.

[0004] In summary, the main shortcomings of existing fire detection methods are as follows: 1) Only a single detector is used for fire detection, resulting in low fire detection accuracy under complex backgrounds, and problems such as missed reports and false alarms; 2) For open outdoor scenes, the small target detection performance is not ideal, and long-distance flame recognition is difficult. Summary of the invention

[0005] In order to overcome the above problems existing in the prior art, the purpose of the present invention is to provide a long-distance video fire detection method based on dual-light fusion, which can detect early-stage fires and long-distance fires at construction sites and improve fire prevention capabilities.

[0006] In order to achieve the above object, the present invention adopts the following technical solution:

[0007] A long-distance video fire detection method based on dual-light fusion includes the following steps:

[0008] S1. Establish a fire dataset to collect visible light images and infrared thermal images of flames and smoke, including different weather conditions, light conditions, and distances;

[0009] S2, labeled dataset;

[0010] S3. Establish an improved YOLOv5 deep learning algorithm framework for visible light image detection;

[0011] S4. Establish an improved SVM framework to accurately segment the image, and output the detection results in combination with the circularity and filling rate of the segmented area to perform infrared thermal image detection;

[0012] S5, training model, pre-training the improved YOLOv5 model through the visible light image dataset, and training the improved SVM model through the infrared thermal image dataset;

[0013] S6. Establish a decision fusion strategy for the detection results of visible light and infrared thermal images. According to the different light levels during the day and night, fuse the output results of infrared thermal images and visible light images with different weights, and finally provide information on whether a fire has occurred and the location of the fire.

[0014] In step S2, the labeled data set is randomly divided into a training set, a validation set and a test set;

[0015] Positive samples with unclear pixel areas are not marked. The training set is used to fit the model, and the classification model is trained by setting the parameters of the classifier. When combined with the validation set later, multiple classifiers are fitted according to the modified parameter values. The validation set data is used to evaluate the accuracy of each model on the same data set, and then select the parameters corresponding to the model with the best effect. After the optimal model is obtained through the training set and validation set, the test set is used for model prediction to measure the performance and generalization ability of the optimal model.

[0016] In step S3, an improved YOLOv5 algorithm is used to perform target detection in the visible light image;

[0017] The network structure of the improved YOLOv5 algorithm mainly includes four parts: Input, Backbone, Neck and Prediction, which are responsible for input image preprocessing, feature extraction, feature fusion, and output detection information respectively, and the input of each module comes from the output of the previous module.

[0018] The Ghost module is used in Backbone and Neck, and the Ghost module is embedded in the C3 module to form the C3Ghost module. In addition, the C3Ghost module includes GhostBottleNeck;

[0019] GhostBottleNeck consists of two stacked Ghost modules. The first Ghost module acts as an expansion layer to increase the number of channels, and the second Ghost module reduces the number of channels to match the input of the first step, so that both can perform element addition.

[0020] Each Ghost module is divided into three steps: regular convolution, Ghost generation and feature map splicing. First, ordinary convolution, batch normalization and an activation function are used to compress the channels of the input image and generate some inherent feature maps. Then a series of simple linear operations are applied to the feature maps to obtain more feature maps and increase features. The simple linear operations consist of depth-wise separable convolution, batch normalization and an activation function. Then, the more feature maps obtained are combined with the feature maps generated in the first step through concat. The final feature map is the output of the module.

[0021] In the improved YOLOv5 algorithm, a 640×640×3 color image is used as the model input; the image is then input into the Backbone part for feature extraction. Backbone processes the input image through a series of convolutional layers and pooling layers, gradually reducing the size of the feature map while increasing the number of channels to retain and extract important features in the image. It is composed of a stack of Focus module, Ghost module, C3Ghost module, SPP and CA modules. The output feature maps of the 2nd, 4th and 6th layers of C3Ghost are passed to the Neck part for multi-scale fusion with other feature maps; in the Neck part, the fusion of shallow graphic features and deep semantic features is realized, and BiFPN is used to realize the bidirectional connection between adjacent levels of the feature pyramid, so that information can flow from bottom to top and from top to bottom in the network at the same time.

[0022] After the CoordAttention (CA) module is embedded into the four C3Ghosts in Backbone, the feature extraction capability of the network is enhanced by highlighting the key information of flame detection. The CA module is divided into two parts, coordinate information embedding and coordinate attention generation, which can be expressed as:

[0023]

[0024] where x c(i, j) represents the localization input of the network’s target of interest, and Output for different attention weights; use EfficientDet-BiFPN to achieve bidirectional fusion of top-down and bottom-up deep features.

[0025] The step S4 specifically includes:

[0026] S41, preprocessing the infrared thermal image;

[0027] S42, image segmentation, using the SVM algorithm to segment targets in the preprocessed infrared thermal image, and improving its prior knowledge of fire;

[0028] S43, fire target feature identification, by determining the circularity and filling rate of the segmented area, and then further analyzing the suspected area, to eliminate interfering targets and determine whether the fire has actually occurred.

[0029] The S41 is specifically as follows: first, the current pixel point and its neighborhood are used as a window, and the window size is generally an odd number. Then, the median grayscale values ​​of the pixels in the row, column and two diagonal directions where the center point (i, j) is located are taken in the window in turn. Then, the maximum value of these four medians is taken to replace the grayscale value of the original center point, and the final filtering result is obtained.

[0030] In S42, the L1-SVM of the SVM algorithm is defined as follows:

[0031]

[0032] swt T x i +b≥1-η i , x i ∈w +

[0033] W T x j +b≤-1+δ j , x j ∈w -

[0034] ||η||0≤Δ, δ≥0, η≥0

[0035]

[0036] Among them, w is the weight sample, ||w||1 is the weight sample introduced by L1 norm, and x i is the positive sample feature, x jis the negative sample feature, b is a constant, l1 is the number of positive samples, l2 is the number of negative samples, C1, C2 are the cost parameters of misclassification, η i is the slack variable for positive samples, δ j is the slack variable of negative samples, a is the fire detection rate, and ||η||0≤Δ is the constraint of introducing the L0 norm into the fire positive samples. This constraint is used to accurately control the misclassification of fire samples.

[0037] The circularity of the segmented area is determined as follows:

[0038]

[0039] Among them, L k represents the perimeter of the kth suspected area, A k represents the area of ​​the kth suspected region, n represents the number of suspected regions, and the circularity C k The closer it is to 1, the closer the shape of the object is to a circle. k ∈[1,∞). C t Represents the circularity threshold. When the circularity discrimination value D k1 When it is equal to 1, it is determined that the suspected target area meets the circularity feature;

[0040] The fill rate of the segmented area is determined as follows:

[0041]

[0042] Wherein, A1 represents the area of ​​the kth suspected area, and A2 represents the area of ​​the circumscribed rectangle.

[0043] The S43 is specifically as follows: the circularity measures the complexity of the edge of an object, and its minimum value is 1. The more complex the edge of the object, the higher the value of the circularity; the circularity can be used to exclude high-temperature objects with low edge complexity; the filling rate refers to the proportional relationship between the material actually filled in a space or container and the total capacity of the space or container. The more actual fillings in the same container or space, the closer the value is to 1, and vice versa, the closer it is to 0. Flames have the characteristics of sharp corners, and the flame filling rate is closer to 0 than high-temperature interference with general regular shapes, which is used to distinguish between fire and high-temperature interference.

[0044] In step S5, the improved YOLOv5 and SVM mentioned in steps S3 and S4 are trained respectively;

[0045] For the improved YOLOv5 algorithm, the 640×640 input image is divided into N×N grids (the YOLOv5 algorithm proposed in the present invention is 160×160, 80×80, 40×40, 20×20), and then three indicators are predicted for each grid: rectangular box, confidence, and classification probability;

[0046] The role of the loss function is to measure the distance between the predicted information of the neural network and the expected information (label). The closer the predicted information is to the expected information, the smaller the loss function value is. From the prediction information of each grid above, it can be seen that the training mainly includes three aspects of loss: rectangular box loss (lossrect), confidence loss (lossobj), and classification loss (lossclc). Therefore, the loss function of the YOLOv5 network is defined as:

[0047] Loss=a*lossobj+b*lossrect+c*lossclc

[0048] Usually the confidence loss takes the largest weight, followed by the rectangular box loss and classification loss.

[0049] The improved YOLOv5 proposed in the present invention uses CIOU loss to calculate the rectangular box loss and uses BCE loss to calculate the confidence and classification losses. The CIOU loss calculation formula is as follows:

[0050]

[0051]

[0052] loss CIOU =1-CIOU

[0053] Where (x p1 ,y p1 ) is the coordinate of the upper left corner of the prediction box, (x p2 ,y p2 ) is the coordinate of the lower right corner of the prediction box, (x l1 ,y l1 ) is the coordinate of the upper left corner of the label rectangle, (x l2 ,y l2 ) is the coordinate of the lower right corner of the label rectangle, ρ is the distance between the center points of box A and box B, c is the diagonal length of the minimum enclosing rectangle of box A and box B, v is the similarity of the aspect ratio between the boxes, and α is the influence factor.

[0054] The BCE loss calculation formula is as follows:

[0055] loss BCE (z,x,y)=-L(z,x,y)*log P(z,x,y)-(1-L(z,x,y))*log(1-P(z,x,y))

[0056] Assume that the confidence labels are matrix L and the prediction confidences are matrix P.

[0057] In order to quantitatively evaluate the performance of the visible light fire detection model, the present invention adopts the five most commonly used evaluation indicators.

[0058] The accuracy P is defined as:

[0059]

[0060] Among them, TP represents the number of positive samples predicted as positive, that is, the number of samples whose intersection-over-unit ratio between the predicted box and the true box is greater than or equal to the threshold; FP represents the number of negative samples predicted as positive, that is, the number of samples that are regarded as positive samples but whose intersection-over-unit ratio between the predicted box and the true box is less than or equal to the threshold.

[0061] The definition of recall R is as follows:

[0062]

[0063] Among them, FN represents the number of positive samples predicted as negative.

[0064] The F1 number, as the harmonic mean of recall and precision, can more comprehensively reflect the detection performance and is defined as follows:

[0065]

[0066] mAP (Mean Average Precision) represents the average AP of each target class. It is defined as follows:

[0067]

[0068] Where N is the number of samples in the test set, P is the precision, ΔR(k) is the change in recall from k-1 samples to k samples, and C is the number of categories that need to be identified in the multi-classification task.

[0069] For the evaluation index of infrared fire detection model, the following two are used:

[0070] Recall rate P TPR :

[0071]

[0072] False alarm rate P FPR :

[0073]

[0074] Among them, n TP Indicates the number of correctly detected target pixels, n FP Indicates the number of background pixels that are mistakenly identified as target pixels, n TN Indicates the number of correctly detected background pixels, n FP Indicates the number of target pixels that are mistakenly identified as background pixels, n TP +nFN Represents the total number of target pixels, n FP +n TN Represents the total number of background pixels.

[0075] In step S6, the process of making a decision on the fusion of visible light and infrared results includes:

[0076] S61, organizing visible light and infrared result information, including the recognized category, prediction box location information, and prediction confidence;

[0077] S62, calculating the IOU of all prediction boxes in the dual-band detection results in sequence;

[0078] S63, determining an IOU threshold for judging whether the two frames detect the same target. If the IOU threshold is greater than or equal to the threshold, it means that the targets detected in the visible light and infrared are the same target; if the IOU threshold is less than the threshold, it means that the targets detected in the visible light and infrared are not the same target;

[0079] S64. If they are the same target, weighted fusion is performed on the two frame positions, and the fusion result is used as the final result. If they are different targets, it means that the target is only detected in a single band, and the detection result of the band is the final result.

[0080] Specifically, according to the different light sources during the day and at night, different weights are used to fuse visible light and infrared. The detection results of visible light images during the day are generally more accurate, so the fusion weight of visible light can be appropriately increased; infrared images at night are more sensitive and easier to detect in the early stages of a fire, so the fusion weight of infrared can be appropriately increased. The detection frame fusion formula is as follows:

[0081] B m =λ i B i +λ v B v

[0082] Among them, B i represents the accurate detection frame position of the fire target F in the infrared image, represents the accurate detection frame position of the target F in the visible light image, and λ i and λ v Respectively represent the weighting coefficients of infrared and visible light target detection frames, λ i ,λ v ∈[0,1] and λ i +λ v =1, B m It represents the accurate detection box position of the target F in the dual-band image after weighted fusion.

[0083] Beneficial effects of the present invention:

[0084] 1. Based on the original YOLOv5, the proposed method first replaces the ordinary convolution in Backbone and Neck with Ghost module and embeds it into the C3 module, which improves the computational efficiency of the network and ensures the real-time detection of the algorithm; secondly, replaces the PANet layer in the original network with BiFPN in Neck to achieve top-down and bottom-up bidirectional fusion of deep features and strengthen the feature information transmission between different network layers; finally, adds a small target detection layer to improve the detection performance of the algorithm for small targets;

[0085] 2. The proposed method introduces prior knowledge (different costs of misclassification) into the model design in the original SVM algorithm; to ensure a high detection rate, the L0 norm constraint is introduced into the fire (positive) class; at the same time, to reduce the false alarm rate, it is extended to the kernel-induced (nonlinear) L1-SVM, which greatly improves the classification accuracy of SVM and lays a solid foundation for subsequent fire identification;

[0086] 3. The method proposed in the present invention has made targeted improvements to both visible light and infrared algorithms, respectively improving the detection accuracy of both. At the same time, it adopts a visible light and infrared decision-making fusion method for fire detection, which greatly avoids missed fire detections due to the defects of visible light or infrared. In addition, considering the influence of different light, the detection effects of visible light and infrared are different, and the fusion weight of the two is adjusted, which generally improves the detection accuracy of the method proposed in the present invention.

[0087] 4. The method proposed in the present invention has high fire detection accuracy and low time cost, and can detect fire in a non-contact manner in complex environments. BRIEF DESCRIPTION OF THE DRAWINGS

[0088] Figure 1 The present invention is a schematic diagram of the process of the method.

[0089] Figure 2 This is the improved YOLOv5 network structure diagram.

[0090] Figure 3 Schematic diagram of the fire detection process in infrared images.

[0091] Figure 4 Schematic diagram of the visible light and infrared decision fusion process. DETAILED DESCRIPTION

[0092] The present invention will be further described in detail below in conjunction with the accompanying drawings.

[0093] This embodiment provides a long-distance video fire detection method based on dual-light fusion, such as Figure 1 As shown, the following steps are included:

[0094] S1. Establish a fire dataset to collect visible light images and infrared thermal images of flames and smoke, including different weather conditions, light conditions, and distances;

[0095] The algorithm proposed in the present invention detects fire by performing fire detection on infrared and visible light images respectively and then fusing the detection results;

[0096] Specifically, the characteristic of infrared being unaffected by light and visibility can be used to make up for missed fire detections of visible light images under low illumination and complex weather conditions. The characteristic of visible light being rich in detail information can make up for false fire detections caused by low resolution of infrared. Secondly, improvements to the visible light detection algorithm for small target detection can increase the detection rate of long-distance fires. At the same time, combined with the temperature data of infrared images, the overall detection rate of the algorithm proposed in the present invention for long- and short-distance fires can be improved.

[0097] S2, labeled dataset;

[0098] To prevent overfitting and better compare the performance of different algorithms, the labeled dataset is randomly divided into training set, validation set and test set according to the ratio of 70%, 20% and 10%, taking into account the correspondence between labels and data and ensuring the uniform distribution of the dataset.

[0099] Positive samples with unclear pixel areas are not marked to prevent overfitting in the neural network. The training set is used to fit the model, and the classification model is trained by setting the parameters of the classifier; when combined with the validation set, multiple classifiers are fitted according to the modified parameter values; the validation set data is used to evaluate the accuracy of each model on the same data set, and then select the parameters corresponding to the model with the best effect; after the optimal model is obtained through the training set and validation set, the test set is used for model prediction to measure the performance and generalization ability of the optimal model.

[0100] S3. Establish a deep learning algorithm framework for fire detection in visible light images, use YOLOv5 as the main algorithm framework, and improve its basic structure for small target detection;

[0101] The single-stage YOLOv5 algorithm is used as the main algorithm for target detection in visible light images, and it is improved for small targets. The core idea of ​​the algorithm is to regard target detection as a regression problem and directly predict the location and category of the target through a convolutional neural network. Compared with traditional target detection algorithms, YOLOv5 has higher detection speed and accuracy, and is particularly suitable for real-time target detection tasks.

[0102] like Figure 2As shown in the figure, the improved YOLOv5 algorithm network structure mainly includes four parts: Input, Backbone, Neck and Prediction;

[0103] The four parts are responsible for input image preprocessing, feature extraction, feature fusion, and output detection information respectively. The input of each module comes from the output of the previous module, and the size of the feature map of each module input and output remains the same as that of the unimproved YOLOv5.

[0104] Specifically, the improved YOLOv5 algorithm replaces the ordinary convolution with Ghostmodule in Backbone and Neck, and embeds it into the C3 module to form the C3Ghost module. This module replaces BottleNeck in the original C3 module with GhostBottleNeck;

[0105] GhostBottleNeck is mainly composed of two stacked Ghost modules. The first Ghostmodule acts as an extension layer to increase the number of channels, and the second Ghostmodule reduces the number of channels to match the input of the first step, so that both can perform element addition.

[0106] Each Ghost module is divided into three steps: regular convolution, Ghost generation and feature map concatenation. First, use ordinary convolution, batch normalization and an activation function to compress the input image channels and generate some inherent feature maps. Then apply a series of simple linear operations (unit mapping and linear transformation in parallel to maintain the inherent feature map) to the feature map to obtain more feature maps and increase features. The simple linear operation consists of depthwise separable convolution, batch normalization and an activation function. Then, the obtained more feature maps are combined with the feature map generated in the first step through concat. The final feature map is the output of the module. As a new basic unit of the neural network, the Ghost module can realize more feature maps with lower computational complexity and fewer parameters. It is particularly suitable for devices such as embedded devices that usually have limited memory and computing resources. Its core is to use the existing feature maps to generate more "ghost" feature maps through low-cost linear changes. Compared with relying on additional convolutional layers, this method greatly improves the computational efficiency of the network. Moreover, due to its modular design, it can also be seamlessly integrated into the existing CNN architecture as a general solution to improve network computational efficiency.

[0107] In the improved YOLOv5 algorithm, a 640×640×3 color image is used as the model input; the image is then input into the Backbone part for feature extraction. Specifically, the backbone processes the input image through a series of convolutional layers and pooling layers, gradually reducing the size of the feature map and increasing the number of channels, thereby retaining and extracting important features in the image. As for the visible light detection algorithm proposed in the present invention, this part is stacked with the Focus module, Ghost module, C3Ghost module, SPP and CA modules, wherein the output feature maps of the C3Ghost of the 2nd, 4th and 6th layers are passed to the Neck part and multi-scale fused with other feature maps; in the Neck part, the fusion of shallow graphic features and deep semantic features is mainly realized, and BiFPN is used to realize the bidirectional connection between adjacent levels of the feature pyramid, so that information can flow from bottom to top and from top to bottom in the network at the same time. Specifically, the feature map output by the 12th layer of the network is fused with the 6th layer, the 15th layer is fused with the 4th layer, and the 20th layer is fused with the 2nd layer. The feature maps of the 23rd layer are fused with the output feature maps of the 19th and 4th layers, the output feature maps of the 26th layer are fused with the output feature maps of the 15th and 6th layers, and the output feature maps of the 30th layer are fused with the output feature maps of the 11th layer; finally, the output feature maps of the C3Ghost modules of the 22nd, 25th, 28th and 31st layers in Neck are passed to the Prediction part. After a series of convolution operations, four feature maps are finally output, which are 20×20×256, 40×40×256, 80×80×256, and 160×160×256, respectively, responsible for detecting large, medium, small and smaller targets in the image. After the CoordAttention (CA) module is embedded in the four C3Ghosts in Backbone, the feature extraction capability of the network is enhanced by highlighting the key information of flame detection. The CA module is divided into two parts, coordinate information embedding and coordinate attention generation, which can be expressed as:

[0108]

[0109] Where xc(i, j) represents the localization input of the target of interest to the network, and Output for different attention weights.

[0110] Use EfficientDet-BiFPN to replace the PANet layer in the original YOLOv5 network to achieve bidirectional fusion of top-down and bottom-up deep features, strengthen the feature information transmission between different network layers, and improve the detection accuracy of the YOLOv5 algorithm;

[0111] Add a small target detection head and upsample the 80×80 feature map again to obtain a 160×160 feature map. This small target detection head may include a smaller receptive field and higher resolution to improve the detection precision and accuracy of small targets.

[0112] S4. Establish an algorithm framework for fire detection in infrared thermal images, use improved SVM to accurately segment the image, and output the detection results in combination with the circularity and filling rate of the segmented area.

[0113] like Figure 3 As shown, the infrared image fire detection of S4 of this embodiment includes the following steps:

[0114] S41, image preprocessing, there are many noise points in the infrared image, and the target to be measured is easily covered by strong noise. Therefore, in order to eliminate the influence of isolated noise points, the infrared image needs to be denoised. Since the maximum median filter not only inherits the characteristics of the median filter "noise removal and edge preservation", but also reduces the amount of calculation, the maximum median filter is used in this image preprocessing to suppress the noise of the infrared image;

[0115] Specifically, first use the current pixel and its neighborhood as a window, the window size is generally an odd number, then take the median grayscale of the row, column and two diagonal directions of the center point (i, j) in the window, and then take the maximum value of these four medians to replace the grayscale value of the original center point, and get the final filtering result.

[0116] S42. For the segmentation of high-temperature targets in infrared images, the present invention adopts the support vector machine (SVM) algorithm, which is excellent in processing small sample data, as the main algorithm for target segmentation in infrared thermal images, and adds fire prior knowledge to constrain the algorithm. Compared with other machine learning algorithms, the algorithm has high-dimensional data processing capabilities, strong generalization capabilities, strong robustness to noise, and can solve nonlinear problems;

[0117] Specifically, SVM is a classifier based on statistical theory. In image segmentation, SVM can be used for pixel-level classification, that is, assigning each pixel to a category. The basic idea is to map high-dimensional features to low-dimensional space and find a hyperplane that maximizes the distance between two types of samples, which can be formalized as a problem of solving convex quadratic programming. In the present invention, through training of images in the data set, an optimal hyperplane is found to distinguish high-temperature pixels from low-temperature pixels, where the connected domain composed of high-temperature pixels is retained as the foreground for later identification of fires, and the connected domain composed of low-temperature pixels is used as the background.

[0118] S43, fire target feature identification, by determining the circularity and filling rate of the segmented area, and then further analyzing the suspected area, to eliminate interfering targets and determine whether the fire has actually occurred.

[0119] In infrared images, although temperature is the most important feature of fire targets, it is not the only stable feature. Therefore, in order to obtain more accurate detection results, other features of fire need to be used. Circularity measures the complexity of the edge of an object, and its minimum value is 1. The more complex the edge of the object, the higher the value of circularity. Since the edge complexity of objects such as car lights, street lights, and the sun, which are similar to the color of flames, is not high, the circularity is approximately 1, while the edges of flames are more complex when they burn, and the circularity is generally much greater than 1. Therefore, high-temperature objects with low edge complexity can be excluded by circularity; filling rate refers to the proportional relationship between the actual amount of material filled in a certain space or container and the total capacity of the space or container. The more actual fillings in the same container or space, the closer its value is to 1, and vice versa, the closer it is to 0. Given that flames have characteristics such as sharp corners, their filling rate is closer to 0 than that of high-temperature interference with regular shapes, so it can be used to distinguish between fire and high-temperature interference.

[0120] Specifically, the improved SVM introduces prior knowledge (different costs of misclassification) into the model design; to ensure a high detection rate, the L0 norm constraint is introduced into the fire (positive) class; and to reduce the false alarm rate, it is extended to the kernel-induced (nonlinear) L1-SVM.

[0121] Specifically, a typical prior knowledge is that the loss caused by undetected fire (TN: true negative) is much greater than the loss caused by false alarm (FP), and it is unreasonable to mix the two types of losses together and measure them with the same scale misclassification rate. In building fire identification, moderate FP loss (false alarm) is tolerable because there must be some fire emergency plan; while TN loss caused by missed fire detection and misclassification is fatal or even catastrophic because it may lead to great loss of life and property. Therefore, it is necessary to introduce prior knowledge into the model design, and use different cost parameters for different misclassifications to reduce missed fire reports; the L0 norm is the number of non-zero elements in the vector, which is specifically explained in the present invention as the number of support vectors for calculating the optimal hyperplane in the sample space. Compared with using the probability value of positive sample misclassification as a constraint, the L0 norm can accurately control the number of misclassified positive samples and improve the fire detection rate of the present invention; the L1 norm is the sum of the absolute values ​​of each element in the vector, and its calculation amount is much smaller than the L2 norm (the 1 / 2 power of the sum of the squares of each element in the vector), which can reduce the time and complexity of model training. The kernel-induced SVM can increase the model's processing ability for nonlinear sample space, and the kernel function can map samples from the original space to a higher-dimensional space, so that the samples are linearly separable in the new space, thereby reducing the false alarm rate of the infrared fire detection algorithm proposed in the present invention.

[0122] The L1-SVM is defined as follows:

[0123]

[0124] swt T x i +b≥1-η i , x i ∈w +

[0125] w T x j +b≤-1+δ j , x j ∈w -

[0126] ||η||0≤Δ, δ≥0, η≥0

[0127]

[0128] Among them, w is the weight sample, ||w||1 is the weight sample introduced by L1 norm, and x i is the positive sample feature, x j is the negative sample feature, b is a constant, l1 is the number of positive samples, l2 is the number of negative samples, C1, C2 are the cost parameters of misclassification, η iis the slack variable for positive samples, δ j is the slack variable of negative samples, a is the fire detection rate, and ||η||0≤Δ is the constraint for introducing the L0 norm into the fire positive samples. This constraint is used to accurately control the misclassification of fire samples.

[0129] The circularity of the segmented area is determined as follows:

[0130]

[0131] Among them, L k represents the perimeter of the kth suspected area, A k represents the area of ​​the kth suspected region, n represents the number of suspected regions, and the circularity C k The closer it is to 1, the closer the shape of the object is to a circle. k ∈[1,∞). C t represents the circularity threshold, which is set to 2.56. k1 When it is equal to 1, it is determined that the suspected target area meets the circularity feature.

[0132] The fill rate of the segmented area is determined as follows:

[0133]

[0134] Wherein, A1 represents the area of ​​the kth suspected area, and A2 represents the area of ​​the circumscribed rectangle.

[0135] In step S4, the improved SVM introduces prior knowledge (different costs of misclassification) into the model design.

[0136] In step S4, the improved SVM introduces the L0 norm constraint into the fire (positive) class to ensure a high detection rate.

[0137] In step S4, the improved SVM is extended to the kernel-induced (non-linear) L1-SVM to reduce the false positive rate.

[0138] S5, training the model, pre-training the improved YOLOv5 model through the visible light fire image dataset, and training the improved SVM model through the infrared fire image dataset;

[0139] Specifically, for the improved YOLOv5 algorithm, the 640×640 input image is divided into N×N grids (the YOLOv5 algorithm proposed in the present invention is 160×160, 80×80, 40×40, 20×20), and then three indicators are predicted for each grid of the grid: rectangular box, confidence, and classification probability;

[0140] The role of the loss function is to measure the distance between the predicted information of the neural network and the expected information (label). The closer the predicted information is to the expected information, the smaller the loss function value is. From the prediction information of each grid above, it can be seen that the training mainly includes three aspects of loss: rectangular box loss (lossrect), confidence loss (lossobj), and classification loss (lossclc). Therefore, the loss function of the YOLOv5 network is defined as:

[0141] Loss=a*lossobj+b*lossrect+c*lossclc

[0142] Usually the confidence loss takes the largest weight, followed by the rectangular box loss and classification loss.

[0143] The improved YOLOv5 proposed in the present invention uses CIOU loss to calculate the rectangular box loss and uses BCE loss to calculate the confidence and classification loss. The CIOU loss calculation formula is as follows:

[0144]

[0145] loss CIOU =1-CIOU

[0146] Where (x p1 ,y p1 ) is the coordinate of the upper left corner of the prediction box, (x p2 ,y p2 ) is the coordinate of the lower right corner of the prediction box, (x l1 ,y l1 ) is the coordinate of the upper left corner of the label rectangle, (x l2 ,y l2 ) is the coordinate of the lower right corner of the label rectangle, ρ is the distance between the center points of box A and box B, c is the diagonal length of the minimum enclosing rectangle of box A and box B, v is the similarity of the aspect ratio between the boxes, and α is the influence factor.

[0147] The BCE loss calculation formula is as follows:

[0148] loss BCE (z,x,y)=-L(z,x,y)*log P(z,x,y)-(1-L(z,x,y))*log(1-P(z,x,y))

[0149] Assume that the confidence labels are matrix L and the prediction confidences are matrix P.

[0150] In order to quantitatively evaluate the performance of the visible light fire detection model, the present invention adopts the five most commonly used evaluation indicators.

[0151] The accuracy P is defined as:

[0152]

[0153] Among them, TP represents the number of positive samples predicted as positive, that is, the number of samples whose intersection-over-unit ratio between the predicted box and the true box is greater than or equal to the threshold; FP represents the number of negative samples predicted as positive, that is, the number of samples that are regarded as positive samples but whose intersection-over-unit ratio between the predicted box and the true box is less than or equal to the threshold.

[0154] The definition of recall R is as follows:

[0155]

[0156] Among them, FN represents the number of positive samples predicted as negative.

[0157] The F1 number, as the harmonic mean of recall and precision, can more comprehensively reflect the detection performance and is defined as follows:

[0158]

[0159] mAP (Mean Average Precision) represents the average AP of each target class. It is defined as follows:

[0160]

[0161] Where N is the number of samples in the test set, P is the precision, ΔR(k) is the change in recall from k-1 samples to k samples, and C is the number of categories that need to be identified in the multi-classification task.

[0162] For the evaluation index of infrared fire detection model, the following two are used:

[0163] Recall rate P TPR :

[0164]

[0165] False alarm rate P FPR :

[0166]

[0167] Among them, n TP Indicates the number of correctly detected target pixels, n FP Indicates the number of background pixels that are mistakenly identified as target pixels, n TN Indicates the number of correctly detected background pixels, n FP Indicates the number of target pixels that are mistakenly identified as background pixels, n TP +n FN Represents the total number of target pixels, n FP +nTN Represents the total number of background pixels.

[0168] S6. Establish an algorithm framework for the decision-making fusion of visible light and infrared detection results. According to the different light during the day and at night, perform weighted fusion of the output results of infrared and visible light with different weights, and finally provide information on whether a fire has occurred and the location of the fire. The location information obtained by the present invention is more accurate than the location information obtained by the single-band fire detection algorithm, especially for fire detection in all-weather, long-distance, and complex weather conditions. Accurate location information is a prerequisite for reducing the huge losses caused by fire.

[0169] Specifically, the light is strong during the day, and the target features are obvious in the visible light image, while the resolution of the infrared image itself is low and the target is blurry. Therefore, the fusion weight of the visible light algorithm detection result can be appropriately increased. At night, the light is dim and the infrared image is not affected by light. There are fewer target features in the visible light image under low illumination conditions. Therefore, the fusion weight of the infrared algorithm detection result can be appropriately increased.

[0170] like Figure 4 As shown, the decision fusion of visible light and infrared includes the following steps:

[0171] S61, organizing visible light and infrared result information, including the recognized category, prediction box location information, and prediction confidence;

[0172] S62, sequentially calculating the IOUs of all detection frames that detect fire targets in infrared and visible light;

[0173] S63, determining a threshold for judging whether the two frames are at the same position, if it is greater than or equal to the threshold, it means that the targets detected in the visible light and infrared are the same target, and if it is less than the threshold, it means that the targets detected in the visible light and infrared are not the same target;

[0174] S64. If they are the same target, weighted fusion is performed on the two frame positions, and the fusion result is used as the final result. If they are different targets, it means that the target is only detected in a single band, and the detection result of the band is the final result.

[0175] Specifically, according to the different light sources during the day and at night, different weights are used to fuse visible light and infrared. The detection results of visible light images during the day are generally more accurate, so the fusion weight of visible light can be appropriately increased; infrared images at night are more sensitive and easier to detect in the early stages of a fire, so the fusion weight of infrared can be appropriately increased. The detection frame fusion formula is as follows:

[0176] B m =λ i B i +λ v Bv

[0177] Among them, B i represents the accurate detection frame position of the fire target F in the infrared image, represents the accurate detection frame position of the target F in the visible light image, and λ i and λ v Respectively represent the weighting coefficients of infrared and visible light target detection frames, λ i ,λ v ∈[0,1] and λ i +λ v =1, B m It represents the accurate detection box position of the target F in the dual-band image after weighted fusion.

[0178] The above-described embodiments are only preferred embodiments for fully illustrating the present invention, and the protection scope of the present invention is not limited thereto. Equivalent substitutions or changes made by those skilled in the art based on the present invention are within the protection scope of the present invention. The protection scope of the present invention shall be subject to the claims.

Claims

1. A long-distance video fire detection method based on dual-light fusion, characterized in that: The steps include: S1. Establish a fire data set to collect visible light images and infrared thermal images of flames and smoke; S2, labeled dataset; S3. Establish an improved YOLOv5 deep learning algorithm framework for visible light image detection; S4. Establish an improved SVM framework to accurately segment the image, and output the detection results in combination with the circularity and filling rate of the segmented area to perform infrared thermal image detection; S5, training model, pre-training the improved YOLOv5 model through the visible light image dataset, and training the improved SVM model through the infrared thermal image dataset; S6. Establish a decision fusion strategy for the detection results of visible light and infrared thermal images. According to the different light levels during the day and night, fuse the output results of infrared thermal images and visible light images with different weights, and finally provide information on whether a fire has occurred and the location of the fire.

2. A long-distance video fire detection method based on dual-light fusion according to claim 1, characterized in that: In step S2, the labeled data set is randomly divided into a training set, a validation set and a test set; Positive samples with unclear pixel areas are not marked. The training set is used to fit the model, and the classification model is trained by setting the parameters of the classifier. When combined with the validation set later, multiple classifiers are fitted according to the modified parameter values. The validation set data is used to evaluate the accuracy of each model on the same data set, and then select the parameters corresponding to the model with the best effect. After the optimal model is obtained through the training set and validation set, the test set is used for model prediction to measure the performance and generalization ability of the optimal model.

3. The long-distance video fire detection method based on dual-light fusion according to claim 1 is characterized in that: In step S3, an improved YOLOv5 algorithm is used to perform target detection in the visible light image; The network structure of the improved YOLOv5 algorithm includes four parts: Input, Backbone, Neck and Prediction, which are responsible for input image preprocessing, feature extraction, feature fusion, and output detection information respectively, and the input of each module comes from the output of the previous module; Ghostmodule is used in Backbone and Neck, and Ghostmodule is embedded in C3 module to form C3Ghost module. In addition, C3Ghost module includes GhostBottleNeck. GhostBottleNeck consists of two stacked Ghost modules. The first Ghost module acts as an expansion layer to increase the number of channels, and the second Ghost module reduces the number of channels to match the input of the first step, so that the two perform element-wise addition. Each Ghost module is divided into three steps: regular convolution, Ghost generation and feature map concatenation. First, ordinary convolution, batch normalization and an activation function are used to compress the channels of the input image and generate some inherent feature maps. Then, linear operations are applied to the feature maps to obtain more feature maps and increase features. The linear operation consists of depth-wise separable convolution, batch normalization, and an activation function. Then, more feature maps are obtained and combined with the feature maps generated in the first step through concat. The final feature map is the output of the module.

4. A long-distance video fire detection method based on dual-light fusion according to claim 3, characterized in that: In the improved YOLOv5 algorithm, visible light images are used as model input; then the images are input into the Backbone part for feature extraction. Backbone processes the input images through convolutional layers and pooling layers, gradually reducing the size of the feature map while increasing the number of channels to retain and extract important features in the image. It is stacked with Focus module, Ghost module, C3Ghost module, SPP and CA modules. The output feature maps of C3Ghost at the 2nd, 4th and 6th layers are passed to the Neck part for multi-scale fusion with other feature maps; in the Neck part, the fusion of shallow graphic features and deep semantic features is realized, and BiFPN is used to realize the bidirectional connection between adjacent levels of the feature pyramid, so that information can flow from bottom to top and from top to bottom in the network at the same time; After the CoordAttention (CA) module is embedded into the four C3Ghosts in Backbone, the CA module is divided into two parts, coordinate information embedding and coordinate attention generation, which can be expressed as: where x c (i, j) represents the localization input of the network’s target of interest, and Output for different attention weights; use EfficientDet-BiFPN to achieve bidirectional fusion of top-down and bottom-up deep features.

5. The long-distance video fire detection method based on dual-light fusion according to claim 1 is characterized in that: The step S4 specifically includes: S41, preprocessing the infrared thermal image; S42, image segmentation, using the SVM algorithm to segment targets in the preprocessed infrared thermal image, and improving its prior knowledge of fire; S43, fire target feature identification, by determining the circularity and filling rate of the segmented area, and then further analyzing the suspected area, to eliminate interfering targets and determine whether the fire has actually occurred.

6. A long-distance video fire detection method based on dual-light fusion according to claim 5, characterized in that: The S41 is specifically as follows: first, the current pixel point and its neighborhood are used as a window, the window size is generally an odd number, and then the median grayscale values ​​of the row, column and two diagonal directions of the center point (i, j) are taken in the window, and then the maximum value of the four medians is taken to replace the grayscale value of the original center point, so as to obtain the final filtering result; In S42, the L1-SVM of the SVM algorithm is defined as follows: s.t.w T x i +b≥1-η i ,x i ∈w + w T x j +b≤-1+δ j ,x j ∈w - ‖η‖0≤Δ, δ≥0, η≥0 Δ=l1*(1-a) Among them, w is the weight sample, ‖w‖1 is the weight sample introduced by L1 norm, and x i is the positive sample feature, x j is the negative sample feature, b is a constant, l1 is the number of positive samples, l2 is the number of negative samples, C1, C2 are the cost parameters of misclassification, η i is the slack variable for positive samples, δ j is the slack variable of negative samples, a is the fire detection rate, ‖η‖0≤Δ is the constraint of introducing L0 norm into fire positive samples, which is used to accurately control the misclassification of fire samples; The circularity of the segmented area is determined as follows: Among them, L k represents the perimeter of the kth suspected area, A k represents the area of ​​the kth suspected region, n represents the number of suspected regions, and the circularity C k The closer it is to 1, the closer the shape of the object is to a circle. k ∈[1,∞). C t Represents the circularity threshold. When the circularity discrimination value D k1 When it is equal to 1, it is determined that the suspected target area meets the circularity feature; The fill rate of the segmented area is determined as follows: Among them, A1 represents the area of ​​the kth suspected area, and A2 represents the area of ​​the circumscribed rectangle; The S43 is specifically as follows: the circularity measures the complexity of the edge of an object, and its minimum value is 1; the circularity is used to exclude high-temperature objects with low edge complexity; the filling rate refers to the proportional relationship between the material actually filled in a space or container and the total capacity of the space or container. The more actual fillings in the same container or space, the closer its value is to 1, and vice versa, the closer it is to 0. Flames have the characteristics of sharp corners, and the flame filling rate is closer to 0 than high-temperature interference with general regular shapes, which is used to distinguish between fire and high-temperature interference.

7. A long-distance video fire detection method based on dual-light fusion according to claim 6, characterized in that: In step S5, the improved YOLOv5 and SVM mentioned in steps S3 and S4 are trained respectively; For the improved YOLOv5 algorithm, the visible light image is divided into an N×N grid, and then three indicators are predicted for each grid: rectangular box, confidence, and classification probability; The role of the loss function is to measure the distance between the predicted information of the neural network and the expected information (label). The closer the predicted information is to the expected information, the smaller the loss function value is. From the prediction information of each grid above, it can be seen that the training mainly includes three aspects of loss: rectangular box loss (lossrect), confidence loss (lossobj), and classification loss (lossclc). Therefore, the loss function of the YOLOv5 network is defined as: Loss=a*lossobj+b*lossrect+c*lossclc Usually the confidence loss takes the largest weight, followed by the rectangular box loss and classification loss; Use BCEloss to calculate confidence and classification loss. The CIOUloss calculation formula is as follows: loss CIOU =1-CIOU Where (x p1 ,y p1 ) is the coordinate of the upper left corner of the prediction box, (x p2 ,y p2 ) is the coordinate of the lower right corner of the prediction box, (x l1 ,y l1 ) is the coordinate of the upper left corner of the label rectangle, (x l2 ,y l2 ) is the coordinate of the lower right corner of the label rectangle, ρ is the distance between the center points of box A and box B, c is the diagonal length of the minimum enclosing rectangle of box A and box B, v is the similarity of the aspect ratio between the boxes, and α is the influence factor; The BCE loss calculation formula is as follows: loss BCE (z,x,y)=-L(z,x,y)*log P(z,x,y)-(1-L(z,x,y))*log(1-P(z,x,y)) Assume that the confidence label is matrix L and the prediction confidence is matrix P; Five evaluation indicators are used. The accuracy P is defined as: Among them, TP represents the number of positive samples predicted as positive, that is, the number of samples whose intersection-over-unit ratio between the predicted box and the true box is greater than or equal to the threshold; FP represents the number of negative samples predicted as positive, that is, the number of samples that are regarded as positive samples but whose intersection-over-unit ratio between the predicted box and the true box is less than or equal to the threshold; The definition of recall R is as follows: Among them, FN represents the number of positive samples predicted as negative; The F1 number is the harmonic mean of recall and precision and is defined as follows: mAP represents the average AP of each type of target, which is defined as follows: Where N is the number of samples in the test set, P is the precision, ΔR(k) is the change in recall from k-1 samples to k samples, and C is the number of categories that need to be identified in the multi-classification task; For the evaluation index of infrared fire detection model, the following two are used: Recall rate P TPR : False alarm rate P FPR : Among them, n TP Indicates the number of correctly detected target pixels, n FP Indicates the number of background pixels that are mistakenly identified as target pixels, n TN Indicates the number of correctly detected background pixels, n FP Indicates the number of target pixels that are mistakenly identified as background pixels, n TP +n FN Represents the total number of target pixels, n FP +n TN Represents the total number of background pixels.

8. The long-distance video fire detection method based on dual-light fusion according to claim 1 is characterized in that: In step S6, the process of making a decision on the fusion of visible light and infrared results includes: S61, organizing visible light and infrared result information, including the recognized category, prediction box location information, and prediction confidence; S62, calculating the IOU of all prediction boxes in the dual-band detection results in sequence; S63, determining an IOU threshold for judging whether the two frames detect the same target. If the IOU threshold is greater than or equal to the threshold, it means that the targets detected in the visible light and infrared are the same target; if the IOU threshold is less than the threshold, it means that the targets detected in the visible light and infrared are not the same target; S64. If they are the same target, weighted fusion is performed on the two frame positions, and the fusion result is used as the final result. If they are different targets, it means that the target is only detected in a single band, and the detection result of the band is the final result.

9. A long-distance video fire detection method based on dual-light fusion according to claim 8, characterized in that: According to the different light during the day and at night, visible light and infrared are fused with different weights. Infrared images are more sensitive at night, so the fusion weight of infrared is appropriately increased. The detection frame fusion formula is as follows: B m =λ i B i +λ v B v Among them, B i represents the accurate detection frame position of the fire target F in the infrared image, represents the accurate detection frame position of the target F in the visible light image, and λ i and λ v Respectively represent the weighting coefficients of infrared and visible light target detection frames, λ i ,λ v ∈[0,1] and λ i +λ v =1, B m It represents the accurate detection box position of the target F in the dual-band image after weighted fusion.

Citation Information

Cited By

  • Cable quality detection system and method based on infrared short wave and visible light image feature fusion

    CN119540146A

  • Automatic detection method for combustion performance of flooring material based on bimodal space-time network

    CN120009462A

  • Dust detection method and system based on multi-task learning model

    CN120070948A

  • Smoke and fire identification detection method and system combining infrared and visible light cameras

    CN120107869A

  • Fire prediction optimization method and system based on YOLO, and storage medium

    CN120409848A