Residential fire detection method and system based on lightweight YOLOv5-SEE model

By using lightweight YOLOv5-SEE model for fire detection in residential environments, the problem of low detection accuracy of traditional methods is solved, and fast and accurate fire recognition and alarm is achieved. It is suitable for mobile deployment and improves the effect of fire detection. and security.

CN118918339APending Publication Date: 2024-11-08JIANGSU UNIV OF SCI & TECH
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411039108.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-31
Publication Date
2024-11-08

AI Technical Summary

Technical Problem

Traditional fire detection methods have low detection accuracy in residential environments and are susceptible to environmental impact, resulting in delayed or false alarms in fire detection, and cannot effectively protect personal and property safety.

Method used

Fire detection method based on lightweight YOLOv5-SEE model is adopted to conduct fire detection through image input training model, and the structure composed of backbone network, neck network layer and head detection terminal is used, combined with CBRM, Shuffle, CBS, and ECA and SPPF modules optimize loss function to improve detection accuracy and speed, suitable for mobile and embedded devices.

Benefits of technology

It realizes rapid and accurate detection of flames or smoke in a residential environment, improves the accuracy and speed of fire detection, reduces the calculation amount and parameter amount, is suitable for mobile deployment, and can monitor fires in real time, improving detection capabilities and effects. .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118918339A_ABST
    Figure CN118918339A_ABST
Patent Text Reader

Abstract

The invention discloses a light-weight YOLOv5-SEE model-based residential fire detection method and system. The method comprises the steps of obtaining an image to be subjected to residential fire detection; inputting an image to be subjected to residential fire detection into the trained lightweight YOLOv5-SEE model to obtain a fire detection result; wherein the lightweight YOLOv5-SEE model is composed of an input end, a backbone network, a neck network layer and a head detection terminal, the backbone network is used for realizing feature extraction, the neck network layer is used for realizing feature fusion, and the head detection terminal is used for outputting a fire detection result; the backbone network is composed of a CBRM module, a plurality of Shuffle modules, a CBS module, an ECA module and an SPPF module.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of fire detection, and specifically relates to a residential fire detection method and system based on a lightweight YOLOv5-SEE model. Background Art

[0002] At present, in the research of fire safety protection and detection, timely and effective monitoring and solutions have been explored for natural fires. However, with the rapid development of the economy, urbanization and industrialization, fires in residents are frequent, causing immeasurable losses. With the advancement of urbanization, the scale of construction is increasing, the decoration standards are generally improved, the population is dense, and various electrical equipment are frequently used, resulting in greater fire hazards in residential areas. At the same time, there are many passages such as stairwells and exhaust ducts in buildings, which will cause the flame to spread rapidly once it is generated, causing huge losses. However, most traditional fire detection methods use sensors, which are easily affected by the surrounding environment, resulting in low fire detection accuracy. Summary of the invention

[0003] Purpose of the invention: In order to solve the problem of low fire detection accuracy in traditional fire detection methods, the present invention proposes a residential fire detection method and system based on a lightweight YOLOv5-SEE model, which can quickly identify and issue a warning to remind users to escape when flames or smoke occur, thereby ensuring the personal safety and property safety of residents.

[0004] Technical solution: A residential fire detection method based on a lightweight YOLOv5-SEE model, comprising the following steps:

[0005] Acquiring images for residential fire detection;

[0006] The images to be detected for residential fires are input into the trained lightweight YOLOv5-SEE model to obtain the fire detection results.

[0007] The lightweight YOLOv5-SEE model consists of an input end, a backbone network, a neck network layer and a head detection terminal, wherein the backbone network is used to realize feature extraction, the neck network layer is used to realize feature fusion, and the head detection terminal is used to output fire detection results;

[0008] The backbone network is composed of a CBRM module, a first Shuffle module, a second Shuffle module, a third Shuffle module, a fourth Shuffle module, a fifth Shuffle module, a sixth Shuffle module, a first CBS module, an ECA module and an SPPF module in sequence;

[0009] The neck network layer is sequentially composed of a second CBS module, a first upsampling module, a first Concat layer, a first CSP module, a third CBS module, a second upsampling module, a second Concat layer, a second CSP module, a fourth CBS module, a third Concat layer, a third CSP module, a fifth CBS module, a fourth Concat layer, and a fourth CSP module; the output of the SPPF module in the backbone network is connected to the input of the second CBS module, the output of the second Shuffle module in the backbone network is simultaneously input to the second Concat layer, the output of the fourth Shuffle module in the backbone network is simultaneously input to the first Concat layer, the output of the second CBS module in the neck network layer is simultaneously input to the fourth Concat layer, and the output of the third CBS module in the neck network layer is simultaneously input to the third Concat layer;

[0010] The output of the second CSP module in the neck network layer is simultaneously input to the head detection terminal, the output of the third CSP module in the neck network layer is simultaneously input to the head detection terminal, and the output of the fourth CSP module in the neck network layer is simultaneously input to the head detection terminal;

[0011] The first CSP module, the second CSP module, the third CSP module and the fourth CSP module are all composed of a sixth CBS module, a seventh CBS module, an eighth CBS module, a ninth CBS module and a fifth Concat layer; the output of the sixth CSP module is connected to the input of the seventh CSP module, the output of the seventh CSP module is connected to the input of the fifth Concat layer, the input of the eighth CBS module is the same as the input of the sixth CSP module, and the output of the eighth CBS module is also connected to the input of the fifth Concat layer, and the output of the fifth Concat layer is connected to the input of the ninth CBS module;

[0012] Each of the Shuffle modules uses channel segmentation technology to divide the input channel into two branches, one branch performs identity mapping, and the other branch undergoes multi-layer convolution. The outputs of the two branches use channel cascade concatenation operations;

[0013] The SPPF module first performs pooling operations of different sizes on the input feature maps, then connects these feature maps of different sizes together, and performs dimensionality reduction through a fully connected layer, and finally generates a fused feature vector.

[0014] Furthermore, each CBS module includes Conv, Batch Normalization and SiLU activation functions in sequence.

[0015] Furthermore, within the SPPF module, the following steps are performed:

[0016] First, the tenth CBS module is used to perform preliminary feature extraction to obtain a feature map;

[0017] After the tenth CBS module, the feature map enters multiple parallel MaxPool operations. Each MaxPool operation uses a pooling kernel of different sizes to capture features of different scales.

[0018] The outputs of all parallel MaxPool operations will be concatenated to obtain the concatenated feature map;

[0019] The concatenated feature maps will then go through one or two CBS modules for further feature extraction and dimension adjustment, and finally output a feature map of the same size as the input.

[0020] Furthermore, when training the lightweight YOLOv5-SEE model, the loss function used is expressed as:

[0021]

[0022] Where IoU represents the intersection-over-union ratio between the prediction box and the target box, ρ 2 (b,b gt ) represents the Euclidean distance between the predicted box and the true box, b and b gt denote the predicted box and the real box respectively, c denotes the angle line distance of the minimum enclosing area that contains both the predicted box and the real box, w and h denote the width and height, w gt and h gt Indicates the predicted width and height, c w and c h are the width and height of the closure of the two rectangles respectively.

[0023] The present invention discloses a residential fire detection system based on a lightweight YOLOv5-SEE model, comprising:

[0024] An image acquisition unit, for acquiring images to be used for residential fire detection;

[0025] A fire detection unit, used to input the image to be detected for residential fire into the trained lightweight YOLOv5-SEE model to obtain the fire detection result;

[0026] The lightweight YOLOv5-SEE model consists of an input end, a backbone network, a neck network layer and a head detection terminal, wherein the backbone network is used to realize feature extraction, the neck network layer is used to realize feature fusion, and the head detection terminal is used to output fire detection results;

[0027] The backbone network is composed of a CBRM module, a first Shuffle module, a second Shuffle module, a third Shuffle module, a fourth Shuffle module, a fifth Shuffle module, a sixth Shuffle module, a first CBS module, an ECA module and an SPPF module in sequence;

[0028] The neck network layer is sequentially composed of a second CBS module, a first upsampling module, a first Concat layer, a first CSP module, a third CBS module, a second upsampling module, a second Concat layer, a second CSP module, a fourth CBS module, a third Concat layer, a third CSP module, a fifth CBS module, a fourth Concat layer, and a fourth CSP module; the output of the SPPF module in the backbone network is connected to the input of the second CBS module, the output of the second Shuffle module in the backbone network is simultaneously input to the second Concat layer, the output of the fourth Shuffle module in the backbone network is simultaneously input to the first Concat layer, the output of the second CBS module in the neck network layer is simultaneously input to the fourth Concat layer, and the output of the third CBS module in the neck network layer is simultaneously input to the third Concat layer;

[0029] The output of the second CSP module in the neck network layer is simultaneously input to the head detection terminal, the output of the third CSP module in the neck network layer is simultaneously input to the head detection terminal, and the output of the fourth CSP module in the neck network layer is simultaneously input to the head detection terminal;

[0030] The first CSP module, the second CSP module, the third CSP module and the fourth CSP module are all composed of a sixth CBS module, a seventh CBS module, an eighth CBS module, a ninth CBS module and a fifth Concat layer; the output of the sixth CSP module is connected to the input of the seventh CSP module, the output of the seventh CSP module is connected to the input of the fifth Concat layer, the input of the eighth CBS module is the same as the input of the sixth CSP module, and the output of the eighth CBS module is also connected to the input of the fifth Concat layer, and the output of the fifth Concat layer is connected to the input of the ninth CBS module;

[0031] Each of the Shuffle modules uses channel segmentation technology to divide the input channel into two branches, one branch performs identity mapping, and the other branch undergoes multi-layer convolution. The outputs of the two branches use channel cascade concatenation operations;

[0032] The SPPF module first performs pooling operations of different sizes on the input feature maps, then connects these feature maps of different sizes together, and performs dimensionality reduction through a fully connected layer, and finally generates a fused feature vector.

[0033] Furthermore, each CBS module includes Conv, Batch Normalization and SiLU activation functions in sequence.

[0034] Furthermore, within the SPPF module, the following steps are performed:

[0035] First, the tenth CBS module is used to perform preliminary feature extraction to obtain a feature map;

[0036] After the tenth CBS module, the feature map enters multiple parallel MaxPool operations. Each MaxPool operation uses a pooling kernel of different sizes to capture features of different scales.

[0037] The outputs of all parallel MaxPool operations will be concatenated to obtain the concatenated feature map;

[0038] The concatenated feature maps will then go through one or two CBS modules for further feature extraction and dimension adjustment, and finally output a feature map of the same size as the input.

[0039] Furthermore, when training the lightweight YOLOv5-SEE model, the loss function used is expressed as:

[0040]

[0041] Where IoU represents the intersection-over-union ratio between the prediction box and the target box, ρ 2 (b,b gt ) represents the Euclidean distance between the predicted box and the true box, b and b gt denote the predicted box and the real box respectively, c denotes the angle line distance of the minimum enclosing area that contains both the predicted box and the real box, w and h denote the width and height, w gt and h gt Indicates the predicted width and height, c w and c h are the width and height of the closure of the two rectangles respectively.

[0042] Beneficial effects: Compared with the prior art, the present invention has the following advantages:

[0043] (1) The present invention optimizes and improves the model by replacing the backbone network, adding the attention mechanism, and optimizing the loss function. Under the premise of ensuring the recognition performance, the fire detection model is effectively lightweight, making the model more suitable for deployment on mobile terminals and embedded devices;

[0044] (2) The average detection accuracy mAP@0.5 of the present invention on the self-constructed data set reached 95.9%. Compared with the performance of the existing YOLOv5 model, the detection speed FPS increased by 17.7 frames per second, the computational load GFLOPs decreased by 84.38%, and the parameters were reduced by 76.2%, meeting the lightweight requirements;

[0045] (3) Compared with traditional fire detection methods, the present invention has fewer model parameters while maintaining high detection accuracy, providing a theoretical basis for mobile fire detection deployment. In addition to image detection, the present invention can also parse videos, parse the collected video stream and extract image frames for subsequent processing and analysis, and deploy and install camera probes to collect images in real time to achieve real-time detection tasks. The target detection platform based on PyQt5 is used to implement the functions of uploading image detection, video detection, and camera detection. At the same time, the camera detection function is used to control the fire generated in the surrounding scene in real time. When the residential fire detection system detects a flame, the alarm mechanism is triggered. The alarm device should be able to send out voice signals in time and connect seamlessly with the system to ensure the timeliness and accuracy of the system;

[0046] (4) The method of the present invention can realize automatic fire monitoring, has the advantages of shorter response, wider monitoring range, more information acquisition, etc., and greatly improves the fire detection capability and effect;

[0047] (5) The method of the present invention has the advantages of rapid detection, reduced cost, and better coping with cluttered detection environments. It can also solve the problems of low accuracy and high missed reporting rate of traditional fire monitoring. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 Figure 2 is a partial data set diagram;

[0049] Figure 2 This is the structure diagram of the improved YOLOv5-SEE model;

[0050] Figure 3 It is the basic unit structure of ShuffleNetV2;

[0051] Figure 4 It is the ECA module structure;

[0052] Figure 5 This is the structure diagram of the residential fire detection system based on improved YOLOv5;

[0053] Figure 6 To design a flow chart;

[0054] Figure 7 Register the interface diagram for the user;

[0055] Figure 8 This is the login interface picture;

[0056] Fig. 9 Select a picture folder for the user;

[0057] Fig.10 Select a video folder map for the user;

[0058] Fig.11 It is the camera detection map;

[0059] Fig.12 is the loss value change curve;

[0060] Fig.13 This is a test image for the image detection function;

[0061] Fig.14 This is a test image for the video detection function;

[0062] Fig.15 This is a test image of the camera detection function. DETAILED DESCRIPTION

[0063] The technical solution of the present invention is now further described in conjunction with the accompanying drawings.

[0064] Embodiment 1:

[0065] This embodiment discloses a residential fire detection method based on the YOLOv5-SEE model, which mainly includes the following steps:

[0066] Step 1: Use the public data set on the aistudio website to create a residential building fire data set. However, the public data sets are mostly for detection of large fire situations and forest fire detection. Therefore, a part of the residential building fire data set created in this embodiment is selected from known public data sets, and the other part is a self-made small target data set, including shooting of lit candles or kitchen flames.

[0067] Preprocess the fire images in the residential building fire dataset: There is redundant information unrelated to the fire in the original images of different fires. The convolutional neural network is sensitive to the input feature range of the data. These redundant information unrelated to the task subject will have a negative impact on the convergence of the convolutional neural network. Therefore, it is necessary to complete image data enhancement and normalization operations before network training, such as geometric transformation and color transformation of the image. For images with uneven illumination, an adaptive correction algorithm based on a two-dimensional gamma function is used to enhance these images. Finally, a total of 1,857 images were collected, including 1,565 training sets, 234 test sets, and 58 validation sets.

[0068] The flames in the fire image are labeled in the labelimg software, with the label name as fire. The labeled information is saved as a txt label file and corresponds to the image file one by one. Each line in the label file corresponds to a target information in the image, which is the target category, the center coordinates of the detection box, and the length and width information, all of which are normalized values. Figure 1 shown.

[0069] Step 2: Build a lightweight YOLOv5-SEE (ShuffleNetv2-ECA-FocalEIoU) fire detection model based on the YOLOv5 network; the specific instructions are as follows.

[0070] YOLOv5 is a mainstream general target detection method and has been updated to version 7.0. The goal of YOLOv5 is to strike a balance between real-time and accuracy to improve the efficiency of target detection. YOLOv5 continues the lightweight design, allowing it to run efficiently on resource-constrained devices. YOLOv5 introduces automatic anchor box calculation to improve its adaptability to different data sets. Advanced data enhancement techniques, such as mosaic enhancement and adaptive image enhancement, improve the robustness and generalization ability of the model. The application of label smoothing technology further improves the generalization performance of the model. In order to optimize bounding box regression, these features have significantly improved YOLOv5 in speed, accuracy, and deployment flexibility, making it a more excellent target detection model.

[0071] This embodiment uses YOLOv5 as a pre-training model. The model size is only 14.5MB, which is the smallest in the 7.0 version model and can ensure a relatively high-speed network. The main structure of YOLOv5s consists of four parts: Input, Backbone, Neck, and Head. The Input is responsible for receiving the original image data, and using Mosaic data enhancement to enrich the data set and enhance the effect of batch normalization; the Backbone uses the Shufflenet v2 network model to extract features. Neck uses FPN+PAN, which realizes the fusion of high-level features and low-level features and strengthens the model's ability to extract features; Head is the target detection result output. In order to make high-quality prediction boxes play a greater role and reduce the negative impact of low-quality samples, Focal-EIoU is used to optimize the problems of CIoU.

[0072] The Backbone (backbone network) used in this embodiment is mainly composed of a CBRM module, several Shuffle modules, a CBS module, an ECA module and an SPPF module. Each module is further described below.

[0073] The CBAM (Convolutional Block Attention Module) module represents the attention mechanism module of the convolutional module, which is an attention mechanism module that combines spatial and channel. Given an intermediate feature map, the CBAM module sequentially infers the attention map along two independent dimensions (channel and spatial), and then multiplies the attention map with the input feature map for adaptive feature optimization.

[0074] Shuffle module: Shufflenet v2 is a lightweight convolutional neural network architecture, mainly used for efficient image processing on mobile devices and devices with limited computing power. It uses channel segmentation technology to divide the input channels into several groups, each of which performs convolution operations independently. In order to solve the information island problem caused by group convolution, Shufflenetv2 performs channel shuffling after each group convolution. This ensures that the features of different groups can interact and improve the network's expressiveness.

[0075] ShuffleNetv2 proposes four practical guidelines for efficient network design:

[0076] G1: Minimize memory access cost (MAC) under the same input and output channels;

[0077] G2: Excessive use of group convolution will increase MAC;

[0078] G3: Fragmented networks reduce parallelism;

[0079] G4: Element-level operations cannot be ignored;

[0080] ShuffleNetv1 violates four design principles everywhere:

[0081] The bottleneck layer is used, which makes the number of input and output channels different, violating the G1 principle;

[0082] Extensive use of 1×1 convolution violates the G2 principle;

[0083] Using too many groups violates the G3 principle;

[0084] There are a lot of element-level add operations in shortcut, which violates the G4 principle.

[0085] In order to eliminate the shortcomings of ShuffleNetv1, ShuffleNetv2 proposes a new operation: channel split, such as Figure 3 shown.

[0086] At the beginning of each unit, the channel is split into two branches. One branch performs identity mapping, which complies with the G3 principle, and the other branch passes through multiple layers of convolution to ensure that the number of input channels is the same as the number of output channels, which complies with the G1 principle.

[0087] Different from ShuffleNetv1, ShuffleNetv2's 1×1 does not use grouped convolution anymore, which complies with the G2 principle;

[0088] The two branches finally use the channel cascade concatenate operation without using TensorAdd, which complies with the G4 principle.

[0089] CBS module: This module contains a convolution layer (Conv), a batch normalization layer (BatchNormalization, BN), and a SiLU activation function. The CBS module is mainly used for feature extraction, adjusting the scale and number of channels of the feature map through convolution kernels of different sizes and strides.

[0090] ECA module: This module is mainly used to enhance the attention mechanism of the convolutional network, adaptively learn the channel attention weights through the outer product operation, and optimize the expressiveness of the features.

[0091] The SPPF module is an improvement on the SPP spatial pyramid pooling to achieve an output of adaptive size. At the same time, the improved model reduces the amount of calculation and improves the model speed. Specifically: The SPPF module first performs pooling operations of different sizes on the input feature maps, then connects these feature maps of different sizes together, and reduces the dimension through the fully connected layer, and finally generates a fused feature vector.

[0092] The structure of the SPPF module includes multi-scale spatial pyramid pooling, convolution operations and feature fusion, with the aim of improving model efficiency by reducing the amount of computation while retaining the ability to capture multi-scale features. It is designed to fuse information of different scales together through an efficient pooling method to achieve fast feature extraction and expression.

[0093] The SPPF module receives feature maps from the previous layer and outputs feature maps of the same size as the input. This allows it to be seamlessly integrated in the network without affecting the processing of subsequent layers. Inside the SPPF, the CBS module is first used for preliminary feature extraction. CBS contains a convolutional layer (Conv), a batch normalization layer (BN), and a SiLU activation function. These operations help enhance the expressiveness of features. After CBS, the feature map enters multiple parallel MaxPool operations. Each MaxPool operation uses a pooling kernel of different sizes to capture features at different scales. The outputs of all parallel MaxPool operations are concatenated to form a rich multi-scale feature representation. This step is the key to the SPPF module because it effectively integrates information at each scale. The concatenated feature map will then pass through one or two CBS modules for further feature extraction and dimensionality adjustment, and finally output a feature map of the same size as the input.

[0094] The FPN (Feature Pyramid Network) in the Neck (Neck Network Layer) proposed in this embodiment is used to transmit high-level semantic information through a top-down path, and the PAN (Path Aggregation Network) is used to transmit low-level detail information through a bottom-up path. Specifically, the top-down part achieves the fusion of features at different levels by upsampling and fusing with coarser-grained feature maps, which is mainly divided into the following steps:

[0095] 1. Upsample the last layer of feature maps to obtain a finer feature map;

[0096] 2. Fuse the upsampled feature map with the feature map of the previous layer to obtain richer feature expression;

[0097] 3. Repeat the above two steps until you reach the highest level.

[0098] The bottom-up part mainly uses a convolutional layer to fuse feature maps from different levels, which is mainly divided into the following steps:

[0099] 1. Convolve the bottom-level feature map to obtain richer feature expressions;

[0100] 2. Fuse the convolutional feature map with the feature map of the previous layer to obtain richer feature expression;

[0101] 3. Repeat the above two steps until you reach the highest level.

[0102] Finally, the feature maps of the top-down part and the bottom-up part are fused to obtain the final feature map for target detection.

[0103] SPPF module

[0104] Now combined Figure 2 The structure of YOLOv5-SEE is further explained.

[0105] The backbone network is composed of a CBRM module, a first Shuffle module, a second Shuffle module, a third Shuffle module, a fourth Shuffle module, a fifth Shuffle module, a sixth Shuffle module, a first CBS module, an ECA module and an SPPF module in sequence.

[0106] The neck network layer is sequentially composed of the second CBS module, the first upsampling module, the first Concat layer, the first CSP module, the third CBS module, the second upsampling module, the second Concat layer, the second CSP module, the fourth CBS module, the third Concat layer, the third CSP module, the fifth CBS module, the fourth Concat layer, and the fourth CSP module; the output of the SPPF module in the backbone network is connected to the input of the second CBS module, the output of the second Shuffle module in the backbone network is simultaneously input to the second Concat layer, the output of the fourth Shuffle module in the backbone network is simultaneously input to the first Concat layer, the output of the second CBS module in the neck network layer is simultaneously input to the fourth Concat layer, and the output of the third CBS module in the neck network layer is simultaneously input to the third Concat layer;

[0107] The output of the second CSP module in the neck network layer is simultaneously input to the head detection terminal, the output of the third CSP module in the neck network layer is simultaneously input to the head detection terminal, and the output of the fourth CSP module in the neck network layer is simultaneously input to the head detection terminal.

[0108] The first CSP module, the second CSP module, the third CSP module and the fourth CSP module are all composed of the sixth CBS module, the seventh CBS module, the eighth CBS module, the ninth CBS module and the fifth Concat layer; the output of the sixth CSP module is connected to the input of the seventh CSP module, the output of the seventh CSP module is connected to the input of the fifth Concat layer, the input of the eighth CBS module is the same as the input of the sixth CSP module, and the output of the eighth CBS module is also connected to the input of the fifth Concat layer, and the output of the fifth Concat layer is connected to the input of the ninth CBS module.

[0109] Each Shuffle module uses channel segmentation technology to divide the input channel into two branches. One branch performs identity mapping, and the other branch undergoes multi-layer convolution. The outputs of the two branches use channel cascade concatenation operations.

[0110] The SPPF module first performs pooling operations of different sizes on the input feature maps, then connects these feature maps of different sizes together, and performs dimensionality reduction through the fully connected layer, and finally generates a fused feature vector. Since the Backbone (backbone network) has a large number of parameters and requires large computer computing resources, it is not conducive to device deployment. Therefore, this embodiment introduces the lightweight network model Shufflenetv2 in the Backbone (backbone network). In order to focus limited attention on the key information of features such as flames and maximize the use of resources, the ECA (Efficient Channel Attention) module is introduced.

[0111] After aggregating convolutional features using GAP without dimensionality reduction, the ECA module first adaptively determines the kernel size k, then performs 1D convolution, and then performs a sigmoid function to learn channel attention, where k is adaptively determined by mapping the channel dimension C.

[0112] The essence of the attention mechanism is to focus limited attention on key information, thereby saving resources and quickly obtaining the most effective information. At the same time, it has the characteristics of few parameters, fast speed and good effect, which can effectively improve the performance of the model. It has been widely used in deep learning, especially in deep high-performance networks. A typical method is SENet (Squeeze-and-excitation networks), which can learn the channel attention of each convolutional block, thereby significantly improving the performance of various deep convolutional neural networks (CNNs). Some studies have attempted to improve SE blocks by capturing more complex channel dependencies or combining additional spatial attention, but usually resulting in more complex models and greater computational burdens. Therefore, in order to make up for the performance loss of the model caused by lightweight, this embodiment introduces an efficient channel attention module for deep CNN, namely the ECA (Efficient Channel Attention) module, which avoids dimensionality reduction, effectively captures cross-channel interaction information, enhances the attention to the flame, and enhances the ability to extract structured flame feature information. The ECA module structure is as follows Figure 4 shown.

[0113] The colors of the flames in the image are different in depth and the features are not obvious, which affects the accuracy of fire recognition. In order to make high-quality prediction boxes play a greater role and reduce the negative impact of low-quality samples, Focal-EIoU is used to optimize the CIoU problem.

[0114] The original CIoU loss function of YOLOv5 7.0 is expressed as:

[0115]

[0116] Where IoU represents the intersection-over-union ratio between the prediction box and the target box, ρ 2 (b,b gt ) represents the Euclidean distance between the predicted box and the true box, b and b gt denote the predicted box and the real box respectively, c denotes the angle line distance of the minimum enclosing area that contains both the predicted box and the real box, w and h denote the width and height, w gt and h gt Indicates the predicted width and height, c w and c h are the width and height of the closure of the two rectangles respectively.

[0117] From formula (2), we can see that when the aspect ratio of the predicted box and the real box is equal or geometrically multiple, v is equal to zero, and it cannot play a penalty role at this time, and CIoU cannot handle the problem of stable bounding box regression. From formula (4) and formula (5), we can see that when one increases, the other must decrease, and they cannot increase or decrease at the same time, which is not conducive to model optimization.

[0118] Therefore, the Focal-EIoU loss function is used to replace the original CIoU loss function to solve the problems that the width and height of the original network regression box cannot be scaled at the same time, the positive and negative samples are unbalanced, and the difficult and easy samples are unbalanced. EIoU cancels the calculation of the aspect ratio of the bounding box and replaces it with the regression of the length and width of the bounding box, solving the problem that ω and h cannot increase or decrease synchronously. The EIoU loss function directly minimizes the difference in width and height between the prediction box and the target box, making the convergence speed faster and the positioning effect better. The Focal-EIoU loss function is defined as:

[0119]

[0120] The backbone network of YOLOv5 uses the CSPDarknet53 network to extract features. Although CSPDarknet53 has excellent detection performance, its network structure has 104 layers and a large number of parameters. It will take up a lot of computing resources during operation and is difficult to deploy on edge devices with limited computing power. Using the Shufflenetv2 network to replace CSPDarkNet53 for feature extraction can effectively reduce the parameters and computational complexity of the model. Shufflenetv2 has two unit structures: basic unit (a) and downsampling unit (b). The basic unit structure of ShuffleNetv2 is as follows: Figure 3 The improved YOLOv5-SEE model structure is shown in Figure 2 shown.

[0121] In summary, the YOLOv5-SEE fire detection model of this embodiment uses the ShuffleNetv2 Block network to extract feature maps based on the YOLOv5 network framework. Figure 5 This is the structural diagram of the residential building fire detection system based on improved YOLOv5.

[0122] This embodiment selects recall rate (Recall), precision rate (Precision), average accuracy rate (AveragePrecision, AP), mean average precision (MeanAverage Precision, mAP) as model evaluation indicators. Among them, AP is a commonly used model evaluation indicator, which can be used to compare the performance of different target detection algorithms. AP is usually used to analyze the performance of network models in each category; mAP focuses on analyzing the performance of multi-target network models. The following formula involves the important parameters TP, FP, FN, and TN. In order to explain it clearly, this embodiment introduces the concept of positive and negative examples. The target object is a positive example. Relative to this type of target, all others are negative examples. TP represents the number of targets correctly classified, FP represents the number of negative examples predicted as targets, FN represents the number of targets classified as negative examples, and TN represents the number of negative examples predicted as negative examples.

[0123] The average precision (AP) is selected as the model evaluation indicator, which can be used to compare the performance of different target detection algorithms.

[0124] The formula for accuracy is shown in Formula 7.

[0125]

[0126] Formula (8) refers to the recall rate.

[0127]

[0128] Formula (9) is the average accuracy, where Precision represents the accuracy.

[0129]

[0130] Formula (10) is the mean average accuracy, where n(class) represents the number of targets.

[0131] Step 3: The collected video signal is collected as a digital image into the image acquisition card, input into the computer, and the data is transmitted to the remote monitoring center through the wireless transmission network. The YOLOv5-SEE fire detection model is used to determine whether a fire hazard is generated. The YOLOv5-SEE fire detection model can solve the damage problem of traditional fire detection technology in the fire detection process from the perspective of images.

[0132] This embodiment also uses PyQt5 to develop a cross-platform graphical user interface application and designs a detection platform based on the YOLOv5-SEE fire detection model. Users need to register an account when logging into the system for the first time, and can log into the system smoothly after successful registration. The detection platform can have the functions of image detection, video detection, and camera detection. When the detection platform recognizes the flame captured by the camera, it will automatically sound an alarm.

[0133] PyQt5 is a powerful and popular GUI library, which is mainly used to develop cross-platform graphical user interface applications. Its advantages are rich controls, good cross-platform experience, complete documentation, and many users (so there are many open source libraries). Therefore, PyQt5 is chosen to design the target detection platform.

[0134] When users log in to the system for the first time, they need to register an account, and then they can log in to the system according to the account and select the detection category. Figure 7 shown.

[0135] After successfully registering an account, the user can log in to the system normally and use the image detection, video detection, and camera detection functions of the residential building flame detection system. Figure 8 shown.

[0136] After the user successfully logs in, he can use the image detection function in the system. Before detecting the image, you need to select weights and initialize the model, then click the image detection button. After clicking the image detection button, a folder selection box will appear. After selecting the image to be detected, the system will automatically detect and display the detection results and detection information on the main page. Fig. 9 shown.

[0137] After the user successfully logs in, he can use the video detection function in the system. Before detecting the video, you need to select weights and initialize the model, then click the video detection button. After clicking the video detection button, a folder selection box will appear. After selecting the image to be detected, the system will automatically detect and display the detection results and detection information on the main page. Fig.10 shown.

[0138] After the user successfully logs in, he can use the camera detection function in the system. Before camera detection, you need to select weights and initialize the model, then click the camera detection button. After clicking the camera detection button, the camera will be opened directly for real-time detection. Fig.11 shown.

[0139] Click Image Detection, and a window for selecting an image will pop up. Select the image and upload it to the system. If the flame on the image is recognized, the test is successful, otherwise it fails. The test results are Fig.13 , it can be seen that the system can complete the image detection function.

[0140] Click on video detection, and a window for selecting a video will pop up. Select the video and upload it to the system. If the flame on the video is recognized, the test is successful, otherwise it fails. The test results are Fig.14 As can be seen from the figure, the system can complete the video detection function.

[0141] After the user successfully logs in, he can use the camera detection function in the system. Before the camera detection, you need to select weights and initialize the model. Then click the camera detection button, and the camera image can upload the video to the system. If the flame on the video is recognized, the test is successful, otherwise it fails. The test results are Fig.15 , so the system can complete the camera detection function.

Claims

1. A residential fire detection method based on a lightweight YOLOv5-SEE model, characterized by: The following steps are involved: Acquiring images for residential fire detection; Input the image to be detected for residential fire into the trained lightweight YOLOv5-SEE model to obtain the fire detection result; The lightweight YOLOv5-SEE model consists of an input end, a backbone network, a neck network layer and a head detection terminal, wherein the backbone network is used to realize feature extraction, the neck network layer is used to realize feature fusion, and the head detection terminal is used to output fire detection results; The backbone network is composed of a CBRM module, a first Shuffle module, a second Shuffle module, a third Shuffle module, a fourth Shuffle module, a fifth Shuffle module, a sixth Shuffle module, a first CBS module, an ECA module and an SPPF module in sequence; The neck network layer is sequentially composed of a second CBS module, a first upsampling module, a first Concat layer, a first CSP module, a third CBS module, a second upsampling module, a second Concat layer, a second CSP module, a fourth CBS module, a third Concat layer, a third CSP module, a fifth CBS module, a fourth Concat layer, and a fourth CSP module; the output of the SPPF module in the backbone network is connected to the input of the second CBS module, the output of the second Shuffle module in the backbone network is simultaneously input to the second Concat layer, the output of the fourth Shuffle module in the backbone network is simultaneously input to the first Concat layer, the output of the second CBS module in the neck network layer is simultaneously input to the fourth Concat layer, and the output of the third CBS module in the neck network layer is simultaneously input to the third Concat layer; The output of the second CSP module in the neck network layer is simultaneously input to the head detection terminal, the output of the third CSP module in the neck network layer is simultaneously input to the head detection terminal, and the output of the fourth CSP module in the neck network layer is simultaneously input to the head detection terminal; The first CSP module, the second CSP module, the third CSP module and the fourth CSP module are all composed of a sixth CBS module, a seventh CBS module, an eighth CBS module, a ninth CBS module and a fifth Concat layer; the output of the sixth CSP module is connected to the input of the seventh CSP module, the output of the seventh CSP module is connected to the input of the fifth Concat layer, the input of the eighth CBS module is the same as the input of the sixth CSP module, and the output of the eighth CBS module is also connected to the input of the fifth Concat layer, and the output of the fifth Concat layer is connected to the input of the ninth CBS module; Each of the Shuffle modules uses channel segmentation technology to divide the input channel into two branches, one branch performs identity mapping, and the other branch undergoes multi-layer convolution. The outputs of the two branches use channel cascade concatenation operations; The SPPF module first performs pooling operations of different sizes on the input feature maps, then connects these feature maps of different sizes together, and performs dimensionality reduction through a fully connected layer, and finally generates a fused feature vector.

2. A residential fire detection method based on a lightweight YOLOv5-SEE model according to claim 1, characterized in that: Each CBS module includes Conv, Batch Normalization and SiLU activation functions in sequence.

3. A residential fire detection method based on a lightweight YOLOv5-SEE model according to claim 1, characterized in that: Inside the SPPF module, the following steps are performed: First, the tenth CBS module is used to perform preliminary feature extraction to obtain a feature map; After the tenth CBS module, the feature map enters multiple parallel MaxPool operations. Each MaxPool operation uses a pooling kernel of different sizes to capture features of different scales. The outputs of all parallel MaxPool operations will be concatenated to obtain the concatenated feature map; The concatenated feature maps will then go through one or two CBS modules for further feature extraction and dimension adjustment, and finally output a feature map of the same size as the input.

4. A residential fire detection method based on a lightweight YOLOv5-SEE model according to claim 1, characterized in that: When training the lightweight YOLOv5-SEE model, the loss function used is expressed as: Where IoU represents the intersection-over-union ratio between the prediction box and the target box, ρ 2 (b,b gt ) represents the Euclidean distance between the predicted box and the true box, b and b gt denote the predicted box and the real box respectively, c denotes the angle line distance of the minimum enclosing area that contains both the predicted box and the real box, w and h denote the width and height, w gt and h gt Indicates the predicted width and height, c w and c h are the width and height of the closure of the two rectangles respectively.

5. A residential fire detection system based on a lightweight YOLOv5-SEE model, characterized by: include: An image acquisition unit, for acquiring images to be used for residential fire detection; A fire detection unit, used to input the image to be detected for residential fire into the trained lightweight YOLOv5-SEE model to obtain the fire detection result; The lightweight YOLOv5-SEE model consists of an input end, a backbone network, a neck network layer and a head detection terminal, wherein the backbone network is used to realize feature extraction, the neck network layer is used to realize feature fusion, and the head detection terminal is used to output fire detection results; The backbone network is composed of a CBRM module, a first Shuffle module, a second Shuffle module, a third Shuffle module, a fourth Shuffle module, a fifth Shuffle module, a sixth Shuffle module, a first CBS module, an ECA module and an SPPF module in sequence; The neck network layer is sequentially composed of a second CBS module, a first upsampling module, a first Concat layer, a first CSP module, a third CBS module, a second upsampling module, a second Concat layer, a second CSP module, a fourth CBS module, a third Concat layer, a third CSP module, a fifth CBS module, a fourth Concat layer, and a fourth CSP module; the output of the SPPF module in the backbone network is connected to the input of the second CBS module, the output of the second Shuffle module in the backbone network is simultaneously input to the second Concat layer, the output of the fourth Shuffle module in the backbone network is simultaneously input to the first Concat layer, the output of the second CBS module in the neck network layer is simultaneously input to the fourth Concat layer, and the output of the third CBS module in the neck network layer is simultaneously input to the third Concat layer; The output of the second CSP module in the neck network layer is simultaneously input to the head detection terminal, the output of the third CSP module in the neck network layer is simultaneously input to the head detection terminal, and the output of the fourth CSP module in the neck network layer is simultaneously input to the head detection terminal; The first CSP module, the second CSP module, the third CSP module and the fourth CSP module are all composed of a sixth CBS module, a seventh CBS module, an eighth CBS module, a ninth CBS module and a fifth Concat layer; the output of the sixth CSP module is connected to the input of the seventh CSP module, the output of the seventh CSP module is connected to the input of the fifth Concat layer, the input of the eighth CBS module is the same as the input of the sixth CSP module, and the output of the eighth CBS module is also connected to the input of the fifth Concat layer, and the output of the fifth Concat layer is connected to the input of the ninth CBS module; Each of the Shuffle modules uses channel segmentation technology to divide the input channel into two branches, one branch performs identity mapping, and the other branch undergoes multi-layer convolution. The outputs of the two branches use channel cascade concatenation operations; The SPPF module first performs pooling operations of different sizes on the input feature maps, then connects these feature maps of different sizes together, and performs dimensionality reduction through a fully connected layer, and finally generates a fused feature vector.

6. A residential fire detection system based on a lightweight YOLOv5-SEE model according to claim 5, characterized in that: Each CBS module includes Conv, Batch Normalization and SiLU activation functions in sequence.

7. A residential fire detection system based on a lightweight YOLOv5-SEE model according to claim 5, characterized in that: Inside the SPPF module, the following steps are performed: First, the tenth CBS module is used to perform preliminary feature extraction to obtain a feature map; After the tenth CBS module, the feature map enters multiple parallel MaxPool operations. Each MaxPool operation uses a pooling kernel of different sizes to capture features of different scales. The outputs of all parallel MaxPool operations will be concatenated to obtain the concatenated feature map; The concatenated feature maps will then go through one or two CBS modules for further feature extraction and dimension adjustment, and finally output a feature map of the same size as the input.

8. A residential fire detection system based on a lightweight YOLOv5-SEE model according to claim 5, characterized in that: When training the lightweight YOLOv5-SEE model, the loss function used is expressed as: Where IoU represents the intersection-over-union ratio between the prediction box and the target box, ρ 2 (b,b gt ) represents the Euclidean distance between the predicted box and the true box, b and b gt denote the predicted box and the real box respectively, c denotes the angle line distance of the minimum enclosing area that contains both the predicted box and the real box, w and h denote the width and height, w gt and h gt Indicates the predicted width and height, c w and c h are the width and height of the closure of the two rectangles respectively.

Citation Information

Cited By

  • Residential fire equivalent combustion method and system based on standard comburent

    CN121302842A