Fire early smoke detection method and system based on YOLOv5
By improving the YOLOv5 network structure, adopting lightweight MobileNetV3 and depthwise separable convolution, and combining it with the Focal Loss loss function, the accuracy and real-time performance issues of early smoke detection in complex scenarios were resolved, achieving efficient embedded device detection.
Patent Information
- Application Number
- CN202211181310.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-27
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2042-09-27
AI Technical Summary
Existing early smoke detection methods for fires suffer from low detection accuracy, poor real-time performance, and weak environmental adaptability in complex scenarios. In particular, traditional sensor detection is easily affected by environmental factors, resulting in the inability to issue timely alarms.
A YOLOv5-based method for early smoke detection in fires is adopted. The lightweight MobileNetV3 is used to replace the backbone feature extraction network, and dilated convolution and depthwise separable convolution are introduced to expand the receptive field. Combined with the Focal Loss loss function, the network structure is optimized to improve detection accuracy and real-time performance.
It achieves high-precision and fast early smoke detection of flames on embedded devices, meeting real-time requirements, improving detection accuracy, reducing computational load, and adapting to complex environments.
Smart Images

Figure CN115601696B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image target detection technology, specifically relating to a method and system for early smoke detection in fires based on YOLOv5. Background Technology
[0002] The statements in this section are merely background information related to the present invention and do not necessarily constitute prior art.
[0003] With the rapid pace of urbanization, my country faces increasingly complex firefighting and rescue situations, particularly in complex scenarios such as urban large-space fires, high-rise building fires, hazardous chemical fires, and tunnel (underground space) fires. These fires pose a serious threat to people's lives and property, making accurate and efficient detection of smoke in the early stages of a fire crucial for prevention. However, in real-world, complex scenarios, early smoke is difficult to observe due to its concealment and susceptibility to changes caused by the surrounding environment, making early smoke detection a significant challenge.
[0004] Traditional fire detection methods rely on sensors such as smoke, temperature, and light to detect environmental information and trigger alarms upon detecting anomalies. However, the detection accuracy of these sensors is inevitably affected by factors such as the area, height, humidity, airflow, and dust in the surrounding environment. Furthermore, alarms are only triggered after certain environmental conditions are met, which can easily lead to missing the optimal window for firefighting. Compared to traditional methods, deep learning-based early fire smoke detection methods offer higher accuracy, stronger real-time performance, lower cost, and greater environmental adaptability.
[0005] In recent years, with the rapid development of deep learning-based computer vision, object detection technology has seen significant advancements and innovations, thanks to the ability of convolutional neural networks to automatically learn and acquire image features. Currently, deep learning-based object detection algorithms are mainly divided into two categories: two-stage object detection algorithms based on candidate regions and single-stage object detection algorithms based on regression. Two-stage object detection algorithms, such as R-CNN, Fast R-CNN, and Faster R-CNN, are characterized by high detection accuracy but relatively slow detection speed. Single-stage object detection algorithms, such as YOLO and SSD, are characterized by fast detection speed, meeting real-time monitoring requirements, but their detection accuracy is lower compared to two-stage algorithms. Summary of the Invention
[0006] To address the aforementioned issues, this invention proposes a method and system for early fire smoke detection based on YOLOv5. This invention, through an early fire smoke detection model based on YOLOv5, can effectively improve the accuracy and real-time performance of smoke detection.
[0007] According to some embodiments, the first aspect of the present invention provides a method for early fire smoke detection based on YOLOv5, employing the following technical solution:
[0008] A method for early smoke detection in fires based on YOLOv5, comprising:
[0009] Acquire fire smoke images and perform preprocessing;
[0010] Based on the preprocessed fire smoke images, early fire smoke detection is performed using a trained early fire smoke detection model.
[0011] Specifically, the early-stage smoke detection model for fires is as follows:
[0012] Based on YOLOv5, the model includes a backbone feature extraction network, an enhanced feature extraction network, and a YOLO Head part. The backbone feature extraction network adopts the Mobilenetv3 network.
[0013] Dilated convolutions are introduced into the enhanced feature extraction network to replace the original convolutions in order to expand the capture of multi-scale contextual information. At the same time, depthwise separable convolutions are introduced into the enhanced feature extraction network to reduce the number of model parameters and computational cost.
[0014] Furthermore, the training process of the early fire smoke detection model is as follows:
[0015] Acquire fire smoke sample images and perform preprocessing;
[0016] The preprocessed fire smoke sample images were randomly divided into training and test sets at a ratio of 9:1.
[0017] Based on the training set, the early fire smoke detection model is trained to obtain a well-trained early fire smoke detection model.
[0018] Based on the test set, the trained early fire smoke detection model is used to detect early fire smoke and verify the effectiveness of the trained early fire smoke detection model.
[0019] Furthermore, the acquisition and preprocessing of fire smoke sample images includes:
[0020] Acquire images of fire smoke samples;
[0021] Mosaic data augmentation method was used to augment fire smoke sample images;
[0022] The preprocessed fire smoke sample image is obtained.
[0023] Furthermore, the loss function for training the early fire smoke detection model is:
[0024] FL (pt) =-α t (1-p t ) γ log(p t )
[0025] Among them, the hyperparameter α t The calculation formula is as follows:
[0026]
[0027] y is the true label, and y = 1 indicates a positive sample, meaning that α is positive when the sample is a positive sample. t =, when the sample is a negative sample, α t =1-α;
[0028] p t The calculation formula is
[0029] p represents the detection result; the larger the value, the greater the probability of a positive sample.
[0030] γ is a factor that adjusts the rate at which the weights of simple samples decrease.
[0031] Furthermore, the backbone feature extraction network utilizes the effective feature layers of the last three shapes in the Mobilenetv3 network to enhance feature extraction.
[0032] Furthermore, the enhanced feature extraction network comprises, in sequence, a depthwise separable convolutional layer, an upsampling layer, a Concat layer, a first fused dilated convolutional C3 layer, a depthwise separable convolutional layer, an upsampling layer, a Concat layer, a second fused dilated convolutional C3 layer, a convolutional layer, a Concat layer, a third fused dilated convolutional C3 layer, a convolutional layer, a Concat layer, and a C3 layer.
[0033] Furthermore, the C3 layer of the second fused dilated convolution, the C3 layer of the third fused dilated convolution, and the output of the C3 layer are fed into the YOLO Head network to obtain the final detection result.
[0034] According to some embodiments, a second aspect of the present invention provides a YOLOv5-based early fire smoke detection system, employing the following technical solution:
[0035] A YOLOv5-based early fire smoke detection system includes:
[0036] The image acquisition module is configured to acquire and preprocess fire smoke images;
[0037] The early fire smoke detection module is configured to perform early fire smoke detection based on preprocessed fire smoke images and using a trained early fire smoke detection model.
[0038] Specifically, the early-stage smoke detection model for fires is as follows:
[0039] Based on YOLOv5, the model includes a backbone feature extraction network, an enhanced feature extraction network, and a YOLO Head part. The backbone feature extraction network adopts the Mobilenetv3 network.
[0040] Dilated convolutions are introduced into the enhanced feature extraction network to replace the original convolutions in order to expand the capture of multi-scale contextual information. At the same time, depthwise separable convolutions are introduced into the enhanced feature extraction network to reduce the number of model parameters and computational cost.
[0041] According to some embodiments, a third aspect of the present invention provides a computer-readable storage medium.
[0042] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of a YOLOv5-based early smoke detection method for fires as described in the first aspect above.
[0043] According to some embodiments, a fourth aspect of the present invention provides a computer device.
[0044] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the steps of a YOLOv5-based early smoke detection method for fires as described in the first aspect above.
[0045] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0046] This invention proposes a novel neural network model structure. It replaces the original backbone feature extraction network with the lightweight MobileNetV3, and introduces dilated convolutions into the feature fusion network to expand the receptive field and capture multi-scale contextual information, thereby improving the network's detection accuracy. Simultaneously, it introduces depthwise separable convolutions to reduce the model's parameter count and computational cost, enabling smooth operation on embedded devices. Finally, it uses Focal Loss to eliminate the effects of class imbalance and improve the network's generalization ability. Experiments demonstrate that the improved network structure has fewer parameters, faster detection speed, and higher detection accuracy, meeting the real-time early-stage flame and smoke detection requirements of embedded devices. Attached Figure Description
[0047] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an improper limitation of the invention.
[0048] Figure 1 This is a flowchart of an early fire smoke detection method based on YOLOv5, as described in an embodiment of the present invention.
[0049] Figure 2 This is a flowchart of the depth-separable convolution process described in an embodiment of the present invention;
[0050] Figure 3 This is the final mAP value curve described in the embodiments of the present invention. Detailed Implementation
[0051] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0052] It should be noted that the following detailed description is illustrative and intended to provide further explanation of the invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0053] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of exemplary embodiments according to the invention. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.
[0054] Where there is no conflict, the embodiments and features in the embodiments of the present invention can be combined with each other.
[0055] Example 1
[0056] like Figure 1 As shown, this embodiment provides a method for early fire smoke detection based on YOLOv5, which includes the following steps:
[0057] Acquire fire smoke images and perform preprocessing;
[0058] Based on the preprocessed fire smoke images, early fire smoke detection is performed using a trained early fire smoke detection model.
[0059] Specifically, the early-stage smoke detection model for fires is as follows:
[0060] Based on YOLOv5, the model includes a backbone feature extraction network, an enhanced feature extraction network, and a YOLO Head network. The backbone feature extraction network adopts the Mobilenetv3 network.
[0061] Dilated convolutions are introduced into the enhanced feature extraction network to replace the original convolutions in order to expand the capture of multi-scale contextual information. At the same time, depthwise separable convolutions are introduced into the enhanced feature extraction network to reduce the number of model parameters and computational cost.
[0062] Specifically, the training process of the early fire smoke detection model is as follows:
[0063] Acquire fire smoke sample images and perform preprocessing;
[0064] The process of acquiring and preprocessing fire smoke sample images includes:
[0065] Acquire images of fire smoke samples;
[0066] Mosaic data augmentation method was used to augment fire smoke sample images;
[0067] The preprocessed fire smoke sample image is obtained.
[0068] The preprocessed fire smoke sample images were randomly divided into training and test sets at a ratio of 9:1.
[0069] Based on the training set, the early fire smoke detection model is trained to obtain a well-trained early fire smoke detection model.
[0070] Based on the test set, the trained early fire smoke detection model is used to detect early fire smoke and verify the effectiveness of the trained early fire smoke detection model.
[0071] The loss function for training the early-stage smoke detection model for fires is:
[0072] FL (pt) =-α t (1-p t ) γ log(p t )
[0073] Among them, the hyperparameter α t The calculation formula is as follows:
[0074]
[0075] y is the true label, and y = 1 indicates a positive sample, meaning that α is positive when the sample is a positive sample. t =, when the sample is a negative sample, α t =1-α;
[0076] p t The calculation formula is
[0077] p represents the detection result; the larger the value, the greater the probability of a positive sample.
[0078] γ is a factor that adjusts the rate at which the weights of simple samples decrease.
[0079] Specifically, the backbone feature extraction network utilizes the effective feature layers of the last three shapes in the Mobilenetv3 network to enhance feature extraction.
[0080] The enhanced feature extraction network comprises, in sequence, a depthwise separable convolutional layer, an upsampling layer, a Concat layer, a first fused dilated convolutional C3 layer, a depthwise separable convolutional layer, an upsampling layer, a Concat layer, a second fused dilated convolutional C3 layer, a convolutional layer, a Concat layer, a third fused dilated convolutional C3 layer, a convolutional layer, a Concat layer, and a C3 layer.
[0081] The C3 layer of the second fused dilated convolution, the C3 layer of the third fused dilated convolution, and the output of the C3 layer are fed into the YOLO Head network to obtain the final detection result.
[0082] The first, second, and third C3 layers with fused dilated convolutions have similar structures. The main difference is that dilated convolutions replace the convolution Conv in the sequential layer of C3, which expands the receptive field to capture multi-scale contextual information and improves the accuracy of network detection.
[0083] YOLOv5 is a mainstream object detection algorithm that achieves good detection accuracy while meeting real-time requirements. However, its model structure is complex and computationally intensive, making it unsuitable for direct deployment on embedded devices. To address these issues, this invention proposes a novel neural network model structure. It replaces the original backbone feature extraction network with the lightweight MobileNetV3 and introduces dilated convolutions into the feature fusion network to expand the receptive field and capture multi-scale contextual information, thus improving network detection accuracy. Furthermore, it introduces depthwise separable convolutions to reduce the number of parameters and computational cost, enabling smooth operation on embedded devices. Finally, it uses Focal Loss to eliminate the impact of class imbalance and improve the network's generalization ability. Experiments demonstrate that the improved network structure has fewer parameters, faster detection speed, and higher detection accuracy, meeting the real-time early smoke detection requirements of embedded devices.
[0084] The YOLOv5 network structure can be divided into three parts:
[0085] The backbone feature extraction network is mainly used for feature extraction. YOLOv5 uses the CSPdarknet structure, which is mainly composed of Conv modules and C3 cross-stage local network modules. By controlling the number of modules and parameters, it is divided into four versions, taking into account both accuracy and speed requirements.
[0086] The enhanced feature extraction network is mainly responsible for feature fusion. YOLOv5's enhanced feature fusion network uses the classic feature pyramid structure. First, the information from different feature layers is fused at multiple scales through the FPN structure. Then, the information is fed into the PAN structure, which performs deeper feature extraction and fusion through downsampling.
[0087] The Yolo Head is mainly responsible for obtaining the prediction results, and its dimensions include classification information and prediction bounding box information. In this case, only the smoke target is included, so the dimension fed into the Yolo Head is 18. Since three prediction bounding boxes are regressed, it can be split into 3*6. The 6 can be seen as 4+1+1, where 4 is used to regress the prediction bounding box of the target, 1 is used to determine whether the feature point contains an object, and the last 1 is used to determine the type of object contained.
[0088] MobileNetV3 is an improvement upon MobileNetV2, incorporating the advantages of all lightweight networks since MobileNetV1 and introducing two major innovations: ① The addition of an SE attention module. ② Improved network structure: The introduction of the h-swish activation function to replace the original activation function reduces computational cost and improves performance. Two versions were released, with the overall structure being identical, differing only in the number of basic unit bneck structures and their internal parameters. Their structures are shown in Table 1 below.
[0089] Table 1 Structural parameters of MobileNetV3 network
[0090]
[0091] The following are some explanations of Table 1:
[0092] The first column, input, represents the size of each feature layer in this network model;
[0093] The second column, Operator, represents the network structure operations performed on each feature layer; where bneck is the basic structure of the model.
[0094] The third and fourth columns represent the number of channels after the inverse residual structure inside the bneck is raised and the number of channels when input to the bneck, respectively.
[0095] The fifth column, SE, indicates whether an attention mechanism is used.
[0096] The sixth column, NL, represents the type of activation function, with two options: HS (h-swish) and RE (ReLU).
[0097] The seventh column 's' represents the stride, which determines whether to perform downsampling to extract features.
[0098] The MobileNetv3 backbone is responsible for feature extraction. This invention uses the MobileNetv3 backbone to replace the YOLOv5 backbone feature extraction network, achieving a lightweight design and facilitating deployment in embedded devices. YOLOv5 requires extracting three feature layers from the backbone feature network for enhanced feature fusion. These three layers contain information at different scales, including deep semantic information and shallow positional information. Therefore, this paper selects the effective feature layers corresponding to 32x downsampling, 16x downsampling, and 8x downsampling from the MobileNet network and feeds them into the enhanced feature fusion network for feature fusion.
[0099] To further reduce computational load, depthwise separable convolution is used instead of ordinary convolution in YOLO. Depthwise separable convolution, also known as channel-wise convolution, means that the convolution kernel has only one channel. When building the model, this invention chooses to set the group parameter to the number of input channels to achieve depthwise separable convolution. Then, the number of channels is adjusted using a 1*1 convolution kernel to output the corresponding feature layer.
[0100] Standard convolution process: Assuming there is a 64*64 input layer with 3 channels, and you want to output 4 feature layers of the same size as the input layer, you need to use four 3-channel convolution kernels, with a parameter size of 3*4*3*3=108.
[0101] like Figure 2 The diagram shows the flowchart of depthwise separable convolution: three 3*3 convolution kernels are used to traverse the 3 channels of data to obtain three feature layers. Then, four 1*1 convolution kernels are used to traverse these three feature layers to obtain the final result. The number of parameters is: 3*3*3+1*1*3*4=39.
[0102] This shows that using depthwise separable convolution can indeed reduce the number of parameters, making the model more lightweight and suitable for deployment on embedded devices.
[0103] Because smoke itself is irregularly shaped and semi-transparent, single-stage detection algorithms suffer from class imbalance, resulting in a small portion of candidate boxes containing the target in an image, while the majority of samples are negative background samples. These negative samples not only fail to benefit network training but also, due to their sheer number, overwhelm positive samples, dominating the loss update and thus the gradient direction. This leads to a training result that prioritizes the background and overlooks the target. Class imbalance is a significant factor affecting the performance of single-stage detection algorithms, and the Focal Loss function aims to eliminate this imbalance, allowing the network to focus more on harder-to-learn samples. Therefore, this invention modifies the loss function to Focal Loss. Focal Loss is an improvement on Cross-Entropy (CE Loss), the formula for which is as follows:
[0104] CE(p,y)=CE(p t ) = -log(p t (3)
[0105] The logarithmic function mentioned in the above formula has the default base e.
[0106] Focal Loss improves upon CE Loss and addresses the following two issues:
[0107] The problem of imbalance between positive and negative samples
[0108] A hyperparameter α is added to the cross-entropy to balance the weights of positive and negative samples during the detection process. The formula after adding the hyperparameter α is as follows:
[0109] CE(p t )=-α t log(p t (4)
[0110] Where the hyperparameter α t The calculation formula is as follows:
[0111]
[0112] That is, when the sample is a positive sample, α t =α, when the sample is a negative sample. t =1-α. By setting the value of α, the weight of negative samples can be controlled, thereby reducing the impact of negative samples on the network. Experiments show that the network performs best when the value of α is 0.75.
[0113] The problem of imbalance between easy and difficult samples
[0114] By adding a γ factor to address the imbalance between easy and difficult samples, this factor reduces the weight of easy samples, causing the network to focus more on difficult samples. The expression is as follows:
[0115] FL (pt) =-(1-p t ) γ log(p t (6)
[0116] Where, p t The larger the value of p, the better, for two reasons: if the sample is a positive sample, p... t =p, where a larger p indicates a higher probability of a positive sample. When the sample is a negative sample, p t = 1-p, where a larger 1-p indicates a smaller probability p of a negative sample. γ is a factor that adjusts the rate of decrease in the weights of simple samples. When γ = 0, the above formula becomes FL. (pt) =CE (pt) As γ increases, the suppression level of simple sample weights is continuously adjusted. Experiments show that reducing the weights of simple samples is most effective when γ is 2. This improvement reduces the influence of simple samples, allowing the network to focus more on samples that are difficult to detect. Combining these two improvements, the final expression for Focal Loss is derived:
[0117] FL (pt) =-α t (1-p t ) γ log(p t (7)
[0118] This model addresses both the imbalance between positive and negative samples and the imbalance between easy and difficult samples. In short, the purpose of Focal Loss is to achieve the detection accuracy of a two-stage algorithm without affecting the detection speed of the first-stage algorithm. After using Focal Loss, the model achieves better detection results when detecting difficult-to-classify samples such as smoke.
[0119] Detection model validation
[0120] First, the XML tag files are converted into corresponding TXT files, with each TXT file representing a single image and recording the tag's category and coordinate information. Then, the converted TXT files and the original images are randomly divided into training and test sets at a 9:1 ratio. Additionally, the necessary YAML files for the network model need to be configured. These YAML files record the path and category information of the tag files, allowing the network to read information from these paths. The Mosaic data augmentation method was used to expand the dataset during the model validation process.
[0121] The original resolution of the images in the dataset was 1440×1080. Considering computational costs, they were proportionally scaled to 416×416 before being fed into the network. Because the backbone feature extraction network was modified, the pre-trained weights provided by the official documentation could not be used for transfer learning. This training employed a two-stage warm-up training approach. In the warm-up stage, the learning rate was set to 0.1, the momentum to 0.94, and the initial threshold for Focal Loss to 0.5. Subsequent cosine annealing was used to adjust the learning rate, with the annealing rate set to 0.2. The total number of iterations was 150, and the batch size was set to 4. After training the required number of times, the final mAP curve was obtained, as shown below. Figure 3 As shown.
[0122] The experimental data shows that the network model proposed in this invention has the highest mAP (IOU = 0.5) value of 91.94%, indicating that the lightweight network model proposed in this invention can reduce the number of parameters while still maintaining high detection accuracy, and can meet the real-time early smoke detection requirements of embedded devices.
[0123] Example 2
[0124] This embodiment provides a YOLOv5-based early fire smoke detection system, including:
[0125] The image acquisition module is configured to acquire and preprocess fire smoke images;
[0126] The early fire smoke detection module is configured to perform early fire smoke detection based on preprocessed fire smoke images and using a trained early fire smoke detection model.
[0127] Specifically, the early-stage smoke detection model for fires is as follows:
[0128] Based on YOLOv5, the model includes a backbone feature extraction network, an enhanced feature extraction network, and a YOLO Head network. The backbone feature extraction network adopts the Mobilenetv3 network.
[0129] Dilated convolutions are introduced into the enhanced feature extraction network to replace the original convolutions in order to expand the capture of multi-scale contextual information. At the same time, depthwise separable convolutions are introduced into the enhanced feature extraction network to reduce the number of model parameters and computational cost.
[0130] The examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the content disclosed in Embodiment 1 above. It should be noted that the above modules, as part of the system, can be executed in a computer system such as a set of computer-executable instructions.
[0131] The descriptions of each embodiment in the above embodiments have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0132] The proposed system can be implemented in other ways. For example, the system embodiments described above are merely illustrative, and the division of modules described above is only a logical functional division. In actual implementation, there may be other division methods. For example, multiple modules may be combined or integrated into another system, or some features may be ignored or not executed.
[0133] Example 3
[0134] This embodiment provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the YOLOv5-based early smoke detection method for fires as described in Embodiment 1 above.
[0135] Example 4
[0136] This embodiment provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the steps in the YOLOv5-based early smoke detection method for fires as described in Embodiment 1 above.
[0137] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of hardware embodiments, software embodiments, or embodiments combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage and optical storage) containing computer-usable program code.
[0138] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0139] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0140] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0141] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0142] While the specific embodiments of the present invention have been described above in conjunction with the accompanying drawings, this is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art without creative effort based on the technical solutions of the present invention are still within the scope of protection of the present invention.
Claims
1. A YOLOv5-based fire early smoke detection method, characterized in that, The method comprises the following steps: acquire fire smoke images and pre-process them; based on the pre-processed fire smoke images, use a trained early fire smoke detection model to detect early fire smoke; wherein the early fire smoke detection model is specifically: taking YOLOv5 as a base model, including a main feature extraction network, a strengthened feature extraction network, and a Yolo Head network, the main feature extraction network uses the last three shape effective feature layers in the Mobilenetv3 network to perform strengthened feature extraction; introducing a hollow convolution into the strengthened feature extraction network to replace the original convolution to expand the capture of multi-scale context information, and introducing a depth separable convolution into the strengthened feature extraction network to reduce the parameter quantity and calculation quantity of the model; the strengthened feature extraction network includes a depth separable convolution layer, an up-sampling layer, a Concat layer, a first C3 layer with fused hollow convolution, a depth separable convolution layer, an up-sampling layer, a Concat layer, a second C3 layer with fused hollow convolution, a convolution layer, a Concat layer, a third C3 layer with fused hollow convolution, a convolution layer, a Concat layer, and a C3 layer connected in sequence; the first C3 layer with fused hollow convolution, the second C3 layer with fused hollow convolution, and the third C3 layer with fused hollow convolution replace the convolution Conv in the sequential in the C3 with a hollow convolution; using a Focal Loss loss function to eliminate the influence of class imbalance and improve the generalization ability of the network.
2. The fire early smoke detection method based on YOLOv5 of claim 1, wherein, The training process of the early fire smoke detection model is specifically: acquire fire smoke sample images and pre-process them; randomly divide the pre-processed fire smoke sample images into a training set and a test set according to a 9:1 ratio; based on the training set, train the early fire smoke detection model to obtain a trained early fire smoke detection model; based on the test set, use the trained early fire smoke detection model to detect early fire smoke and verify the effectiveness of the trained early fire smoke detection model.
3. The fire early smoke detection method based on YOLOv5 of claim 2, wherein, The method for acquiring fire smoke sample images and pre-processing them comprises the following steps: acquire fire smoke sample images; use a Mosaic data enhancement method to enhance the fire smoke sample images; obtain pre-processed fire smoke sample images.
4. The fire early smoke detection method based on YOLOv5 of claim 2, wherein, The loss function of the early fire smoke detection model is: where the hyperparameters The formula for calculating is as follows: y is the true label, y = 1 means positive sample, i.e. when the sample is a positive sample when the sample is a negative sample ; The calculation formula is: For the detection result, the larger the value is, the greater the probability of the positive sample is; γ A factor to adjust the simple sample weight reduction rate.
5. The fire early smoke detection method based on YOLOv5 of claim 1, wherein, the second C3 layer with fused hollow convolution, the third C3 layer with fused hollow convolution, and the C3 layer output results to the Yolo Head network to obtain the final detection results.
6. A YOLOv5-based early fire smoke detection system, characterized in that, The method comprises the following steps: an image acquisition module configured to acquire fire smoke images and pre-process them; an early fire smoke detection module configured to use a trained early fire smoke detection model to detect early fire smoke based on pre-processed fire smoke images; wherein the early fire smoke detection model is specifically: The YOLOv5-based model includes a backbone feature extraction network, a strengthened feature extraction network, and a Yolo Head network, the backbone feature extraction network adopts the last three shape effective feature layers in the Mobilenetv3 network to perform strengthened feature extraction; The original convolution is replaced by a hollow convolution in the strengthened feature extraction network to expand the capture of multi-scale context information, and a depth separable convolution is introduced in the strengthened feature extraction network to reduce the parameter quantity and calculation quantity of the model; The strengthened feature extraction network includes a depth separable convolution layer, an upsampling layer, a Concat layer, a first C3 layer of a fused hollow convolution, a depth separable convolution layer, an upsampling layer, a Concat layer, a second C3 layer of a fused hollow convolution, a convolution layer, a Concat layer, a third C3 layer of a fused hollow convolution, a convolution layer, a Concat layer, and a C3 layer connected in sequence. A Focal Loss loss function is used to eliminate the influence of class imbalance and improve the generalization ability of the network.
7. A computer-readable storage medium having stored thereon a computer program, characterized in that The program is executed by the processor to implement the steps in the YOLOv5-based fire early smoke detection method according to any one of claims 1-5.
8. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the program to implement the steps in the YOLOv5-based fire early smoke detection method according to any one of claims 1-5.
Citation Information
Patent Citations
Multi-scale fire target identification method and system
CN113011319A
Underwater whale target detection method based on lightweight YOLOv4
CN114418930A