A flame detection method based on improved RetinaNet network

By using the improved RetinaNet network and SandGlass module in flame detection, and combining the flame color characteristics to provide supervision signals, the problems of low accuracy and slow speed of existing flame detection technology are solved, and more efficient flame detection is achieved.

CN112686276BActive Publication Date: 2024-09-13CHONGQING UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110105436.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-26
Publication Date
2024-09-13
Estimated Expiration
2041-01-26

AI Technical Summary

Technical Problem

Existing flame detection technology has low accuracy and slow speed. Deep learning-based methods such as Faster R-CNN, YOLOv3, and SSD have low detection accuracy and poor robustness in flame detection, and are not specifically optimized for flames.

Method used

Using the improved RetinaNet network, the SandGlass module is used to replace the residual module, and the color characteristics of the flame are used to provide segmentation supervision signals to build a feature pyramid network, increase segmentation branches, reduce the amount of parameters and calculations, and improve detection speed and accuracy.

Benefits of technology

Without compromising the accuracy of the network, the flame detection speed and accuracy are improved, the robustness of the model is enhanced, and the flame detection is faster and more accurate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112686276B
    Figure CN112686276B
Patent Text Reader

Abstract

The present invention discloses a flame detection method based on an improved RetinaNet network, S1: collect N pictures with flame images as a training data set, and mark the flames in the training data set; S2: use the SandGlass module to replace the residual module, so as to obtain an improved RetinaNet network, denoted as SG-ResNet50; the SandGlass module includes a first depth separable convolution, a first convolution, a second convolution and a second depth separable convolution connected in sequence; S3: construct a feature pyramid network, and add a segmentation branch after each layer of features output by the feature pyramid network; S4: train the constructed improved RetinaNet network to obtain a trained flame detection model; S5: use the flame detection model obtained in step S4 to perform flame detection on the acquired video. The present invention uses the SandGlass module to replace the residual module of the existing RetinaNet network, thereby improving the speed of flame detection; and uses the color characteristics of the flame to provide a segmented supervision signal, thereby improving the accuracy of flame detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of flame detection, and in particular to a flame detection method based on an improved RetinaNet network. Background Art

[0002] Traditional flame detection technology usually uses manually extracted features, such as flame texture features, edge features, etc. However, these methods are often slow and have low accuracy.

[0003] With the development of deep learning, more and more people are beginning to use deep learning for flame detection. Compared with traditional methods, the target detection method based on deep learning can improve the speed and accuracy of flame detection, and the generalization performance of the detection model is good, which can be applied to flame detection in various scenarios.

[0004] Popular flame detection methods based on deep learning include the two-stage Faster R-CNN and the one-stage YOLOv3, SSD, etc. Although Faster R-CNN has high accuracy, its detection speed is very slow and cannot be applied to scenarios with high speed requirements. Although YOLOv3 and SSD are fast, their detection accuracy is low. On the other hand, whether using Faster R-CNN directly or using YOLOv3, SSD and other methods for flame detection, the process is the same as general target detection, and no specific optimization is made for flames, resulting in low accuracy and poor robustness for flame detection. Summary of the invention

[0005] In view of the problem of low flame detection accuracy in the prior art, the present invention proposes a flame detection method based on an improved RetinaNet network. By using a SandGlass module to replace the residual module of the existing RetinaNet network and using the color characteristics of the flame to provide a segmented supervision signal, the network parameters and calculation amount are reduced, thereby improving the flame detection speed and accuracy.

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

[0007] A flame detection method based on an improved RetinaNet network specifically includes the following steps:

[0008] S1: Collect N pictures with flames as training data sets, and label the flames in the training data sets;

[0009] S2: The residual module is replaced by a SandGlass module to obtain an improved RetinaNet network, denoted as SG-ResNet50; the SandGlass module includes a first depthwise separable convolution, a first convolution, a second convolution, and a second depthwise separable convolution connected in sequence;

[0010] S3: Build a feature pyramid network and add a segmentation branch after each layer of features output by the feature pyramid network;

[0011] S4: training the constructed improved RetinaNet network to obtain a trained flame detection model;

[0012] S5: Use the flame detection model obtained in step S4 to perform flame detection on the acquired video.

[0013] Preferably, in S1, the N pictures with flame images are from different scenes, thereby improving the versatility of flame detection.

[0014] Preferably, in S1, M pictures without flame images are also collected to reduce the false detection rate of training.

[0015] Preferably, in S2, the first convolution is used to reduce the number of feature channels by half, and the second convolution is used to double the number of feature channels.

[0016] Preferably, in S2, the activation function RELU6 is added after the first depth-separable convolution and the second convolution, while the activation function RELU6 is not added after the first convolution and the second depth-separable convolution.

[0017] Preferably, in S3, the segmentation branch includes a 3*3 convolution with an output channel number of 256, a 3*3 convolution with an output channel number of 1, and a Sigmod layer.

[0018] Preferably, the step of training the constructed improved RetinaNet network includes:

[0019] S4-1: Adjust the target scale of each image in the training dataset. The long side of the target scale is randomly selected from [700, 1080, 1200, 1333], and the short side is randomly selected from [416, 600, 640, 800, 1000]. Then perform data augmentation on the image.

[0020] S4-2: Convert the data-enhanced image from the RGB color model to the HLS color model, and obtain the mask of the flame area according to the specified rule. The rule calculation formula is as follows:

[0021]

[0022] In formula (1), F mask (x, y) represents the flame area mask of the entire image after data enhancement, (x, y) represents the coordinates of the pixel points in the image, and f h (x,y),f l (x,y),f s (x, y) represents the value of the pixel in the three channels of H (hue), L (brightness) and S (saturation) respectively;

[0023] S4-3: Then F mask (x,y) are downsampled by 8, 16, 32, 64 and 128 times respectively as segmentation supervision signals of features of different scales.

[0024] Preferably, in S5, the flame detection step includes:

[0025] S5-1: Input the acquired video into the flame detection model obtained in step S4, output the category score of the flame prediction box, the relative offset relative to the anchor, and the border confidence, and then combine the category score and the border confidence to obtain the output confidence of the flame prediction box. The calculation formula of the output confidence is as follows:

[0026] p r (out) = p r (class)*p r (seg) (2)

[0027] In formula (2), p r (out) is the output confidence of the flame prediction box; p r (class) is the category score; p r (seg) is the output of the segmentation branch, i.e., the confidence of the bounding box, which represents the probability that an object exists in the box near the point;

[0028] S5-2: Sort the prediction boxes based on their output confidence, and then perform NMS analysis. The prediction boxes with an output confidence greater than 0.5 are flame prediction boxes.

[0029] In summary, due to the adoption of the above technical solution, compared with the prior art, the present invention has at least the following beneficial effects:

[0030] The present invention uses the SandGlass module to replace the residual module of the existing RetinaNet network, which reduces the number of parameters and calculations without compromising the network accuracy, thereby improving the flame detection speed. At the same time, the present invention uses the color characteristics of the flame as an additional supervisory signal to participate in the update of the network model parameters, so that the network model converges faster during the training process, and the final model is more robust, thereby improving the flame detection accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 Schematic diagram of a flame detection method based on an improved RetinaNet network according to an exemplary embodiment of the present invention.

[0032] Figure 2 Schematic diagram of the SandGlass module structure according to an exemplary embodiment of the present invention. DETAILED DESCRIPTION

[0033] The present invention is further described in detail below in conjunction with the examples and specific implementation methods. However, this should not be understood as the scope of the above subject matter of the present invention being limited to the following examples, and all technologies realized based on the content of the present invention belong to the scope of the present invention.

[0034] In the description of the present invention, it is necessary to understand that the terms "longitudinal", "lateral", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc., indicating the orientation or position relationship, are based on the orientation or position relationship shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention.

[0035] like Figure 1 As shown, the present invention provides a flame detection method based on an improved RetinaNet network, which specifically includes the following steps:

[0036] S1: Collect N pictures with flames and M pictures without flames as a training data set, and label the flames in the training data set.

[0037] In this embodiment, N pictures with flames in various scenes (such as indoor and outdoor, night and day, fire, car accident, candle, etc.) are collected from major educational institutions, Baidu, Google, etc. to ensure the versatility of the RetinaNet network in various scenes; at the same time, M pictures without flames are collected as the training set and verification set of the RetinaNet network to reduce the false detection rate of the RetinaNet network. The flames in the N pictures with flames are labeled using a labeling tool (such as LabelImg, etc.), and the labeled label is flame-flame.

[0038] S2: Build an improved RetinaNet network SG-ResNet50.

[0039] In this embodiment, based on the existing ResNet50 network, the SandGlass module is used to replace the residual module, thereby obtaining an improved RetinaNet network, which is denoted as SG-ResNet50.

[0040] like Figure 2 As shown in the figure, the SandGlass module includes the first depth-wise separable convolution (Dwise3*3), the first convolution with half the number of feature channels (reduction) (Conv 1*1), the second convolution with double the number of feature channels (expansion) (Conv 1*1) and the second depth-wise separable convolution (Dwise3*3) connected in sequence; at the same time, the input and output of the SandGlass module are connected by direct addition. Bottleneck represents the bottleneck layer, which means a module composed of two 1*1 convolutions.

[0041] In this embodiment, the activation function RELU6 is added only after the first depth-separable convolution and the second convolution, while the activation function RELU6 is not added after the first convolution and the second depth-separable convolution to avoid the phenomenon that too many eigenvalues ​​become zero. By changing the step size of the second depth-separable convolution, the size of the feature map after the SandGlass module can be adjusted.

[0042] Sufficient spatial coding information can be obtained through the first depth-separable convolution and the second depth-separable convolution, which reduces the amount of calculation and parameters compared with the 3*3 convolution in the existing residual module; the first convolution and the second convolution can effectively extract the information of the feature on the channel. At the same time, the combination of first reducing the dimension and then increasing the dimension is adopted, which also reduces the amount of calculation and parameters compared with the direct use of 1*1 ordinary convolution in the existing module. On the other hand, the SandGlass module uses a wider feature connection method than in the residual module, which can keep more information from the bottom layer to the top layer, which is conducive to the back propagation of gradients and the extraction of effective features. Therefore, using the SandGlass module to replace the residual module can greatly improve the model speed while maintaining a certain accuracy.

[0043] S3: Build a feature pyramid network and add a segmentation branch after each layer of features output by the feature pyramid network.

[0044] In this embodiment, based on the existing classification branch and regression branch in the detection head of the SG-ResNet50 network, a segmentation branch is added after each layer of features output by the feature pyramid network (such as the Featurized image pyramid network, the Single feature map network, and the Pyramidal feature hierarchy network, etc.). The segmentation branch includes a 3*3 convolution with an output channel number of 256, a 3*3 convolution with an output channel number of 1, and a Sigmoid layer, and the Sigmoid layer is used to normalize the output of the segmentation branch.

[0045] S4: Training the constructed improved RetinaNet network to obtain a trained flame detection model, specifically including the following steps:

[0046] S4-1: Adjust the target scale of each image in the training data set in step S1. The longer side of the target scale is randomly selected from [700, 1080, 1200, 1333], and the shorter side is randomly selected from [416, 600, 640, 800, 1000] for multi-scale training. Then, data enhancement methods such as rotation, cropping, and brightness transformation are used to enhance the image.

[0047] S4-2: Convert the data-enhanced image from the RGB color model to the HLS color model, and obtain the mask of the flame area according to the specified rule. The rule calculation formula is as follows:

[0048]

[0049] In formula (1), F mask (x, y) represents the flame area mask of the entire image after data enhancement, (x, y) represents the coordinates of the pixel points in the image, and f h (x,y),f l (x,y),f s (x, y) represents the value of the pixel in the three channels of H (hue), L (brightness) and S (saturation).

[0050] Then F mask (x, y) are downsampled by 8, 16, 32, 64, and 128 times respectively (i.e. F mask The resolution of (x,y) is reduced by 8, 16, 32, 64 and 128 times respectively) as segmentation supervision signals of features of different scales.

[0051] In the present invention, the color characteristics of the flame itself are used to provide a supervisory signal to assist the training of the improved RetinaNet network, thereby accelerating the network convergence and improving the network accuracy. The flame detection model obtained after training has stronger robustness for the flame target.

[0052] The classification loss during the improved RetinaNet network training process uses Focal Loss (L cls ), to reduce the impact of simple samples on network training, and the regression loss uses Smooth L1 Loss (L reg ), and add the binary cross entropy loss L seg As the segmentation loss, it is calculated as follows:

[0053]

[0054] In formula (2), is the probability that the network predicts that the sample is a positive example, y is the sample label, if the sample is within the flame area mask of the corresponding scale, it is a positive example and the value is 1, otherwise it is a negative example and the value is 0.

[0055] Total loss L total =α*L cls +β*L reg +γ*L seg , where α, β and γ are the weight coefficients of classification loss, regression loss and segmentation loss in the total loss, respectively. Generally, α=β=γ=1.

[0056] In this embodiment, the improved RetinaNet network performs stochastic gradient descent on multiple GPUs, and the learning rate is changed using the warm up strategy, that is, the learning rate is slowly increased to 0.01 at the beginning of training. A total of 12 rounds of training are performed, and a 10-fold learning rate decay is set in the 8th and 11th rounds, and finally the flame detection model with the highest accuracy on the validation set is saved.

[0057] S5: Use the flame detection model obtained in step S4 to perform flame detection on the acquired video.

[0058] S5-1: In this embodiment, the acquired video is input into the flame detection model obtained in step S4, and the category score, relative offset relative to the anchor and border confidence of the flame prediction box are output. The category score and border confidence are combined to obtain the output confidence of the flame prediction box, so as to replace the method of directly using the category score as the output confidence of the prediction box in the existing RetinaNet network. The calculation formula of the output confidence (the output confidence indicates the probability that the prediction box is a flame. This step obtains the probability of all prediction boxes, that is, the prediction box decoding and redundant box screening have not been performed) is as follows:

[0059] p r (out) = p r (class)*p r (seg) (3)

[0060] In formula (3), p r (out) is the output confidence of the flame prediction box; p r (class) is the category score; p r (seg) is the output of the segmentation branch, that is, the bounding box confidence, which represents the probability that an object exists in the box near the point.

[0061] S5-2: Decode the relative offset of the flame prediction box to obtain the actual position of the prediction box in the image, sort these boxes based on the output confidence of the prediction box (preliminary screening of the prediction box is performed using an output confidence threshold of 0.01, and sorting is performed from large to small according to the output confidence), then perform NMS (Non-Maximum Suppression) analysis to filter out redundant boxes, and then control the output flame prediction box by outputting a confidence threshold of 0.5.

[0062] Those skilled in the art will appreciate that the above-mentioned embodiments are specific examples for implementing the present invention, and in actual applications, various changes may be made thereto in form and detail without departing from the spirit and scope of the present invention.

Claims

1. A flame detection method based on an improved RetinaNet network, characterized in that: The specific steps include: S1: Collect N pictures with flames as training data sets, and label the flames in the training data sets; S2: The residual module is replaced by a SandGlass module to obtain an improved RetinaNet network, denoted as SG-ResNet50; the SandGlass module includes a first depthwise separable convolution, a first convolution, a second convolution, and a second depthwise separable convolution connected in sequence; S3: Build a feature pyramid network and add a segmentation branch after each layer of features output by the feature pyramid network; The segmentation branch includes a 3*3 convolution with an output channel number of 256, a 3*3 convolution with an output channel number of 1, and a Sigmod layer; S4: training the constructed improved RetinaNet network to obtain a trained flame detection model; S4-1: Adjust the target scale of each image in the training dataset. The long side of the target scale is randomly selected from [700, 1080, 1200, 1333], and the short side is randomly selected from [416, 600, 640, 800, 1000]. Then perform data augmentation on the image. S4-2: Convert the data-enhanced image from the RGB color model to the HLS color model, and obtain the mask of the flame area according to the specified rule. The rule calculation formula is as follows: (1) In formula (1), represents the flame area mask of the entire image after data enhancement, (x, y) represents the coordinates of the pixel points in the image, Respectively represent the values ​​of the pixel in the three channels of hue H, brightness L and saturation S; S4-3: Downsampled by 8, 16, 32, 64 and 128 times respectively as segmentation supervision signals of different scale features; S5: Use the flame detection model obtained in step S4 to perform flame detection on the acquired video.

2. A flame detection method based on an improved RetinaNet network as claimed in claim 1, characterized in that: In S1, the N pictures with flame images come from different scenes, thereby improving the versatility of flame detection.

3. A flame detection method based on an improved RetinaNet network as claimed in claim 1, characterized in that: In S1, M pictures without flame images are also collected to reduce the false detection rate of training.

4. A flame detection method based on an improved RetinaNet network as claimed in claim 1, characterized in that: In S2, the first convolution is used to reduce the number of feature channels by half, and the second convolution is used to double the number of feature channels.

5. A flame detection method based on an improved RetinaNet network as claimed in claim 1, characterized in that: In S2, the activation function RELU6 is added after the first depth-wise separable convolution and the second convolution, while the activation function RELU6 is not added after the first convolution and the second depth-wise separable convolution.

6. A flame detection method based on an improved RetinaNet network as claimed in claim 1, characterized in that: In S5, the flame detection step includes: S5-1: Input the acquired video into the flame detection model obtained in step S4, output the category score of the flame prediction box, the relative offset relative to the anchor, and the border confidence, and then combine the category score and the border confidence to obtain the output confidence of the flame prediction box. The calculation formula of the output confidence is as follows: (2) In formula (2), is the output confidence of the flame prediction box; is the category score; The output of the segmentation branch, i.e., the bounding box confidence, represents the probability that an object exists in the flame prediction box; S5-2: Sort the prediction boxes based on their output confidence, and then perform NMS analysis. The prediction boxes with an output confidence greater than 0.5 are flame prediction boxes.