A fire detection model training method and detection method based on improved DETR

Through the improved DETR model, combined with the convolutional neural network and Transformer module, the adaptive module is used to perform secondary extraction and weight distribution of shallow features, which solves the problem of traditional fire detection methods being susceptible to environmental influences and processing complexity, and improves detection efficiency. Accuracy and efficiency.

CN114639007BActive Publication Date: 2024-09-17CHINA UNICOM (GUANGDONG) IND INTERNET CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210347943.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-01
Publication Date
2024-09-17
Estimated Expiration
2042-04-01

AI Technical Summary

Technical Problem

Traditional fire detection methods are easily affected by environmental factors, have complex processing methods and ignore shallow features, resulting in poor detection results.

Method used

The improved DETR model is used, combined with the convolutional neural network and Transformer module, and the shallow features are secondary extracted and weighted through the adaptive module. The final output features are calculated based on the deep features to directly detect the fire and simplify the processing process.

Benefits of technology

It improves the robustness and detection accuracy of the model, reduces the impact on external environmental factors, simplifies the detection process, and improves detection efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114639007B
    Figure CN114639007B
Patent Text Reader

Abstract

The present invention discloses a fire detection model training method and a detection method based on improved DETR, the training method comprising: obtaining a fire sample image, setting an annotation, and obtaining a sample data set; constructing a fire detection model based on improved DETR, comprising a convolutional neural network, an adaptive module, a connection module, and a Transformer module; inputting the sample data set into the model, extracting shallow features and deep features through the convolutional neural network, performing secondary extraction of shallow features through the adaptive module and assigning weights to the shallow features after secondary extraction, calculating the final output features by combining the weights, shallow features, and deep features through the connection module, and then identifying the detection results through the Transformer module, comparing the detection results and the annotations, and training the model according to the comparison results to obtain a trained fire detection model. In the present invention, the fire detection model is not affected by environmental factors, has high feature extraction performance and model robustness, does not require post-processing, and has a simple processing flow.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of fire detection, and more specifically, to a fire detection model training method and a detection method based on improved DETR. Background Art

[0002] Fire refers to the damage caused by uncontrolled combustion in time or space. Fire is the most frequent and common occurrence, and is one of the major disasters that has caused huge casualties to humans and threatened public safety and social development. From ancient times to the present, fire has been causing huge casualties and economic losses to people. Fire will endanger life safety, cause economic losses, destroy the achievements of civilization, affect social stability, and damage the ecological environment.

[0003] Therefore, if a fire can be discovered in time and an early warning is issued before the fire expands and spreads, it can help people discover the fire in time and "smother" the fire in the cradle, thereby protecting people's lives and property safety in a timely and effective manner.

[0004] Traditional fire detection is based on sensor monitoring technology, such as using temperature to determine whether a fire has occurred. However, these methods are easily affected by environmental factors such as weather. When these environmental factors change, the fire detection effect will be affected.

[0005] In recent years, with the rapid development of artificial intelligence, deep learning and other technologies, computer vision-based target detection methods have achieved excellent results in many fields. For example, in the field of autonomous driving, vehicle detection, traffic sign detection, and in the field of smart security, face detection have all achieved good detection results. Commonly used target detection models include Faster-RCNN, SSD, YOLO and other models. Some researchers also use these models for fire detection. After detecting multiple target areas through the model, some post-processing techniques such as NMS are used for filtering and screening.

[0006] However, traditional fire detection methods have the following defects:

[0007] (1) Traditional fire detection methods are based on sensor monitoring technology, such as temperature sensors and smoke sensors, which detect fires by sampling gas and temperature. However, this method is easily affected by external environmental factors, such as wind direction and weather. Once the environment changes, the detection effect will be affected.

[0008] (2) Traditional deep learning-based target detection methods, such as SSD and YOLO, build deep neural networks to regress the coordinates of the target area in the image. Generally, outputs of different scales are set to detect targets of different sizes in the target area, thereby improving the detection effect. However, the processing methods of these methods are not simple enough. After obtaining the output through the network model, manually designed post-processing methods are required to "decode" the network output to obtain the final detection result.

[0009] (3) The original DETR model, combining CNN and Transformer, regards the target detection problem as a series of set prediction problems. Compared with traditional methods such as SSD and YOLO, the processing flow is simpler. After the network output, there is no need to perform "decoding" and other operations. The target detection area can be directly obtained. However, the original DETR only uses the deep features of CNN and ignores the role of shallow features. Summary of the invention

[0010] The present invention aims to overcome at least one defect (shortcoming) of the above-mentioned prior art and provide a fire detection model training method and a detection method based on improved DETR, which are used to solve the problems that traditional fire detection methods are greatly affected by environmental factors, require complex post-processing, and ignore shallow features.

[0011] The technical solution adopted by the present invention is a fire detection model training method based on improved DETR, comprising the following steps:

[0012] Acquire fire sample images, and set annotations for the fire sample images to obtain a sample data set;

[0013] Constructing a fire detection model based on improved DETR, wherein the fire detection model includes a convolutional neural network, an adaptive module, a connection module and a Transformer module;

[0014] The sample data set is input into the fire detection model, a plurality of shallow features and at least one deep feature are extracted from the sample data set through the convolutional neural network, a plurality of shallow features are subjected to secondary feature extraction through the adaptive module, and weights are assigned to the shallow features after the secondary extraction, a final output feature is calculated by combining the weights, the shallow features and the deep features through the connection module, a fire detection result is identified according to the final output feature through the Transformer module, the fire detection result is compared with the annotation, and the fire detection model is trained according to the comparison result to obtain a trained fire detection model.

[0015] Furthermore, obtaining a fire sample image and setting a label for the fire sample image specifically includes:

[0016] Acquire a fire sample image involving smoke, a fire sample image involving flames, and a fire sample image not involving smoke or flames;

[0017] The fire target position coordinates and fire category in the fire sample image are labeled.

[0018] In the present invention, the fire detection model based on improved DETR is an artificial intelligence machine model that can directly detect targets through computer vision without the need for a large number of sensors, and the detection results are not easily affected by external environmental factors.

[0019] In addition, the present invention introduces an adaptive module into the original DETR model, which performs secondary feature extraction on shallow features and assigns weights to the shallow features after secondary extraction, and then calculates the final output features by combining the weights, the shallow features and the deep features through a connection module, thereby improving the performance of the model in extracting features, thereby improving the robustness of the model and achieving better detection effect.

[0020] At the same time, the fire detection model based on improved DETR used in the present invention, combined with convolutional neural networks and Transformer modules, regards the detection problem as a series of set prediction problems, directly predicts the results through the model, detects the flames and smoke in the pictures by inputting pictures, and returns the position coordinates and fire categories of the detected fire targets. Compared with traditional target detection methods such as SSD and YOLO, the processing flow is simpler. After output through the network, there is no need for post-processing operations such as "decoding", and the detection area of ​​the target can be directly obtained, thereby improving the detection efficiency.

[0021] Furthermore, the convolutional neural network includes a plurality of shallow feature extraction modules and at least one deep feature extraction module connected in sequence;

[0022] The adaptive module includes a plurality of secondary feature extraction modules and a weight output module, and the secondary feature extraction modules correspond one to one with the shallow feature extraction modules;

[0023] Extracting a plurality of shallow features and at least one deep feature from the sample data set by the convolutional neural network, performing secondary feature extraction on the plurality of shallow features by the adaptive module, and assigning weights to the shallow features after the secondary extraction, specifically includes:

[0024] Several shallow features are extracted respectively through several shallow feature extraction modules, at least one deep feature is extracted respectively through at least one deep feature extraction module, secondary feature extraction is performed on several shallow features respectively through several secondary feature extraction modules, and weights are assigned to the shallow features after secondary extraction through the weight output module.

[0025] Furthermore, the final output feature is calculated by combining the weight, the shallow feature and the deep feature through the connection module, specifically including:

[0026] The final output feature f is calculated by the connection module using the following formula:

[0027]

[0028] Among them, f i ' represents the shallow feature after the i-th secondary extraction, w i represents the weight assigned to the shallow feature after the i-th secondary extraction, f m+1 represents deep features, and m represents the number of shallow features.

[0029] In the original DETR model, only the deep features extracted by the convolutional neural network are used as the output features, and they are used as the input of the Transformer module for subsequent detection, while the role of shallow features is ignored. However, due to the loss of feature information during the transmission process, if only the extracted deep features are used as the final output features, it may lead to the loss of feature information, which further leads to low accuracy of the final detection results. In the present invention, considering combining shallow features with deep features, the performance of the extracted features can be effectively improved, so that the model has higher robustness, thereby improving the model detection accuracy. At the same time, by introducing a weight allocation module in the adaptive module to assign different weights to different shallow features, an adaptive weighting effect can be achieved.

[0030] Further, the shallow feature extraction module includes a plurality of first sub-feature extraction units, a first splicing unit, a first convolution unit, a second splicing unit and a second sub-feature extraction unit, the first sub-feature extraction units are connected in sequence, the input end of the first first sub-feature extraction unit is used as the input end of the shallow feature extraction module, the output end of the first first sub-feature extraction unit is also connected to the input end of the first splicing unit, the output end of the last first sub-feature extraction unit is connected to the input end of the first splicing unit, the output end of the first splicing unit is connected to the input end of the first convolution unit, the output end of the first convolution unit is connected to the input end of the second splicing unit, the output end of the second splicing unit is connected to the input end of the second sub-feature extraction unit, and the output end of the second sub-feature extraction unit is used as the output end of the shallow feature extraction module;

[0031] The shallow feature extraction module also includes a second convolution unit, an input end of the second convolution unit serves as an input end of the shallow feature extraction module, and an output end of the second convolution unit is connected to an input end of the second splicing unit.

[0032] Furthermore, the first sub-feature extraction unit and the second sub-feature extraction unit both include a convolution layer, a normalization layer, and an activation function layer connected in sequence;

[0033] The first convolution unit and the second convolution unit both include a convolution layer.

[0034] Furthermore, the secondary feature extraction module includes a convolution layer with a 1*1 convolution kernel; the weight output module includes a fully connected layer and a classification function layer connected in sequence, and the classification function layer is a softmax function layer.

[0035] On the other hand, another technical solution adopted by the present invention is a fire detection method based on improved DETR, comprising the following steps:

[0036] Acquire an image to be detected;

[0037] Fire detection is performed on the image to be detected using a fire detection model trained based on any one of the methods described in claims 1 to 7.

[0038] Furthermore, another technical solution adopted by the present invention is a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the above-mentioned training method or detection method when executing the computer program.

[0039] Furthermore, another technical solution adopted by the present invention is a computer storage medium on which a computer program is stored, and the computer program implements the above-mentioned training method or detection method when executed by a processor.

[0040] Compared with the prior art, the present invention has the following beneficial effects:

[0041] 1. In the present invention, the fire detection model based on improved DETR can directly detect targets through computer vision without the need for a large number of sensors, and the detection results are not easily affected by external environmental factors;

[0042] 2. The present invention introduces an adaptive module into the original DETR model. The adaptive module performs secondary feature extraction on shallow features and assigns weights to the shallow features after secondary extraction. Then, the connection module combines the weights, the shallow features and the deep features to calculate the final output features, thereby improving the performance of the model in extracting features, thereby improving the robustness of the model and having a better detection effect.

[0043] 3. The fire detection model based on improved DETR used in the present invention, combined with convolutional neural network and Transformer module, regards the detection problem as a series of set prediction problems, directly predicts the results through the model, detects the flame and smoke in the picture by inputting the picture, and returns the position coordinates and fire category of the detected fire target. Compared with traditional target detection methods such as SSD and YOLO, the processing flow is simpler. After output through the network, there is no need for post-processing operations such as "decoding", and the detection area of ​​the target can be directly obtained, thereby improving the detection efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 It is a flow chart of the training method in the present invention.

[0045] Figure 2 It is a structural schematic diagram of the fire detection model in the present invention.

[0046] Figure 3 It is a schematic diagram of the structure of the convolutional neural network and the adaptive module in the fire detection model of the present invention.

[0047] Figure 4 It is a schematic diagram of the structure of the shallow feature extraction module in the convolutional neural network of the present invention.

[0048] Figure 5 It is a schematic diagram of the structure of the first secondary feature extraction module in the adaptive module of the present invention.

[0049] Figure 6 It is a schematic diagram of the structure of the second secondary feature extraction module in the adaptive module of the present invention.

[0050] Figure 7 It is a schematic diagram of the structure of the weight output module in the adaptive module of the present invention.

[0051] Figure 8 It is a structural schematic diagram of the Transformer module in the fire detection model of the present invention.

[0052] Fig. 9 It is a flow chart of the detection method in the present invention. DETAILED DESCRIPTION

[0053] The drawings of the present invention are only for illustrative purposes and should not be construed as limiting the present invention. In order to better illustrate the following embodiments, some parts of the drawings may be omitted, enlarged or reduced, and do not represent the size of the actual product; it is understandable to those skilled in the art that some well-known structures and their descriptions in the drawings may be omitted.

[0054] Example 1

[0055] like Figure 1 As shown, this embodiment proposes a fire detection model training method based on improved DETR, comprising the following steps:

[0056] S1. Obtain fire sample images, and set annotations for the fire sample images to obtain a sample data set;

[0057] Specifically, in this embodiment, the fire sample image is obtained in step S1, and a label is set for the fire sample image, specifically including:

[0058] Acquire a fire sample image involving smoke, a fire sample image involving flames, and a fire sample image not involving smoke or flames;

[0059] Annotate the fire target location coordinates and fire category in the fire sample image;

[0060] In addition, specifically, in this embodiment, the fire sample image in the sample data set can be represented by X, and the annotation can be represented by Y. Before model training, the sample data set can be divided into a training data set and a test data set. The training data set can be represented by X_train and Y_train, and the test data set can be represented by X_test and Y_test. When the model is trained, the training data sets X_train and Y_train are used to train the model, and the test data sets X_test and Y_test are used to test the effect of the model during the training process. The test results are fed back to the model and the model parameters are adjusted to continue training, and finally a trained model is obtained.

[0061] S2. Build a fire detection model based on improved DETR, which includes a convolutional neural network, an adaptive module, a connection module, and a Transformer module;

[0062] S3. Input the sample data set into the fire detection model, extract several shallow features and at least one deep feature from the sample data set through the convolutional neural network, perform secondary feature extraction on several shallow features through the adaptive module and assign weights to the shallow features after the secondary extraction, calculate the final output features by combining the weights, shallow features and deep features through the connection module, identify the fire detection results according to the final output features through the Transformer module, compare the fire detection results and annotations, train the fire detection model according to the comparison results, and obtain a trained fire detection model.

[0063] In this embodiment, the schematic diagram of the fire detection model principle structure is as follows: Figure 2 shown.

[0064] Specifically, in this embodiment, Figure 3 As shown, the convolutional neural network includes two shallow feature extraction modules and a deep feature extraction module connected in sequence;

[0065] The adaptive module includes two secondary feature extraction modules and a weight output module. The secondary feature extraction modules correspond one-to-one to the shallow feature extraction modules.

[0066] Specifically, in step S3, a plurality of shallow features and at least one deep feature are extracted from the sample data set by a convolutional neural network, a secondary feature extraction is performed on the plurality of shallow features by the adaptive module, and weights are assigned to the shallow features after the secondary extraction, specifically including:

[0067] Two shallow features are extracted respectively through two shallow feature extraction modules, one deep feature is extracted respectively through a deep feature extraction module, and secondary feature extraction is performed on the two shallow features respectively through two secondary feature extraction modules, and weights are assigned to the shallow features after secondary extraction through a weight output module.

[0068] Furthermore, in step S3, the final output features are calculated by combining the weights, shallow features and deep features through the connection module, specifically including:

[0069] The final output feature f is calculated by connecting the modules using the following formula:

[0070]

[0071] Among them, f i ' represents the shallow feature after the i-th secondary extraction, w irepresents the weight assigned to the shallow feature after the i-th secondary extraction, f m+1 represents deep features, and m represents the number of shallow features.

[0072] Specifically, in this embodiment, the calculation formula for the final output feature f is:

[0073] f=f1'*w1+f2'*w2+f3

[0074] Among them, f1' represents the shallow features after the first secondary extraction, w1 represents the weight assigned to the shallow features after the first secondary extraction, f2' represents the shallow features after the second secondary extraction, w2 represents the weight assigned to the shallow features after the second secondary extraction, and f3 represents the deep features.

[0075] Specifically, in this embodiment, Figure 4 As shown, the shallow feature extraction module includes three first sub-feature extraction units, a first splicing unit, a first convolution unit, a second splicing unit and a second sub-feature extraction unit. The first sub-feature extraction units are connected in sequence, the input end of the first first sub-feature extraction unit is used as the input end of the shallow feature extraction module, the output end of the first first sub-feature extraction unit is also connected to the input end of the first splicing unit, the output end of the last first sub-feature extraction unit is connected to the input end of the first splicing unit, the output end of the first splicing unit is connected to the input end of the first convolution unit, the output end of the first convolution unit is connected to the input end of the second splicing unit, the output end of the second splicing unit is connected to the input end of the second sub-feature extraction unit, and the output end of the second sub-feature extraction unit is used as the output end of the shallow feature extraction module;

[0076] The shallow feature extraction module also includes a second convolution unit, an input end of the second convolution unit serves as an input end of the shallow feature extraction module, and an output end of the second convolution unit is connected to an input end of the second splicing unit.

[0077] Furthermore, the first sub-feature extraction unit and the second sub-feature extraction unit both include a convolution layer, a normalization layer, and an activation function layer connected in sequence;

[0078] The first convolution unit and the second convolution unit both include a convolution layer.

[0079] Further, such as Figure 5 , 6 As shown in , the secondary feature extraction module includes a convolution layer with a 1*1 convolution kernel; Figure 7 As shown, the weight output module includes a fully connected layer FC and a classification function layer connected in sequence, and the classification function layer is a softmax function layer.

[0080] In addition, specific Figure 8As shown, the Transformer module structure in this embodiment specifically includes: a feature input module, a position encoding module, a connection module, an encoder input module, an encoder, an encoder output module, a decoder, an object query module, a decoder output module, a feedforward neural network and a detection result module. The feature input module obtains the final output feature f obtained by the previous convolutional neural network and the adaptive module. The output ends of the feature input module and the position encoding module are connected to the input end of the connection module. The output end of the connection module is connected to the input end of the encoder input module, the output end of the encoder input module is connected to the input end of the encoder, the output end of the encoder is connected to the input end of the encoder output module, the output end of the encoder output module is connected to the input end of the decoder, the output end of the object query module is also connected to the input end of the decoder, the output end of the decoder is connected to the input end of the decoder output module, the output end of the decoder output module is connected to the input end of the feedforward neural network, the output end of the feedforward neural network is connected to the input end of the detection result module, and the detection result module outputs the fire detection result.

[0081] Example 2

[0082] like Fig. 9 As shown, this embodiment provides a fire detection method based on improved DETR, comprising the following steps:

[0083] S10, obtaining an image to be detected;

[0084] S20. Perform fire detection on the image to be detected using the fire detection model trained based on the method described in Example 1.

[0085] Example 3

[0086] This embodiment provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the training method described in Embodiment 1 or the detection method described in Embodiment 2 is implemented.

[0087] Example 4

[0088] This embodiment provides a computer storage medium on which a computer program is stored. When the computer program is executed by a processor, the training method described in Embodiment 1 or the detection method described in Embodiment 2 is implemented.

[0089] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the technical solution of the present invention, and are not intended to limit the specific implementation methods of the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the claims of the present invention shall be included in the protection scope of the claims of the present invention.

Claims

1. A fire detection model training method based on improved DETR, characterized in that: The following steps are involved: Acquire fire sample images, and set annotations for the fire sample images to obtain a sample data set; Constructing a fire detection model based on improved DETR, wherein the fire detection model includes a convolutional neural network, an adaptive module, a connection module and a Transformer module; Inputting the sample data set into the fire detection model, extracting several shallow features and at least one deep feature from the sample data set through the convolutional neural network, performing secondary feature extraction on several shallow features through the adaptive module and assigning weights to the shallow features after the secondary extraction, calculating the final output features by combining the weights, the shallow features and the deep features through the connection module, identifying the fire detection result according to the final output feature through the Transformer module, comparing the fire detection result with the annotation, and training the fire detection model according to the comparison result to obtain a trained fire detection model; The convolutional neural network includes a plurality of shallow feature extraction modules and at least one deep feature extraction module connected in sequence; The adaptive module includes a plurality of secondary feature extraction modules and a weight output module, and the secondary feature extraction modules correspond one to one with the shallow feature extraction modules; Extracting a plurality of shallow features and at least one deep feature from the sample data set by the convolutional neural network, performing secondary feature extraction on the plurality of shallow features by the adaptive module, and assigning weights to the shallow features after the secondary extraction, specifically includes: Several shallow features are extracted respectively through several shallow feature extraction modules, at least one deep feature is extracted respectively through at least one deep feature extraction module, secondary feature extraction is performed on several shallow features respectively through several secondary feature extraction modules, and weights are assigned to the shallow features after secondary extraction through the weight output module.

2. A fire detection model training method based on improved DETR according to claim 1, characterized in that: Obtaining a fire sample image and setting a label for the fire sample image specifically includes: Acquire a fire sample image involving smoke, a fire sample image involving flames, and a fire sample image not involving smoke or flames; The fire target position coordinates and fire category in the fire sample image are labeled.

3. A fire detection model training method based on improved DETR according to claim 1, characterized in that: The final output feature is calculated by combining the weight, the shallow feature and the deep feature through the connection module, specifically including: The final output feature f is calculated by the connection module using the following formula: in, f i ’ Indicates i The shallow features after secondary extraction, w i Expressed as i The weight assigned to the shallow features after secondary extraction, f m+1 Represents deep features, m Indicates the number of shallow features.

4. A fire detection model training method based on improved DETR according to claim 1, characterized in that: The shallow feature extraction module includes a plurality of first sub-feature extraction units, a first splicing unit, a first convolution unit, a second splicing unit and a second sub-feature extraction unit. The first sub-feature extraction units are connected in sequence, the input end of the first first sub-feature extraction unit is used as the input end of the shallow feature extraction module, the output end of the first first sub-feature extraction unit is also connected to the input end of the first splicing unit, the output end of the last first sub-feature extraction unit is connected to the input end of the first splicing unit, the output end of the first splicing unit is connected to the input end of the first convolution unit, the output end of the first convolution unit is connected to the input end of the second splicing unit, the output end of the second splicing unit is connected to the input end of the second sub-feature extraction unit, and the output end of the second sub-feature extraction unit is used as the output end of the shallow feature extraction module; The shallow feature extraction module also includes a second convolution unit, an input end of the second convolution unit serves as an input end of the shallow feature extraction module, and an output end of the second convolution unit is connected to an input end of the second splicing unit.

5. A fire detection model training method based on improved DETR according to claim 4, characterized in that: The first sub-feature extraction unit and the second sub-feature extraction unit both include a convolution layer, a normalization layer, and an activation function layer connected in sequence; The first convolution unit and the second convolution unit both include a convolution layer.

6. A fire detection model training method based on improved DETR according to claim 1, characterized in that: The secondary feature extraction module includes a convolution layer with a 1*1 convolution kernel; the weight output module includes a fully connected layer and a classification function layer connected in sequence, and the classification function layer is a softmax function layer.

7. A fire detection method based on improved DETR, characterized in that: The following steps are involved: Acquire an image to be detected; Fire detection is performed on the image to be detected using a fire detection model trained based on the method described in any one of claims 1 to 6.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the training method according to any one of claims 1 to 6 or the detection method according to claim 7 is implemented.

9. A computer storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the training method according to any one of claims 1 to 6 or the detection method according to claim 7 is implemented.