Fire detection method based on PD-YOLO

By introducing PConvs, DYDPConv module and SimAM attention mechanism into the YOLOv8 algorithm, the loss function WIoU is improved, which solves the problem of poor detection effect of traditional fire detection methods under complex backgrounds and illumination changes, and achieves more efficient and accurate fire detection. detection.

CN117333753BActive Publication Date: 2024-09-24HUAIYIN INSTITUTE OF TECHNOLOGY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311230499.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-22
Publication Date
2024-09-24
Estimated Expiration
2043-09-22

AI Technical Summary

Technical Problem

Traditional fire detection methods have poor detection results when dealing with complex backgrounds, illumination changes, and occlusions, and are limited in extracting and processing flame features in images, making them unable to meet the high requirements of modern society for fire detection.

Method used

Based on the YOLOv8 algorithm, combined with the PConvs module and the DYDPConv module, the SimAM attention mechanism and the improved loss function WIoU are introduced to enhance the model's feature learning and multi-scale feature fusion for flame and smoke, reduce the number of model parameters, and improve detection accuracy and speed.

Benefits of technology

It improves the accuracy and speed of fire detection, reduces the model complexity and parameter amount, enhances the adaptability and generalization ability to different scenarios, reduces the dependence on manual intervention, and improves the efficiency and reliability of fire detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117333753B
    Figure CN117333753B
Patent Text Reader

Abstract

The present invention relates to the field of image processing technology, and discloses a fire detection method based on PD-YOLO, comprising the following steps: Step 1: Obtain a fire data set, and divide it into a training set and a test set after preprocessing; Step 2: Construct a YOLOv8 network model, design a PConvs module and a DYDPConv module, and replace part of the C2f modules with PConvs modules and DYDPConv modules on the basis of the YOLOv8 network model to obtain an improved YOLOv8 network model; Step 3: Use the training set to train the improved YOLOv8 network model, and use the trained improved YOLOv8 network model to perform fire data detection. Compared with the prior art, the present invention strengthens the model's feature learning of flames and smoke, improves the model's feature extraction capability, further promotes the multi-scale feature fusion of flames and smoke, and captures richer and more critical feature representations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a fire detection method based on PD-YOLO. Background Art

[0002] As a sudden public disaster, fire may cause huge casualties and property losses in a short period of time, posing a serious threat to social stability and personal safety. Traditional methods often rely on manually designed rules and feature extraction algorithms, which require a lot of manpower and expertise, and are not suitable for different scenarios and changing environments. Secondly, traditional methods perform poorly in dealing with complex backgrounds, lighting changes, and occlusions, and it is difficult to accurately distinguish between flames and non-flame areas. In addition, since traditional methods are limited in extracting and processing flame features in images, their detection effect and real-time performance are often poor, and cannot meet the high requirements of modern society for fire detection. Therefore, traditional image processing technology has gradually been replaced by emerging technologies such as deep learning in the field of fire detection to improve the efficiency and accuracy of fire detection.

[0003] The deep learning model can automatically extract fire features such as flames and smoke by learning a large amount of data. Compared with traditional methods, it can detect flames and smoke in fire scenes more accurately. It can adapt to different scenes and lighting conditions and has stronger generalization ability. In addition, deep learning technology can realize the automation and real-time processing of fire detection. It can perform flame detection in real time in video streams, reduce dependence on manual intervention, and improve the efficiency and reliability of fire detection.

[0004] Hu et al. (Hu Y, Lu X. Real-time video fire smoke detection by utilizing spatial-temporal ConvNet features [J]. Multimedia Tools and Applications, 2018, 77: 29283-29301) proposed a spatial-temporal convolutional neural network for video smoke detection, and designed an enhanced architecture that uses a multi-task learning strategy to simultaneously identify smoke and estimate optical flow, capturing the appearance features within the frame and the motion features between frames in real time. Although the detection accuracy of this algorithm has been greatly improved, the detection speed cannot meet the actual needs. Lin et al. (Lin G, Zhang Y, Xu G, et al. Smoke detection on video sequences using 3D convolutional neural networks [J]. Fire Technology, 2019, 55: 1827-1847) developed a joint detection framework based on Faster RCNN and 3D CNN, which showed excellent performance in smoke localization and recognition when tested on a dataset of smoke videos from multiple sources. In order to solve the complexity problem of fire detection algorithms in practical applications, Valikhujaev et al. (Valikhujaev Y, Abdusalomov A, Cho Y I. Automatic fire and smoke detection method for surveillance systems based on dilated CNNs [J]. Atmosphere, 2020, 11 (11): 1241) used a convolutional neural network based on dilated convolutions. After evaluation on their custom data set, the algorithm complexity of this neural network was effectively reduced. Khan et al. (Khan S, Muhammad K, Hussain T, et al. Deepsmoke: Deep learning model for smoke detection and segmentation in outdoor environments [J]. Expert Systems with Applications, 2021, 182: 115125) used an efficient CNN architecture called EfficientNet for smoke detection. This model can ensure detection accuracy while taking into account a faster detection speed in fire detection scenarios.Wang et al. (Wang Z, Wu L, Li T, et al. A smoke detection model based on improved YOLOv5[J]. Mathematics, 2022, 10(7): 1190) introduced the k-means++ clustering algorithm and attention structure based on the YOLOv5 model to improve the detection performance of the network. The detection accuracy and speed of the above improved algorithm are improved.

[0005] In summary, the use of deep learning technology for fire detection is crucial to ensuring public safety and reducing the impact of fire. In actual fire scenarios, in order to reduce property losses and casualties, fire detection algorithms have high requirements for detection accuracy, detection speed, complexity and generalization. To meet the above requirements, the present invention proposes a PD-YOLO fire detection method based on the advanced YOLOv8 algorithm. Summary of the invention

[0006] Purpose of the invention: In view of the problems existing in the prior art, the present invention provides a fire detection method based on PD-YOLO, proposes a PConvs module combined with the YOLOv8 backbone network, strengthens the model's feature learning for flames and smoke, improves the model's feature extraction capability, proposes a DYDPConv lightweight dynamic convolution module combined with FPN (feature pyramid structure), further promotes the multi-scale feature fusion of flames and smoke, and reduces the number of model parameters; introduces the SimAM attention mechanism to help the model focus on the image area most relevant to the current task, thereby capturing richer and more critical feature representations, and improves the loss function to WIoU, accelerates model convergence, and provides sufficient gradient information to guide model learning.

[0007] Technical solution: The present invention provides a fire detection method based on PD-YOLO, comprising the following steps:

[0008] Step 1: Obtain the fire dataset and divide it into training set and test set after preprocessing;

[0009] Step 2: Build a YOLOv8 network model, design PConvs modules and DYDPConv modules, replace some C2f modules with PConvs modules and DYDPConv modules on the basis of the YOLOv8 network model, and obtain an improved YOLOv8 network model;

[0010] Step 3: Use the training set to train the improved YOLOv8 network model, and use the trained improved YOLOv8 network model to detect fire data.

[0011] Furthermore, in step 2, the PConvs module adds BN, SiLU activation function and SimAM attention mechanism on the basis of the PConv module to form a PConvs module.

[0012] Furthermore, the DYDPConv module in step 2 is designed based on the ODConv module, including a DDConv module and a DPConv module. The number of convolution kernels of the DDConv module corresponds to the number of input channels. A single convolution kernel only performs full-dimensional dynamic convolution calculation on a single channel, and the number of output channels is the same as the number of input channels. After the dynamic convolution calculation of the DDConv module, the DPConv dynamic convolution calculation is performed. The size of the convolution kernel of the DPConv module is 1×1×m, where m is the number of channels of the previous layer. The full-dimensional dynamic convolution operation performs weighted combination of the map of the DDConv module in the depth direction to generate a new feature map.

[0013] Furthermore, the specific calculation process of the DDConv module is: the feature map is input into the ODConv convolution module, in the ODConv module, the Kernel size is set to 3×3; the Stride is set to 1; the Padding is set to 1; and the Groups is set to the number of input channels.

[0014] Furthermore, the specific calculation process of the DPConv module is: the feature map is input into the ODConv convolution module, and in the ODConv module, the Kernel size is set to 1×1; the Stride is set to 1; the Padding is set to 0; and the Groups is set to 0.

[0015] Furthermore, the introduced SimAM can imitate the human visual system to assign a weight to each neuron, so as to better extract fire information; the energy function of each neuron is:

[0016]

[0017] Among them, each channel has M = H × M is the number of neurons on the channel; t and x i are the target neuron and other neurons in a single channel of the input feature X; i is the index in the spatial dimension; w t and b t are the transformation weights and biases; u t and is the mean and variance of all neurons in this channel except t;

[0018] The minimum energy formula is:

[0019]

[0020] in, From formula (2), we can see that the lower the energy, the greater the difference between neuron t and surrounding neurons, the higher the importance, and the higher the corresponding weight assigned; according to the definition of the attention mechanism, the features are enhanced:

[0021]

[0022] Among them, E represents all The channels and spatial dimensions passed through; sigmoid is the activation function; X is the feature map.

[0023] Furthermore, the improved YOLOv8 network model also improves the loss function to WIoU, and the WIoU formula is:

[0024]

[0025] Among them, W g ,H g Indicates the width and height of the minimum bounding box; when This will effectively enlarge the normal quality anchor box when This will significantly reduce the R of high-quality anchorboxes. WIoU , and when the anchorbox coincides with the target box, focus on the distance between the center points.

[0026] Furthermore, the improved YOLOv8 network model also introduces a SimAM module after the SPPF module at the end of the backbone network.

[0027] Furthermore, the improved YOLOv8 network model replaces the C2f module in the backbone network with a PConvs module, and replaces the C2f module with a DYDPConv module in the neck network part.

[0028] Beneficial effects:

[0029] 1. The present invention adds Batch Normalization, SiLU activation function and SimAM to PConv to form a PConvs module. The module inherits the advantages of PConv and is more suitable for fire detection. The PConvs module is combined with the backbone network of YOLOv8 to strengthen the model's feature learning for flames and smoke and improve the model's feature extraction ability. In the PConvs module, the PConv module can further reduce FLOPs, improve the model's detection speed for flames and smoke, BN improves the model's convergence speed, reduces the model's sensitivity to weight initialization, prevents overfitting, and alleviates the problems of gradient explosion and gradient disappearance. The SiLU activation function has significant advantages when applied to the fire detection model. First, it is non-monotonic, which can help the neural network better adapt to different fire scenes and improve the generalization of the algorithm. Secondly, it is smooth, which makes it easier for the fire detection algorithm to perform gradient descent optimization during the training process. Third, the SiLU function has an adaptive characteristic and can self-adjust within different input ranges, which helps to improve gradient propagation. In different fire scenes, there are inevitably interference factors, such as scene brightness, obstacles, etc., which makes the model easily interfered during the detection process. Therefore, adding the SimAM attention mechanism to the designed PConvs module can better suppress the interference information in the input image, making it easier for the model to focus on the area of ​​interest where the fire occurs, thereby improving the detection accuracy of the model.

[0030] 2. Based on ODConv, the present invention designs a lightweight convolution calculation module DYDPConv, which is inspired by the deep separable convolution. It can ensure the accuracy of fire detection while having fewer parameters. ODConv expands the dynamic adjustment dimension of the convolution kernel's attention to four dimensions, namely: convolution kernel size, number of input channels, number of output channels and number of convolution kernels. The dynamic adjustment of attention in these four dimensions can capture rich contextual information for fire detection and improve model performance. Although ODConv can calculate the attention of the convolution kernel in four dimensions, the number of parameters has increased compared to DyConv and CondConv, which only calculate the attention of one convolution kernel dimension. In order to meet the requirements for lightweight models and high precision in fire detection, we borrowed the ideas of Depthwise Convolution and Pointwise Convolution to design DDConv and DPConv respectively.

[0031] 3. The present invention introduces the SimAM attention mechanism to help the model focus on the image area most relevant to the current task, so as to capture richer and more critical feature representations. When the human visual system identifies flames and smoke targets in a fire scene, the spatial and channel attention needs to work together to process the external information captured by the eyes. The SimAM introduced in the present invention can imitate the human visual system to assign a weight to each neuron, so as to better extract fire information.

[0032] 4. The present invention improves the loss function to WIoU, accelerates model convergence, and provides sufficient gradient information to guide model learning. The bounding box loss function in the YOLOv8 model is CIOU, which adds the loss of the detection box scale, length and width loss on the basis of DIoU, so that the predicted box can be more consistent with the ground-truth. However, the aspect ratio description of this function is relatively vague, and the balance problem of difficult and easy samples is not considered. Due to the complexity of fire scenes, it is very easy to generate low-quality samples when training data. Geometric factors such as distance and aspect ratio will increase the penalty for low-quality samples, and ultimately weaken the generalization of the model. WIoU can make full use of the non-monotonic dynamic focusing mechanism (FM) to solve the bounding box regression (BBR) balance problem between high-quality and low-quality samples. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 This is a structural diagram of the improved YOLOv8 network model of the present invention;

[0034] Figure 2 It is the PConvs module structure diagram of the present invention;

[0035] Figure 3 is the SiLU function image of the present invention;

[0036] Figure 4 This is a structural diagram of the DYDPConv module of the present invention;

[0037] Figure 5 This is a schematic diagram of the calculation of the DDConv module of the present invention;

[0038] Figure 6 This is a calculation diagram of the DPConv module of the present invention;

[0039] Figure 7 This is a comparison chart of CIoU and WIoU convergence;

[0040] Figure 8 This is a comparison chart of the fire detection effects of the present invention and YOLOv8. DETAILED DESCRIPTION

[0041] The present invention will be further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the protection scope of the present invention.

[0042] The present invention discloses a fire detection method based on PD-YOLO, proposes a PConvs module combined with the YOLOv8 backbone network, strengthens the model's feature learning of flames and smoke, improves the model's feature extraction capability, proposes a DYDPConv lightweight dynamic convolution module combined with FPN (feature pyramid structure), further promotes the multi-scale feature fusion of flames and smoke, and reduces the number of model parameters; introduces the SimAM attention mechanism to help the model focus on the image area most relevant to the current task, thereby capturing richer and more critical feature representations, and improves the loss function to WIoU, accelerates model convergence, and provides sufficient gradient information to guide model learning. Specifically, it includes the following steps:

[0043] Step 1: Obtain the fire dataset and divide it into training set and test set after preprocessing.

[0044] Step 2: Build a YOLOv8 network model, design PConvs modules and DYDPConv modules, and replace some C2f modules with PConvs modules and DYDPConv modules on the basis of the YOLOv8 network model to obtain an improved YOLOv8 network model.

[0045] Step 3: Use the training set to train the improved YOLOv8 network model, and use the trained improved YOLOv8 network model to detect fire data.

[0046] YOLOv8 is a SOTA model that builds on the success of previous YOLO versions and designs a new backbone network, a new Anchor-Free detection head, and a new loss function to further improve performance and flexibility. In fire detection tasks, the backbone network of YOLOv8 can effectively obtain feature information in fire images and improve the accuracy of flame and smoke detection. The Anchor-Free detection head can further reduce the amount of anchor calculations, increase the speed of fire detection, and improve detection performance.

[0047] Based on PConv, this paper designs a new feature extraction module PConvs that is suitable for the actual needs of fire detection. Based on PConv, BatchNormalization, SiLU activation function and SimAM attention mechanism are added to form the PConvs module. This module inherits the advantages of PConv and is more suitable for fire detection. The PConvs structure is as follows Figure 2 shown.

[0048] In the PConvs module, the PConv module can further reduce FLOPs and improve the model's detection speed for flames and smoke. BN (batch normalization) can improve the model's convergence speed, reduce the model's sensitivity to weight initialization, prevent overfitting, and alleviate the gradient explosion and gradient disappearance problems. The SiLU (Sigmoid Linear Unit) activation function geometric image is as follows Figure 3 It is also called Swish, and this function has significant advantages when applied to fire detection models. First, it is non-monotonic, which can help neural networks better adapt to different fire scenarios and improve the generalization of the algorithm. Second, it is smooth, which makes it easier for fire detection algorithms to perform gradient descent optimization during training. Third, the SiLU function has an adaptive feature that can self-adjust within different input ranges, which helps improve gradient propagation. In different fire scenes, there are inevitably interference factors, such as scene brightness, obstacles, etc., which makes the model easily disturbed during the detection process. Therefore, the SimAM attention mechanism is added to the PConvs module we designed, which can better suppress the interference information in the input image, making it easier for the model to focus on the area of ​​interest where the fire occurs, and improving the detection accuracy of the model.

[0049] In addition, a DYDPConv lightweight dynamic convolution module is proposed to combine with the FPN feature pyramid structure to further promote the multi-scale feature fusion of flame and smoke and reduce the number of model parameters. Based on ODConv, a DYDPConv lightweight convolution calculation module is designed. The structure is as follows Figure 4 As shown in Figure 2. This module is inspired by depthwise separable convolution, which can ensure fire detection accuracy while having fewer parameters.

[0050] In order to solve the problem of model performance degradation caused by lightweight computing, Microsoft researchers proposed DyConv (Yinpeng Chen, Xiyang Dai, Mengchen Liu, Dongdong Chen, Lu Yuan, and Zicheng Liu. Dynamic convolution: Attention over convolution kernels. In CVPR, 2020.), which can improve the expressiveness of the model without increasing the depth and width of the model. The basic idea of ​​dynamic convolution is to dynamically adjust the weight of each convolution kernel through attention for different input images to achieve the purpose of adaptively adjusting the convolution parameters. However, CondConv (Yang B, Bender G, Le QV, et al. Condconv: Conditionally parameterized convolutions for efficient inference [J]. Advances in neural information processing systems, 2019, 32.) and DyConv only use a single attention scalar, which leads to a lower performance gain compared to large models. ODConv expands the dynamic adjustment dimension of the convolution kernel's attention to four dimensions, namely: convolution kernel size, number of input channels, number of output channels, and number of convolution kernels. The dynamic adjustment of attention in these four dimensions can capture rich contextual information for fire detection and improve model performance.

[0051] Although ODConv can calculate the attention of four dimensions of the convolution kernel, the number of parameters has increased compared to DyConv and CondConv, which only calculate the attention of one convolution kernel dimension. In order to meet the requirements of lightweight model and high precision in fire detection, we design DDConv (Dynamic Depthwise Convolution) and DPConv (Dynamic Pointwise Convolution) respectively based on the ideas of Depthwise Convolution and Pointwise Convolution.

[0052] The number of convolution kernels in DDConv corresponds to the number of input channels. A single convolution kernel only performs full-dimensional dynamic convolution calculation on a single channel, and the number of output channels is the same as the number of input channels. After the DDConv dynamic convolution calculation, the DPConv dynamic convolution calculation is performed. The size of the DPConv convolution kernel is 1×1×M (M is the number of channels in the previous layer). The full-dimensional dynamic convolution operation here will perform a weighted combination of the DDConv map in the depth direction to generate a new feature map. The schematic diagram of DDConv and DPConv calculation is shown below. Figure 5 and Figure 6 As shown. The specific calculation process of the DDConv module is: the feature map is input into the ODConv convolution module. In the ODConv module, the Kernel size is set to 3×3; the Stride is set to 1; the Padding is set to 1; and the Groups is set to the number of input channels. The specific calculation process of the DPConv module is: the feature map is input into the ODConv convolution module. In the ODConv module, the Kernel size is set to 1×1; the Stride is set to 1; the Padding is set to 0; and the Groups is set to 0.

[0053] See also Figure 1 The attention module is inspired by the attention mode in the human visual system. This mode does not pay equal attention to all content, but pays more attention to important parts. There is a lot of interference information in the fire scene, which will greatly affect the model performance and thus the detection accuracy. In the process of extracting the features of flames and smoke, in order to effectively suppress the interference information and extract effective features, we introduce the SimAM attention module into the backbone network of the YOLOv8 network model, and introduce the SimAM module after the SPPF module at the end of the backbone network. The energy function of each neuron is shown in formula (1):

[0054]

[0055] Among them, each channel has M = H × M is the number of neurons on the channel; t and x i are the target neuron and other neurons in a single channel of the input feature X; i is the index in the spatial dimension; w t and b t are the transformation weights and biases; u t and are the mean and variance of all neurons in this channel except t.

[0056] The minimum energy formula is shown in formula (2):

[0057]

[0058] in, From formula (2), we can see that the lower the energy, the greater the difference between neuron t and surrounding neurons, the higher the importance, and the higher the weight assigned accordingly. According to the definition of the attention mechanism, the features need to be enhanced:

[0059]

[0060] Among them, E represents all The channels and spatial dimensions passed through; sigmoid is the activation function; X is the feature map.

[0061] Finally, the loss function of the YOLOv8 network model is improved to WIoU. In the YOLOv8 model, the bounding box loss function is CIOU. This function adds the loss of the detection box scale, length and width on the basis of DIoU, so that the predicted box can be more consistent with the ground-truth. However, the aspect ratio description of this function is relatively vague, and the balance problem of difficult and easy samples is not considered. Due to the complexity of the fire scene, it is very easy to generate low-quality samples when training data. Geometric factors such as distance and aspect ratio will increase the penalty for low-quality samples and ultimately weaken the generalization of the model. WIoU can make full use of the non-monotonic dynamic focusing mechanism (FM) to solve the bounding box regression (BBR) balance problem between high-quality and low-quality samples. The WIoU formula is shown in formula (4).

[0062]

[0063] Among them, W g ,H g Indicates the width and height of the minimum bounding box. In order to prevent R WIoU Produces gradients that hinder convergence, W g and H g Separate from the computation graph (superscript * indicates this operation). This will effectively enlarge the normal quality anchorbox when This will significantly reduce the R of high-quality anchorboxes. WIoU , and when the anchorbox coincides with the target box, focus on the distance between the center points.

[0064] With respect to the above fire detection method, the applicant conducted the following experiments:

[0065] 1) Experimental environment: The algorithm of the present invention is written based on the Pytorch framework, and the experiment is carried out in the environment of Table 1.

[0066] Table 1 Experimental environment

[0067]

[0068] 2) Fire Dataset

[0069] Since there is a lack of scene-rich fire datasets in public datasets, the present invention expands the existing fire datasets. Fire pictures in various scenes are crawled from the Internet by web crawlers, and the 4998 fire pictures in the original dataset are expanded to 19558. The flame and smoke targets in the expanded fire dataset are labeled by labelimg labeling software, and an XML file storing the target anchor information is generated. Finally, the constructed fire dataset is divided into a training set and a validation set in a ratio of 8:2.

[0070] 3) Evaluation indicators

[0071] The present invention sets IoU (intersection over union) to 0.5, that is, when the IoU of the predicted box and the ground-truth is greater than 0.5, it indicates a successful prediction. Use mAP, Precision (P), Recall (R), parameters, GFLOPs and FPS (frame per second) as model evaluation criteria. mAP is the average of the average precision of all categories in the data set. In the target detection task, mAP is usually used as a comprehensive indicator to evaluate the performance of the model. Precision is the number of correctly detected positive samples divided by the number of all detected positive samples (including correct and incorrectly detected positive samples). This indicator focuses on how many of all detected positive samples are true positive samples. Recall is the number of correctly detected positive samples divided by the number of all true positive samples. This indicator focuses on the number of all true positive samples that are correctly detected. Parameters and GFLOPs are directly related to the complexity, computational requirements and storage requirements of the model. In scenarios with limited computing resources, it may be necessary to balance the accuracy and computational efficiency of the model. FPS is an indicator to measure the model inference speed. It indicates the number of frames and images that the model can process per second. The FPS calculation formula in YOLOv8 is shown in formula (5).

[0072]

[0073] In formula (5), preprocess is the preprocessing time, inference is the inference time, and postprocess is the postprocessing time.

[0074] 4) Experimental results and analysis

[0075] 4.1) Model hyperparameter settings, the model hyperparameter settings are shown in Table 2:

[0076] Table 2 Hyperparameter settings

[0077]

[0078] 4.2) Analysis of experimental results of adding attention mechanism

[0079] In order to prove the effectiveness of introducing the SimAM attention mechanism for fire detection, the present invention verifies the improved model based on the self-built fire dataset, and introduces BiLevelRoutingAttention (Zhu L, Wang X, Ke Z, et al. BiFormer: Vision Transformer with Bi-Level RoutingAttention [C] / / Proceedings of the IEEE / CVF Conference on Computer Vision and Pattern Recognition. 2023: 10323-10333) and TripletAttention (Misra D, Nalamada T, Arasanipalai AU, et al. Rotate to attend: Convolutional triplet attention module [C] / / Proceedings of the IEEE / CVF winter conference on applications of computer vision. 2021: 3139-3148) for verification and comparison. The experimental comparison data are shown in Table 3, where P represents Precision and R represents Recall.

[0080] Table 3 Comparison experimental data of attention mechanism

[0081]

[0082] As can be seen from Table 3, after the introduction of SimAM in the YOLOv8 network model, mAP reached 82.4% and P reached 82.3%. After the BiLevelRoutingAttention was introduced into the model, mAP dropped by 0.3%. After the TripletAttention was introduced into the model, mAP increased by 0.3%. Comprehensive comparison shows that the introduction of SimAM has the greatest improvement on the accuracy of the model. We believe that the SimAM attention mechanism can better release the flexibility of the attention weights, allowing the model to infer the three-dimensional weights from the current neurons (i.e., considering both the spatial and channel dimensions at the same time), and focusing on learning more neural units containing fire information.

[0083] The number of model parameters and floating-point calculations are important factors affecting capital costs. If the number of parameters and floating-point calculations of the fire detection model is too large, it will bring more storage and computing burdens to the hardware equipment and increase deployment costs.

[0084] After introducing SimAM, BiLevelRoutingAttention and TripletAttention, the comparative experiments on the number of parameters and floating-point calculations are shown in Table 4.

[0085] Table 4 Comparative experimental data of attention mechanism for model parameters and floating point calculations

[0086]

[0087] In Table 4, after BiLevelRoutingAttention is introduced into the model, the number of parameters increases by 265728. After TripletAttention is introduced into the model, the number of parameters increases by 5400, and the floating-point calculation increases by 0.1GFLOPs. However, after SimAM is introduced into the model, the number of parameters and floating-point calculation do not increase, which proves that the introduction of SimAM will not add more storage and computing burden to the hardware device, thereby reducing the actual cost.

[0088] 4.3) Analysis of experimental results of introducing WIoU function

[0089] In order to prove that the introduction of WIoU loss function helps to promote model convergence and improve detection accuracy, the present invention verifies the improved loss function based on the self-built fire dataset, and introduces EIOU (Yang Z, Wang X, Li J. EIoU: animated vehicle detection algorithm based on vehiclenet neural network [C] / / Journal of Physics: Conference Series. IOP Publishing, 2021, 1924 (1): 012001), EIoU-scale, SIoU (Gevorgyan Z. SIoU loss: More powerful learning for bounding box regression [J]. arXiv preprint arXiv: 2205.12740, 2022), SIoU-focal, SIoU-scale, and WIoU for verification and comparison. The experimental comparison data are shown in Table 5.

[0090] Table 5 Loss function comparison experimental data table

[0091]

[0092] After introducing WIoU in Table 5, the mAp of the model reached 82.5% and P reached 83%. By comparing with the separately introduced EIoU, EIoU-scale, SIoU, SIoU-focal and SIOU-scale, WIoU has the greatest effect on improving the mAP of the model. Complex environment is one of the characteristics of most fire scenes. Under this condition, the detection effect of the fire detection model is disturbed, and it is easy to produce low-quality examples, which will greatly reduce the performance of the model. However, the WIoU function can replace IoU to evaluate the quality of the anchor through a dynamic non-monotonic focusing mechanism, and provide an effective gradient gain allocation policy. This allocation policy reduces the invalid gradients generated by low-quality examples while reducing the competitiveness of high-quality anchors.

[0093] The converged model can show excellent performance on both training and validation data. Figure 7 We can see that the WIoU function can promote model convergence faster than the CIoU function, which also proves the effectiveness of introducing the WIoU function into the model.

[0094] 4.4) Analysis of experimental results on feature extraction model improvement

[0095] To demonstrate that the PConvs and DYDPConv modules we designed can ensure detection accuracy while reducing the number of model parameters and floating-point calculations. Based on the self-built fire dataset, we introduced YOLOv3(Redmon J, Farhadi A. Yolov3: An incremental improvement[J]. arXiv preprint arXiv: 1804.02767, 2018), YOLOv5s, YOLOv6(Li C, Li L, Jiang H, et al. YOLOv6: A single-stage object detection framework for industrial applications[J]. arXiv preprint arXiv: 2209.02976, 2022), and YOLOv7-tiny(Wang CY, Bochkovskiy A, Liao HY M. YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors[C] / / Proceedings of the IEEE / CVF Conference on Computer Vision and PatternRecognition.2023:7464-7475) is compared with our designed PConvs, DYDPConv and PD-YOLO-(PConvs+DYDPConv+SimAM+WIoU). The experimental comparison data is shown in Table 6.

[0096] Table 6. Comparison of experimental data of feature extraction module

[0097]

[0098]

[0099] In Table 6, we can see that the mAP of our designed DYDPConv, PConvs and PD-YOLO are improved by 0.5%, 0.1% and 0.6% respectively compared with the YOLOv8 model. This proves that the three modules (DYDPConv, PConvs and PD-YOLO) we proposed can effectively improve the detection accuracy of flame and smoke. In order to reflect the effectiveness of the improved algorithm in detecting fire, we introduce YOLOv3, YOLOv5s, YOLOv6 and YOLOv7-tiny to compare with the improved algorithm. As shown in Table 6, the mAP of our improved algorithm is higher than that of the current mainstream single-stage target detection model.

[0100] Due to the limitation of cost issues in real scenarios, we need to reduce the number of model parameters and floating-point calculations while ensuring the accuracy of model detection. In Table 6, after we introduced DYDPConv into YOLOv8, the number of model parameters and floating-point calculations decreased by 62838 and 0.9 GFLOPs respectively; after we introduced PConvs into YOLOv8, the number of model parameters and floating-point calculations decreased by 347648 and 0.5 GFLOPs respectively; the improved model PD-YOLO, which combines all the improvements, has a model parameter number and floating-point calculation amount decreased by 382486 and 1.4 GFLOPs respectively. Depthwise separable convolution includes channel-by-channel convolution and point-by-point convolution. The number of parameters and floating-point calculations of these two convolution calculations are lower than those of ordinary 2D convolution, but they will also lead to a decrease in model performance. We propose that the DYDPConv module adds four spatial attention extractions for the convolution kernel on the basis of depthwise separable convolution, which can improve the detection accuracy of the model while reducing the number of model parameters and floating-point calculations. The PConvs module can reduce redundant calculations and hardware memory accesses at the same time, and extract spatial features more effectively.

[0101] In order to demonstrate the performance of the improved model for fire detection, we selected three fire pictures to test PD-YOLO and YOLOv8. Figure 8 In the figure, the left side shows the effect of YOLOv8 in detecting fire, and the right side shows the effect of PD-YOLO in detecting fire.

[0102] exist Figure 8 In the figure, we can see that the improvement effect of PD-YOLO is significantly better than that of the YOLOv8 model. In the fire scene, due to the uneven distribution of smoke concentration, smoke is difficult to detect in areas with low concentration. Figure 8 In the third row of images, our improved model can better detect areas with thin smoke.

[0103] The above embodiments are only for illustrating the technical concept and features of the present invention, and their purpose is to enable people familiar with the technology to understand the content of the present invention and implement it accordingly, and they cannot be used to limit the protection scope of the present invention. Any equivalent transformation or modification made according to the spirit of the present invention should be included in the protection scope of the present invention.

Claims

1. A fire detection method based on PD-YOLO, characterized in that: The steps include: Step 1: Obtain the fire dataset and divide it into training set and test set after preprocessing; Step 2: Build a YOLOv8 network model, design PConvs modules and DYDPConv modules, replace some C2f modules with PConvs modules and DYDPConv modules on the basis of the YOLOv8 network model, and obtain an improved YOLOv8 network model; The improved YOLOv8 network model replaces the C2f module in the backbone network with the PConvs module, and replaces the C2f module with the DYDPConv module in the neck network. In step 2, the PConvs module adds BN, SiLU activation function and SimAM attention mechanism to the PConv module to form the PConvs module; The DYDPConv module in step 2 is designed based on the ODConv module, including a DDConv module and a DPConv module. The number of convolution kernels of the DDConv module corresponds to the number of input channels. A single convolution kernel only performs full-dimensional dynamic convolution calculation on a single channel, and the number of output channels is the same as the number of input channels. After the dynamic convolution calculation of the DDConv module, the DPConv dynamic convolution calculation is performed. The size of the convolution kernel of the DPConv module is 1×1×m, where m is the number of channels of the previous layer. The full-dimensional dynamic convolution operation performs weighted combination of the map of the DDConv module in the depth direction to generate a new feature map. The specific calculation process of the DDConv module is as follows: the feature map is input into the ODConv convolution module. In the ODConv module, the Kernel size is set to 3×3; the Stride is set to 1; the Padding is set to 1; and the Groups is set to the number of input channels. The specific calculation process of the DDConv module is as follows: the feature map is input into the ODConv convolution module. In the ODConv module, the Kernel size is set to 3×3; the Stride is set to 1; the Padding is set to 1; and the Groups is set to the number of input channels. Step 3: Use the training set to train the improved YOLOv8 network model, and use the trained improved YOLOv8 network model to detect fire data.

2. The fire detection method based on PD-YOLO according to claim 1, characterized in that: The introduced SimAM imitates the human visual system to assign a weight to each neuron, so as to better extract fire information; the energy function of each neuron is: Among them, each channel has M = H × M is the number of neurons on the channel; t and x i are the target neuron and other neurons in a single channel of the input feature X; i is the index in the spatial dimension; w t and b t are the transformation weights and biases; u t and is the mean and variance of all neurons in this channel except t; The minimum energy formula is: in, From formula (2), we can see that the lower the energy, the greater the difference between neuron t and surrounding neurons, the higher the importance, and the higher the corresponding weight assigned; according to the definition of the attention mechanism, the features are enhanced: Among them, E represents all The channels and spatial dimensions passed through; sigmoid is the activation function; X is the feature map.

3. The fire detection method based on PD-YOLO according to claim 1, characterized in that: The improved YOLOv8 network model also improves the loss function to WIoU, and the WIoU formula is: Among them, W g ,H g Indicates the width and height of the minimum bounding box; when This will effectively enlarge the normal quality anchorbox when This will significantly reduce the R of the high-quality anchor box. WIoU , and when the anchorbox coincides with the target box, focus on the distance between the center points.

4. The fire detection method based on PD-YOLO according to claim 1, characterized in that: The improved YOLOv8 network model also introduces a SimAM module after the SPPF module at the end of the backbone network.