Image adaptive feature enhancement and layered attention method for forest fire detection
By employing a bidirectional feature transfer and hierarchical attention enhancement mechanism in a multi-scale feature extraction backbone network, combined with a Dense-O2O matching mechanism, the problem of missed detection of small targets and insufficient robustness in complex scenarios in forest fire detection is solved, achieving high-precision real-time detection and adapting to the real-time detection needs of edge devices.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-16
- Publication Date
- 2026-04-03
AI Technical Summary
Existing forest fire detection technologies suffer from problems such as missed detection of small targets, insufficient robustness in complex scenarios, high computational overhead, and unreasonable threshold determination, making it difficult to achieve high-precision real-time detection, especially on edge devices.
By employing a bidirectional feature transfer structure of a multi-scale feature extraction backbone network, combined with a hierarchical attention enhancement mechanism and a Dense-O2O matching mechanism, high-precision, real-time detection of forest fire targets is achieved through adaptive feature enhancement and optimized threshold determination.
It significantly improves the detection accuracy of small targets, enhances robustness in complex scenarios, reduces computational complexity, adapts to the real-time detection needs of edge devices, and meets the full-scenario requirements for forest fire detection.
Smart Images

Figure CN121789089A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of computer vision and forest disaster monitoring technology, specifically to an image adaptive feature enhancement and hierarchical attention method for forest fire detection. It is particularly suitable for real-time forest fire monitoring scenarios using edge devices (such as drones and field monitoring terminals), and can achieve high-precision identification and positioning of targets such as flames and firefighters. Background Technology
[0002] Forest ecosystems possess rich biodiversity and play a vital role in soil and water conservation and the Earth's environmental ecological cycles. Forest fires are generally considered an unavoidable disaster, especially during summer and drought periods. Whether naturally occurring or controlled, forest fires have a significant impact on natural forest ecosystems. Therefore, rapid and effective monitoring and suppression of wildfires over large areas is crucial. However, in actual firefighting operations, forest fire scenarios are often accompanied by complex environmental factors such as smoke obstruction, drastic changes in light, and significant differences in target scale, posing a significant challenge to real-time target detection models.
[0003] In recent years, deep learning has made significant progress in the field of computer vision, and detection models based on Convolutional Neural Networks (CNNs) and Transformers have been widely used in fire detection tasks. Early fire detection mainly relied on traditional image processing methods, such as color features and texture analysis, but these methods had poor robustness under complex lighting and background interference conditions. With the development of deep learning technology, CNNs have become the mainstream method due to their powerful feature extraction capabilities. CNNs can automatically extract hierarchical features and effectively capture local spatial information, and are easily combined with attention mechanisms to enhance flame features and improve detection accuracy in complex backgrounds. However, CNNs still have limitations: their local receptive field leads to insufficient global semantic understanding, and their detection performance degrades in large-scale scenes or under occlusion conditions. At the same time, multiple downsampling operations can over-compress small target features, making it difficult to accurately identify small targets such as flames or smoke.
[0004] To improve detection efficiency and real-time performance, the YOLO (YouOnlyLookOnce) series of models has been introduced into the field of flame detection. The YOLO model achieves rapid prediction with an end-to-end single-stage structure, exhibiting high efficiency and real-time characteristics, thus finding widespread application in scenarios such as video surveillance and drone fire identification. YOLO employs a one-to-many (O2M) anchor box matching strategy, generating multiple positive samples for each target during training, increasing supervision density and improving recall. However, this anchor box mechanism also introduces redundant candidate boxes and bounding box overlap issues, requiring additional non-maximum suppression (NMS) for filtering, significantly increasing computational complexity. Furthermore, the fixed anchor box scale limits the model's adaptability to multi-scale targets, resulting in insufficient performance in detecting small targets. In summary, while YOLO has an advantage in speed, it still falls short in robustness against complex backgrounds and multi-scale detection capabilities.
[0005] To overcome the locality problem of CNNs and improve the globality of feature representation, researchers introduced the Transformer architecture into visual detection tasks, forming a hybrid model combining CNNs and Transformers. CNNs excel at extracting local details, while Transformers capture long-distance dependencies through a self-attention mechanism, thereby achieving global feature modeling. The combination of the two improves the model's performance in flame detection, especially in scenes with complex backgrounds and drastic lighting changes. However, this hybrid structure also faces two challenges: first, the attention mechanism is computationally expensive, making real-time detection difficult on edge devices; second, inconsistencies exist in the fusion of shallow spatial features and deep semantic features, which can easily lead to a decrease in detection accuracy.
[0006] To address the limitations of traditional anchor point methods, Carion et al. proposed the DETR (DEtectionTRansforme) model, redefining the object detection task as a set prediction problem. DETR achieves one-to-one (O2O) matching by introducing the Hungarian matching algorithm, completely eliminating cumbersome processes such as anchor box generation and non-maximum suppression, thus realizing a true end-to-end detection framework. DETR significantly simplifies the detection process structurally and improves global feature modeling capabilities. However, this model suffers from slow convergence, low feature resolution, and high computational complexity, performing particularly poorly in small object detection. Summary of the Invention
[0007] The purpose of this invention is to overcome the shortcomings of existing forest fire detection technologies, such as missed detection of small targets, insufficient robustness in complex scenes, high computational cost, and unreasonable threshold determination. This invention provides an image adaptive feature enhancement and hierarchical attention method for forest fire detection. Through multi-scale feature bidirectional transfer, hierarchical attention enhancement, lightweight feature encoding, and adaptive threshold optimization, this method achieves high-precision, real-time detection of forest fire targets, while also being compatible with edge device deployment.
[0008] To achieve the above objectives, the technical solution adopted by this invention is: an image adaptive feature enhancement and hierarchical attention method for forest fire detection, implemented based on the DEIM framework, comprising the following steps:
[0009] A. Dataset Construction and Preprocessing Steps: Construct a self-collected forest fire dataset, which includes forest fire scene samples, suspected fire scene samples, and non-fire scene samples. Perform annotation and data augmentation processing on the sample images.
[0010] B. Image Acquisition and Standardization Steps: Acquire raw image data of the forest scene using an image acquisition device, and perform format standardization processing on the raw image data, including resolution unification, color space conversion, and pixel value normalization, to obtain a standardized image;
[0011] C. Multi-scale feature extraction and bidirectional feature transfer steps: The standardized image is input into a multi-scale feature extraction backbone network. The backbone network includes a top-down feature downsampling path, a bottom-up feature upsampling path, and multiple lateral connections connecting the two, which are used to generate feature maps at multiple scales and realize bidirectional feature transfer and fusion between shallow and deep layers.
[0012] D. Adaptive Feature Enhancement Steps: Input feature maps at various scales into the feature fusion and diffusion module. The module includes a convolutional embedding subunit, a spatial context subunit, a feature refinement subunit, and a bidirectional feature transfer subunit. The feature refinement subunit sequentially performs input concatenation, multi-receptive field extraction, multi-scale aggregation and residual diffusion, pointwise convolutional interaction, and dimensionality reduction operations to refine and enhance features from different scales and output an enhanced feature map.
[0013] E. Hierarchical attention encoding step: The enhanced feature map is input into the hierarchical attention encoder based on the MetaFormer architecture, and the feature weights are allocated sequentially through the shallow feature attention unit (using the SHSA spatial hierarchical self-attention mechanism), the middle semantic attention unit (using the EDFFN efficient dynamic feedforward network), and the deep target attention unit to enhance the fire features and suppress background interference, and output the attention-weighted feature map.
[0014] F. Feature matching and recognition steps: Based on the Dense-O2O (DenseOne-to-One) matching mechanism of the DEIM framework, the attention-weighted feature map and the fire feature template are matched pixel by pixel to calculate the fire feature matching degree;
[0015] G. Model optimization and judgment steps: If the matching degree is greater than the preset threshold, it is judged as a fire scene and the detection result is output; otherwise, it is judged as a non-fire scene. During the model training stage, the network parameters are optimized based on multiple performance evaluation indicators to improve the accuracy and robustness of forest fire detection.
[0016] The beneficial effects of this technical solution are as follows:
[0017] This system employs a comprehensive technical design, forming a closed loop from the data layer, preprocessing layer, feature extraction layer to recognition optimization layer: Self-collected datasets cover multiple scenarios and undergo data augmentation, providing diverse training samples for the model, effectively reducing sample bias and improving the model's generalization ability across different forest fire scenarios; image standardization ensures a unified input format, avoiding the impact of differences in resolution, color space, etc., on model performance and guaranteeing input consistency; multi-scale feature extraction and bidirectional transfer fusion solve the problem of cross-scale feature loss in traditional networks, allowing feature maps at each scale to simultaneously possess local details and global semantic information, laying the foundation for small target and occluded target detection; multi-step feature refinement in the feature fusion and diffusion module further integrates multi-scale and multi-receptor field features, enhancing the distinguishability of fire target features; hierarchical attention encoding, through a targeted attention mechanism, accurately enhances fire features and suppresses background interference, improving recognition accuracy in complex environments; Dense-O2O matching and threshold determination combined with parameter optimization achieve accurate fire identification, reducing false positives and false negatives, while continuous parameter optimization during the training phase continuously improves the model's detection accuracy and robustness, meeting the full-scenario needs of forest fire detection.
[0018] As a further improvement to the above technical solution, the multi-scale feature extraction backbone network adopts a bidirectional feature transfer structure, specifically including:
[0019] 1) Top-down feature downsampling path, used to reduce the feature map resolution and increase the number of channels layer by layer through continuous convolution and downsampling operations, in order to extract high-level semantic features;
[0020] 2) Bottom-up feature upsampling path, used to restore the spatial resolution of feature maps layer by layer through upsampling and convolution operations, so as to reconstruct fine-grained spatial information;
[0021] 3) Multiple lateral connections are used to transfer features from different paths between the same or adjacent scales, fusing high-resolution detail features from shallow layers with high-semantic features from deep layers.
[0022] 4) Through the above bidirectional feature transfer structure, features rich in contextual information are diffused between different detection scales, so that the feature map at each scale has both local details and global semantic information, thereby enhancing the detectability of small targets and occluded targets.
[0023] The beneficial effects of the above-mentioned further improvements are as follows: The bidirectional feature transfer structure comprehensively optimizes the feature extraction effect through the synergistic effect of three core paths: The top-down sampling path effectively extracts high-level semantic features by reducing resolution and increasing the number of channels, providing global context support for fire category determination and helping the model to distinguish between fire and non-fire scenes as a whole; The bottom-up sampling path supplements key detail features such as fire target edges and textures through spatial resolution restoration and fine-grained information reconstruction, solving the problem of loss of deep feature spatial information; The lateral connection realizes feature fusion of the same or adjacent scales, avoiding the isolation of shallow high-resolution details and deep high-semantic features, so that the feature map has both detail depiction and semantic understanding capabilities; Finally, through bidirectional feature diffusion, the feature maps at each scale have local details and global semantics, greatly enhancing the detectability of small targets (such as early Mars, distant firefighters) and occluded targets (such as flames blocked by trees), filling the shortcomings of traditional single-path feature extraction.
[0024] As a further improvement to the above technical solution, the specific operations of the feature refinement sub-unit in step D include:
[0025] 1) Input concatenation: Combine the multi-scale initial features according to the formula X = Concat(X 1 ,X 2 ,X 3 Perform feature concatenation, where X is the concatenated feature map; X 1 ,X 2 ,X 3 These are initial feature maps at different scales; Concat is the feature concatenation operation.
[0026] 2) Multi-receptor field extraction: According to formula X k =DWConv k (X) Extracts multi-receptive-field features, where X... k This is the feature map of the k-th receptive field; DWConv k . represents a k×k depth convolution operation, where k∈5,7,9,11;
[0027] 3) Multiscale aggregation and residual diffusion: according to the formula Perform feature aggregation, where X' is the aggregated feature map;
[0028] This is the sum of the characteristics of each receptive field;
[0029] 4) Pointwise Convolution Interaction and Dimensionality Reduction: First, perform pointwise convolution according to the formula X″=PWConv(X′), then perform pointwise convolution according to the formula Y=Conv 1×1 (X+X″) outputs the enhanced feature map, where X″ is the feature map after pointwise convolution; PWConv is the pointwise convolution operation; Y is the enhanced feature map; Conv 1×1 This is a 1×1 convolution operation.
[0030] The beneficial effects of the above further improvements are as follows: The feature refinement subunit achieves in-depth optimization and enhancement of multi-scale features through four consecutive operations: Input concatenation integrates the information advantages of initial features at different scales through formulaic multi-scale feature fusion, providing rich basic data for subsequent processing and avoiding the loss of details caused by insufficient information in single-scale features; Multi-receptive field extraction adopts multi-size deep convolution, accurately calculating different receptive field features through formulas, covering fire targets of different sizes from small sparks to large-area flames, ensuring that the model can comprehensively identify fires of various scales; Multi-scale aggregation and residual diffusion accumulate the original features and receptive field features through formulas, aggregating multi-dimensional features while reducing information loss during feature transmission through residual connections, ensuring feature integrity and expressive power; Pointwise convolution interaction and dimensionality reduction achieve information interaction and fusion between channels through two formulaic operations, while optimizing the feature map dimension, reducing computational resource consumption, and the output enhanced feature map not only has high feature recognition, but can also better adapt to the needs of subsequent hierarchical attention encoding, laying a high-quality feature foundation for accurate recognition.
[0031] As a further improvement to the above scheme, the bidirectional feature transfer subunit in step C includes a forward transfer path and a reverse feedback path. The forward transfer path transfers the output features of the spatial context subunit to the feature refinement subunit, and the reverse feedback path feeds back the multi-scale aggregated features of the feature refinement subunit to the spatial context subunit. During the transfer process, the feature transfer direction and intensity are controlled by a gating unit.
[0032] The beneficial effects of the above technical solution are as follows: the bidirectional path design realizes the bidirectional interaction between shallow detailed features and deep semantic features. Forward transmission can supplement semantic information and reverse feedback can supplement detailed information. The gating unit can dynamically adjust the feature transmission priority, reduce the feature information imbalance caused by unidirectional transmission, and improve the feature fusion consistency in complex scenarios (such as smoke obscuration and day-night alternation).
[0033] As a further improvement to the above scheme, the multi-scale feature extraction backbone network is equipped with a hierarchical attention feature enhancement mechanism in both shallow and deep layers, including:
[0034] 1) In the shallow feature extraction stage, a frequency-spatial attention mechanism is introduced into the early feature map to decompose the features in the frequency domain and perform weight allocation in the spatial dimension to highlight the high-frequency detail features of small targets such as flames and small firefighters, and suppress low-frequency interference from the background.
[0035] 2) In the deep feature extraction stage, a channel attention mechanism is introduced into the high-level feature map. By weighting the responses of each channel, the weight of the channel related to fire category determination is increased and the weight of redundant channels is reduced to ensure the stability of global semantic modeling.
[0036] 3) By combining shallow frequency-spatial attention with deep channel attention in a hierarchical manner, high-frequency details of small targets are enhanced while maintaining the integrity of deep semantic expression, thus achieving hierarchical feature enhancement without significantly increasing computational cost.
[0037] The beneficial effects of the above technical solution are as follows: The hierarchical attention feature enhancement mechanism achieves precision and efficiency in feature enhancement through differentiated design of shallow and deep layers: The shallow frequency-space attention mechanism targets early feature maps and, through frequency domain decomposition and spatial weight allocation, accurately highlights high-frequency detail features of small targets such as flames and small firefighters, effectively suppressing low-frequency interference from backgrounds such as tree shadows and uniform grass, solving the pain point of traditional models easily losing details of small targets, and significantly improving the detection accuracy of small targets; The deep channel attention mechanism targets high-level feature maps and, through channel response weighting, prioritizes increasing the weight of channels related to fire category determination, reducing interference from redundant channels, ensuring the stability of global semantic modeling of deep features, and avoiding misclassification caused by semantic ambiguity; The hierarchical combination of shallow and deep attention strengthens high-frequency details of small targets while taking into account the integrity of deep semantic expression, and the entire mechanism only increases the amount of computation, achieving a balance between performance and efficiency, so that the features extracted by the backbone network have both fine detail depiction capabilities and stable semantic understanding capabilities, adapting to the detection needs of complex forest fire scenarios.
[0038] As a further improvement to the above scheme, the feature encoding module adopts a hierarchical attention encoder based on the MetaFormer architecture, which divides the input enhanced feature map into several spatial blocks of a preset size. Within each spatial block, the correlation coefficient between features is calculated to determine the attention weight within the block, enhancing local features such as fire edges and smoke textures, and retaining only a small number of cross-block connections to achieve sparse global modeling. This reduces the amount of attention computation while improving the retention of small target features.
[0039] The beneficial effects of the above technical solution are as follows: The hierarchical attention encoder based on the MetaFormer architecture achieves the dual goals of local feature enhancement and computational efficiency improvement through spatial block partitioning and sparse global modeling: dividing the enhanced feature map into spatial blocks of preset size, calculating the correlation coefficient within the block and determining the attention weight, can accurately focus on local features such as fire edges and smoke textures, enhance the recognizability of local features, and allow the model to more clearly capture the key local information of fire targets; retaining only a small number of cross-block connections to achieve sparse global modeling, while ensuring the correlation of global features, significantly reduces the computational load of the traditional Transformer attention mechanism and avoids excessive consumption of computing resources; this design not only solves the problem of insufficient local feature characterization of traditional encoders, but also overcomes the defect of high computational complexity. While reducing the computational load of attention, it effectively improves the retention of small target features, allowing the model to accurately identify local fire details in complex forest environments, adapt to the computing power limitations of edge devices, and meet the needs of real-time detection.
[0040] As a further improvement to the above scheme, the EDFFN efficient dynamic feedforward network in the hierarchical attention encoder includes a channel shuffling layer and a dynamic activation layer. The channel shuffling layer divides the input feature channels into multiple channel groups and rearranges them to break down the information barriers between channels and enhance the interaction and fusion of features from different channels. The dynamic activation layer introduces an adjustment term related to the feature value on the basis of the standard activation function. The coefficient of the adjustment term ranges from 0.01 to 0.05 and is used to amplify or suppress different feature responses as needed, thereby improving the feature representation ability while controlling the computational complexity.
[0041] The beneficial effects of the above technical solution are as follows: The EDFFN high-efficiency dynamic feedforward network comprehensively optimizes feature processing effect and computational efficiency through the collaborative design of channel shuffling and dynamic activation: The channel shuffling layer rearranges the input feature channels into groups, effectively breaking down information barriers between channels, promoting the interaction and fusion of features from different channels (such as color features and texture features), avoiding the problem of incomplete feature expression caused by isolated channel information, and significantly improving the comprehensive expression ability of features; The dynamic activation layer introduces an adjustment term on the basis of the standard activation function, and the coefficient is controlled within a reasonable range of 0.01 to 0.05, which can amplify weak fire features (such as light smoke) and suppress background interference features as needed according to feature values, solving the problem of traditional activation functions suppressing weak features, and allowing the model to more accurately capture fire features of different intensities; While improving the feature expression ability, the entire network controls the computational complexity through reasonable structural design, avoids the waste of computational resources, provides support for the efficient operation of the hierarchical attention encoder, and further ensures the real-time inference capability of the model on edge devices.
[0042] As a further improvement to the above scheme, in the model optimization and judgment steps, the fire feature template library constructed by the Dense-O2O matching mechanism contains feature templates for three types of fires: open flame, smoke, and embers. During matching, the cosine similarity between the attention-weighted feature map and each template is calculated, and the maximum similarity is taken as the fire feature matching degree.
[0043] The beneficial effects of the above technical solution are as follows: The Dense-O2O matching mechanism significantly improves the accuracy of fire matching through the design of a multi-category template library and cosine similarity calculation: The fire feature template library covers three common types of fires: open flame, smoke, and embers, comprehensively covering different forms of forest fires, avoiding the problem that a single template cannot adapt to different fire features, and enabling the model to accurately cope with various fire scenarios; During the matching process, the attention-weighted feature map is calculated with the cosine similarity of each template, and the maximum similarity is selected as the matching degree, which can accurately measure the degree of fit between the current feature and various fire templates. It can not only determine whether it is a fire scenario, but also indirectly distinguish the fire type, reduce misjudgments caused by differences in fire type, improve the accuracy and detail of fire identification, provide a more reliable matching basis for subsequent threshold determination, and further reduce the risk of false detection and false negative detection.
[0044] As a further improvement to the above scheme, the preset threshold in step F is determined in the following way: based on the training samples of the self-collected dataset, with the goal of maximizing the harmonic mean of precision and recall, the candidate threshold interval is traversed to determine the optimal threshold, and the threshold with the largest comprehensive performance index is selected as the optimal fire judgment threshold, which is used to determine the fire feature matching degree in the inference stage to balance the false detection rate and the false negative rate.
[0045] The beneficial effects of the above technical solution are as follows: The method for determining the preset threshold achieves accuracy and adaptability of the threshold through data-driven and comprehensive performance optimization design: the threshold is determined based on training samples of self-collected datasets, ensuring that the threshold fits the data characteristics of actual forest fire scenarios, avoiding the empirical bias of traditional fixed thresholds, and improving the adaptability of the threshold to actual detection needs; with the goal of maximizing the harmonic mean of precision and recall, the optimal value is selected by traversing the candidate threshold range, which can effectively balance the false detection rate and the false negative rate, avoiding the problem of false negatives caused by pursuing precision alone or false positives caused by pursuing recall alone; the threshold with the largest comprehensive performance index is used as the optimal judgment threshold and applied to the inference stage, which can more accurately determine the matching degree of fire features, further improving the reliability of the model in practical applications, allowing the model to maintain stable detection performance in different forest scenarios, and reducing detection bias caused by unreasonable thresholds.
[0046] As a further improvement to the above scheme, the gating unit in step D adopts the Sigmoid activation function. By performing weight transformation and bias adjustment on the feature vector after fusing the positive and negative features, the gating coefficient in the range of 0-1 is output to control the feature transmission intensity.
[0047] The beneficial effects of the above technical solution are as follows: The gating unit achieves precise control of feature transmission intensity through the design of the Sigmoid activation function and feature vector processing: The Sigmoid activation function can stably output a gating coefficient in the range of 0-1, providing a quantitative standard for feature transmission intensity, realizing a smooth adjustment from "complete blocking" to "complete transmission", and adapting to the feature transmission needs in different scenarios; By performing weight transformation and bias adjustment on the feature vector after the fusion of positive and negative features, the gating coefficient can be dynamically adjusted according to the actual content of the feature vector (such as whether it contains valid fire information), prioritizing the transmission of features containing high-value information and blocking invalid or low-value features, avoiding invalid information from interfering with subsequent feature processing steps; This precise control mechanism not only improves the feature processing efficiency and quality of the bidirectional feature transmission subunit, but also indirectly optimizes the feature enhancement effect of the entire feature fusion and diffusion module, providing better feature input for subsequent hierarchical attention encoding and matching recognition, and further ensuring the overall detection performance of the model.
[0048] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0049] Compared with the prior art, the present invention has the following beneficial effects:
[0050] 1. Significantly improved small target detection accuracy: By leveraging the bidirectional feature transfer structure of the multi-scale feature extraction backbone network, the system achieves bidirectional fusion of shallow detail features and deep semantic features. Combined with the multi-receptive field extraction and residual diffusion operation of the feature fusion and diffusion modules, feature maps at each scale simultaneously possess local details (such as Mars or small firefighter outlines) and global semantic information, reducing the false negative rate of small targets by 15%-20%. Simultaneously, the shallow frequency-spatial attention mechanism specifically enhances the high-frequency detail features of small targets, further improving the detectability of small targets (such as early light smoke or distant firefighters). In the test set, the mAP@50 for small targets reached 76.5%, an improvement of 3.2% compared to YOLO11-n.
[0051] 2. Significantly enhanced robustness in complex scenes: The hierarchical attention encoding suppresses background interference such as tree occlusion and lighting changes through SHSA spatial hierarchical self-attention, and the EDFFN dynamic activation layer optimizes feature responses on demand. Combined with multi-class templates and adaptive thresholds of the Dense-O2O matching mechanism, the model reduces the false detection rate by 12%-18% and the false negative rate by 10%-15% in scenes with tree occlusion (occlusion rate ≤40%), low light at night (illuminance ≤50 lux), and smoke interference. The overall detection accuracy (mAP@50) in complex scenes reaches 77.8%, which is 3.5% higher than the benchmark DEIM model.
[0052] 3. Computational efficiency adapted to edge devices: The MetaFormer architecture's hierarchical attention encoder reduces the computational cost of attention from O(N) through spatial block partitioning and sparse cross-block connections. 2 The value decreased to O((N / 16)). 2 ×16), EDFFN reduces computational cost by 28% compared to traditional MLP, with an overall model parameter count of only 3.3M and a computational complexity of 6.8B. Inference speeds on edge devices such as NVIDIA Jetson Nano reach [speed not specified].
[0053] With a frame rate of 28.2 FPS, it meets the requirements for real-time detection (frame rate ≥ 20 FPS), and its inference speed is 50% faster than RT-DETR. It can be directly deployed on devices with limited computing power, such as drones and field monitoring terminals.
[0054] 4. More Adaptive Threshold Judgment: Based on an adaptive threshold optimization strategy that maximizes the F1 score, the matching degree is calculated separately for three types of fires: open flame, smoke, and embers, and the optimal threshold is dynamically selected. Compared with the fixed threshold judgment method, the F1 score is improved by 8%-12%, effectively solving the problem of difficulty in balancing false detection and false negative under a single threshold. In practical applications, the threshold can be fine-tuned according to different forest area scenarios (such as coniferous forest / broadleaf forest) to further improve the judgment accuracy.
[0055] 5. Strong generalization ability of the dataset: The self-collected dataset contains 21,378 samples of multiple scenes and fire situations. Combined with data augmentation processing, the model has good generalization ability for forest fire scenarios in different regions (such as coniferous forests in Northeast China and broad-leaved forests in Southwest China) and different seasons. The mAP@50 of the cross-regional test set reaches 74.2%, which is 10%-13% better than the generalization ability of the model using only the public dataset. Attached Figure Description
[0056] Figure 1 This is a diagram of the FFD-DEIM network structure.
[0057] Figure 2 FSA structure diagram
[0058] Figure 3Network structure diagram of feature fusion and diffusion module
[0059] Figure 4 MetaFormer network structure diagram
[0060] Figure 5 EDFFN network structure diagram
[0061] Figure 6 SHSA network structure diagram
[0062] Figure 7 For dataset images
[0063] Figure 8 Comparison of heatmaps for each module
[0064] Figure 9 To compare the model's accuracy and recall
[0065] Figure 10 Figures showing the detection results of DEIM, YOLO11n, and FFD-DEIM. Detailed Implementation
[0066] To enable those skilled in the art to better understand the technical solution, the present invention will be described in detail below with reference to embodiments. The description in this part is only exemplary and explanatory, and should not be used to limit the scope of protection of the present invention in any way.
[0067] I. Introduction
[0068] This invention proposes a forest fire detection model based on the DEIM framework, FFD-DEIM (Feature Fusion and Diffusion Enhanced DEIM). This model innovatively designs a multi-scale feature extraction backbone network and a bidirectional feature transfer structure. Through two information pathways—top-down semantic downlink and bottom-up detail backlink—it achieves deep fusion of features at different scales. To address the issue of small target features being easily lost during transmission, a multi-scale feature extraction backbone network and a feature fusion and diffusion module are introduced, combined with a hierarchical attention feature enhancement mechanism to achieve synergistic enhancement of high-frequency details and deep semantic features of small targets. In the feature encoding stage, a hierarchical attention encoder based on the MetaFormer architecture is adopted, replacing the traditional MHSA (Multi-Head Self-Attention) with SHSA (Sparse Hierarchical Self-Attention), and paired with EDFFN (Efficient Dynamic Feed-Forward Network), which reduces computational complexity while improving global and local feature modeling capabilities.
[0069] The core advantage of the DEIM (DETR with Improved Matching) framework lies in the introduction of a dense one-to-one matching mechanism (Dense O2O) and Matchability-Aware Loss (MAL). By constructing multiple target regions to increase the number of positive samples and assigning differentiated weights to matching samples of different quality, it significantly improves training efficiency and detection performance. This invention, based on the DEIM framework, further optimizes multi-scale feature transfer, feature enhancement, and encoding structure, aiming to solve problems such as missed detection of small targets, insufficient robustness in complex scenes, and high computational overhead in forest fire detection, achieving high-precision, real-time detection of flames and firefighter targets on edge devices.
[0070] II. The main innovations of this invention are summarized as follows:
[0071] 1. A multi-scale feature extraction backbone network and a bidirectional feature transfer structure are proposed. By passing down high-level semantic features from top to bottom and passing back shallow detail features from bottom to top, and combining lateral connections, feature fusion of the same scale and cross scales is achieved. This enables feature maps of each scale to have both local details and global semantic information, which greatly improves the detectability of small targets and occluded targets.
[0072] 2. A hierarchical attention feature enhancement mechanism is constructed. The shallow layer uses frequency-spatial attention (FSA) to enhance the high-frequency detail representation of small targets, while the deep layer uses channel attention (SE) to ensure the stability of semantic modeling. This achieves hierarchical feature optimization without significantly increasing the computational cost.
[0073] 3. The feature encoding architecture based on MetaFormer is optimized by combining SHSA sparse hierarchical self-attention and EDFFN efficient dynamic feedforward network. The computational overhead is reduced by spatial block partitioning and sparse global connection, while enhancing the local feature correlation and global dependency modeling capabilities, which can meet the real-time detection requirements of complex forest fire scenarios.
[0074] 4. Improve the Dense-O2O matching mechanism and threshold optimization strategy, construct a multi-type fire feature template library, determine the optimal threshold by combining the principle of maximizing the harmonic mean of precision and recall, balance the risks of false detection and false negative detection, and improve the robustness of detection in complex scenarios.
[0075] III. The specific implementation of the technical solution of the present invention is as follows: (I) The main innovative points and methods of the present invention
[0076] 1. FFD-DEIM Model Structure
[0077] The FFD-DEIM model proposed in this invention, based on the DEIM framework, constructs a complete detection process of "multi-scale feature extraction → bidirectional feature transfer → adaptive feature enhancement → hierarchical attention encoding → dense-O2O matching → threshold determination," and its core structure is as follows: Figure 1 As shown.
[0078] Compared to the original DEIM model, the core improvement of FFD-DEIM lies in:
[0079] (1) A new multi-scale feature extraction backbone network is added. Through the top-down downsampling path, the bottom-up upsampling path and the lateral connection, the bidirectional transmission and fusion of shallow high-resolution detail features and deep high-semantic features are realized, which solves the problem of cross-scale information loss in the traditional feature pyramid network (FPN).
[0080] (2) A hierarchical attention feature enhancement mechanism is embedded in the backbone network. The shallow FSA enhances the high-frequency details of small targets, and the deep SE optimizes the channel semantic weights to achieve adaptive optimization in the feature extraction stage.
[0081] (3) The feature fusion and diffusion module receives multi-scale fused features and further refines the features through operations such as multi-receptive field extraction and residual diffusion, thereby improving the ability to express cross-scale contextual information.
[0082] (4) The encoder adopts the MetaFormer architecture. Through the collaborative optimization of SHSA and EDFFN, it enhances the global and local feature modeling capabilities while reducing computational complexity, and adapts to the real-time inference requirements of edge devices.
[0083] The entire model achieves three goals through the collaborative work of multiple modules: preservation of small target features, improved adaptability to complex scenarios, and optimization of computational efficiency, providing a more efficient solution for forest fire and target detection by firefighters.
[0084] 2. Multi-scale feature extraction backbone network and bidirectional feature transfer structure
[0085] The multi-scale feature extraction backbone network is the core foundation of the FFD-DEIM model. Its structural design aims to achieve efficient transfer and fusion of features at different scales, and it consists of three parts:
[0086] (1) Top-down feature downsampling path: A series of convolutional layers (Conv) and max pooling layers (MaxPool) are used to perform four downsampling operations on the standardized image. The feature map resolution is halved layer by layer (640×640→320×320→160×160→80×80→40×40), while the number of channels is doubled layer by layer (3→64→128→256→512→1024). This path gradually expands the receptive field, extracts high-level semantic features, and provides global contextual information for fire category determination.
[0087] (2) Bottom-up feature upsampling path: The deepest feature map (40×40, 1024 channels) is upsampled using transposed convolution (TransConv), successively restored to scales of 80×80, 160×160, and 320×320, with the number of channels halved simultaneously (1024→512→256→128). During the upsampling process, fine-grained spatial information is reconstructed through convolution operations to supplement detailed features such as edges and textures;
[0088] (3) Lateral Connections: Lateral connections are established between the upsampled feature maps at each layer and the downsampled feature maps at the corresponding scale. After unifying the number of channels through 1×1 convolution, element-wise addition is used to achieve feature fusion. For example, the 80×80 and 512 channel feature maps obtained from upsampling are fused with the 80×80 and 512 channel feature maps in the downsampled path after adjustment by 1×1 convolution, which preserves shallow details and incorporates deep semantics.
[0089] (4) The bidirectional feature transfer structure realizes the bidirectional diffusion of features through the above paths and connections: the top-down path transfers deep semantic information to the shallow layer, improving the class discrimination ability of small targets; the bottom-up path feeds back shallow detail information to the deep layer, supplementing the target edge and texture features.
[0090] The final output of four feature maps at different scales—P2 (320×320, 128 channels), P3 (160×160, 256 channels), P4 (80×80, 512 channels), and P5 (40×40, 1024 channels)—all possess both local details and global semantic information, providing high-quality input for subsequent feature enhancement and encoding.
[0091] 3. Hierarchical attention feature enhancement mechanism
[0092] To address the challenges of large target scale differences, easy loss of details in small targets, and the need for stable deep semantics in forest fire detection, this invention embeds a hierarchical attention feature enhancement mechanism into the multi-scale feature extraction backbone network, specifically implemented as follows:
[0093] (1) Shallow Feature Attention (FSA): A frequency-spatial attention mechanism is applied to the shallow feature maps (320×320 and 160×160 scales) of the P2 and P3 layers of the backbone network. Its structure is as follows: Figure 2 As shown, this mechanism comprises two parallel branches: a spatial branch learns spatial attention weights through 3×3 convolutions to enhance the spatial response of the target region; and a frequency branch performs a two-dimensional discrete Fourier transform (FFT) on the feature map, decomposing the features into high-frequency and low-frequency components. An adaptive filter is used to adjust the weights of the low-frequency components, and then an inverse Fourier transform (IFFT) is performed to restore the spatial domain. Finally, the outputs of the two branches are fused through element-wise multiplication to highlight the high-frequency details of small targets such as flames and small firefighters, while suppressing low-frequency interference from the background, such as trees and shadows.
[0094] (2) Deep Feature Attention (SE): A channel attention mechanism is applied to the P4 and P5 deep feature maps (80×80 and 40×40 scales) of the backbone network. This mechanism first performs global average pooling on the feature maps to obtain channel-level statistical features; then, it learns channel weights through a two-layer fully connected network (FC), assigning high weights to channels highly correlated with the fire category and low weights to redundant channels; finally, it applies the weights to the original feature maps through element-wise multiplication to enhance semantic feature expression and ensure the stability of global category determination.
[0095] The hierarchical attention mechanism, through its design of "shallow detail enhancement + deep semantic stabilization", achieves precise enhancement of target features during the feature extraction stage, laying a good foundation for subsequent processing, while increasing computational overhead by only about 3%, thus balancing performance and efficiency.
[0096] 4. Feature Fusion and Diffusion Module (FeatureEnhancement)
[0097] The feature fusion and diffusion module receives P3, P4, and P5 scale feature maps output from the multi-scale feature extraction backbone network. Through operations such as multi-receptive field extraction, multi-scale aggregation, and residual diffusion, it achieves deep fusion and refinement of cross-scale features. Its structure is as follows: Figure 3 As shown, the specific steps are as follows:
[0098] (1) Input concatenation: After upsampling (P4→P3 scale, P5→P3 scale) or maintaining the scale of the feature maps P3, P4, and P5, the concatenation is performed according to the formula X = Concat(X). 1 ,X 2 ,X 3 Perform feature concatenation to obtain features that fuse multi-scale information. Figure X (320×320, 768 channels), where X 1 ,X 2 ,X3 These correspond to the feature maps after upsampling P3, P4, and P5, respectively.
[0099] (2) Multiple receptive field extraction: Four parallel depthwise convolutions (DWConv) were used, with convolution kernels of 5×5, 7×7, 9×9, and 11×11 respectively, according to formula X. k =DWConv k (X) Extracting features from different receptive fields Figure X k It covers target features of different sizes, from small Mars to large-area flames;
[0100] (3) Multiscale aggregation and residual diffusion: according to the formula The original spliced features are accumulated and fused with the features of each receptive field. The residual connection reduces the information loss during the feature transmission process, while the contextual information of multiple receptive fields is aggregated to improve the robustness of the features.
[0101] (4) Pointwise Convolution Interaction: The aggregated feature X′ is subjected to channel shuffling and information interaction through pointwise convolution (PWConv), and the feature with 384 channels is output according to the formula X″=PWConv(X′). Figure X ";
[0102] (5) Dimensionality reduction output: According to the formula Y = Conv 1×1 (X+X″) performs a 1×1 convolution, reducing the number of feature map channels to 256, and outputs an enhanced feature map Y (320×320, 256 channels), ensuring that the subsequent encoder can process it efficiently.
[0103] This module effectively integrates feature information from different scales and receptive fields through multi-receptive field extraction and residual diffusion, significantly improving the feature representation capability of multi-scale targets, especially enhancing the feature differentiation between small targets and occluded targets.
[0104] 5. A hierarchical attention encoder based on MetaFormer
[0105] To address the issues of high computational cost and memory overhead associated with traditional Transformer attention algorithms, this invention employs a hierarchical attention encoder based on the MetaFormer architecture, replacing the "MHSA+MLP" approach with a combination of "SHSA+EDFFN," as shown in the following structure. Figure 4 As shown, the specific implementation is as follows:
[0106] (1) Sparse hierarchical self-attention mechanism of SHSA: Its structure is as follows Figure 6As shown, the enhanced feature map Y (320×320, 256 channels) is first divided into 4×4 spatial blocks (each block is 80×80 pixels). Attention weights are calculated only within each spatial block, and only a few key connections are retained across blocks to achieve sparse global modeling. During the attention calculation process, attention weights are obtained by calculating the similarity between the query vector (Q) and the key vector (K). High weights are assigned to local features such as fire edges and smoke textures to strengthen the correlation of features within the block. This design reduces the attention computation cost from O(N) to O(N)×N. 2 The value decreased to O((N / 16)). 2 ×16), significantly reducing computational overhead;
[0107] (2) EDFFN High-Efficiency Dynamic Feedforward Network: Its structure is as follows Figure 5 As shown, it includes a channel shuffling layer and a dynamic activation layer: The channel shuffling layer divides the input feature channels (256 channels) into 8 groups (32 channels per group), rearranges and reassembles the channels in each group, breaking down information barriers between channels and enhancing channel interaction; The dynamic activation layer introduces an eigenvalue adjustment term α·sign(x)·|x| based on the GEGLU activation function. β (where α ranges from 0.01 to 0.05, and β is set to 0.5), enabling adaptive amplification or suppression of different feature responses, avoiding the suppression problem of weak features by traditional activation functions. EDFFN, through grouped computation and dynamic activation, improves feature representation capabilities while reducing computational cost by 28% compared to traditional MLPs.
[0108] The encoder is implemented using a stacked 6-layer "SHSA+EDFFN" architecture, with each layer incorporating LayerNorm normalization and residual connections to ensure training stability. The final output attention-weighted feature map retains key features of small targets while possessing powerful global semantic modeling capabilities, and its computational complexity meets the deployment requirements of edge devices.
[0109] 6. Dense-O2O Matching Mechanism and Threshold Optimization
[0110] (1) Construction of fire feature template library: Based on the Dense-O2O matching mechanism, a feature template library containing three types of fires, namely open flame, smoke and embers, was constructed. The feature templates in the template library were obtained by clustering analysis of the positive sample features of the self-collected dataset. Each template corresponds to a typical feature vector (256 dimensions) of a type of fire, covering the fire features under different lighting and different degrees of obstruction.
[0111] (2) Pixel-by-pixel matching calculation: The attention-weighted feature map (320×320, 256 channels) is reshaped into a two-dimensional feature matrix (102400×256). The cosine similarity between this matrix and the three types of fire templates is calculated row by row. The formula is as follows: Where x is the pixel feature vector and t is the template feature vector. The maximum similarity among the three templates is taken as the fire feature matching degree of the pixel, resulting in a matching degree map (320×320).
[0112] (3) Determining the optimal threshold: Based on the training samples of the self-collected dataset, traverse the candidate threshold interval [0.3, 0.8], and calculate the harmonic mean of precision (P) and recall (R) for each candidate threshold. The threshold corresponding to the largest F1 value is selected as the optimal threshold (in this embodiment, the optimal threshold is determined to be 0.52). This strategy balances the false positive rate and the false negative rate, ensuring that the model can accurately determine the fire in both the early stage (weak smoke) and the fire spread stage (open flame).
[0113] (II) Experiment
[0114] 1. Experimental setup
[0115] All experiments were performed in a unified environment. The experimental environment and key parameter settings are shown in Table 2.
[0116] Table 2 Experimental Hyperparameter Settings
[0117]
[0118]
[0119] 2. Experimental Dataset
[0120] This study constructed a multi-source composite dataset containing 21,378 RGB images, which was formed by filtering and fusing self-collected data and publicly available datasets.
[0121] (1) 11,703 self-collected data images: collected through drones, field monitoring terminals and other equipment, covering different lighting (day / night), different terrain (mountain / forest / grassland), different fire conditions (open flame / smoke / ember) and different obstruction (tree obstruction / smoke obstruction) scenarios, including two types of targets: flames and firefighters;
[0122] (2) 9675 images were selected from public datasets: images that match the forest fire scenario were selected from public datasets such as FLAME and D-Fire to supplement fire samples from different regions and improve the generalization ability of the model.
[0123] (3) Labeling and Classification: The LabelImg annotation tool was used to annotate the bounding boxes and class labels of the images, with an annotation accuracy of ≥98%. The dataset was divided into a training set (17102 images), a validation set (2138 images), and a test set (2138 images) in an 8:1:1 ratio. Representative data images are shown below. Figure 7 As shown in Table 3, the sample distribution for each category is as follows:
[0124] Table 3. Statistical data for training and test sets of each category.
[0125] Category Training Set Test Set Fire 9765 1763 Firefighter 8562 1288
[0126] 3. Performance Indicators
[0127] The COCO standard evaluation metrics are used, including precision (P), recall (R), average precision (mAP@50, mAP@95), number of parameters, computational complexity (GFLOPs), and inference speed (FPS). The calculation formulas for the core metrics are as follows:
[0128] (1) Precision: In the formula, TP represents the number of true positive samples and FP represents the number of false positive samples;
[0129] (2) Recall rate: In the formula, FN represents the number of false negative samples;
[0130] (3) Average accuracy: In the formula, T is the number of IoU thresholds (taken as 10), AP IoU=t This represents the average accuracy when the IoU threshold is t.
[0131] 4. Experimental Results
[0132] 4.1 Visual Analysis of Attention Distribution
[0133] To verify the focusing effect of each module on the target area, the attention distribution was visualized and analyzed using a heatmap. The results are as follows: Figure 8 As shown:
[0134] (1) Baseline DEIM model: The attention area is scattered, the focus on the fire source and firefighters is insufficient, and it is significantly affected by smoke and background interference;
[0135] (2) After adding the hierarchical attention mechanism: the attention to the target area is enhanced, but the background interference is still significant;
[0136] (3) After adding the FeatureEnhancement module: the distinction between the target and the background is improved, and the details of small targets are enhanced, but the global dependency modeling is insufficient;
[0137] (4) After adding the MetaFormer encoder: the interaction between global and local features is enhanced, effectively suppressing smoke and background interference;
[0138] (5) FFD-DEIM (Full Module Integration): Attention is precisely focused on the fire source and the firefighter area. Even under conditions of smoke obscuring and low light, the target boundary can still be clearly delineated, verifying the effectiveness of the collaborative optimization of each module.
[0139] 4.2 Ablation Experiment
[0140] To evaluate the contribution of each core module, ablation experiments were conducted under the same experimental setup, and the results are shown in Table 4:
[0141] Table 4 Comparison of ablation test results
[0142]
[0143]
[0144] Analysis shows that:
[0145] (1) After the multi-scale backbone network (ID2) was introduced alone, mAP@50 was improved by 0.8% and recall was improved by 2.4%, which verified the promoting effect of bidirectional feature transfer on small target detection.
[0146] (2) The hierarchical attention mechanism (ID3) improves the accuracy by 1.3% while reducing the number of parameters, demonstrating its advantage of lightweight enhancement features;
[0147] (3) The FeatureEnhancement module (ID4) is the core of improving detection accuracy, with a 2.5% improvement in mAP@50, indicating that multi-receptive field fusion and residual diffusion can effectively enhance cross-scale feature expression;
[0148] (4) The MetaFormer encoder (ID5) maintains stable performance while reducing computational complexity, providing support for lightweight models;
[0149] (5) Full module integration (ID9) achieves optimal performance, with mAP@50 reaching 77.8%, parameter count 3.3M, and GFLOPs 6.8B, verifying the collaborative optimization effect of each module.
[0150] 4.3 Comparison of Typical Models
[0151] The results of comparing FFD-DEIM with mainstream detection models on the same dataset are shown in Table 5:
[0152] Table 5 Performance comparison among mainstream detection models
[0153]
[0154]
[0155] The comparison results show that:
[0156] (1) FFD-DEIM ranked first in four core indicators: mAP@50 (77.8%), mAP@95 (45.8%), accuracy (79.8%), and recall (76.8%), which is 0.5%-3.6% higher than YOLO11-n, demonstrating its advantage in detection accuracy;
[0157] (2) The number of parameters (3.3M) is comparable to that of GFLOPs (6.8B), and is comparable to that of YOLO11-n, and is much lower than that of RT-DETR (6.8M / 9.6B);
[0158] (3) The inference speed on the edge device NVIDIA Jetson Nano reaches 28.2 FPS, which meets the requirements of real-time detection and is better than most comparison models.
[0159] 4.4 Visual Comparison of Detection
[0160] The detection visualizations of FFD-DEIM, DEIM benchmark model, and YOLO11-n are compared, and the results are as follows: Figure 10 As shown:
[0161] (1) DEIM model: It can identify the main flame area, but the confidence level is low (0.31-0.32), and there are missed detections of edge flames and distant firefighters;
[0162] (2) YOLO11-n: It can detect obvious flames and firefighters, but it has false detections in areas obscured by smoke and small targets (such as sparks).
[0163] The rate of missed detections is relatively high;
[0164] (3) FFD-DEIM: The detection frame is more compact, the flame area is fully covered, and the confidence level is higher (0.85-0.92). It can accurately detect flames and distant firefighters under smoke cover, significantly reduce the false negative rate of small targets, and show stronger robustness in low light and complex backgrounds.
[0165] IV. Conclusion
[0166] The proposed FFD-DEIM model effectively addresses the issues of missed detection of small targets, insufficient robustness in complex scenarios, and high computational complexity in forest fire detection through a multi-scale feature extraction backbone network, a hierarchical attention feature enhancement mechanism, and a collaborative design of the FeatureEnhancement module and the MetaFormer encoder. Experimental results show that the model achieves 77.8% mAP@50 on a self-collected dataset, with 3.3M parameters, 6.8B GFLOPs, and an inference speed of 28.2 FPS on edge devices, outperforming mainstream detection models in all performance metrics.
[0167] This model can not only accurately detect fire targets such as open flames, smoke, and embers, but also effectively identify firefighters, providing comprehensive technical support for forest fire monitoring and fighting. It is especially suitable for deployment of edge devices such as drones and field monitoring terminals, and has important practical application value.
[0168] It should be noted that in this invention, the terms "comprising," "including," and any other variations are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Specific examples have been used in this invention to illustrate the principles and implementation methods of the technical solutions. The above examples are merely for the purpose of helping to understand the method and core ideas of this invention. The above descriptions are only preferred embodiments of this invention. It should be pointed out that due to the limitations of written expression, and the objective existence of infinite specific structures, those skilled in the art can make several improvements, modifications, or changes without departing from the principles of this invention, and can also combine the above technical features in an appropriate manner. These improvements, modifications, changes, or combinations, or the direct application of the concept and technical solutions of this invention to other situations without modification, should all be considered within the scope of protection of this invention.
Claims
1. An image adaptive feature enhancement and hierarchical attention method for forest fire detection, implemented based on the DEIM framework, characterized in that: Includes the following steps: A. Dataset Construction and Preprocessing Steps: Construct a self-collected forest fire dataset, which includes forest fire scene samples, suspected fire scene samples, and non-fire scene samples. Perform annotation and data augmentation processing on the sample images. B. Image Acquisition and Standardization Steps: Acquire raw image data of the forest scene using an image acquisition device, and perform format standardization processing on the raw image data, including resolution unification, color space conversion, and pixel value normalization, to obtain a standardized image; C. Multi-scale feature extraction and bidirectional feature transfer steps: The standardized image is input into a multi-scale feature extraction backbone network. The backbone network includes a top-down feature downsampling path, a bottom-up feature upsampling path, and multiple lateral connections connecting the two, which are used to generate feature maps at multiple scales and realize bidirectional feature transfer and fusion between shallow and deep layers. D. Adaptive Feature Enhancement Steps: Input feature maps at various scales into the feature fusion and diffusion module. The module includes a convolutional embedding subunit, a spatial context subunit, a feature refinement subunit, and a bidirectional feature transfer subunit. The feature refinement subunit sequentially performs input concatenation, multi-receptive field extraction, multi-scale aggregation and residual diffusion, pointwise convolutional interaction, and dimensionality reduction operations to refine and enhance features from different scales and output an enhanced feature map. E. Hierarchical attention encoding step: The enhanced feature map is input into the hierarchical attention encoder based on the MetaFormer architecture, and the feature weights are allocated sequentially through the shallow feature attention unit (using the SHSA spatial hierarchical self-attention mechanism), the middle semantic attention unit (using the EDFFN efficient dynamic feedforward network), and the deep target attention unit to enhance the fire features and suppress background interference, and output the attention-weighted feature map. F. Feature matching and recognition steps: Based on the Dense-O2O matching mechanism of the DEIM framework, the attention-weighted feature map and the fire feature template are matched pixel by pixel to calculate the fire feature matching degree; G. Model optimization and judgment steps: If the matching degree is greater than the preset threshold, it is judged as a fire scene and the detection result is output; Otherwise, it is determined to be a non-fire scenario; during the model training phase, the network parameters are optimized based on multiple performance evaluation indicators to improve the accuracy and robustness of forest fire detection.
2. The method according to claim 1, characterized in that, The multi-scale feature extraction backbone network adopts a bidirectional feature transfer structure, specifically including: 1) Top-down feature downsampling path, used to reduce the feature map resolution and increase the number of channels layer by layer through continuous convolution and downsampling operations, in order to extract high-level semantic features; 2) Bottom-up feature upsampling path, used to restore the spatial resolution of feature maps layer by layer through upsampling and convolution operations, so as to reconstruct fine-grained spatial information; 3) Multiple lateral connections are used to transfer features from different paths between the same or adjacent scales, fusing high-resolution detail features from shallow layers with high-semantic features from deep layers. 4) Through the above bidirectional feature transfer structure, features rich in contextual information are diffused between different detection scales, so that the feature map at each scale has both local details and global semantic information, thereby enhancing the detectability of small targets and occluded targets.
3. The method according to claim 1, characterized in that, The specific operations for refining the feature sub-units in step D include: 1) Input concatenation: Combine the multi-scale initial features according to the formula X = Concat(X 1 ,X 2 ,X 3 Perform feature concatenation, where X is the concatenated feature map; X 1 ,X 2 ,X 3 These are initial feature maps at different scales; Concat is the feature concatenation operation. 2) Multi-receptor field extraction: According to formula X k =DWConv k (X) Extracts multi-receptive-field features, where X... k This is the feature map of the k-th receptive field; DWConv k . represents a k×k depth convolution operation, where k∈5,7,9,11; 3) Multiscale aggregation and residual diffusion: according to the formula Perform feature aggregation, where X' is the aggregated feature map; This is the sum of the characteristics of each receptive field; 4) Pointwise Convolution Interaction and Dimensionality Reduction: First, perform pointwise convolution according to the formula X″=PWConv(X′), then perform pointwise convolution according to the formula Y=Conv 1×1 (X+X″) outputs the enhanced feature map, where X″ is the feature map after pointwise convolution; PWConv is the pointwise convolution operation; Y is the enhanced feature map; Conv 1×1 This is a 1×1 convolution operation.
4. The method according to claim 1, characterized in that, In step C, the bidirectional feature transfer subunit includes a forward transfer path and a reverse feedback path. The forward transfer path transfers the output features of the spatial context subunit to the feature refinement subunit, and the reverse feedback path feeds back the multi-scale aggregated features of the feature refinement subunit to the spatial context subunit. During the transfer process, the feature transfer direction and intensity are controlled by a gating unit.
5. The method according to claim 1, characterized in that, The multi-scale feature extraction backbone network incorporates a hierarchical attention feature enhancement mechanism in both shallow and deep layers, including: 1) In the shallow feature extraction stage, a frequency-spatial attention mechanism is introduced into the early feature map to decompose the features in the frequency domain and perform weight allocation in the spatial dimension to highlight the high-frequency detail features of small targets such as flames and small firefighters, and suppress low-frequency interference from the background. 2) In the deep feature extraction stage, a channel attention mechanism is introduced into the high-level feature map. By weighting the responses of each channel, the weight of the channel related to fire category determination is increased and the weight of redundant channels is reduced to ensure the stability of global semantic modeling. 3) By combining shallow frequency-spatial attention with deep channel attention in a hierarchical manner, high-frequency details of small targets are enhanced while maintaining the integrity of deep semantic expression, thus achieving hierarchical feature enhancement without significantly increasing computational cost.
6. The method according to claim 1, characterized in that, The feature encoding module adopts a hierarchical attention encoder based on the MetaFormer architecture, which divides the input enhanced feature map into several spatial blocks of a preset size. Within each spatial block, the correlation coefficient between features is calculated to determine the attention weight within the block. Local features such as fire edges and smoke textures are enhanced, and only a small number of cross-block connections are retained to achieve sparse global modeling, thereby reducing the amount of attention computation while improving the retention of small target features.
7. The method according to claim 6, characterized in that, The hierarchical attention encoder's EDFFN efficient dynamic feedforward network includes a channel shuffling layer and a dynamic activation layer. The channel shuffling layer divides the input feature channels into multiple channel groups and rearranges them to break down information barriers between channels and enhance the interaction and fusion of features from different channels. The dynamic activation layer introduces an adjustment term related to the feature value on the basis of the standard activation function. The coefficient of the adjustment term ranges from 0.01 to 0.05 and is used to amplify or suppress different feature responses as needed, thereby improving feature representation capabilities while controlling computational complexity.
8. The method according to claim 1, characterized in that, In the model optimization and judgment steps, the preset threshold is determined in the following way: the fire feature template library constructed by the Dense-O2O matching mechanism contains feature templates for three types of fires: open flame, smoke, and embers. During matching, the cosine similarity between the attention-weighted feature map and each template is calculated, and the maximum similarity is taken as the fire feature matching degree.
9. The method according to claim 8, characterized in that, The preset threshold in step F is determined in the following way: based on the training samples of the self-collected dataset, with the goal of maximizing the harmonic mean of precision and recall, the candidate threshold interval is traversed to determine the optimal threshold, and the threshold with the largest comprehensive performance index is selected as the optimal fire judgment threshold, which is used to determine the fire feature matching degree in the inference stage to balance the false detection rate and the false negative rate.
10. The method according to claim 4, characterized in that, The gating unit uses the Sigmoid activation function, which performs weight transformation and bias adjustment on the feature vector after fusing forward and reverse features, and outputs a gating coefficient in the range of 0-1 to control the feature transmission intensity.
Citation Information
Cited By
Infrared image enhancement and multi-scale fusion wild animal recognition traceability method
CN122336808A