A dynamic fireworks detection method and system based on self-supervised contrast learning

By employing self-supervised comparative learning and feature difference analysis, the problems of high false alarm rate and large computational cost in fireworks detection are solved, achieving high-precision, low-false-alarm-rate real-time fireworks detection, which is suitable for industrial sites and forest scenarios.

CN122454477APending Publication Date: 2026-07-24DALIAN MARITIME UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
DALIAN MARITIME UNIVERSITY
Filing Date
2026-04-15
Publication Date
2026-07-24

AI Technical Summary

Technical Problem

Existing smoke detection methods suffer from high false alarm rates, difficulty in distinguishing smoke from visual interference targets, and high computational costs, making it difficult to meet real-time detection requirements.

Method used

A self-supervised contrastive learning method is adopted. By constructing a dynamic fireworks dataset, a ResNet50 encoder is trained to learn the temporal evolution features of fireworks targets and the differences in static features of false alarm targets. Combined with the DIoU matching algorithm and cosine similarity calculation, cross-frame target association and false alarm filtering are achieved.

Benefits of technology

It achieves a false alarm rate of less than 1% and high real-time performance in smoke and fire detection, making it suitable for complex scenarios and reducing data acquisition costs and computational overhead.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122454477A_ABST
    Figure CN122454477A_ABST
Patent Text Reader

Abstract

The application discloses a dynamic firework detection method and system based on self-supervised contrast learning, and relates to the technical field of computer vision and fire safety. In view of the problem that the existing firework detection technology has a high false alarm rate in a complex scene and is difficult to distinguish real fireworks from visual interference targets, the application realizes accurate modeling of dynamic characteristics of firework targets and effective filtering of false alarm targets by constructing a dynamic firework dataset, training a self-supervised contrast learning encoder and designing a cross-frame target tracking and feature similarity discrimination mechanism. The application first performs target cropping and edge enhancement preprocessing on continuous frame firework videos, then detects firework time evolution characteristics by using a ResNet50 encoder trained based on a MoCo v2 framework, and finally completes the distinction between real fireworks and false alarm targets through a three-stage post-processing process of information caching, DIoU target tracking and cosine similarity calculation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of computer vision, deep learning and fire safety technology, specifically to a dynamic smoke and fire detection method and system based on self-supervised comparative learning, which is applicable to real-time smoke and fire detection and early warning in scenarios such as industrial production sites, forest reserves, high-rise buildings, and transportation hubs. Background Technology

[0002] Fire, as a sudden and destructive disaster, seriously threatens people's lives and property and public safety. Traditional smoke and fire detection mainly relies on smoke sensors, temperature sensors, and other equipment, which suffer from drawbacks such as slow response and susceptibility to environmental interference. Although visual detection methods based on static images can achieve real-time detection, in complex scenes, targets such as yellow safety helmets, incandescent lamps, and clouds are highly similar to smoke and fire in color and shape. Relying solely on single-frame static features is insufficient for effective differentiation, resulting in a high false alarm rate and seriously affecting the reliability and engineering practicality of the detection system.

[0003] Existing dynamic smoke detection methods are mostly based on optical flow, frame difference, or LSTM networks to model temporal features. However, optical flow is prone to generating pseudo-motion features in scenarios such as smoke diffusion, and LSTM networks rely on a large amount of labeled data and have high computational costs, making it difficult to meet real-time detection requirements. Self-supervised contrastive learning technology does not require manual annotation and achieves feature differentiation by mining the temporal features of the data itself, providing a new technical path for dynamic smoke detection. However, there is currently no mature solution for using it to dynamically distinguish between smoke and false alarm targets. There is an urgent need for a dynamic smoke detection method that balances detection accuracy, real-time performance, and a low false alarm rate. Summary of the Invention

[0004] To address the problems of high false alarm rates, difficulty in distinguishing between fireworks and visual interference targets, and high computational costs in existing technologies, this invention provides a dynamic fireworks detection method and system based on self-supervised contrastive learning. By modeling the temporal evolution characteristics of fireworks targets and the differences in static characteristics of falsely reported targets, high-precision, low-false-alarm, and real-time dynamic fireworks detection is achieved. The technical means employed in this invention are as follows:

[0005] A dynamic fireworks detection method based on self-supervised contrastive learning includes: Constructing a dynamic fireworks dataset: Select video sequences containing real fireworks and typical false alarm targets, extract continuous frame images at a preset frame sampling frequency, crop the target region based on the detection box coordinates, use the Sobel edge detection algorithm to extract the target edge features and convert them into grayscale images to construct a dynamic fireworks dataset; The training process of the self-supervised contrastive learning encoder is as follows: The MoCo v2 framework is used as the training sample based on the constructed dataset. The positive sample is the enhanced image of the same target, and the negative sample is the images of fireworks or false alarm targets in different frames. The ResNet50 encoder is trained so that the encoder learns the temporal evolution features of the fireworks target and the static feature differences of the false alarm targets. Post-processing of detection results: A unique identifier (ID) is assigned to the first suspected fireworks target appearing in the video stream. The detection box coordinates and feature vectors extracted by the encoder are stored. The DIoU matching algorithm is used to calculate the matching degree between the detection box in the current frame and the historical cached detection boxes to realize cross-frame target association and ID inheritance. The historical feature vectors of the same ID and the feature vectors in the current frame are retrieved, and the cosine similarity is calculated. If the similarity is ≤ a preset threshold, it is determined to be a real fireworks target; otherwise, it is determined to be a false alarm target and filtered out.

[0006] Furthermore, the preset frame sampling frequency is T1 frames / second, and the typical false alarm targets include yellow safety helmets, incandescent lamps, clouds, gray work clothes, and red static objects.

[0007] Furthermore, when extracting target edge features, the corresponding region in the image is cropped based on the coordinates of the suspected fireworks target detection box output by the static detection network, and redundant background information is filtered out. After cropping, the target region image size is uniformly N×N pixels.

[0008] Furthermore, the training parameters of the MoCo v2 framework are set as follows: learning rate T2, temperature coefficient T3, momentum coefficient of momentum encoder T4, dynamic dictionary queue capacity T5, training epochs T6, and an early-stop mechanism is adopted, which stops training when the validation set score has no improvement for T7 consecutive epochs.

[0009] Furthermore, the Score metric is used to evaluate the encoder's feature discrimination capability, and is calculated as follows:

[0010] In the formula, M and N are the number of sample pairs and the total number of samples in the similar sample set, respectively; U and V are the number of sample pairs and the total number of samples in the dissimilar sample set, respectively; and S(i,i+j) is the feature cosine similarity between the target in frame i and frame i+j.

[0011] Furthermore, the matching threshold of the DIoU matching algorithm is T8. If the DIoU value of the current frame detection box and the historical cache detection box is ≥ T8, they are determined to be the same target and inherit the ID.

[0012] A dynamic fireworks detection system based on self-supervised contrastive learning includes: The dataset construction module is used to select video sequences containing real fireworks and typical false alarm targets, extract continuous frame images at a preset frame sampling frequency, crop the target region based on the detection box coordinates, extract the target edge features using the Sobel edge detection algorithm and convert them into grayscale images to construct a dynamic fireworks dataset. The encoder training module constructs the MoCo v2 framework, builds training samples based on the dynamic fireworks dataset, trains the ResNet50 encoder, and outputs the optimal model. The information caching module is used to store the ID, detection box coordinates, and feature vector of suspected fireworks targets; Target tracking module: Employs the DIoU matching algorithm to achieve cross-frame target association and ID inheritance; The similarity discrimination module calculates the cosine similarity between the historical and current feature vectors of the same ID, and outputs the actual firework target detection results and false alarm filtering results. Output module: Visualizes real-world fireworks target detection boxes, triggers warning signals, and saves relevant frame images.

[0013] Furthermore, the system also includes a static detection module, which uses an improved YOLOv10 network to output suspected fireworks target detection boxes with a confidence level ≥ T9, which serve as inputs to the dataset construction module and the information caching module.

[0014] This invention also provides a dynamic smoke detection method and system based on self-supervised contrastive learning. This method offers the following advantages: by modeling the differences between the dynamic features of smoke and the static features of false alarm targets through self-supervised contrastive learning, the false alarm rate is reduced to below 1%, approximately 20 percentage points lower than traditional static detection methods. The encoder in this method employs a lightweight architecture such as ResNet50, resulting in low computational overhead in the post-processing workflow. The overall system frame rate (FPS) is ≥60, meeting the real-time detection requirements of scenarios such as industrial sites and forests. Furthermore, the method eliminates the need for manual annotation in constructing the dynamic dataset, automatically generating training samples through static detection box clipping and edge enhancement, reducing data acquisition costs. Finally, this method covers various typical false alarm targets and complex scenarios, and the model can adapt to extreme conditions such as heavy fog, backlighting, and occlusion, making it widely applicable. Attached Figure Description

[0015] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0016] Figure 1 is a flowchart of the dynamic smoke detection method of the present invention; Figure 2 is an example diagram of the dynamic fireworks dataset of the present invention; Figure 3 is a diagram of the training framework of the MoCo v2 encoder of the present invention; Figure 4 is a schematic diagram of the post-processing flow of the detection results of the present invention; Figure 5 shows a comparison between the dynamic smoke detection and static detection of the present invention. Figure 6 is a comparison of the false alarm rates of the present invention and the static smoke detection method. Detailed Implementation

[0017] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0018] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0019] like Figure 1 As shown, this invention provides a dynamic fireworks detection method based on self-supervised contrastive learning, specifically including the following steps: S1: Construction of dynamic fireworks dataset: Select data including flame videos, smoke videos (covering the fireworks diffusion process at different scales and in different scenes) and false alarm videos (including typical interference targets such as yellow safety helmets, incandescent lamps, clouds, and gray work clothes), and extract frames at a frequency of T1 frames / second to ensure that adjacent frames retain the dynamic change characteristics of fireworks while avoiding feature redundancy caused by excessively small differences between frames.

[0020] Based on the coordinates of the detection boxes output by the static detection network, the target region image is cropped (with a uniform size of N×N pixels) and redundant background information is filtered out. The Sobe edge detection algorithm is used to extract the target edge features and convert them into grayscale images to weaken color interference. Finally, a dynamic fireworks dataset containing about 20,000 images is constructed, including 1.6 training images and 4,000 test images.

[0021] S2: Self-supervised contrastive learning encoder training: The training model is built based on the MoCo v2 framework, using ResNet50 or other similar convolutional networks as the backbone network, and the query encoder and momentum encoder are set to have the same structure. Positive sample construction: For the same frame of target image, only random cropping (cropping ratio is fixed at 1) is used for enhancement to ensure that positive samples retain the consistency of target structure and simulate the static features of false alarm targets; Negative sample construction: Historical features output by the momentum encoder are cached through a dynamic queue with a queue capacity of 65536 to ensure the diversity of negative samples; Training parameters: learning rate T2, temperature coefficient T3, momentum coefficient T4, batch size T5, training epochs T6, introducing an early-stop mechanism, which stops training when the validation set score shows no improvement for T7 consecutive epochs.

[0022] During training, the InfoNCE loss function minimizes the feature distance between positive sample pairs and maximizes the feature distance between negative sample pairs, enabling the encoder to learn the core difference features between the "dynamic edge perturbation" of the pyrotechnic target and the "static structural stability" of the false alarm target.

[0023] S3: The DIoU matching algorithm is used to calculate the matching degree between the current frame detection box and the historical detection boxes in the Boxes dictionary. The DIoU calculation method is as follows:

[0024] In the formula, IoU is the overlap area ratio of the detection boxes, ρ is the Euclidean distance between the center points of the detection boxes, and c is the length of the diagonal of the minimum bounding rectangle. When DIoU≥T8, it is determined to be the same target, the historical ID is inherited, and the feature vector in the Features dictionary is updated; otherwise, it is determined to be a new target, and the information caching process is executed.

[0025] Similarity discrimination module Retrieve the historical feature vectors and the current frame feature vector for the same ID, and calculate the cosine similarity:

[0026] In the formula, A is the historical feature vector, and B is the feature vector of the current frame. When cosθ≤0.7, it is determined to be a real firework target (with significant dynamic changes), the detection result is output, and an early warning is triggered; when cosθ>0.7, it is determined to be a false alarm target (with a statically stable structure), and the detection box is filtered out.

[0027] A dynamic fireworks detection system based on self-supervised contrastive learning includes: The dataset construction module is used to select video sequences containing real fireworks and typical false alarm targets, extract continuous frame images at a preset frame sampling frequency, crop the target region based on the detection box coordinates, extract the target edge features using the Sobel edge detection algorithm and convert them into grayscale images to construct a dynamic fireworks dataset. The encoder training module constructs the MoCo v2 framework, builds training samples based on the dynamic fireworks dataset, trains the ResNet50 encoder, and outputs the optimal model. The information caching module is used to store the ID, detection box coordinates, and feature vector of suspected fireworks targets; Target tracking module: Employs the DIoU matching algorithm to achieve cross-frame target association and ID inheritance; The similarity discrimination module calculates the cosine similarity between the historical and current feature vectors of the same ID, and outputs the actual firework target detection results and false alarm filtering results. Output module: Visualizes real-world fireworks target detection boxes, triggers warning signals, and saves relevant frame images.

[0028] Furthermore, the system also includes a static detection module, which uses an improved YOLOv10 network to output suspected fireworks target detection boxes with a confidence level ≥ T9, which serve as inputs to the dataset construction module and the information caching module.

[0029] Example S1. Experimental Environment Hardware environment: CPU is Intel i9-13900H, GPU is NVIDIA RTX4060; Software environment: Python 3.8, PyTorch 2.0, CUDA 12.1, OpenCV 4.8.0.

[0030] S2. Dataset Construction Thirty fire videos (including forest fires, indoor fires, and vehicle fires), ten smoke videos (including rapidly spreading and slowly spreading smoke), and six false alarm videos (including yellow safety helmets, incandescent lamps, clouds, gray work clothes, red fire extinguishers, and static red objects) were selected, with a total duration of approximately 58 minutes. Frames were extracted at 15 frames per second, resulting in 15,657 images. These images were cropped to 224×224 pixels, and after Sobel edge detection and grayscale conversion, they were divided into training and test sets in an 8:2 ratio.

[0031] S3. Encoder Training A ResNet50 encoder was trained based on the MoCo v2 framework with the following parameters: learning rate 0.06, temperature coefficient 0.05, momentum coefficient 0.999, batch size 32, and 100 training epochs. An early-stop mechanism (patience=10) was introduced. During training, the validation set score reached a maximum of 0.5193, indicating that the encoder can effectively distinguish between similar and dissimilar sample features. After training, the encoder's feature extraction time on the test set was ≤10ms / frame.

[0032] S4. System Testing The test set included 49 false alarm videos (22 minutes and 30 seconds) and 60 real fireworks videos (26 minutes). The test results are as follows: (1) False alarm filtering performance: In a scenario with only false alarms, the false alarm rate decreased from 21.00% of the baseline model to 1.02%; (2) Detection performance: In real-world fireworks scenarios, the recall rate increased from 95.80% to 95.95%; (3) Real-time performance: The overall FPS of the system is 69, which meets the requirements for real-time detection.

[0033] This invention achieves accurate modeling of the dynamic features of fireworks targets and effective filtering of false alarms by constructing a dynamic fireworks dataset, training a self-supervised contrastive learning encoder, and designing a cross-frame target tracking and feature similarity discrimination mechanism. The invention first performs target cropping and edge enhancement preprocessing on consecutive frames of fireworks video. Then, it uses the MoCo v2 framework to train a ResNet50 encoder to learn the temporal evolution features of fireworks. Finally, through a three-stage post-processing process of information caching, DIoU target tracking, and cosine similarity calculation, it distinguishes between real fireworks and false alarms. Experimental results show that this invention maintains a fireworks recall rate of over 95% while reducing the false alarm rate to below 1.02%, and the inference speed meets the requirements of real-time detection. It is suitable for fireworks early warning in complex scenarios such as industrial sites, forests, and buildings.

[0034] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0035] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0036] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.

[0037] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0038] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0039] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A dynamic fireworks detection method based on self-supervised contrastive learning, characterized in that, include: Constructing a dynamic fireworks dataset: Select video sequences containing real fireworks and typical false alarm targets, extract continuous frame images at a preset frame sampling frequency, crop the target region based on the detection box coordinates, use the Sobel edge detection algorithm to extract the target edge features and convert them into grayscale images to construct a dynamic fireworks dataset; The training process of the self-supervised contrastive learning encoder is as follows: The MoCo v2 framework is used as the training sample based on the constructed dataset. The positive sample is the enhanced image of the same target, and the negative sample is the images of fireworks or false alarm targets in different frames. The ResNet50 encoder is trained so that the encoder learns the temporal evolution features of the fireworks target and the static feature differences of the false alarm targets. Post-processing of detection results: A unique identifier (ID) is assigned to the first suspected fireworks target appearing in the video stream. The detection box coordinates and feature vectors extracted by the encoder are stored. The DIoU matching algorithm is used to calculate the matching degree between the detection box in the current frame and the historical cached detection boxes to realize cross-frame target association and ID inheritance. The historical feature vectors of the same ID and the feature vectors in the current frame are retrieved, and the cosine similarity is calculated. If the similarity is ≤ a preset threshold, it is determined to be a real fireworks target; otherwise, it is determined to be a false alarm target and filtered out.

2. The dynamic fireworks detection method based on self-supervised contrastive learning according to claim 1, characterized in that: The preset frame sampling frequency is T1 frames / second, and the typical false alarm targets include yellow safety helmets, incandescent lamps, clouds, gray work clothes, and red static objects.

3. The dynamic fireworks detection method based on self-supervised contrastive learning according to claim 1, characterized in that: When extracting target edge features, the corresponding region in the image is cropped based on the coordinates of the suspected fireworks target detection box output by the static detection network, and redundant background information is filtered out. After cropping, the target region image size is uniformly N×N pixels.

4. The dynamic fireworks detection method based on self-supervised contrastive learning according to claim 1, characterized in that: The training parameters of the MoCo v2 framework are set as follows: learning rate T2, temperature coefficient T3, momentum coefficient of momentum encoder T4, dynamic dictionary queue capacity T5, training epochs T6, and an early-stop mechanism is adopted, which stops training when the validation set score has no improvement for T7 consecutive epochs.

5. The dynamic fireworks detection method based on self-supervised contrastive learning according to claim 4, characterized in that: The Score metric is used to evaluate the encoder's feature discrimination capability, and is calculated as follows: In the formula, M and N are the number of sample pairs and the total number of samples in the similar sample set, respectively; U and V are the number of sample pairs and the total number of samples in the dissimilar sample set, respectively; and S(i,i+j) is the feature cosine similarity between the target in frame i and frame i+j.

6. The dynamic fireworks detection method based on self-supervised contrastive learning according to claim 4, characterized in that: The matching threshold of the DIoU matching algorithm is T8. If the DIoU value of the current frame detection box and the historical cache detection box is ≥ T8, they are determined to be the same target and inherit the ID.

7. A dynamic fireworks detection system based on self-supervised contrastive learning, characterized in that... include: The dataset construction module is used to select video sequences containing real fireworks and typical false alarm targets, extract continuous frame images at a preset frame sampling frequency, crop the target region based on the detection box coordinates, extract the target edge features using the Sobel edge detection algorithm and convert them into grayscale images to construct a dynamic fireworks dataset. The encoder training module constructs the MoCo v2 framework, builds training samples based on the dynamic fireworks dataset, trains the ResNet50 encoder, and outputs the optimal model. The information caching module is used to store the ID, detection box coordinates, and feature vector of suspected fireworks targets; Target tracking module: Employs the DIoU matching algorithm to achieve cross-frame target association and ID inheritance; The similarity discrimination module calculates the cosine similarity between the historical and current feature vectors of the same ID, and outputs the actual firework target detection results and false alarm filtering results. Output module: Visualizes real-world fireworks target detection boxes, triggers warning signals, and saves relevant frame images.

8. A dynamic fireworks detection system based on self-supervised contrastive learning according to claim 7, characterized in that: The system also includes a static detection module, which uses an improved YOLOv10 network to output suspected fireworks target detection boxes with a confidence level ≥ T9, which serve as inputs to the dataset construction module and the information caching module.