Adaptive Multi-Scale Dynamic Fire Detection Method and System Based on Few-Sample Learning

By combining few-shot learning and multi-scale dynamic feature extraction with contrastive learning and visual encoder, a scene-specific model is generated, which solves the problems of insufficient dynamic behavior feature capture and poor scene adaptability in fire detection, and achieves efficient fire detection with low false alarms.

CN121330620BActive Publication Date: 2026-03-06SHANGHAI TECHN INST OF ELECTRONICS & INFORMATION
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511883750.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-15
Publication Date
2026-03-06
Estimated Expiration
2045-12-15

AI Technical Summary

Technical Problem

Existing fire detection methods are unable to effectively capture the dynamic behavior characteristics of fires, resulting in a high false alarm rate. Furthermore, they lack generalization ability across different scenarios and cannot adapt to the ever-changing real-world environment.

Method used

An adaptive multi-scale dynamic fire detection method based on few-shot learning is adopted. By constructing a multi-scale semantic attribute library, extracting multi-scale dynamic feature maps, and combining contrastive learning and a visual encoder, a scene-specific model is generated for real-time fire detection.

Benefits of technology

It improves the accuracy of flame and smoke detection, reduces the false alarm rate, and can quickly adapt to new scenarios, thus reducing annotation costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121330620B_ABST
    Figure CN121330620B_ABST
Patent Text Reader

Abstract

This invention relates to the fields of computer vision and public safety technology, and in particular to an adaptive multi-scale dynamic fire detection method and system based on few-shot learning. The method includes: constructing a multi-scale semantic attribute library; generating a multi-scale dynamic feature map based on video sequences, fusing color, temporal motion, and multi-scale optical flow information; acquiring visual and textual feature vectors, and constructing a basic model through cross-modal semantic alignment via contrastive learning; calculating and fusing visual and semantic prototypes to obtain a scene prototype, and fine-tuning the basic model to generate a scene-specific model; acquiring real-time video sequences and calculating real-time multi-scale dynamic feature maps, and extracting the cosine similarity between real-time feature visual vectors and scene prototypes, thereby performing real-time fire detection. Because multi-scale optical flow information is extracted, it can accurately capture dynamic characteristics across all scales, from microscopic flickering to macroscopic spread, enabling efficient fire detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of computer vision and public safety technology, and in particular to an adaptive multi-scale dynamic fire detection method and system with few-sample learning. Background Technology

[0002] In fire safety monitoring, image- or video-based fire detection technology aims to achieve early and accurate fire alarms by analyzing visual data. Traditional fire detection systems often rely on physical sensors, while vision-based detection methods have attracted widespread attention due to their advantages such as non-contact operation and wide monitoring range. Currently, most image-based fire detection methods focus on single-frame static images as the core analysis object. However, this static analysis mode struggles to effectively capture and utilize the unique dynamic behavioral characteristics of fires, such as the irregular flickering and spread of flames, and the dynamic diffusion patterns of smoke. Due to the lack of analysis of temporal dynamic characteristics, these methods have a weak ability to distinguish static interference with similar colors or textures, resulting in a high false alarm rate in practical applications and seriously affecting the reliability of the system.

[0003] In fire detection, mainstream technologies mostly employ supervised learning paradigms, whose performance heavily relies on large-scale, high-quality, and accurately labeled training datasets. However, fire scenarios are diverse. While a model may perform well in scenarios covered by the training set (such as specific viewpoints, lighting, and geographical environments), it struggles to effectively generalize to unfamiliar new scenarios. For example, changing camera models, perspective variations, lighting differences due to day or night or season, and different natural environmental backgrounds can all lead to significant performance degradation. This contradiction between high data dependence and insufficient generalization ability limits the technology's universality in the ever-changing real world. Existing models often employ fixed network structures or perform feature analysis at a single scale, making it difficult to effectively handle the vast scale variations exhibited by fire targets in images, thus affecting the comprehensiveness and accuracy of detection. When a trained model needs to be deployed to a new and significantly different monitoring scenario, its performance often fails to meet requirements.

[0004] Therefore, traditional fire detection methods often suffer from low data utilization, high detection costs, and high false alarm rates because they do not fully incorporate the dynamic characteristics of fires, make insufficient use of dynamic information, and lack adaptation mechanisms for different fire target scales. Summary of the Invention

[0005] Based on this, in order to solve the above-mentioned technical problems, an adaptive multi-scale dynamic fire detection method and system with few-sample learning is provided, which can take into account efficient data utilization and dynamic feature mining, and achieve high-performance, low-false-alarm adaptive fire detection.

[0006] An adaptive multi-scale dynamic fire detection method based on few-sample learning, the method comprising:

[0007] Collect fire data, determine the atomic attribute set, scale context set, and attribute relationship set based on the fire data, and construct a multi-scale semantic attribute library based on the atomic attribute set, scale context set, and attribute relationship set;

[0008] The video sequence to be analyzed is obtained, and multi-scale dynamic features are extracted from the video sequence to generate a multi-scale dynamic feature map that integrates color, temporal motion and multi-scale optical flow information.

[0009] Visual feature vectors are obtained based on the multi-scale dynamic feature map, and text feature vectors are obtained based on the multi-scale semantic attribute library. The visual feature vectors and text feature vectors are then semantically aligned across modalities using contrastive learning loss to construct a pre-trained basic model.

[0010] The visual prototype and semantic prototype are calculated and fused according to the multi-scale semantic attribute library to obtain the scene prototype. The parameters of the basic model are optimized to generate a scene-specific model.

[0011] A real-time video sequence is acquired and a real-time multi-scale dynamic feature map is calculated. The visual encoder in the scene-specific model is used to determine the real-time visual feature vector, and the cosine similarity between the real-time visual feature vector and the scene prototype is calculated. Real-time fire detection is performed based on the cosine similarity.

[0012] In one embodiment, determining the set of atomic attributes, the set of scale contexts, and the set of attribute relationships based on the fire data includes:

[0013] Based on the fire data, static visual attributes and dynamic behavioral attributes are defined, and the static visual attributes and dynamic behavioral attributes are combined into an atomic attribute set;

[0014] Each observation scale is defined based on the fire data, and a scale context set is constructed based on each observation scale;

[0015] Establish a mapping function between scale and attribute, construct a combination between scale and attribute, and generate semantic description text as a set of attribute relationships.

[0016] In one embodiment, multi-scale dynamic feature extraction is performed on the video sequence to generate a multi-scale dynamic feature map that integrates color, temporal motion, and multi-scale optical flow information, including:

[0017] For the video sequence, the RGB color channels of the keyframes are extracted;

[0018] The frame difference between video frames in the video sequence is calculated using the three-frame difference method;

[0019] Based on the video sequence, a lightweight deep learning optical flow network is used to calculate optical flow on a multi-scale spatial pyramid to generate multi-scale optical flow information;

[0020] The RGB color channels and frame difference multi-scale optical flow information are spliced ​​and fused to generate a multi-scale dynamic feature map.

[0021] In one embodiment, based on the video sequence, a lightweight deep learning optical flow network is used to calculate optical flow on a multi-scale spatial pyramid to generate multi-scale optical flow information, including:

[0022] Based on the video sequence, a lightweight deep learning optical flow network is used to calculate the fine-scale optical flow, the mid-scale optical flow, and the macro-scale optical flow through scale transformation operations and optical flow calculation functions, respectively.

[0023] The fine-scale optical flow, mid-scale optical flow, and macro-scale optical flow are fused using adaptive weights based on channel attention learning to obtain multi-scale optical flow information.

[0024] In one embodiment, a visual feature vector is obtained based on the multi-scale dynamic feature map, and a text feature vector is obtained based on the multi-scale semantic attribute library. The visual feature vector and the text feature vector are then semantically aligned across modalities using a contrastive learning loss, including:

[0025] The multi-scale dynamic feature map is input into the visual encoder, and the visual feature vector is obtained by encoding through the visual encoder.

[0026] The attribute relationship set in the multi-scale semantic attribute library is input into the text encoder, and the text feature vector is obtained by encoding through the text encoder;

[0027] The contrastive learning loss function is optimized in a shared semantic space, and the visual feature vector and the text feature vector are semantically aligned across modalities using the contrastive learning loss function.

[0028] In one embodiment, a scene prototype is obtained by calculating and fusing a visual prototype and a semantic prototype based on the multi-scale semantic attribute library, and the parameters of the base model are optimized to generate a scene-specific model, including:

[0029] Obtain the target scene and its corresponding support set samples, extract visual features from the support set samples, and calculate the visual prototype;

[0030] Select a semantic description corresponding to the target scene from the multi-scale semantic attribute library, and encode and calculate the semantic prototype;

[0031] The visual prototype and the semantic prototype are weighted and fused to generate a scene prototype of the target scene;

[0032] Based on the scene prototype, the parameters of the base model are optimized using a prompting fine-tuning technique to generate a scene-specific model.

[0033] In one embodiment, a real-time video sequence is acquired and a real-time multi-scale dynamic feature map is calculated. A real-time visual feature vector is determined using a visual encoder in the scene-specific model. The cosine similarity between the real-time visual feature vector and the scene prototype is calculated. Real-time fire detection is performed based on the cosine similarity, including:

[0034] The real-time video sequence of the fire to be detected is obtained, and multi-scale dynamic features are extracted frame by frame from the real-time video sequence to obtain a real-time multi-scale dynamic feature map.

[0035] The real-time multi-scale dynamic feature map is mapped into a real-time visual feature vector using the visual encoder in the scene-specific model.

[0036] Calculate the cosine similarity between the real-time visual feature vector and the scene prototype, and determine the dynamic decision threshold;

[0037] The cosine similarity is compared with the dynamic decision threshold. If the cosine similarity is greater than the dynamic decision threshold, the detection result is a fire.

[0038] In one embodiment, the method further includes:

[0039] Define a confidence interval. When the cosine similarity is within the confidence interval, add the real-time multi-scale dynamic feature map to the hard sample set.

[0040] The scenario prototype and scenario-specific model are periodically optimized using the difficult sample set.

[0041] An adaptive multi-scale dynamic fire detection system with few-sample learning, the system comprising:

[0042] The attribute library construction module is used to collect fire data, determine the atomic attribute set, scale context set, and attribute relationship set based on the fire data, and construct a multi-scale semantic attribute library based on the atomic attribute set, scale context set, and attribute relationship set.

[0043] The feature extraction module is used to acquire the video sequence to be analyzed, perform multi-scale dynamic feature extraction on the video sequence, and generate a multi-scale dynamic feature map that integrates color, temporal motion and multi-scale optical flow information.

[0044] The semantic alignment module is used to obtain visual feature vectors based on the multi-scale dynamic feature map, obtain text feature vectors based on the multi-scale semantic attribute library, and perform cross-modal semantic alignment of the visual feature vectors and the text feature vectors through contrastive learning loss to build a pre-trained basic model.

[0045] The Few-Shot adaptation module is used to calculate and fuse the visual prototype and semantic prototype based on the multi-scale semantic attribute library to obtain the scene prototype, optimize the parameters of the basic model, and generate a scene-specific model.

[0046] The real-time detection module is used to acquire real-time video sequences and calculate real-time multi-scale dynamic feature maps, use the visual encoder in the scene-specific model to determine real-time visual feature vectors, calculate the cosine similarity between the real-time visual feature vectors and the scene prototype, and perform real-time fire detection based on the cosine similarity.

[0047] The aforementioned adaptive multi-scale dynamic fire detection method and system based on few-shot learning can accurately capture dynamic characteristics across all scales, from microscopic flickering to macroscopic spread, by extracting multi-scale optical flow information, significantly improving the detection rate of flames and smoke. By generating multi-scale dynamic feature maps and combining them with contrastive learning for model training, scene prototypes and scene-specific models are constructed, overcoming the limitations of single-scale models and enabling efficient detection of both small nearby fire sources and large-scale fires in the distance. Attached Figure Description

[0048] Figure 1 This is a diagram illustrating the application environment of an adaptive multi-scale dynamic fire detection method based on few-sample learning in one embodiment.

[0049] Figure 2 This is a flowchart illustrating an adaptive multi-scale dynamic fire detection method based on few-sample learning in one embodiment.

[0050] Figure 3 This is a schematic diagram of the multi-scale dynamic feature extraction process in one embodiment;

[0051] Figure 4 This is a schematic diagram of the application system structure of an adaptive multi-scale dynamic fire detection method based on few-sample learning in one embodiment.

[0052] Figure 5 This is a block diagram of an adaptive multi-scale dynamic fire detection system with few-sample learning in one embodiment.

[0053] Figure 6 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0054] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0055] The fire detection method based on multi-scale dynamic perception and few-shot learning provided in this application embodiment can be applied to, for example... Figure 1 The application environment shown. For example... Figure 1 As shown, the application environment includes computer equipment 110. Computer device 110 can collect fire data, determine atomic attribute sets, scale context sets, and attribute relationship sets based on the fire data, and construct a multi-scale semantic attribute library based on the atomic attribute sets, scale context sets, and attribute relationship sets; computer device 110 can acquire video sequences to be analyzed, perform multi-scale dynamic feature extraction on the video sequences, and generate multi-scale dynamic feature maps that fuse color, temporal motion, and multi-scale optical flow information; computer device 110 can obtain visual feature vectors based on the multi-scale dynamic feature maps and text feature vectors based on the multi-scale semantic attribute library, and perform cross-modal semantic alignment of the visual feature vectors and text feature vectors through contrastive learning loss to construct a pre-trained basic model; computer device 110 can calculate and fuse visual prototypes and semantic prototypes according to the multi-scale semantic attribute library to obtain a scene prototype, optimize the parameters of the basic model, and generate a scene-specific model; computer device 110 can acquire real-time video sequences and calculate real-time multi-scale dynamic feature maps, use the visual encoder in the scene-specific model to determine real-time visual feature vectors, calculate the cosine similarity between the real-time visual feature vectors and the scene prototypes, and perform real-time fire detection based on the cosine similarity. Among them, computer equipment 110 may include, but is not limited to, various personal computers, laptops, smartphones, robots, unmanned aerial vehicles, tablets, and other devices.

[0056] In one embodiment, such as Figure 2 As shown, an adaptive multi-scale dynamic fire detection method based on few-shot learning is provided, including the following steps:

[0057] Step 202: Collect fire data, determine the atomic attribute set, scale context set, and attribute relationship set based on the fire data, and construct a multi-scale semantic attribute library based on the atomic attribute set, scale context set, and attribute relationship set.

[0058] Computer devices can first collect datasets and prior knowledge in the field of fire in text form, define and collect atomic properties, and thus build a structured knowledge base.

[0059] In one embodiment, the provided adaptive multi-scale dynamic fire detection method based on few-shot learning may further include the process of constructing a multi-scale dynamic semantic attribute library. The specific process includes: defining static visual attributes and dynamic behavioral attributes based on fire data, and constructing an atomic attribute set by combining the static visual attributes and dynamic behavioral attributes; defining various observation scales based on fire data, and constructing a scale context set based on each observation scale; establishing a mapping function between scale and attribute, constructing a combination between scale and attribute, and generating semantic description text as an attribute relationship set.

[0060] Computer devices can define subsets of static visual attributes and subsets of dynamic behavioral attributes. The static visual attribute subset can be represented as: , Let represent the i-th static attribute, such as "orange-red" or "gray fluffy". A subset of dynamic behavioral attributes can be represented as: , Let j represent the j-th dynamic attribute, such as "blinking" or "diffusion". The resulting set of atomic attributes can be represented as: .

[0061] Computer devices can define three observation scales: fine, medium, and macro, and construct a set of scale contexts: .in, This indicates the fine observation scale, corresponding to the original resolution; This indicates the mid-level observation scale, corresponding to 1 / 2 resolution; This indicates the macroscopic observation scale, corresponding to 1 / 4 resolution.

[0062] Next, the computer device can define a set of attribute relationships. It contains a scale-attribute mapping function. This is used to generate a specific semantic description D. The defined set of attribute relationships can implement a scale-attribute mapping function. ; ; ; in This represents a string concatenation operation. The constructed multi-scale semantic attribute library can be represented as...

[0063] Step 204: Obtain the video sequence to be analyzed, perform multi-scale dynamic feature extraction on the video sequence, and generate a multi-scale dynamic feature map that integrates color, temporal motion and multi-scale optical flow information.

[0064] In one embodiment, the provided adaptive multi-scale dynamic fire detection method based on few-shot learning may further include a multi-scale dynamic feature extraction process, specifically including: for a video sequence, extracting the RGB color channels of key frames; calculating the frame difference of video frames in the video sequence using a three-frame difference method; based on the video sequence, calculating optical flow on a multi-scale spatial pyramid using a lightweight deep learning optical flow network to generate multi-scale optical flow information; and concatenating and fusing the RGB color channels and frame difference multi-scale optical flow information to generate a multi-scale dynamic feature map.

[0065] Computer equipment can acquire the raw video sequences that need to be analyzed. in, Let t represent the video image at frame t. Next, the computer device can normalize each frame: ,in Here are the mean and standard deviation of the dataset.

[0066] like Figure 3 As shown, the computer device can perform triple feature extraction and fusion on the input raw video sequence. The first step is to extract keyframes from the raw video sequence. The RGB color channels; then the frame difference is calculated. ,in, This refers to pixel-by-pixel absolute value calculation. To address the "hole" phenomenon in two-frame differences and extract a more complete internal region of the moving object, the computer can preferentially use the three-frame difference method to calculate the frame difference. Next, the computer can calculate optical flow on a multi-scale spatial pyramid, generating a scale-adaptive optical flow field. The RGB color channels, frame difference, and scale-adaptive optical flow field are stitched together to form a unified feature map, i.e., a multi-scale dynamic feature map. ;in This indicates a splicing operation along the channel dimension.

[0067] In one embodiment, the provided adaptive multi-scale dynamic fire detection method based on few-shot learning may further include a process of calculating multi-scale optical flow. The specific process includes: based on the video sequence, using a lightweight deep learning optical flow network, calculating fine-scale optical flow, mid-scale optical flow, and macro-scale optical flow respectively through scale transformation operations and optical flow calculation functions; fusing the fine-scale optical flow, mid-scale optical flow, and macro-scale optical flow through adaptive weights based on channel attention learning to obtain multi-scale optical flow information.

[0068] like Figure 3As shown, computer devices can choose the lightweight deep learning optical flow network FastFlowNet based on their computing resources. FastFlowNet is a deep optical flow estimation network focused on high speed and high energy efficiency. Its core goal is to significantly reduce computational cost, model complexity, and inference time while maintaining accuracy comparable to state-of-the-art large models, making it well-suited for real-time operation on edge devices with limited computing resources. Its core idea is to replace the complex and time-consuming modules in traditional optical flow networks with carefully designed, efficient core components, achieving a balance between speed and accuracy.

[0069] Specifically, computer devices can define optical flow calculation functions: Define the scaling operation: This indicates scaling image I by a factor of s. In multi-scale optical flow, the calculation processes for fine-scale optical flow, meso-scale optical flow, and macro-scale optical flow are as follows: ; Finally, the fine-scale optical flow, the meso-scale optical flow, and the macro-scale optical flow are fused at multiple scales to obtain multi-scale optical flow information. The calculation formula can be expressed as: in These are the adaptive weights for each scale. The adaptive weights are calculated using channel attention-based learning.

[0070] Step 206: Obtain visual feature vectors based on multi-scale dynamic feature maps and text feature vectors based on multi-scale semantic attribute libraries. Use contrastive learning loss to perform cross-modal semantic alignment between visual feature vectors and text feature vectors to build a pre-trained basic model.

[0071] In one embodiment, the provided adaptive multi-scale dynamic fire detection method based on few-shot learning may further include a semantic alignment process, specifically including: inputting the multi-scale dynamic feature map into a visual encoder and encoding it to obtain a visual feature vector; inputting the attribute relationship set in the multi-scale semantic attribute library into a text encoder and encoding it to obtain a text feature vector; optimizing the contrastive learning loss function in a shared semantic space, and performing cross-modal semantic alignment between the visual feature vector and the text feature vector through the contrastive learning loss function.

[0072] The visual encoder used in this embodiment Based on the ViT-B / 16 architecture, the input channels have been modified to 6. ViT-B / 16 is a standard benchmark model within the Vision Transformer (ViT) architecture. Its core idea is to directly apply the Transformer architecture, used in natural language processing, to computer vision tasks, completely abandoning traditional convolutional operations. By treating images as a sequence of patches and leveraging the powerful global modeling capabilities of the pure Transformer architecture, ViT-B / 16, after pre-training on sufficient data (such as JFT-300M), achieved performance comparable to or even better than the state-of-the-art convolutional networks at the time on multiple image recognition benchmarks.

[0073] The text encoder used in this embodiment is: Based on the Transformer architecture (such as BERT). The core idea of ​​Transformer-based pre-trained text encoders is to build a "pre-training + fine-tuning" paradigm. It leverages the powerful context modeling capabilities of the Transformer architecture to compress linguistic knowledge into the model parameters through self-supervised pre-training on unlabeled big data, thereby forming a general and powerful foundation for text feature extraction.

[0074] Computer devices can input multi-scale dynamic feature maps F into a visual encoder. Obtain visual feature vectors Computer devices can also sample text descriptions from a multi-scale semantic attribute library K and input them into a text encoder. Obtain the text feature vector Next, by comparing the learning loss Closer matching within a shared semantic space By pushing away mismatched pairs and contrastively learning the loss function, the model is forced to understand the abstract concept of fire, ultimately outputting a pre-trained base model.

[0075] Specifically, during the comparative learning training process, it is assumed that there are N image-text pairs in the batch. Calculate the similarity matrix in The contrast loss function is ,in This refers to temperature hyperparameters.

[0076] Step 208: Calculate the visual prototype and semantic prototype based on the multi-scale semantic attribute library and fuse them to obtain the scene prototype. Optimize the parameters of the basic model to generate a scene-specific model.

[0077] In one embodiment, the provided adaptive multi-scale dynamic fire detection method using few-shot learning may further include a Few-Shot rapid adaptation process, specifically including: acquiring the target scene and its corresponding support set samples; extracting visual features from the support set samples to calculate a visual prototype; selecting a semantic description corresponding to the target scene from a multi-scale semantic attribute library and encoding and calculating a semantic prototype; performing weighted fusion of the visual prototype and the semantic prototype to generate a scene prototype of the target scene; and optimizing the parameters of the basic model based on the scene prototype using cue-based fine-tuning techniques to generate a scene-specific model. .

[0078] Few-Shot fast adaptation refers to a technique that allows a model to quickly learn and adapt to new tasks or domains using only a small number of samples. In this embodiment, the target scene and its corresponding support set samples can be represented as follows: in K is typically 3-10.

[0079] Computer devices can use a basic model Extracting support set samples Features and calculate its visual prototype ExtractFeatures is a multi-scale dynamic feature extraction method. Simultaneously, the computer device can obtain relevant semantic priors from the multi-scale dynamic semantic attribute library K and calculate the semantic prototype. in The relevant descriptions of the target scene are ultimately fused to obtain the scene prototype. in This is the fusion coefficient.

[0080] In this embodiment, the computer device can be based on a basic model. As the initial state, using support set samples Use prompt templates to quickly fine-tune the model and optimize parameters. Generate scenario-specific decision boundaries. Specifically, computer devices can define prompt template functions: The fine-tuning objective of the model can be expressed as: in This represents the cross-entropy loss.

[0081] Step 210: Obtain the real-time video sequence and calculate the real-time multi-scale dynamic feature map. Use the visual encoder in the scene-specific model to determine the real-time visual feature vector and calculate the cosine similarity between the real-time visual feature vector and the scene prototype. Perform real-time fire detection based on the cosine similarity.

[0082] In one embodiment, the provided adaptive multi-scale dynamic fire detection method based on few-shot learning may further include an online adaptive fire detection process, specifically including: acquiring a real-time video sequence of the fire to be detected, and extracting multi-scale dynamic features frame by frame from the real-time video sequence to obtain a real-time multi-scale dynamic feature map; mapping the real-time multi-scale dynamic feature map to a real-time visual feature vector using a visual encoder in a scene-specific model; calculating the cosine similarity between the real-time visual feature vector and the scene prototype, and determining a dynamic decision threshold; comparing the cosine similarity with the dynamic decision threshold, and if the cosine similarity is greater than the dynamic decision threshold, the detection result is a fire.

[0083] Computer equipment can acquire real-time video sequences to be analyzed and detected. For each frame in the real-time video sequence, Multi-scale dynamic feature extraction can be performed to generate real-time multi-scale dynamic feature maps. Next, computer devices can use scene-specific models. The visual encoder in the middle is used for real-time multi-scale dynamic feature maps Mapped to feature vectors Then calculate the eigenvectors. With scene prototype The cosine similarity is calculated using the following formula: Computer devices can be configured with decision functions: ,in This is a dynamic decision threshold that can be adaptively adjusted based on the complexity of the scenario. If If the dynamic decision threshold is exceeded, it is determined to be a fire. Ultimately, the computer equipment outputs a binary detection result. and confidence level .

[0084] In one embodiment, the provided adaptive multi-scale dynamic fire detection method based on few-shot learning may further include an online learning process, specifically including: defining a confidence interval; adding real-time multi-scale dynamic feature maps to the hard sample set when the cosine similarity is within the confidence interval; and periodically optimizing the scene prototype and scene-specific model using the hard sample set.

[0085] Computer devices can define confidence intervals: when When this happens, the sample is added to the hard sample set. Regular updates: And re-execute the Few-Shot quick adaptation process.

[0086] In one embodiment, a few-sample learning adaptive multi-scale dynamic fire detection method is provided that can be applied to applications such as... Figure 4The system architecture shown mainly includes Phase 1: Basic pre-training; Phase 2: Few-Shot adaptation and inference. Specifically, as... Figure 4 As shown, the basic pre-training stage may include: Step S1: Constructing a multi-scale dynamic semantic attribute library K; Step S2: Multi-scale dynamic feature extraction to output feature maps F; Step S3: Visual-language semantic alignment training to output a base model M_base. The Few-Shot adaptation and inference stage may include: Step S4: Few-Shot fast adaptation to output the target model M_target and the prototype p_target; Step S5: Online adaptive detection.

[0087] In this embodiment, multi-scale optical flow analysis can accurately capture dynamic characteristics across all scales, from microscopic flickering to macroscopic spread, significantly improving the detection rate of flames and smoke. It overcomes the limitations of single-scale models, enabling simultaneous and efficient detection of small nearby fire sources and large-scale fires in the distance, especially further improving detection performance in complex multi-scale scenarios. With the help of few-sample learning, new scene adaptation requires only a small number of samples and a few minutes, greatly reducing annotation costs. By integrating dynamic semantic prior knowledge, the model has stronger resistance to changes in illumination, partial occlusion, and complex background interference.

[0088] It should be understood that although the steps in the flowchart above are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowchart above may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.

[0089] In one embodiment, such as Figure 5 As shown, an adaptive multi-scale dynamic fire detection system based on few-shot learning is provided, comprising: an attribute library construction module 510, a feature extraction module 520, a semantic alignment module 530, a few-shot adaptation module 540, and a real-time detection module 550, wherein:

[0090] The attribute library construction module 510 is used to collect fire data, determine the atomic attribute set, scale context set, and attribute relationship set based on the fire data, and construct a multi-scale semantic attribute library based on the atomic attribute set, scale context set, and attribute relationship set.

[0091] The feature extraction module 520 is used to acquire the video sequence to be analyzed, perform multi-scale dynamic feature extraction on the video sequence, and generate a multi-scale dynamic feature map that integrates color, temporal motion and multi-scale optical flow information.

[0092] The semantic alignment module 530 is used to obtain visual feature vectors based on multi-scale dynamic feature maps and text feature vectors based on multi-scale semantic attribute libraries. It performs cross-modal semantic alignment of visual feature vectors and text feature vectors through contrastive learning loss to build a pre-trained basic model.

[0093] The Few-Shot adaptation module 540 is used to calculate and fuse visual and semantic prototypes based on a multi-scale semantic attribute library to obtain a scene prototype, optimize the parameters of the basic model, and generate a scene-specific model.

[0094] The real-time detection module 550 is used to acquire real-time video sequences and calculate real-time multi-scale dynamic feature maps. It uses the visual encoder in the scene-specific model to determine the real-time visual feature vector and calculates the cosine similarity between the real-time visual feature vector and the scene prototype. Based on the cosine similarity, it performs real-time fire detection.

[0095] In one embodiment, the attribute library construction module 510 is further configured to define static visual attributes and dynamic behavioral attributes based on fire data, and to construct an atomic attribute set by combining the static visual attributes and dynamic behavioral attributes; define various observation scales based on fire data, and construct a scale context set based on each observation scale; establish a mapping function between scales and attributes, construct a combination between scales and attributes, and generate semantic description text as an attribute relationship set.

[0096] In one embodiment, the feature extraction module 520 is further configured to extract the RGB color channels of key frames from the video sequence; calculate the frame difference of video frames in the video sequence using the three-frame difference method; calculate optical flow on a multi-scale spatial pyramid based on the video sequence using a lightweight deep learning optical flow network to generate multi-scale optical flow information; and splice and fuse the RGB color channels and frame difference multi-scale optical flow information to generate a multi-scale dynamic feature map.

[0097] In one embodiment, the feature extraction module 520 is further configured to calculate fine-scale optical flow, mid-scale optical flow, and macro-scale optical flow based on the video sequence using a lightweight deep learning optical flow network through scale transformation operations and optical flow calculation functions; and to fuse the fine-scale optical flow, mid-scale optical flow, and macro-scale optical flow through adaptive weights based on channel attention learning to obtain multi-scale optical flow information.

[0098] In one embodiment, the semantic alignment module 530 is further configured to input a multi-scale dynamic feature map into a visual encoder, and encode it to obtain a visual feature vector; input the attribute relationship set in the multi-scale semantic attribute library into a text encoder, and encode it to obtain a text feature vector; optimize the contrastive learning loss function in the shared semantic space, and semantically align the visual feature vector with the text feature vector through the contrastive learning loss function.

[0099] In one embodiment, the Few-Shot adaptation module 540 is further configured to acquire the target scene and its corresponding support set samples, extract visual features from the support set samples, and calculate a visual prototype; select a semantic description corresponding to the target scene from a multi-scale semantic attribute library, encode and calculate a semantic prototype; perform weighted fusion of the visual prototype and the semantic prototype to generate a scene prototype of the target scene; and optimize the parameters of the basic model based on the scene prototype using a prompting fine-tuning technique to generate a scene-specific model.

[0100] In one embodiment, the real-time detection module 550 is further configured to acquire a real-time video sequence of the fire to be detected, and extract multi-scale dynamic features frame by frame from the real-time video sequence to obtain a real-time multi-scale dynamic feature map; use a visual encoder in the scene-specific model to map the real-time multi-scale dynamic feature map into a real-time visual feature vector; calculate the cosine similarity between the real-time visual feature vector and the scene prototype, and determine the dynamic decision threshold; compare the cosine similarity with the dynamic decision threshold, and if the cosine similarity is greater than the dynamic decision threshold, the detection result is a fire.

[0101] In one embodiment, the Few-Shot adaptation module 540 is also used to define a confidence interval, and when the cosine similarity is within the confidence interval, the real-time multi-scale dynamic feature map is added to the hard sample set; the hard sample set is used periodically to optimize the scene prototype and scene-specific model.

[0102] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 6As shown, the computer device includes a processor, memory, network interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements a few-sample learning adaptive multi-scale dynamic fire detection method. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad on the computer device casing, or an external keyboard, touchpad, or mouse.

[0103] Those skilled in the art will understand that Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0104] In one embodiment, a computer device is provided, including a memory and a processor, the memory storing a computer program, the processor executing the computer program to implement steps of an adaptive multi-scale dynamic fire detection method based on few-sample learning.

[0105] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program being executed by a processor to implement steps of an adaptive multi-scale dynamic fire detection method based on few-sample learning.

[0106] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0107] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0108] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. An adaptive multi-scale dynamic fire detection method for few-shot learning, characterized in that, The method comprises: collecting fire data, determining an atomic attribute set, a scale context set, and an attribute relationship set based on the fire data, including: defining static visual attributes and dynamic behavior attributes based on the fire data, and constructing the static visual attributes and dynamic behavior attributes into an atomic attribute set; defining each observation scale based on the fire data, and constructing a scale context set based on each observation scale; establishing a mapping function between scales and attributes, constructing a combination between scales and attributes, and generating a semantic description text as an attribute relationship set; constructing a multi-scale semantic attribute library based on the atomic attribute set, the scale context set, and the attribute relationship set; obtaining a video sequence to be analyzed, performing multi-scale dynamic feature extraction on the video sequence, and generating a multi-scale dynamic feature map that fuses color, time domain motion, and multi-scale optical flow information, including: extracting an RGB color channel of a key frame for the video sequence; calculating frame differences of video frames in the video sequence using a three-frame difference method; based on the video sequence, calculating optical flow to generate multi-scale optical flow information using a lightweight deep learning optical flow network on a multi-scale spatial pyramid; and splicing and fusing the RGB color channel, frame difference, and multi-scale optical flow information to generate a multi-scale dynamic feature map; based on the multi-scale dynamic feature map, obtaining a visual feature vector, based on the multi-scale semantic attribute library, obtaining a text feature vector, and performing cross-modal semantic alignment of the visual feature vector and the text feature vector through a contrastive learning loss to construct a pre-trained base model; calculating visual prototypes and semantic prototypes based on the multi-scale semantic attribute library and fusing to obtain a scene prototype, performing parameter optimization on the base model, and generating a scene-specific model; obtaining a real-time video sequence and calculating a real-time multi-scale dynamic feature map, determining a real-time visual feature vector using a visual encoder in the scene-specific model, calculating a cosine similarity between the real-time visual feature vector and the scene prototype, and performing real-time fire detection based on the cosine similarity.

2. The adaptive multi-scale dynamic fire detection method of few-shot learning according to claim 1, characterized in that, based on the video sequence, calculating optical flow to generate multi-scale optical flow information using a lightweight deep learning optical flow network on a multi-scale spatial pyramid, including: based on the video sequence, calculating fine-scale optical flow, middle-scale optical flow, and macro-scale optical flow using a lightweight deep learning optical flow network through a scale transformation operation and an optical flow calculation function; fusing the fine-scale optical flow, middle-scale optical flow, and macro-scale optical flow through adaptive weight fusion based on channel attention learning to obtain multi-scale optical flow information.

3. The adaptive multi-scale dynamic fire detection method of few-shot learning according to claim 1, wherein, based on the multi-scale dynamic feature map, obtaining a visual feature vector, based on the multi-scale semantic attribute library, obtaining a text feature vector, and performing cross-modal semantic alignment of the visual feature vector and the text feature vector through a contrastive learning loss, including: inputting the multi-scale dynamic feature map into a visual encoder to obtain a visual feature vector through the visual encoder; inputting an attribute relationship set in the multi-scale semantic attribute library into a text encoder to obtain a text feature vector through the text encoder; Optimize a contrastive learning loss function in a shared semantic space and cross-modal semantic align the visual feature vector and the text feature vector through the contrastive learning loss function.

4. The adaptive multi-scale dynamic fire detection method of few-shot learning according to claim 1, wherein, According to the multi-scale semantic attribute library, a visual prototype and a semantic prototype are calculated and fused to obtain a scene prototype, a basic model is parameter optimized, and a scene special model is generated, including: Obtaining a target scene and its corresponding support set samples, extracting visual features from the support set samples, and calculating a visual prototype; Selecting a semantic description corresponding to the target scene from the multi-scale semantic attribute library, and calculating a semantic prototype through encoding; Weighted fusion of the visual prototype and the semantic prototype to generate a scene prototype of the target scene; Parameter optimization of the basic model based on the scene prototype using prompt fine-tuning technology to generate a scene special model.

5. The adaptive multi-scale dynamic fire detection method of few-shot learning according to claim 1, wherein, Obtaining a real-time video sequence and calculating a real-time multi-scale dynamic feature map, using a visual encoder in the scene special model to determine a real-time visual feature vector, and calculating the cosine similarity between the real-time visual feature vector and the scene prototype, real-time fire detection based on the cosine similarity, including: Obtaining a real-time video sequence to be detected, and extracting multi-scale dynamic features from the real-time video sequence frame by frame to obtain a real-time multi-scale dynamic feature map; Using the visual encoder in the scene special model to map the real-time multi-scale dynamic feature map to a real-time visual feature vector; Calculate the cosine similarity between the real-time visual feature vector and the scene prototype, and determine a dynamic decision threshold; Compare the cosine similarity with the dynamic decision threshold, if the cosine similarity is greater than the dynamic decision threshold, the detection result is fire.

6. The adaptive multi-scale dynamic fire detection method of few-shot learning according to claim 5, characterized in that, The method further comprises: Defining a confidence interval, when the cosine similarity is within the confidence interval, adding the real-time multi-scale dynamic feature map to a difficult sample set; Periodically optimize the scene prototype and scene special model using the difficult sample set.

7. An adaptive multi-scale dynamic fire detection system with few-shot learning, characterized in that, The system comprises: An attribute library construction module for collecting fire data, determining an atomic attribute set, a scale context set, and an attribute relationship set based on the fire data, including: defining static visual attributes and dynamic behavior attributes based on the fire data, and constructing the static visual attributes and dynamic behavior attributes into an atomic attribute set; defining each observation scale based on the fire data, and constructing a scale context set based on each observation scale; establishing a mapping function between scales and attributes, constructing combinations between scales and attributes, and generating semantic description texts as an attribute relationship set; constructing a multi-scale semantic attribute library based on the atomic attribute set, the scale context set, and the attribute relationship set; The feature extraction module is configured to obtain a video sequence to be analyzed, perform multi-scale dynamic feature extraction on the video sequence, and generate a multi-scale dynamic feature map that fuses color, time domain motion, and multi-scale optical flow information. The feature extraction module includes: extracting an RGB color channel of a key frame for the video sequence; calculating frame difference of a video frame in the video sequence by using a three-frame difference method; calculating multi-scale optical flow information by using a lightweight deep learning optical flow network on a multi-scale spatial pyramid based on the video sequence; and fusing the RGB color channel, frame difference, and multi-scale optical flow information to generate a multi-scale dynamic feature map. The semantic alignment module is configured to obtain a visual feature vector based on the multi-scale dynamic feature map, obtain a text feature vector based on the multi-scale semantic attribute library, perform cross-modal semantic alignment on the visual feature vector and the text feature vector by using a contrastive learning loss, and construct a pre-trained base model. The few-shot adaptation module is configured to calculate a visual prototype and a semantic prototype based on the multi-scale semantic attribute library, fuse the visual prototype and the semantic prototype to obtain a scene prototype, perform parameter optimization on the base model, and generate a scene-specific model. The real-time detection module is configured to obtain a real-time video sequence, calculate a real-time multi-scale dynamic feature map, determine a real-time visual feature vector by using a visual encoder in the scene-specific model, calculate a cosine similarity between the real-time visual feature vector and the scene prototype, and perform real-time fire detection based on the cosine similarity.

Citation Information

Patent Citations

  • Fire detection early warning method based on attention mechanism and multi-scale characteristics

    CN116343077A

  • Live broadcast abnormal state monitoring method, live broadcast abnormal state monitoring platform and data acquisition device

    CN120547406A