A lightweight fireworks detection method based on dynamic fusion of spatiotemporal features

By adopting the spatio-temporal feature fusion method of NanoDet-Plus network and LSTM temporal motion feature network in fireworks detection, the problems of fireworks detection accuracy and computing resource limitations in the existing technology are solved, and fireworks detection with high accuracy and low computational load is achieved. , suitable for complex backgrounds and environments with limited resources.

CN118628964BActive Publication Date: 2024-10-15CHENGDU UNIVERSITY OF TECHNOLOGY +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411089567.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-09
Publication Date
2024-10-15
Estimated Expiration
2044-08-09

AI Technical Summary

Technical Problem

Existing pyrotechnic detection technology is difficult to achieve high-precision detection in environments with limited costs and computing resources. It is especially prone to false detections in complex backgrounds, which increases the cost of deployment and inspection.

Method used

Adopting a lightweight spatio-temporal feature dynamic fusion fireworks detection method, the NanoDet-Plus network is combined with the ShuffleNetV2 backbone network, LSTM temporal motion feature network and edge detection algorithm to dynamically fuse the temporal and spatial features of the image sequence, and generate spatio-temporal fusion features to improve detection accuracy sex.

Benefits of technology

Significantly improves the accuracy and robustness of firework detection, reduces false positives and false negatives, and enhances the overall accuracy and reliability of the monitoring system, while maintaining the lightweight and low computational load of the model, making it suitable for mobile devices and Embedded system deployment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118628964B_ABST
    Figure CN118628964B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for detecting fireworks with dynamic fusion of lightweight spatiotemporal features, which belongs to the field of image data processing technology, and includes constructing a fireworks video data set; constructing a dynamic fusion detection network of spatiotemporal features; training the dynamic fusion detection network of spatiotemporal features with the fireworks video data set to obtain a fireworks detection model; obtaining a video segment to be identified, processing it into an image sequence, sending it to the fireworks detection model, and outputting the predicted target position and target category in each image. The present invention targets the spatial features and unique temporal features of smoke and flame targets, and fuses the two features according to the complexity of the detection background, which not only improves the efficiency and expression depth of feature extraction, but also significantly enhances the model's ability to capture target details, so that the model can maintain excellent adaptability and generalization performance in a complex and changeable environment, effectively suppresses false alarms and missed alarms, and significantly enhances the accuracy and reliability of fireworks detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image data technology, and in particular to a fireworks detection method with lightweight dynamic fusion of spatiotemporal features. Background Art

[0002] In the face of the severe challenge of frequent fires, effective smoke and fire detection technology has become the key to ensuring public safety. Although traditional smoke and fire detection methods, such as infrared sensors, can sense the specific wavelength of infrared rays generated by flames to a certain extent, their high cost and the limitations that may be encountered when applied in large spaces in mountains and forests restrict their widespread application. In addition, infrared sensors have limited ability to detect smoke and cannot fully cover the smoldering stage at the beginning of a fire.

[0003] At the same time, with the development of artificial intelligence and deep learning technology, computer vision models such as the YOLO series, SSD, and VisionTransformer have been introduced into the field of fireworks detection, providing new solutions to this problem. Yao Bo et al. further improved the detection accuracy of small-sized fire points by improving the calculation target box regression loss function of the YOLO v5 detection model; Zhao Yang et al. improved the SSD target detection algorithm by replacing the backbone network in the SSD algorithm and using the Concat operation for multi-scale feature fusion, further improving the detection accuracy of fireworks; Song Junmeng et al. proposed a multi-band fireworks recognition algorithm based on a 3D convolutional neural network. This algorithm combines visible light images and near-infrared images, uses a 3D VGG model for feature extraction and classification, and realizes accurate recognition of fireworks.

[0004] These models can analyze video images, identify the unique flame spectrum characteristics and smoke forms of fires, and achieve high-precision fire warnings. However, high precision is often based on complex model architectures, which not only require powerful computing resource support, but may also lead to increased deployment costs. For environments with limited computing resources, it is difficult to apply.

[0005] In recent years, some lightweight target detection models have emerged, such as the NanoDet series, YOLO-Nano, PicoDet, etc. These models usually have a small model size and a fast inference speed, which are suitable for mobile devices, embedded devices, and edge computing platforms. However, due to the simple network structure, fireworks targets in complex backgrounds often cause false detections, increasing the cost of manual inspection and confirmation. Summary of the invention

[0006] The purpose of the present invention is to provide a solution to the above-mentioned problems, improve the accuracy of fireworks video recognition, reduce unnecessary false detections, while maintaining the miniaturization and low computational load of the model to ensure its feasibility and efficiency in actual deployment, a fireworks detection method with lightweight spatiotemporal feature dynamic fusion.

[0007] NanoDet-Plus is a lightweight target detection model based on NanoDet, which is mainly divided into three parts: NanoDet-plus backbone network, NanoDet-plus feature fusion network and NanoDet-plus detection head. Its backbone network uses ShuffleNetV2 network, which is a lightweight neural network with fine-tuning design, mainly used in tasks such as image classification and target detection.

[0008] In order to achieve the above-mentioned object, the technical solution adopted by the present invention is as follows: a method for detecting fireworks by dynamically fusion of lightweight spatiotemporal features, comprising the following steps;

[0009] S1, construct fireworks video dataset;

[0010] Obtain video segments containing smoke and / or flames in different scenes, and process the video segments into image sequences. The processing method for one video segment is as follows:

[0011] Decompose the video segment into multiple single-frame RGB images, sort them by time to obtain an image sequence, manually annotate each RGB image in the image sequence to obtain annotation information, the annotation information includes the target position, target category and sequence number, the targets include smoke and flame, and the sequence number of the kth RGB image in the image sequence is k;

[0012] The labeled image sequences form a fireworks video dataset;

[0013] S2, construct a spatiotemporal feature dynamic fusion detection network;

[0014] It includes an edge detection network, an LSTM temporal motion feature network, a NanoDet-plus network and a spatiotemporal feature fusion layer, wherein the NanoDet-plus network includes a NanoDet-plus backbone network, a NanoDet-plus feature fusion network and a NanoDet-plus detection head;

[0015] The edge detection network is used to convert the input RGB image into a grayscale image and then use the Sobel edge detection algorithm to perform edge detection, and output the background complexity of the grayscale image;

[0016] The LSTM temporal motion feature network is used to input an image sequence, extract the temporal features of each RGB image, and form a temporal feature sequence;

[0017] The NanoDet-plus backbone network and the NanoDet-plus feature fusion network are used to input an image sequence, extract the spatial features of each RGB image, and form a spatial feature sequence;

[0018] The spatiotemporal feature fusion layer generates the weights of temporal features and spatial features according to the background complexity, fuses the temporal features and spatial features, and obtains spatiotemporal fusion features, where the kth RGB image P in the image sequence k The background complexity of the corresponding grayscale image is C k , P k The corresponding time series characteristics are The spatial characteristics are , its spatiotemporal fusion feature F k , obtained according to steps S21 to S23;

[0019] S21, calculate C k The relative deviation of ;

[0020] ,

[0021] Where T is the preset complexity threshold;

[0022] S22, calculation Weight and Weight ;

[0023] ,

[0024] ,

[0025] In the formula, is the sigmoid function, α is the adjustment parameter;

[0026] S23, calculate P k The spatiotemporal fusion feature F k ;

[0027] ,

[0028] The NanoDet-plus detection head is used to input spatiotemporal fusion features and output predicted target positions and target categories;

[0029] S3, using the fireworks video dataset to train the spatiotemporal feature dynamic fusion detection network, inputting an image sequence each time for training, and taking the annotation information corresponding to each RGB image as the expected output, training the spatiotemporal feature dynamic fusion detection network until convergence, and obtaining the fireworks detection model;

[0030] S4, obtains the video segment to be identified, processes it into an image sequence, and processes it frame by frame by the fireworks detection model. For each frame of RGB image, the predicted target position and target category are output.

[0031] Preferably, after decomposing the video segment into multiple single-frame RGB images, the RGB images are preprocessed, specifically, the RGB images are adjusted to a size of 416×416 and the pixel values ​​are normalized to the interval [0,1].

[0032] Preferably, in the edge detection network, the background complexity is obtained according to steps a1 to a3;

[0033] a1, if the size of the grayscale image I corresponding to an RGB image is H×W, the horizontal gradient value of the pixel (i, j) in the i-th row and j-th column of the grayscale image I is calculated according to the following formula: , vertical gradient value ;

[0034] ,

[0035] ,

[0036] In the formula, is the 3×3 neighborhood of pixel (i,j), , They are the horizontal convolution kernel and vertical convolution kernel of the Sobel operator respectively;

[0037] a2, calculate the gradient strength G(i,j) of pixel (i,j);

[0038] ,

[0039] a3, calculate the background complexity of grayscale image I;

[0040] .

[0041] Preferably, the LSTM temporal motion feature network comprises two layers of depth-separable convolutional layers, a pooling layer, an LSTM network, a fully connected layer and a Dropout layer, which are arranged in sequence;

[0042] The two-layer depth-separable convolution layer is used to input the RGB image in the image sequence, and perform two depth-separable convolution operations to output local features;

[0043] The pooling layer is used to downsample the local features to obtain downsampled features;

[0044] The LSTM network is used to input continuous down-sampling features and output LSTM time series features;

[0045] The fully connected layer is used to convert the LSTM time series features into a feature vector of a preset length, and then obtain the time series features through the Dropout layer, and the continuous time series features constitute a time series feature sequence.

[0046] About the LSTM temporal motion feature network: The depth-separable convolution layer and the pooling layer both process a single frame of RGB images. The depth-separable convolution layer extracts the spatial features of each frame, which contain the static information of the fireworks in each frame. After being processed by the pooling layer, the size of the feature map is reduced, the most important features are retained, and the abstractness and robustness of the features are enhanced. The downsampled features obtained by the pooling layer continuously form a set of feature sequences and are sent to the LSTM network. The LSTM network is an existing technology that can capture the temporal dependencies between video frames through memory units and gating mechanisms. Specifically, the LSTM network can learn the dynamic changes of fireworks, such as burning, diffusion, and extinguishing. These changes are the motion features of fireworks. The LSTM temporal features output by the LSTM network are passed to the fully connected layer for integration and mapping to generate higher-level feature representations. The Dropout layer is used to prevent overfitting and improve the generalization ability of the model. The temporal features obtained by the LSTM temporal motion feature network can be understood as temporal motion features containing the motion features of fireworks.

[0047] Compared with the prior art, the advantages of the present invention are:

[0048] The present invention targets the spatial features and unique temporal features of smoke and flame targets, and dynamically fuses the two features according to the complexity of the detection background. This fusion not only improves the efficiency and expression depth of feature extraction, but also significantly enhances the model's ability to capture target details, thereby greatly improving the accuracy and robustness of smoke and fire detection. The existence of spatiotemporal fusion features enables the model to maintain excellent adaptability and generalization performance in complex and changing environments, effectively suppresses false alarms and missed alarms, and significantly enhances the overall accuracy and reliability of the smoke and fire monitoring system.

[0049] The present invention introduces an edge detection algorithm to detect the background complexity of the image to dynamically adjust the fusion weights of temporal features and spatial features. The present invention focuses on temporal features when the background complexity is high, focuses on spatial features when the background complexity is low, and evenly distributes the weights when the background complexity is close to T. This is because, when the video background is more complex, more attention should be paid to temporal features to avoid interference objects such as clouds, lights and other objects with higher brightness being misdetected as smoke or flames; when the video background is simpler, it means that there are fewer interference objects, and more attention should be paid to targets that meet the spatial visual characteristics.

[0050] The present invention is based on a lightweight NanoDet-Plus network, combined with a simple edge detection algorithm and an LSTM network. The overall lightweight design enables it to have higher operating efficiency and faster response speed on mobile devices and embedded systems, so that smoke and fire monitoring can be carried out more in real time, providing more timely support for safety monitoring and disaster prevention. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] Figure 1 The structure diagram of the dynamic fusion detection network for spatiotemporal features;

[0052] Figure 2 This is the LSTM temporal motion feature network structure diagram. DETAILED DESCRIPTION

[0053] The present invention will be further described below in conjunction with the accompanying drawings.

[0054] Example 1: See Figure 1 , Figure 2 ,A fireworks detection method with lightweight spatiotemporal feature dynamic fusion includes the following steps;

[0055] S1, construct fireworks video dataset;

[0056] Obtain video segments containing smoke and / or flames in different scenes, and process the video segments into image sequences. The processing method for one video segment is as follows:

[0057] Decompose the video segment into multiple single-frame RGB images, sort them by time to obtain an image sequence, manually annotate each RGB image in the image sequence to obtain annotation information, the annotation information includes the target position, target category and sequence number, the targets include smoke and flame, and the sequence number of the kth RGB image in the image sequence is k;

[0058] The labeled image sequences form a fireworks video dataset;

[0059] S2, construct a spatiotemporal feature dynamic fusion detection network;

[0060] It includes an edge detection network, an LSTM temporal motion feature network, a NanoDet-plus network and a spatiotemporal feature fusion layer, wherein the NanoDet-plus network includes a NanoDet-plus backbone network, a NanoDet-plus feature fusion network and a NanoDet-plus detection head;

[0061] The edge detection network is used to convert the input RGB image into a grayscale image and then use the Sobel edge detection algorithm to perform edge detection, and output the background complexity of the grayscale image;

[0062] The LSTM temporal motion feature network is used to input an image sequence, extract the temporal features of each RGB image, and form a temporal feature sequence;

[0063] The NanoDet-plus backbone network and the NanoDet-plus feature fusion network are used to input an image sequence, extract the spatial features of each RGB image, and form a spatial feature sequence;

[0064] The spatiotemporal feature fusion layer generates the weights of temporal features and spatial features according to the background complexity, fuses the temporal features and spatial features, and obtains spatiotemporal fusion features, where the kth RGB image P in the image sequence k The background complexity of the corresponding grayscale image is C k , P k The corresponding time series characteristics are The spatial characteristics are , its spatiotemporal fusion feature F k , obtained according to steps S21 to S23;

[0065] S21, calculate C k The relative deviation of ;

[0066] ,

[0067] Where T is the preset complexity threshold;

[0068] S22, calculation Weight and Weight ;

[0069] ,

[0070] ,

[0071] In the formula, is the sigmoid function, α is the adjustment parameter;

[0072] S23, calculate P k The spatiotemporal fusion feature F k ;

[0073] ,

[0074] The NanoDet-plus detection head is used to input spatiotemporal fusion features and output predicted target positions and target categories;

[0075] S3, using the fireworks video dataset to train the spatiotemporal feature dynamic fusion detection network, inputting an image sequence each time for training, and taking the annotation information corresponding to each RGB image as the expected output, training the spatiotemporal feature dynamic fusion detection network until convergence, and obtaining the fireworks detection model;

[0076] S4, obtains the video segment to be identified, processes it into an image sequence, and processes it frame by frame by the fireworks detection model. For each frame of RGB image, the predicted target position and target category are output.

[0077] In the present invention, after decomposing the video segment into multiple single-frame RGB images, the RGB images are preprocessed, specifically, the RGB images are adjusted to a size of 416×416 and the pixel values ​​are normalized to the interval [0, 1].

[0078] In the edge detection network, the background complexity is obtained according to steps a1 to a3;

[0079] a1, if the size of the grayscale image I corresponding to an RGB image is H×W, the horizontal gradient value of the pixel (i, j) in the i-th row and j-th column of the grayscale image I is calculated according to the following formula: , vertical gradient value ;

[0080] ,

[0081] ,

[0082] In the formula, is the 3×3 neighborhood of pixel (i,j), , They are the horizontal convolution kernel and vertical convolution kernel of the Sobel operator respectively;

[0083] a2, calculate the gradient strength G(i,j) of pixel (i,j);

[0084] ,

[0085] a3, calculate the background complexity of grayscale image I;

[0086] .

[0087] The LSTM temporal motion feature network includes two layers of depth-separable convolutional layers, a pooling layer, an LSTM network, a fully connected layer and a Dropout layer, which are arranged in sequence;

[0088] The two-layer depth-separable convolution layer is used to input the RGB image in the image sequence, and perform two depth-separable convolution operations to output local features;

[0089] The pooling layer is used to downsample the local features to obtain downsampled features;

[0090] The LSTM network is used to input continuous down-sampling features and output LSTM time series features;

[0091] The fully connected layer is used to convert the LSTM time series features into a feature vector of a preset length, and then obtain the time series features through the Dropout layer, and the continuous time series features constitute a time series feature sequence.

[0092] Convert the RGB image to grayscale, that is, grayscale processing of the image.

[0093] Example 2: See Figure 1 and Figure 2 On the basis of Example 1, comparative experiments were conducted using the method of the present invention and several common models.

[0094] First, construct a fireworks video dataset: select multiple videos containing fireworks from the Internet, and use video processing tools to decompose the videos into single-frame image sequences. Make sure that the frequency of extracted frames is high enough to capture the dynamic changes of fireworks. Use annotation tools to manually annotate the fireworks targets in each frame. The annotation information includes the location and category of the target object and the sequence of video frames. Resize the image to 416×416 and normalize the pixel value to the [0,1] interval. Ensuring the consistency of input data is conducive to model training and reasoning. Divide the annotated image sequence into a training set and a validation set in a ratio of 8:2. It is necessary to ensure that both the training set and the validation set are continuous image sequences and the order cannot be disrupted, otherwise the temporal motion features cannot be extracted.

[0095] The training set is sent to the five models in Table 1 for training. The number of target categories is set to 2, namely smoke and fire. In the program, the number of target categories is num_class, smoke is smoke, fire is fire, and the number of iterations is set to 300. After the training is completed, the validation set is used to verify and test various indicators to evaluate the performance of the model. Finally, the five trained models are used for target recognition, and their parameters are compared as shown in Table 1:

[0096] Table 1: Comparison of different model parameters

[0097] Model Precision Recall mAP@0.5 Params FLOPS PicoDet 75.76% 73.92% 66.10% 1.35M 1.23G YOLOV5-n 78.18% 80.67% 69.14% 3.1M 4.5G YOLOX-Nano 72.22% 74.14% 64.63% 2.41M 2.35G Nanodet-Plus 78.63% 79.32% 69.47% 2.43M 2.94G The present invention 89.63% 88.32% 78.70% 2.54M 3.11G

[0098] In Table 1, Precision is the accuracy, Recall is the recall, mAP@0.5 is the average precision with an IoU threshold of 0.5, Params is the number of model parameters, and FLOPS is the amount of model calculation.

[0099] As can be seen from Table 1, on the same fireworks video, the present invention has higher precision, recall and mean average precision (mAP@0.5) than several other different lightweight target detection models. Compared with the four models of PicoDet, YOLOV5-n, YOLOX-Nano and Nanodet-Plus, the present invention has achieved the best performance in the three indicators of precision, recall and mAP@0.5. In addition, although the number of parameters of the present invention is slightly higher than that of some models, the amount of calculation required is relatively small. This means that while ensuring high recognition performance, the present invention also has good computing resource utilization, can effectively reduce the computing burden, and is conducive to deployment on devices with limited computing resources.

[0100] The present invention can be used not only in common fire-prone areas such as urban buildings and forest areas, but also in some special scenarios, such as fire monitoring in industrial production processes and transportation. By timely discovering and handling fireworks, the losses caused by fire can be minimized, social stability and sustainable development can be guaranteed, and people's lives can be provided with safer and more reliable protection.

[0101] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for detecting fireworks by dynamically fusion of lightweight spatiotemporal features, characterized by: The steps include: S1, construct fireworks video dataset; Obtain video segments containing smoke and / or flames in different scenes, and process the video segments into image sequences. The processing method for one video segment is as follows: Decompose the video segment into multiple single-frame RGB images, sort them by time to obtain an image sequence, manually annotate each RGB image in the image sequence to obtain annotation information, the annotation information includes the target position, target category and sequence number, the targets include smoke and flame, and the sequence number of the kth RGB image in the image sequence is k; The labeled image sequences form a fireworks video dataset; S2, construct a spatiotemporal feature dynamic fusion detection network; It includes an edge detection network, an LSTM temporal motion feature network, a NanoDet-plus network and a spatiotemporal feature fusion layer, wherein the NanoDet-plus network includes a NanoDet-plus backbone network, a NanoDet-plus feature fusion network and a NanoDet-plus detection head; The edge detection network is used to convert the input RGB image into a grayscale image and then use the Sobel edge detection algorithm to perform edge detection, and output the background complexity of the grayscale image; The LSTM temporal motion feature network is used to input an image sequence, extract the temporal features of each RGB image, and form a temporal feature sequence; The NanoDet-plus backbone network and the NanoDet-plus feature fusion network are used to input an image sequence, extract the spatial features of each RGB image, and form a spatial feature sequence; The spatiotemporal feature fusion layer generates the weights of temporal features and spatial features according to the background complexity, fuses the temporal features and spatial features, and obtains spatiotemporal fusion features, where the kth RGB image P in the image sequence k The background complexity of the corresponding grayscale image is C k , P k The corresponding time series characteristics are The spatial characteristics are , its spatiotemporal fusion feature F k , obtained according to steps S21 to S23; S21, calculate C k The relative deviation of ; , Where T is the preset complexity threshold; S22, calculation Weight and Weight ; , , In the formula, is the sigmoid function, α is the adjustment parameter; S23, calculate P k The spatiotemporal fusion feature F k ; , The NanoDet-plus detection head is used to input spatiotemporal fusion features and output predicted target positions and target categories; S3, using the fireworks video dataset to train the spatiotemporal feature dynamic fusion detection network, inputting an image sequence each time for training, and taking the annotation information corresponding to each RGB image as the expected output, training the spatiotemporal feature dynamic fusion detection network until convergence, and obtaining the fireworks detection model; S4, obtains the video segment to be identified, processes it into an image sequence, and processes it frame by frame by the fireworks detection model. For each frame of RGB image, the predicted target position and target category are output.

2. The method for detecting fireworks by dynamically fusion of lightweight spatiotemporal features according to claim 1, characterized in that: After decomposing the video segment into multiple single-frame RGB images, the RGB images are also preprocessed. Specifically, the RGB images are adjusted to a size of 416×416 and the pixel values ​​are normalized to the interval [0,1].

3. The method for detecting fireworks by dynamically fusion of lightweight spatiotemporal features according to claim 1, characterized in that: In the edge detection network, the background complexity is obtained according to steps a1 to a3; a1, if the size of the grayscale image I corresponding to an RGB image is H×W, the horizontal gradient value of the pixel (i, j) in the i-th row and j-th column of the grayscale image I is calculated according to the following formula: , vertical gradient value ; , , In the formula, is the 3×3 neighborhood of pixel (i,j), , They are the horizontal convolution kernel and vertical convolution kernel of the Sobel operator respectively; a2, calculate the gradient strength G(i,j) of pixel (i,j); , a3, calculate the background complexity of grayscale image I; 。 4. The method for detecting fireworks by dynamically fusion of lightweight spatiotemporal features according to claim 1, characterized in that: The LSTM temporal motion feature network includes two layers of depth-separable convolutional layers, a pooling layer, an LSTM network, a fully connected layer and a Dropout layer, which are arranged in sequence; The two-layer depth-separable convolution layer is used to input the RGB image in the image sequence, and perform two depth-separable convolution operations to output local features; The pooling layer is used to downsample the local features to obtain downsampled features; The LSTM network is used to input continuous down-sampling features and output LSTM time series features; The fully connected layer is used to convert the LSTM time series features into a feature vector of a preset length, and then obtain the time series features through the Dropout layer, and the continuous time series features constitute a time series feature sequence.