A flame detection method for a petrochemical scene
By improving the YOLOv8n network for multi-scale feature extraction and adaptive fusion, and combining a dynamic alignment single-head structure and a focusing geometric loss function, the problem of unifying accuracy and efficiency in flame detection in petrochemical scenarios is solved, achieving high-precision and high-efficiency flame detection, which is suitable for resource-constrained edge devices.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANGHAI JIAOTONG UNIV
- Filing Date
- 2026-03-12
- Publication Date
- 2026-05-29
AI Technical Summary
Existing technologies face the challenge of balancing accuracy and efficiency in flame detection tasks in petrochemical scenarios. Traditional methods have weak generalization capabilities and high false alarm rates, while advanced models suffer from high computational costs or insufficient accuracy on resource-constrained devices, making it difficult to achieve a balance between high accuracy and high efficiency.
An improved YOLOv8n network with multi-scale feature extraction and adaptive fusion is adopted, which combines dynamic alignment single-head structure and focusing geometric loss function to optimize bounding box regression, reduce parameter redundancy, and improve detection accuracy and efficiency.
It achieves high-precision and high-efficiency flame detection on resource-constrained devices, significantly reduces dependence on high-computing-power hardware, and improves the robustness and real-time processing performance of the model in complex petrochemical scenarios.
Smart Images

Figure CN122115837A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of computer vision and industrial safety monitoring technology, specifically to a flame detection method for petrochemical scenarios. Background Technology
[0002] In recent years, with the deep integration of artificial intelligence technology into industrial safety monitoring, computer vision-based intelligent sensing systems have become a core means of ensuring production safety. In high-risk scenarios such as the petrochemical industry, achieving early and accurate flame detection is crucial for preventing catastrophic accidents and protecting personnel and assets, and is a key infrastructure for driving the industry's transformation towards intelligent and proactive safety control. Deep learning-based target detection algorithms, with their powerful feature learning and recognition capabilities, provide a new technical path for automatically and in real-time locating flames from complex monitoring video streams.
[0003] However, real-time flame detection in petrochemical scenarios still faces significant challenges. On one hand, industrial environments are extremely complex: monitoring perspectives are variable, lighting conditions are unstable, and there are numerous dynamic interference sources. Furthermore, flames themselves exhibit characteristics such as varying scale, color distortion, and non-rigid shape. Traditional detection methods, such as algorithms based on manually designed features or early lightweight neural networks, suffer from weak generalization ability and high false alarm rates in such complex scenarios, failing to meet industrial-grade reliability requirements. On the other hand, while advanced detection models like the YOLO series perform well in general target detection, their direct application to resource-constrained petrochemical edge devices faces dual bottlenecks in accuracy and efficiency. Large models designed for high accuracy have enormous parameter counts and high computational costs, making real-time inference impossible on embedded devices with limited computing power. Lightweight models designed for efficiency suffer from inherently rigid feature fusion strategies, redundant detection heads, and insufficient modeling of irregular target geometry, leading to a significant decrease in accuracy in complex and variable flame detection tasks. It is difficult to achieve a balance between high detection rate and low false alarm rate while maintaining lightweight design. Summary of the Invention
[0004] To address the shortcomings of existing technologies, the present invention aims to provide a flame detection method for petrochemical scenarios. By performing multi-scale feature extraction and adaptive fusion on the input image, adopting a dynamically aligned single-head detection structure to reduce parameter redundancy, and utilizing a focusing geometric loss function to optimize bounding box regression, the method achieves a balance between high accuracy and high efficiency in flame detection.
[0005] To solve the above problems, the technical solution of the present invention is as follows:
[0006] A flame detection method for petrochemical scenarios includes the following steps:
[0007] Image preprocessing of monitoring images from petrochemical scenes;
[0008] The preprocessed image is input into the improved YOLOv8n network, and the P2 to P5 feature layers extracted by the backbone network are dynamically integrated through the neck module by multi-scale adaptive weighted fusion.
[0009] The detection task is carried out using a dynamically aligned single-head structure, and deformable convolution is used to adapt to the non-rigid shape of the flame, reducing the number of model parameters.
[0010] Training is performed using a focused geometric loss function, combined with shape-aware constraints and a sample weighting mechanism to improve the accuracy of bounding box regression.
[0011] The trained model is deployed on edge computing devices to achieve real-time flame detection and alarm functions in petrochemical scenarios.
[0012] Preferably, in the step of image preprocessing of the petrochemical scene monitoring image, the image preprocessing includes image scaling, normalization and data augmentation operations, and the data augmentation operations include random rotation, random cropping and color space transformation operations.
[0013] Preferably, in the step of inputting the preprocessed image into an improved YOLOv8n network and dynamically integrating the P2 to P5 feature layers extracted by the backbone network through a multi-scale adaptive weighted fusion neck module, the improved YOLOv8n network includes a backbone network, a multi-scale adaptive weighted fusion neck module, and a dynamically aligned single-head module.
[0014] Preferably, the multi-scale adaptive weighted fusion neck module fuses multi-level features through a dynamic weight allocation mechanism, and its weight calculation formula is as follows:
[0015]
[0016] in For dynamic weights learned through the ReLU activation function, To prevent the removal of zero constants and ensure the numerical stability of feature fusion.
[0017] Preferably, in the step of using a dynamically aligned single-head structure for the detection task and adapting the non-rigid shape of the flame through deformable convolution to reduce the number of model parameters, the dynamically aligned single-head structure includes a group normalized dual-path fusion block, a task decomposition module, and a deformable convolutional layer, and its deformable convolution operation is defined as follows:
[0018]
[0019] in The learned offset, For modulation scalar correspond Convolution kernels adaptively capture changes in flame shape.
[0020] Preferably, in the step of training with a focusing geometric loss function and improving the bounding box regression accuracy by combining shape-aware constraints and sample weighting mechanisms, the focusing geometric loss function integrates shape IoU and dynamic focusing mechanisms, and its calculation formula is:
[0021]
[0022] in Based on sample outlier Weighting factors This is the shape-aware loss term.
[0023] Compared with existing technologies, this invention achieves a balance between high accuracy and high efficiency in flame detection by performing multi-scale feature extraction and adaptive fusion on the input image, employing a dynamically aligned single-head detection structure to reduce parameter redundancy, and utilizing a focusing geometric loss function to optimize bounding box regression. Compared to existing solutions, this invention significantly reduces reliance on high-performance hardware (such as GPU servers), substantially improves the deployment efficiency and real-time processing performance of the model on resource-constrained edge devices, and exhibits strong robustness to complex petrochemical scenarios (such as variable lighting, small targets, and irregularly shaped flames), providing a reliable technical foundation for the intelligent, real-time, and universal deployment of industrial safety monitoring. Attached Figure Description
[0024] Other features, objects, and advantages of the present invention will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings:
[0025] Figure 1 This is a flowchart of the flame detection method for petrochemical scenarios according to the present invention;
[0026] Figure 2 This is a diagram of the improved YOLOv8n network architecture of this invention;
[0027] Figure 3 This is a detailed structural diagram of the multi-scale adaptive weighted fusion neck module in this invention;
[0028] Figure 4 This is a detailed diagram illustrating the internal structure of the dynamic alignment single-head module in this invention;
[0029] Figure 5 This is a schematic diagram of the focusing geometry IoU loss principle used in this invention. Detailed Implementation
[0030] The present invention will now be described in detail with reference to specific embodiments. These embodiments will help those skilled in the art to further understand the present invention, but do not limit the invention in any way. It should be noted that those skilled in the art can make several changes and improvements without departing from the concept of the present invention. These all fall within the protection scope of the present invention.
[0031] Specifically, this invention provides a flame recognition method based on an improved YOLOv8 network, such as... Figure 1 As shown, the method includes the following steps:
[0032] S1: Perform image preprocessing on monitoring images of petrochemical scenes;
[0033] Specifically, the image preprocessing of the petrochemical scene monitoring images includes image scaling, normalization, and data augmentation operations; the data augmentation operations include random rotation, random cropping, and color space transformation.
[0034] S2: Input the preprocessed image into the improved YOLOv8n network, and dynamically integrate the P2 to P5 feature layers extracted from the backbone network through multi-scale adaptive weighted fusion of the neck module;
[0035] Specifically, such as Figure 2 As shown, the improved YOLOv8n network includes a backbone network, a multi-scale adaptive weighted fusion neck module (MAWFN), and a dynamically aligned single-head module (DAUH).
[0036] The Multi-Scale Adaptive Weighted Fusion Neck Module (MAWFN) achieves adaptive fusion of multi-level features through a dynamic weight allocation mechanism. Its network structure diagram is shown below. Figure 3 As shown, this module employs learnable attention weights, ensuring non-negativity of the weights through the ReLU activation function, and introducing a minimal constant (ε=0.0001) to prevent numerical instability. During feature fusion, low-level P2 features (4x downsampling) are specifically preserved to enhance spatial detail perception and effectively capture subtle features of small-scale flames. Simultaneously, the module dynamically integrates high-level semantic features from P3 to P5 through weighted summation, forming multi-scale feature pyramids of 80×80, 40×40, and 20×20, significantly improving the model's sensitivity to flame detection at different scales.
[0037] The multi-scale adaptive weighted fusion neck module fuses multi-level features through a dynamic weight allocation mechanism, and its weight calculation formula is as follows:
[0038]
[0039] in For dynamic weights learned through the ReLU activation function, To prevent the removal of zero constants and ensure the numerical stability of feature fusion.
[0040] S3: The detection task is carried out using a dynamically aligned single-head structure. Deformable convolution is used to adapt to the non-rigid shape of the flame and reduce the number of model parameters.
[0041] Specifically, a dynamically aligned single-head structure replaces the traditional detection head for detection tasks. This structure adaptively adjusts the sampling position of the convolution kernel through deformable convolutional layers to accurately capture the edge jitter and morphological change features of the flame. Its detailed architecture is as follows: Figure 4 As shown, the Dynamic Aligned Single Head (DAUH) architecture replaces the traditional multi-branch detection head with a unified architecture, including a group-normalized dual-path fusion block, a task decomposition module, and deformable convolutional layers. The group-normalized dual-path fusion block improves training stability through channel grouping normalization. The task decomposition module splits the detection task into two parallel branches: regression and classification. The deformable convolutional layers achieve adaptive sampling through a 27-channel offset generator, enabling the 3×3 convolutional kernel to adaptively adjust the sampling position. This design not only effectively captures the non-rigid morphological changes of flames but also reduces the number of parameters by approximately 33.9%, significantly improving the computational efficiency of the model.
[0042] The deformable convolution operation of the dynamically aligned single-head structure is defined as follows:
[0043]
[0044] in The learned offset, For modulation scalar correspond Convolution kernels adaptively capture changes in flame shape.
[0045] S4: Use the focused geometry loss function for training, and combine shape-aware constraints and sample weighting mechanism to improve the accuracy of bounding box regression;
[0046] Specifically, the focused geometric IoU loss function is used to optimize bounding box regression, and shape-aware constraints and sample weighting mechanisms are combined to improve the accuracy of bounding box regression. A schematic diagram of this principle is shown below. Figure 5 As shown, the focused geometric IoU loss function integrates shape-aware constraints and a dynamic sample weighting mechanism. By calculating the aspect ratio difference between the predicted bounding box and the ground truth bounding box, a shape sensitivity coefficient (λ=1.5) is introduced to construct a shape penalty term. Simultaneously, a dynamic weighting factor is generated based on the sample outlier degree (β), applying greater weight to difficult samples. This dual optimization mechanism enables the model to maintain stable localization performance in complex multi-scale scenes, especially performing exceptionally well when dealing with irregular flame shapes.
[0047] First, based on the width of the actual bounding box. and high Calculate the shape weight coefficient and adjust the penalty in the width and height directions using hyperparameters. Controlling sensitivity to the aspect ratio of the bounding box:
[0048]
[0049]
[0050] Based on shape weights, a shape-aware distance penalty term is constructed. In addition to the traditional center point distance penalty, shape weight modulation is introduced to associate the penalty for center point offset with the target shape.
[0051]
[0052] in Let this be the diagonal length of the smallest bounding rectangle of both. A shape cost term is also defined to penalize shape inconsistencies:
[0053]
[0054] Simultaneously, a dynamic focusing mechanism is introduced, along with the concept of sample outlier:
[0055] in It is the Shape-IoU loss value calculated for the current single training sample. It is the average loss of all samples within a statistical period, and then a dynamic focusing mechanism is introduced:
[0056] The focused geometric IoU loss function integration With the dynamic focusing mechanism, its calculation formula is:
[0057]
[0058] in Based on sample outlier Weighting factors This is the shape-aware loss term.
[0059] S5: Deploy the trained model on edge computing devices to achieve real-time flame detection and alarm functions in petrochemical scenarios.
[0060] Specifically, after the above optimization process, the final lightweight model has a parameter count of 2.05M. On a petrochemical scene-specific test set containing 5,302 images, it achieves a detection accuracy of 94.6% and a mAP@0.5 of 94.0%. Compared with mainstream models, it improves accuracy by 4.7% while reducing the parameter count by 33.9%, which is significantly better than advanced models such as YOLOv10m (15.3M parameters) and RT-DETR.
[0061] Through end-to-end optimization, this invention achieves a final model with a computational complexity of only 8.1 GFLOPs while maintaining high accuracy. This high performance enables deployment on resource-constrained edge devices, enabling high frame rate detection and fully meeting the real-time requirements of 24 / 7 uninterrupted monitoring in petrochemical industrial sites, thus providing reliable technical support for industrial safety.
[0062] Specific embodiments of the present invention have been described above. It should be understood that the present invention is not limited to the specific embodiments described above, and those skilled in the art can make various changes or modifications within the scope of the claims, which do not affect the essence of the present invention. Unless otherwise specified, the embodiments and features described in this application can be arbitrarily combined with each other.
Claims
1. A flame detection method for petrochemical scenarios, characterized in that, The method includes the following steps: Image preprocessing of monitoring images from petrochemical scenes; The preprocessed image is input into the improved YOLOv8n network, and the P2 to P5 feature layers extracted by the backbone network are dynamically integrated through the neck module by multi-scale adaptive weighted fusion. The detection task is carried out using a dynamically aligned single-head structure, and deformable convolution is used to adapt to the non-rigid shape of the flame, reducing the number of model parameters. Training is performed using a focused geometric loss function, combined with shape-aware constraints and a sample weighting mechanism to improve the accuracy of bounding box regression. The trained model is deployed on edge computing devices to achieve real-time flame detection and alarm functions in petrochemical scenarios.
2. The flame detection method for petrochemical scenarios according to claim 1, characterized in that, The step of image preprocessing for monitoring images of petrochemical scenes includes image scaling, normalization, and data augmentation operations. The data augmentation operations include random rotation, random cropping, and color space transformation operations.
3. The flame detection method for petrochemical scenarios according to claim 1, characterized in that, In the step of inputting the preprocessed image into the improved YOLOv8n network and dynamically integrating the P2 to P5 feature layers extracted by the backbone network through the multi-scale adaptive weighted fusion neck module, the improved YOLOv8n network includes a backbone network, a multi-scale adaptive weighted fusion neck module, and a dynamically aligned single-head module.
4. The flame detection method for petrochemical scenarios according to claim 3, characterized in that, The multi-scale adaptive weighted fusion neck module fuses multi-level features through a dynamic weight allocation mechanism, and its weight calculation formula is as follows: in For dynamic weights learned through the ReLU activation function, To prevent the removal of zero constants and ensure the numerical stability of feature fusion.
5. The flame detection method for petrochemical scenarios according to claim 1, characterized in that, In the step of employing a dynamically aligned single-head structure for the detection task, and adapting the non-rigid shape of the flame through deformable convolution to reduce the number of model parameters, the dynamically aligned single-head structure includes a group-normalized dual-path fusion block, a task decomposition module, and a deformable convolutional layer. Its deformable convolutional operation is defined as follows: in The learned offset, For modulation scalar correspond Convolution kernels adaptively capture changes in flame shape.
6. The flame detection method for petrochemical scenarios according to claim 1, characterized in that, In the step of training with a focusing geometric loss function and combining shape-aware constraints and sample weighting mechanisms to improve the accuracy of bounding box regression, the focusing geometric loss function integrates shape IoU and dynamic focusing mechanisms, and its calculation formula is as follows: in Based on sample outlier Weighting factors This represents the shape-aware loss term.