Fire smoke identification method for chemical industry park based on YOLO detection and ResNet feature comparison

By using YOLO detection and ResNet feature comparison, a fire smoke recognition system for chemical industrial parks was constructed, which solved the problem of high false alarm rates for production smoke and fire smoke in chemical industrial parks, and achieved efficient and accurate fire early warning and all-weather monitoring.

CN122391981APending Publication Date: 2026-07-14GUANGDONG INSTITUTE OF SAFETY PRODUCTION & EMERGENCY MANAGEMENT SCIENCE & TECHNOLOGY +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GUANGDONG INSTITUTE OF SAFETY PRODUCTION & EMERGENCY MANAGEMENT SCIENCE & TECHNOLOGY
Filing Date
2026-04-07
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

Existing technologies cannot effectively distinguish between production smoke and fire smoke in chemical industrial parks, resulting in a high false alarm rate and affecting the reliability and practicality of the monitoring system.

Method used

This paper adopts the method of YOLO detection and ResNet feature comparison. By constructing a targeted fire dataset and a multi-class smoke dataset, and combining color perturbation, target copy and paste, background interference superposition and alpha fusion enhancement, the YOLO model is trained and the ResNet feature extraction network is improved to build a smoke feature library, so as to achieve accurate identification and discrimination of smoke type.

Benefits of technology

It significantly reduced the false alarm rate, improved the accuracy of fire early warning and the reliability of the system, realized all-weather unmanned intelligent monitoring of the chemical industrial park, and enhanced the park's safety management level.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122391981A_ABST
    Figure CN122391981A_ABST
Patent Text Reader

Abstract

A chemical industry park fire smoke identification method based on YOLO detection and ResNet feature comparison, a fire data set and a multi-class smoke data set are constructed; the fire data set is enhanced to obtain an expanded data set, YOLO is used as a benchmark model, an attention mechanism is introduced, a training set is divided based on the expanded data set and online enhancement is carried out, and a fire target detection model is obtained after training; the pre-trained ResNet model is fine-tuned using the multi-class smoke data set to obtain a smoke feature extraction network model; the features in the multi-class smoke data set are extracted using the smoke feature extraction network model, and a normal production smoke feature library is constructed; real-time smoke images are collected, the candidate region is located by the fire target detection model, the feature vector is extracted after the image block is processed, the cosine similarity with the feature library vector is calculated, and whether to trigger the early warning is judged according to the similarity threshold. The method can effectively improve the accuracy and reliability of the park fire warning system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of intelligent manufacturing and industrial internet security technology, specifically involving a method for identifying smoke from fires in chemical industrial parks based on YOLO detection and ResNet feature comparison. Background Technology

[0002] As a vital pillar of the national economy, the chemical industry's production processes often involve hazardous factors such as high temperature, high pressure, flammability, explosiveness, toxicity, and harmful substances. Chemical industrial parks, as concentrated areas for numerous chemical enterprises, are of paramount importance for safe operation. An explosion could not only cause enormous property damage and casualties but also lead to severe environmental pollution and even public panic. Therefore, real-time, efficient, and precise safety monitoring of chemical industrial parks, especially in early warning and rapid response to explosions, is an urgent need to safeguard people's lives and property and maintain social stability.

[0003] Currently, chemical industrial parks widely deploy fixed and mobile monitoring equipment such as high-altitude observation towers. However, in actual operation, these devices suffer from numerous problems, such as a large number of monitoring points and video feeds, and anomaly identification still heavily relies on human experience, making it difficult to achieve 24 / 7 real-time analysis of each monitoring point. In recent years, with the continuous development of video surveillance and artificial intelligence technologies, new approaches have been provided for video-based intelligent identification, and fire smoke detection has thus become a research hotspot.

[0004] However, existing technologies in practical applications mainly fall into two categories, both with significant drawbacks. One category is video analysis methods based on general target detection models. While these methods offer fast detection speeds, their core problem lies in their inability to effectively distinguish the nature of smoke. Their architecture is essentially a single-stage target localization and classification, focusing only on improving the detection accuracy and speed of the general target "smoke," lacking a deep semantic understanding of the smoke source. Therefore, they lack the ability to effectively differentiate between normal process smoke (such as steam and process flue gas) commonly found in chemical production and initial smoke from fires. The other category is monitoring technology based on satellite remote sensing. This technology relies on multispectral data analysis and fire point determination using fixed spatiotemporal thresholds. While suitable for large-scale natural resource monitoring, it cannot meet the high real-time and high-resolution requirements of ground-based video monitoring in chemical industrial parks. Furthermore, it suffers from significant communication delays, is susceptible to interference, and similarly lacks the ability to learn and differentiate emissions from specific processes within the plant area.

[0005] The shortcomings of these two existing technologies lead to a high false alarm rate in park monitoring systems during actual deployment, resulting in frequent false alarms. The root cause of this problem lies in the common occurrence of normal process emissions during chemical production, such as steam emissions and process flue gas. These normal smokes are highly similar in video characteristics to the smoke at the initial stage of a fire. While existing technologies can effectively detect "smoke" targets, they lack the ability to distinguish the source and nature of the smoke, making it difficult to differentiate between process smoke and actual fire. This not only seriously interferes with the normal duty work of security personnel and consumes valuable emergency resources, but also triggers a "crying wolf" crisis of trust in long-term operation, severely damaging the credibility and practicality of the overall early warning system, making it difficult for advanced technologies to be truly implemented and effective.

[0006] Therefore, there is an urgent need to develop a new fire detection method that can intelligently distinguish between production smoke and fire smoke, so as to significantly reduce the false alarm rate, effectively break through the technical bottleneck of safety management in chemical industrial parks, and improve the inherent safety level of the parks. Summary of the Invention

[0007] To address the problems existing in the prior art, this invention provides a method for identifying fire smoke in chemical industrial parks based on YOLO detection and ResNet feature comparison. This method is simple to implement and has low implementation costs. It effectively solves the problems of high false alarm rates and ineffective unattended monitoring systems caused by the inability of existing technologies to distinguish between smoke during production and smoke from fires. It can significantly reduce the false alarm rate caused by normal production activities in chemical industrial parks, effectively improve the accuracy of fire early warning and system reliability, and realize all-weather, unmanned intelligent monitoring of chemical industrial parks, fundamentally solving the problem of frequent false alarms caused by normal process emissions.

[0008] To achieve the above objectives, this invention provides a method for identifying smoke from fires in chemical industrial parks based on YOLO detection and ResNet feature comparison, comprising the following steps: Step 1: Building the offline model; S11: Construct a fire dataset labeled with smoke candidate regions and a multi-class smoke dataset containing multiple types of smoke images, respectively; S12: Enhance the fire dataset using color perturbation enhancement, small target copy-paste enhancement, background interference overlay enhancement, and alpha fusion enhancement to obtain an expanded fire dataset; S13: Use YOLO as the baseline model and introduce an attention mechanism. Simultaneously, construct bounding box regression loss functions and improved classification loss functions to make model training more focused on difficult-to-classify samples; Divide the training set based on the expanded fire dataset. During training, first randomly apply Mosaic data augmentation, random flipping, and color jitter operations to the fire images in the training set for online enhancement processing, then input them into the YOLO model for training. After training, a fire target detection model for detecting smoke candidate regions is obtained; S14: Use the multi-class smoke dataset to perform end-to-end contrastive learning fine-tuning on the pre-trained ResNet base model to obtain a smoke feature extraction network model for extracting smoke feature vectors; Step 2: Construction of the normal production smoke feature library; The smoke feature extraction network model is used to extract features from all sample images labeled as industrial production smoke in the multi-class smoke dataset, and a set of normal production smoke feature vectors is obtained to construct the initial normal production smoke feature library. Step 3: Real-time image recognition and intelligent early warning; S31: Real-time acquisition of smoke images and input into the fire target detection model to detect and locate candidate smoke regions in the smoke images; S32: Cropping the image blocks corresponding to the candidate smoke regions, and inputting them into the smoke feature extraction network model after unified preprocessing to extract smoke feature vectors; S33: Calculating the cosine similarity between the smoke feature vector and all normal production smoke feature vectors, and selecting the highest cosine similarity; S34: If the highest cosine similarity is greater than or equal to the similarity threshold, it is determined to be a normal process emission condition, and no fire alarm is triggered; if the highest cosine similarity is less than the similarity threshold, it is determined to be unknown smoke suspected of being from a fire, and a fire warning is immediately triggered.

[0009] As a preferred embodiment, in step S11 of step 1, the process of constructing a fire dataset labeled with smoke candidate regions and a multi-class smoke dataset containing multiple types of smoke images is as follows: We collected fire images of different scenes, scales, and combustion states, and used the Labelling annotation tool to annotate smoke candidate regions in the form of rectangular boxes to construct a fire dataset for target detection training. We collected and organized three types of smoke images: fire smoke, industrial smoke, and smoke from natural environmental disturbances. We then performed unified preprocessing and segmentation operations on the smoke images to construct a multi-class smoke dataset for feature extraction training. The unified preprocessing included size scaling and normalization.

[0010] In this technical solution, a fire dataset is constructed by collecting fire images with different characteristics and labeling smoke candidate regions. At the same time, three types of smoke images are collected, preprocessed, and divided to construct a multi-class smoke dataset. This provides targeted, rich, and standardized basic data for target detection and feature extraction training, which helps to improve the model training effect and recognition accuracy.

[0011] As a preferred embodiment, in step S12 of step 1, the process of obtaining the extended fire dataset is as follows: During the color perturbation enhancement process, each fire image in the fire dataset is linearly transformed in the HSV color space, and the hue, saturation, and brightness are randomly adjusted to generate multiple color variant images. In the small target copy-paste enhancement process, all small-scale smoke targets are selected from the fire dataset. These small targets are randomly scaled and rotated, and then pasted into the non-smoke areas of other fire images at random positions to obtain small target pasted images. In the background interference overlay enhancement process, image segments that are easily confused with smoke are cropped from the natural environment interference data such as smoke, and these image segments are overlaid onto the fire images in the fire dataset with random transparency and random position to obtain the interference overlay image; During the Alpha fusion enhancement process, a smoke template image is selected. and different background images Alpha fusion technology was used to synthesize smoke samples of different concentrations, resulting in alpha fusion images. All color variant images, small target pasted images, interference overlay images, and alpha fused images are merged with the fire images in the fire dataset to form a unified extended fire dataset.

[0012] In this technical solution, various variant images are generated by performing enhancement operations on the fire dataset targeting smoke characteristics during color perturbation, small target copying and pasting, background interference overlay, and Alpha fusion enhancement. These variant images are then merged with the original fire images to form an extended fire dataset, which greatly enriches the diversity and complexity of the data and helps to enhance the model's ability to learn and recognize smoke features in different scenarios.

[0013] As a preferred embodiment, in step 1, S13, the process of randomly applying Mosaic data augmentation, random flipping, and color dithering operations to the fire images in the training set is as follows: During the Mosaic data augmentation process, Mosaic augmentation is applied to the images in the training set at a preset frequency. Four fire images are randomly stitched into a large image. At the same time, the corresponding bounding box labels are automatically merged and adjusted. During random flipping, the image is flipped horizontally or vertically with a preset probability, or the horizontal equidistant, rotational and translational flipping effect is simulated in the target area of ​​some images, while the position coordinates of the bounding box are automatically adjusted. During the color jitter enhancement process, the brightness, contrast, and saturation of the image are adjusted slightly and randomly with a preset probability.

[0014] In this technical solution, by applying Mosaic data augmentation, random flipping, and color jitter enhancement to the fire images in the training set at preset frequencies and probabilities, the features of the images can be comprehensively enriched, which is conducive to improving the model's ability to adapt to and recognize different forms of fire smoke and complex environments.

[0015] As a preferred option, in step S12 of step 1, in order to flexibly simulate the color changes of smoke under different lighting and material combustion, effectively enhance data diversity, and improve the model's ability to recognize smoke with different color characteristics, during the color perturbation enhancement process, the hue, saturation, and brightness of the image are randomly linearly transformed in the HSV color space according to formulas (1), (2), and (3), respectively, to obtain new values ​​of the hue, saturation, and brightness components in the HSV color space. , , ; (1); (2); (3); In the formula, , , These are the original values ​​of the hue, saturation, and lightness components of the image in the HSV color space, respectively. , , These represent the new values ​​of the hue, saturation, and lightness components of the image in the HSV color space after the linear transformation; The perturbation parameters for hue, randomly sampled within a predetermined range, are used to adjust the hue values; , These are two different perturbation parameters about saturation, randomly sampled within a predetermined range; , These are two different perturbation parameters of brightness, randomly sampled within a predetermined range. In order to effectively simulate smoke scenarios with different concentrations, enrich data diversity, and improve the model's ability to recognize various smoke concentrations, the smoke template image is fused using Alpha fusion technology according to formula (4) during the Alpha fusion enhancement process. With background image Perform weighted fusion to generate new synthetic samples ; (4); In the formula, This is a transparency parameter used to control the density of the smoke.

[0016] As a preferred embodiment, in step S13 of step 1, the process of obtaining the fire target detection model for detecting smoke candidate areas is as follows: S13-1: YOLOv8 or YOLOv5 is used as the baseline model. At the same time, an attention mechanism is embedded after the C2f module in the backbone part of the baseline model to enhance the model's attention to the features of the smoke candidate region. S13-2: Construct the bounding box regression loss function according to formula (5) An improved classification loss function is constructed based on formula (6). ; (5); In the formula, This is the ratio of the area of ​​the intersection of the predicted bounding box and the area of ​​the union of the predicted bounding box and the ground truth bounding box. For prediction boxes With real frame Euclidean distance between the center points; To include prediction boxes With real frame The length of the diagonal of the smallest bounding rectangle; These are the weighting coefficients; This is used to measure the consistency of the aspect ratio between the predicted bounding box and the ground truth bounding box; (6); In the formula, This represents the model's predicted probability for the correct category. As a category balance factor; As a regulating factor; S13-3: Divide the extended fire dataset into training, validation, and test sets in a 7:2:1 ratio. Then, use the training set to train the baseline model. At the same time, use the validation set to adjust the model's hyperparameters and use the test set to evaluate the model's performance. Finally, save the model with the best performance as the fire target detection model.

[0017] This technical solution uses YOLOv8 or YOLOv5 as the baseline model and embeds an attention mechanism after the C2f module of the Backbone, which effectively enhances the model's focus on smoke candidate region features. By constructing a specific bounding box regression loss function and improving the classification loss function, precise optimization directions are provided for model training, effectively improving detection accuracy and the ability to handle class imbalance problems. Using the training set for training, the validation set for parameter tuning, and the test set for evaluation, the model performance can be comprehensively optimized, ensuring that the final fire target detection model has high accuracy and reliability in detecting smoke candidate regions.

[0018] As a preferred embodiment, the process of obtaining the smoke feature extraction network model in step S14 of step 1 is as follows: S14-1: Remove the fully connected classification layer at the end of the pre-trained ResNet network model and replace it with a feature projection head consisting of two fully connected layers to obtain an improved ResNet network model. The feature projection head is used to map the image to a low-dimensional normalized feature space and obtain the final output feature vector according to formula (7). ; (7); In the formula, It is the L2 normalization function; The second layer weight matrix ; For activation functions; This is the first layer weight matrix. ; The input feature vector; This is the first layer bias vector. ; This is the second layer bias vector. ; S14-2: Construct the triplet loss function according to formula (8) Triple loss function This is used to transform the training objective into making smoke features of the same type similar and smoke features of different types distant; (8); In the formula, Anchor point sample; Positive samples; Negative samples; This represents the feature vector extracted by the ResNet network along with the feature projection head; It is a distance metric for the feature space; It is a non-negative hyperparameter; S14-3: Divide the multi-class smoke dataset into training, validation, and test sets in a 7:2:1 ratio. Then, use the training set to train the improved ResNet network model. During training, based on the class labels in the multi-class smoke dataset, dynamically construct positive and negative sample pairs or triples for contrastive learning, and minimize the classification loss function. The network is fine-tuned so that smoke features of the same type are close to each other in the feature space, while smoke features of different types are far apart. After training, the feature projection head is removed, and the backbone of the ResNet network is used as the smoke feature extraction network model.

[0019] In this technical solution, a high-performance smoke feature extraction network model is effectively constructed through reasonable modification and training. First, the ends of the pre-trained ResNet model are replaced to construct a feature projection head and obtain the output feature vector according to a specific formula, optimizing the model structure to better map to a low-dimensional normalized feature space. Next, a triplet loss function is constructed to clearly define the training objective of bringing similar smoke features closer together and pushing dissimilar ones further apart. Finally, the model is trained using the training set, dynamically constructing sample pairs or triplets based on category labels, and fine-tuning the network by minimizing the loss function to enhance the model's ability to distinguish between different categories of smoke features. The retained ResNet network backbone serves as the smoke feature extraction network model, ensuring that the obtained model has the ability to accurately extract smoke features and improving the accuracy of smoke identification in chemical industrial park fires.

[0020] As a preferred approach, after constructing the initial normal production smoke feature library in step 2, continuous learning and optimization are performed through an online update mechanism; the continuous learning and optimization process is as follows: New normal production smoke feature vectors are obtained through two methods: periodically capturing industrial production smoke images during normal processes and obtaining smoke images from confirmed false alarm events. This enables dynamic updates to the normal production smoke feature library. Simultaneously, a threshold is set for the number of feature vectors in the library. When the number exceeds this threshold, the earliest or least frequently used feature vector is discarded based on its entry time or usage frequency. Furthermore, all normal production smoke feature vectors in the library are periodically clustered, with the cluster center vector representing all normal smoke features within each cluster. This clustering and compression of the normal production smoke feature library effectively controls its size and ensures detection efficiency while continuously replenishing the library.

[0021] In this technical solution, an online update mechanism forms a closed-loop system of "detection-discrimination-feedback-update" in actual operation. Each confirmed false alarm can be effectively transformed into new knowledge in the feature library. Over time, the feature library can continuously absorb new normal process smoke samples and become increasingly complete, enriching the smoke samples in the feature library. The ability to identify various normal process smokes in the park will be continuously enhanced, thereby achieving a continuous and significant decrease in the false alarm rate and a steady improvement in reliability in long-term operation, effectively improving the model's adaptability to the smoke conditions in the park. Unlike satellite remote sensing methods that rely on fixed spectra or brightness temperature thresholds, the dynamic feature library constructed in this invention can continuously learn the normal smoke characteristics of a specific industrial park through an online mechanism (active collection and false alarm feedback). It has the ability to adaptively optimize in response to changes in production processes, enabling the park's early warning system to evolve autonomously over long-term operation. This effectively avoids the performance degradation of static models due to scene changes and achieves a continuous reduction in false alarm rates, improving the long-term reliability and practicality of the system. It provides reliable technical support for realizing truly all-weather, unmanned intelligent monitoring and fire early warning for high-altitude observation systems in chemical industrial parks, effectively ensuring the safety of industrial production in the park.

[0022] As a preferred option, the process of dynamically updating the normal production smoke feature library in step 2 is as follows: During normal production in the chemical industrial park, smoke images of the normal process are collected regularly through the park's monitoring system. Normal industrial production smoke images are obtained by manually selecting and labeling the areas. First, a fire target detection model is used to detect smoke candidate areas. Then, a smoke feature extraction network model is used to extract the smoke feature vectors of the smoke candidate areas and add the smoke feature vectors to the normal production smoke feature library. Meanwhile, when a fire alarm occurs and is verified to be a false alarm, the smoke detection area image is saved within a set time before and after the alarm time. The fire target detection model is used to detect the smoke candidate area in the smoke detection area image, and the smoke feature vector of the smoke candidate area is extracted using the smoke feature extraction network model. The smoke feature vector is then added to the normal production smoke feature library.

[0023] In this technical solution, by regularly collecting and labeling images of normal industrial smoke during normal production in the chemical industrial park, and saving relevant images when false fire alarms occur, the feature vectors obtained by the fire target detection and smoke feature extraction model are added to the normal production smoke feature library. This enables dynamic and continuous updating of the feature library, improves its effective coverage of normal smoke features and accuracy of identification, and helps to continuously reduce the false alarm rate.

[0024] Furthermore, in order to effectively quantify the similarity between the two, so as to provide accurate and reliable numerical basis for subsequent accurate judgment of smoke category based on similarity, and ultimately ensure the effective improvement of the accuracy and rationality of smoke recognition, in step S33 of step 3, the cosine similarity is obtained according to formula (9). ; (9); In the formula, For normal production smoke feature library The first in A normal production smoke feature vector ; This is the vector dot product operator; Let be the Euclidean norm of the vector.

[0025] To address the problem of high false alarm rates in existing general fire smoke detection methods in chemical industrial park scenarios due to their inability to effectively distinguish between normal process emissions and actual fires, this invention provides a fire smoke recognition method for chemical industrial parks based on YOLO detection and ResNet feature comparison. This aims to solve the problem of excessively high false alarm rates commonly found in existing fire smoke detection technologies used in industrial parks. First, a fire dataset and a multi-class smoke dataset are constructed separately, providing a data foundation for subsequent model training to differentiate smoke characteristics. Annotating smoke candidate regions in the fire dataset helps the target detection model learn smoke features more accurately. Including different types of smoke images in the multi-class smoke dataset provides diverse data for the feature extraction network model, enabling it to better distinguish different types of smoke and effectively improving the model's recognition accuracy. Various enhancement methods are employed to enhance the fire dataset, including color perturbation enhancement, small target copy-paste enhancement, background interference overlay enhancement, and alpha fusion enhancement. Color perturbation simulates smoke color changes under different lighting and burning materials, allowing the model to learn richer color features. Copying and pasting small targets increases the frequency of small-scale smoke targets, effectively improving the model's ability to detect small-target smoke. Background interference overlay simulates interference factors in real-world scenarios, enhancing the model's anti-interference capabilities. Alpha fusion generates new samples, further enriching data diversity and improving the model's robustness to smoke detection in complex environments. Using YOLO as the baseline model and introducing an attention mechanism allows the model to focus more on smoke region features and suppress irrelevant background information, significantly improving the accuracy of smoke target detection. Constructing bounding box regression loss functions and improved classification loss functions effectively addresses the class imbalance problem between smoke targets and the background, making model training more focused on hard-to-classify samples and improving the model's accuracy in detecting smoke targets. During training, online enhancement processing such as Mosaic data augmentation, random flipping, and color jitter is applied to the fire images in the training set, further enriching data features and enhancing the model's ability to detect smoke under different poses and lighting conditions, effectively improving the model's generalization ability. The resulting fire target detection model can more effectively detect and locate smoke targets. By fine-tuning the pre-trained ResNet base model through end-to-end contrastive learning using a multi-class smoke dataset, the model learns the feature differences between different types of smoke, resulting in a high-performance smoke feature extraction network model that can more accurately extract smoke feature vectors, providing strong support for subsequent smoke type discrimination. Next, the smoke feature extraction network model extracts features from industrial production smoke sample images in the multi-class smoke dataset, constructing an initial normal production smoke feature library. This provides a normal smoke feature reference for subsequent real-time image recognition, helping to quickly and accurately distinguish between normal process smoke and fire smoke, significantly reducing the false alarm rate.Then, during real-time detection, smoke images are acquired and input into the fire target detection model, enabling rapid and accurate detection and location of smoke candidate areas. This allows for real-time monitoring of smoke, providing a foundation for timely fire early warning. By cropping smoke candidate area image blocks and performing unified preprocessing, the images are input into the smoke feature extraction network model to extract smoke feature vectors, ensuring the accuracy and consistency of feature extraction and providing reliable data for subsequent similarity calculations. The extracted smoke feature vectors are compared with the normal production smoke feature vectors in the common production smoke feature library using cosine similarity. The cosine similarity is calculated, and the highest value is selected. The smoke type is then determined by quantifying the similarity, providing an objective basis for intelligent discrimination. Based on the comparison between the highest cosine similarity and the similarity threshold, the smoke type is accurately determined, and corresponding early warning decisions are made. If the similarity is high, it is determined to be normal process emissions, and no alarm is triggered, reducing false alarms. If the similarity is low, it is determined to be suspected fire smoke, and an immediate warning is issued, ensuring timely fire detection and effectively improving the accuracy and timeliness of fire early warning in chemical industrial parks. This invention forms a complete fire smoke identification system for chemical industrial parks through three key steps: offline model construction, construction of a normal production smoke feature library, and real-time image recognition and intelligent early warning. From data augmentation to model training, and then to real-time discrimination and early warning, each link works closely together, which effectively improves the accuracy and timeliness of fire smoke identification and significantly reduces the false alarm rate.

[0026] This method is simple to implement and low in cost. It fully utilizes the advantages of YOLO detection and ResNet feature comparison to achieve intelligent discrimination upgrade from "presence or absence of smoke" to "what type of smoke," improving the model's ability to identify smoke in complex chemical industrial park environments. This method effectively solves the problems of high false alarm rates and ineffective unattended monitoring systems caused by the inability of existing technologies to distinguish between smoke from production processes and fire smoke. It significantly reduces the false alarm rate caused by normal production activities in chemical industrial parks, improves the accuracy of fire early warning and system reliability, and enables all-weather, unattended intelligent monitoring of chemical industrial parks. It fundamentally solves the problem of frequent false alarms caused by normal process emissions, achieves targeted adaptation to high-risk scenarios in chemical industrial parks, and provides reliable technical support for fire safety in chemical industrial parks. It has high practical value and promotion significance. Attached Figure Description

[0027] Figure 1 This is a flowchart of the present invention. Detailed Implementation

[0028] The invention will now be further described with reference to the accompanying drawings.

[0029] like Figure 1As shown, this invention provides a method for identifying smoke from fires in chemical industrial parks based on YOLO detection and ResNet feature comparison, comprising the following steps: Step 1: Building the offline model; S11: Construct a fire dataset labeled with smoke candidate regions and a multi-class smoke dataset containing multiple types of smoke images, respectively; As a preferred approach, the process of constructing a fire dataset labeled with smoke candidate regions and a multi-class smoke dataset containing multiple types of smoke images is as follows: We collected fire images of different scenes, scales, and combustion states, and used annotation tools such as Labelling to annotate smoke candidate regions in the form of rectangular boxes to construct a fire dataset for target detection training. We collected and organized three types of smoke images: fire smoke, industrial smoke, and smoke caused by natural environmental interference (such as cloud fog). We then performed unified preprocessing and segmentation operations on the smoke images to construct a multi-class smoke dataset for feature extraction training. The unified preprocessing included size scaling (scaled to 256×256 pixels) and normalization.

[0030] In this technical solution, a fire dataset is constructed by collecting fire images with different characteristics and labeling smoke candidate regions. At the same time, three types of smoke images are collected, preprocessed, and divided to construct a multi-class smoke dataset. This provides targeted, rich, and standardized basic data for target detection and feature extraction training, which helps to improve the model training effect and recognition accuracy.

[0031] As a preferred approach, each smoke image in a multi-class smoke dataset contains only one primary smoke category; S12: The fire dataset is enhanced by color perturbation enhancement, small target copy and paste enhancement, background interference overlay enhancement and alpha fusion enhancement to obtain an extended fire dataset, so as to effectively improve the generalization ability of the model. As a preferred option, the process for obtaining an extended fire dataset is as follows: During the color perturbation enhancement process, each fire image in the fire dataset undergoes a linear transformation in the HSV color space, and the hue, saturation, and brightness are randomly adjusted to generate multiple color variant images. These variants simulate the changes in smoke color, saturation, and transparency under different burning materials (e.g., wood emitting white smoke, rubber emitting black smoke) and different lighting conditions (e.g., backlighting, cloudy days). Preferably, 3-5 color variants can be generated for each original image, while the corresponding annotation file remains unchanged. In order to flexibly simulate the color changes of smoke under different lighting and combustion conditions, effectively enhance data diversity, and improve the model's ability to recognize smoke with different color characteristics, during the color perturbation enhancement process, the hue, saturation, and brightness of the image are randomly linearly transformed in the HSV color space according to formulas (1), (2), and (3), respectively, to obtain new values ​​of the hue, saturation, and brightness components in the HSV color space. , , ; (1); (2); (3); In the formula, , , These are the original values ​​of the hue, saturation, and lightness components of the image in the HSV color space, respectively. , , These represent the new values ​​of the hue, saturation, and lightness components of the image in the HSV color space after the linear transformation; The perturbation parameters for hue, randomly sampled within a predetermined range, are used to adjust the hue values; , These are two different perturbation parameters about saturation, randomly sampled within a predetermined range; , These are two different perturbation parameters of brightness, randomly sampled within a predetermined range. In the small target copy-paste enhancement process, all small-scale smoke targets are selected from the fire dataset. These small targets are randomly scaled and rotated, and then pasted into the non-smoke regions of other fire images at random locations to increase the diversity of small target samples and obtain small target pasted images. This generates a completely new synthetic image, and the bounding box annotations of the new pasted targets need to be generated simultaneously. After merging with the annotations of the original image, the images are saved. This can effectively increase the frequency of small-scale smoke targets in the image and improve the model's sensitivity to small targets. In the background interference overlay enhancement process, image segments (such as clouds and fog) that are easily confused with smoke are cropped from natural environmental interference data, and these image segments are overlaid onto fire images in the fire dataset with random transparency and random position to obtain interference overlay images. The image annotations generated in this process remain unchanged and are used to train the model to distinguish between real smoke and similar natural phenomena. Thus, smoke-like interference objects (such as clouds) can be randomly overlaid in the image to improve the model's anti-interference and discrimination capabilities. During the Alpha fusion enhancement process, a smoke template image is selected. and different background images Alpha fusion technology is used to synthesize smoke samples of different concentrations, resulting in alpha fused images. This process requires generating new bounding box annotations based on the fusion location and the scaling ratio of the smoke template. In order to effectively simulate smoke scenarios with different concentrations, enrich data diversity, and improve the model's ability to recognize various smoke concentrations, the smoke template image is fused using Alpha fusion technology according to formula (4) during the Alpha fusion enhancement process. With background image Perform weighted fusion to generate new synthetic samples ; (4); In the formula, This is a transparency parameter used to control the density of the smoke. Take a random value between 0 and 1. The larger the value, the denser the smoke.

[0032] All color variant images, small target pasted images, interference overlay images, and alpha fused images are merged with the fire images in the fire dataset to form a unified extended fire dataset. Preferably, each image has a corresponding YOLO format label file with consistent format.

[0033] In this technical solution, various variant images are generated by performing enhancement operations on the fire dataset targeting smoke characteristics during color perturbation, small target copying and pasting, background interference overlay, and Alpha fusion enhancement. These variant images are then merged with the original fire images to form an extended fire dataset, which greatly enriches the diversity and complexity of the data and helps to enhance the model's ability to learn and recognize smoke features in different scenarios.

[0034] S13: YOLO is used as the baseline model, and an attention mechanism is introduced. At the same time, bounding box regression loss function and improved classification loss function are constructed to make the model training more focused on difficult-to-classify samples. The training set is divided based on the extended fire dataset. During the training process, Mosaic data augmentation, random flipping and color dithering are randomly applied to the fire images in the training set to perform online enhancement processing to effectively enrich the diversity of the images. Then, the images are input into the YOLO model for training. During the training process, the model parameters are updated through forward propagation, loss calculation and backpropagation. The online enhancement processing is repeated in each training iteration, so that the model sees different images each time. After training, a high-precision fire target detection model for detecting smoke candidate regions is obtained. As a preferred approach, the process of randomly applying Mosaic data augmentation, random flipping, and color dithering operations to the fire images in the training set is as follows: In the Mosaic data augmentation process, Mosaic augmentation is applied to images in the training set at a preset frequency. Four fire images are randomly stitched into one large image. At the same time, the corresponding bounding box annotations are automatically merged and adjusted to effectively simulate the coexistence of multiple targets in complex scenes and increase the contextual diversity of targets. During the random flipping process, the image is flipped horizontally and vertically with a preset probability, or the horizontal equidistant, rotational and translational flipping effect is simulated in the target area of ​​some images. At the same time, the position coordinates of the bounding box are automatically adjusted to effectively increase the robustness of the model to changes in the orientation of the target. During the color jitter enhancement process, the brightness, contrast, saturation, etc. of the image are slightly and randomly adjusted with a preset probability. The pixel values ​​of the original image are adjusted from the original image ratio to the target sample in a certain way. This process uses a probabilistic method to randomly achieve color jitter or blurring effects, further enriching color changes and enhancing the robustness of the model to changes in lighting. In this technical solution, by applying Mosaic data augmentation, random flipping, and color jitter enhancement to the fire images in the training set at preset frequencies and probabilities, the features of the images can be comprehensively enriched, which is conducive to improving the model's ability to adapt to and recognize different forms of fire smoke and complex environments.

[0035] As a preferred option, the process of obtaining a fire target detection model for detecting smoke candidate areas is as follows: S13-1: Using YOLOv8 or YOLOv5 as the baseline model, in order to enhance the detection capability of smoke targets, an attention mechanism (such as SE, CBAM, etc.) is embedded after the C2f module in the backbone part of the baseline model to enhance the model's feature attention to the smoke candidate region and suppress irrelevant background information; by introducing the attention mechanism, the model can adaptively calibrate the feature response of each feature channel by learning the importance of each feature channel; As a preferred option, YOLOv8m is used as the baseline model; S13-2: Construct the bounding box regression loss function according to formula (5) To effectively alleviate the extreme imbalance between the foreground (smoke) and background, and to enable model training to focus more on difficult-to-classify samples, an improved classification loss function is constructed based on formula (6). ; (5); In the formula, This is the ratio of the area of ​​the intersection of the predicted bounding box and the area of ​​the union of the predicted bounding box and the ground truth bounding box. For prediction boxes With real frame Euclidean distance between the center points; To include prediction boxes With real frame The length of the diagonal of the smallest bounding rectangle; These are the weighting coefficients; This is used to measure the consistency of the aspect ratio between the predicted bounding box and the ground truth bounding box; (6); In the formula, This represents the model's predicted probability for the correct category. As a category balance factor; As a regulating factor; S13-3: Divide the extended fire dataset into training, validation, and test sets in a 7:2:1 ratio. Then, use the training set to train the baseline model. At the same time, use the validation set to adjust the model's hyperparameters and use the test set to evaluate the model's performance. Finally, save the model with the best performance as the fire target detection model.

[0036] This technical solution uses YOLOv8 or YOLOv5 as the baseline model and embeds an attention mechanism after the C2f module of the Backbone, which effectively enhances the model's focus on smoke candidate region features. By constructing a specific bounding box regression loss function and improving the classification loss function, precise optimization directions are provided for model training, effectively improving detection accuracy and the ability to handle class imbalance problems. Using the training set for training, the validation set for parameter tuning, and the test set for evaluation, the model performance can be comprehensively optimized, ensuring that the final fire target detection model has high accuracy and reliability in detecting smoke candidate regions.

[0037] S14: Use a multi-class smoke dataset to perform end-to-end contrastive learning fine-tuning on the pre-trained ResNet base model to achieve deep feature learning for smoke differentiation and obtain a smoke feature extraction network model for extracting smoke feature vectors. As a preferred option, the process of obtaining the smoke feature extraction network model is as follows: S14-1: Remove the fully connected classification layer at the end of the pre-trained ResNet network model and replace it with a feature projection head consisting of two fully connected layers to obtain an improved ResNet network model. The feature projection head is used to map the image to a low-dimensional normalized feature space and obtain the final output feature vector according to formula (7). In one specific embodiment, the feature projection head can map the 512-dimensional features extracted by the ResNet backbone network to a 128-dimensional vector space, and after L2 normalization, obtain the final feature representation; as a preferred embodiment, a ResNet-34 model pre-trained on the ImageNet dataset is used as the pre-trained ResNet base model. (7); In the formula, It is the L2 normalization function; The second layer weight matrix ; For activation functions; This is the first layer weight matrix. ; The input feature vector; This is the first layer bias vector. ; This is the second layer bias vector. ; S14-2: Training is driven by contrastive loss or its improved form. Taking triplet loss as an example, for each training sample (anchor sample)... Based on its category label (fire, industry, nature), construct a sample of the same category (positive sample). ) and a different class sample (negative sample) (Through the triplet loss function) Make anchor point sample With negative samples The distance between features has at least one boundary value. Specifically, the triplet loss function is constructed according to formula (8). Triple loss function This is used to transform the training objective into making smoke features of the same type similar and smoke features of different types distant; (8); In the formula, Anchor point sample; Positive samples; Negative samples; This represents the feature vector extracted by the ResNet network along with the feature projection head; For distance metrics in feature space, Euclidean distance is typically used, i.e. ; It is a non-negative hyperparameter used to control the degree of difference between positive and negative sample pairs, and is preferably set to 0.2; S14-3: The multi-class smoke dataset is divided into training, validation, and test sets in a 7:2:1 ratio. The improved ResNet network model is then trained using the training set. During training, positive and negative sample pairs or triples for contrastive learning are dynamically constructed based on the category labels of fire smoke, industrial smoke, and natural environmental disturbance smoke in the multi-class smoke dataset. The classification loss function is minimized. The network is fine-tuned to ensure that smoke features of the same class are close to each other in the feature space, while smoke features of different classes are far apart. After training, the feature projection head is removed, and the backbone of the ResNet network is used as the smoke feature extraction network model. This smoke feature extraction network model serves as a feature extractor, which can convert any smoke image into a highly class-discriminative 128-dimensional feature vector. In this technical solution, a high-performance smoke feature extraction network model is effectively constructed through reasonable modification and training. First, the ends of the pre-trained ResNet model are replaced to construct a feature projection head and obtain the output feature vector according to a specific formula, optimizing the model structure to better map to a low-dimensional normalized feature space. Next, a triplet loss function is constructed to clearly define the training objective of bringing similar smoke features closer together and pushing dissimilar ones further apart. Finally, the model is trained using the training set, dynamically constructing sample pairs or triplets based on category labels, and fine-tuning the network by minimizing the loss function to enhance the model's ability to distinguish between different categories of smoke features. The retained ResNet network backbone serves as the smoke feature extraction network model, ensuring that the obtained model has the ability to accurately extract smoke features and improving the accuracy of smoke identification in chemical industrial park fires.

[0038] Step 2: Construction of the normal production smoke feature library; The smoke feature extraction network model is used to extract features from all sample images labeled as industrial production smoke in a multi-class smoke dataset. The 128-dimensional feature vector is extracted first, and the final set of normal production smoke feature vectors is obtained and stored in a vector database to construct the initial normal production smoke feature library. This initial normal production smoke feature library represents the feature fingerprint of all normal working condition smoke that is initially recognized. As a preferred approach, after constructing an initial feature library of normal production smoke, continuous learning and optimization are performed through an online update mechanism. This allows for the continuous absorption of smoke sample images from new normal production processes, enriching the feature library and thus continuously reducing the false alarm rate, improving the model's adaptability, and ensuring detection accuracy during long-term operation. The continuous learning and optimization process is as follows: New normal production smoke feature vectors are obtained through two methods: periodically capturing industrial production smoke images during normal processes and obtaining smoke images from confirmed false alarm events. This allows for dynamic updates to the normal production smoke feature library. To prevent the feature library from growing indefinitely and impacting comparison efficiency, a threshold is set for the number of feature vectors. When the number exceeds this threshold, the earliest or least frequently used feature vector is discarded based on its entry time or usage frequency. Furthermore, all normal production smoke feature vectors in the library are periodically clustered, with each cluster's center vector representing all normal smoke features within that cluster. This clustering compression effectively controls the size of the normal production smoke feature library while continuously replenishing it, ensuring detection efficiency. As a preferred method, the K-Means algorithm is used for clustering. Through cluster compression, hundreds of cluster centers can replace thousands of original feature vectors, significantly improving comparison speed while effectively preserving the core feature distribution.

[0039] In this technical solution, an online update mechanism forms a closed-loop system of "detection-discrimination-feedback-update" in actual operation. Each confirmed false alarm can be effectively transformed into new knowledge in the feature library. Over time, the feature library can continuously absorb new normal process smoke samples and become increasingly complete, enriching the smoke samples in the feature library. The ability to identify various normal process smokes in the park will be continuously enhanced, thereby achieving a continuous and significant decrease in the false alarm rate and a steady improvement in reliability in long-term operation, effectively improving the model's adaptability to the smoke conditions in the park. Unlike satellite remote sensing methods that rely on fixed spectra or brightness temperature thresholds, the dynamic feature library constructed in this invention can continuously learn the normal smoke characteristics of a specific industrial park through an online mechanism (active collection and false alarm feedback). It has the ability to adaptively optimize in response to changes in production processes, enabling the park's early warning system to evolve autonomously over long-term operation. This effectively avoids the performance degradation of static models due to scene changes and achieves a continuous reduction in false alarm rates, improving the long-term reliability and practicality of the system. It provides reliable technical support for realizing truly all-weather, unmanned intelligent monitoring and fire early warning for high-altitude observation systems in chemical industrial parks, effectively ensuring the safety of industrial production in the park.

[0040] As a preferred approach, the process of dynamically updating the normal production smoke feature library is as follows: During normal production in the chemical industrial park, smoke images of normal processes (such as the first batch of smoke images emitted by newly commissioned equipment) are collected regularly through the park's monitoring system. Normal industrial production smoke images are obtained by manually selecting and labeling areas. First, a fire target detection model is used to detect candidate smoke areas. Then, a smoke feature extraction network model is used to extract smoke feature vectors from the candidate smoke areas. The smoke feature vectors are then added to the normal production smoke feature library. As a preferred method, to ensure accuracy, the smoke feature vectors can be reviewed after they are obtained. Only after the review is completed can they be added to the normal production smoke feature library. Meanwhile, when a fire alarm occurs and is verified to be a false alarm (that is, normal process smoke is mistaken for fire smoke), the smoke detection area image is saved within a set time before and after the alarm time, and the smoke candidate area of ​​the smoke detection area image is detected by the fire target detection model. The smoke feature vector of the smoke candidate area is extracted by the smoke feature extraction network model, and the smoke feature vector is added to the normal production smoke feature library as a new normal sample image.

[0041] In this technical solution, by regularly collecting and labeling images of normal industrial smoke during normal production in the chemical industrial park, and saving relevant images when false fire alarms occur, the feature vectors obtained by the fire target detection and smoke feature extraction model are added to the normal production smoke feature library. This enables dynamic and continuous updating of the feature library, improves its effective coverage of normal smoke features and accuracy of identification, and helps to continuously reduce the false alarm rate.

[0042] Step 3: Real-time image recognition and intelligent early warning; S31: Deploy the fire target detection model and smoke feature extraction network model on the edge computing server in the chemical industrial park, and establish a communication connection between the edge computing server and the park's monitoring system (such as video acquisition equipment like high-altitude surveillance cameras) to continuously receive real-time video streams from the park's monitoring system; on the edge computing server, sample frames at a rate of 5 frames per second to obtain one frame of smoke image. ; Real-time acquisition of smoke images The data is then input into a fire target detection model to detect and locate candidate smoke regions in the smoke image; each candidate smoke region comprises a set of bounding boxes representing a series of smoke targets. and the confidence level of each bounding box { Further preferably, the confidence level is set to 0.5, and detection results with a confidence level lower than 0.5 are filtered out.

[0043] S32: From smoke image Extract the image patch corresponding to the smoke candidate region from the middle. And after uniform preprocessing (first dividing the image blocks) After scaling to 224×224 and then normalizing, the data is input into the smoke feature extraction network model to extract the smoke feature vector. This yields a 128-dimensional smoke feature vector. ; S33: Calculate the smoke feature vector The cosine similarity with all normal production smoke feature vectors (or cluster center feature vectors) is calculated, and the highest cosine similarity is selected. In order to effectively quantify the similarity between the two, so as to provide accurate and reliable numerical basis for subsequent accurate judgment of smoke category based on similarity, and ultimately ensure that the accuracy and rationality of smoke recognition are effectively improved, in step S33 of step 3, the cosine similarity is obtained according to formula (9). And select the height cosine similarity according to formula (10). ; (9); In the formula, For normal production smoke feature library The first in A normal production smoke feature vector ; This is the vector dot product operator; Let be the Euclidean norm of the vector.

[0044] (10).

[0045] S34: Set a similarity threshold T. If the highest cosine similarity is... If the similarity is greater than or equal to the similarity threshold T, it indicates that the current smoke image is highly similar to a known normal production smoke feature vector in the normal production smoke feature library, which falls under a safe operating condition. Therefore, it is determined to be a normal process emission condition, and no fire alarm is triggered. The detection event is only recorded in the log. If the highest cosine similarity... If the similarity threshold T is less than 0.75, it indicates that the current smoke image is dissimilar to all known normal production smoke feature vectors in the normal production smoke feature library, belonging to an abnormal operating condition. It is determined to be unknown smoke, suspected to be from a fire, and a fire warning is immediately triggered. As a preferred option, the similarity threshold T is 0.75.

[0046] To address the problem of high false alarm rates in existing general fire smoke detection methods in chemical industrial park scenarios due to their inability to effectively distinguish between normal process emissions and actual fires, this invention provides a fire smoke recognition method for chemical industrial parks based on YOLO detection and ResNet feature comparison. This aims to solve the problem of excessively high false alarm rates commonly found in existing fire smoke detection technologies used in industrial parks. First, a fire dataset and a multi-class smoke dataset are constructed separately, providing a data foundation for subsequent model training to differentiate smoke characteristics. Annotating smoke candidate regions in the fire dataset helps the target detection model learn smoke features more accurately. Including different types of smoke images in the multi-class smoke dataset provides diverse data for the feature extraction network model, enabling it to better distinguish different types of smoke and effectively improving the model's recognition accuracy. Various enhancement methods are employed to enhance the fire dataset, including color perturbation enhancement, small target copy-paste enhancement, background interference overlay enhancement, and alpha fusion enhancement. Color perturbation simulates smoke color changes under different lighting and burning materials, allowing the model to learn richer color features. Copying and pasting small targets increases the frequency of small-scale smoke targets, effectively improving the model's ability to detect small-target smoke. Background interference overlay simulates interference factors in real-world scenarios, enhancing the model's anti-interference capabilities. Alpha fusion generates new samples, further enriching data diversity and improving the model's robustness to smoke detection in complex environments. Using YOLO as the baseline model and introducing an attention mechanism allows the model to focus more on smoke region features and suppress irrelevant background information, significantly improving the accuracy of smoke target detection. Constructing bounding box regression loss functions and improved classification loss functions effectively addresses the class imbalance problem between smoke targets and the background, making model training more focused on hard-to-classify samples and improving the model's accuracy in detecting smoke targets. During training, online enhancement processing such as Mosaic data augmentation, random flipping, and color jitter is applied to the fire images in the training set, further enriching data features and enhancing the model's ability to detect smoke under different poses and lighting conditions, effectively improving the model's generalization ability. The resulting fire target detection model can more effectively detect and locate smoke targets. By fine-tuning the pre-trained ResNet base model through end-to-end contrastive learning using a multi-class smoke dataset, the model learns the feature differences between different types of smoke, resulting in a high-performance smoke feature extraction network model that can more accurately extract smoke feature vectors, providing strong support for subsequent smoke type discrimination. Next, the smoke feature extraction network model extracts features from industrial production smoke sample images in the multi-class smoke dataset, constructing an initial normal production smoke feature library. This provides a normal smoke feature reference for subsequent real-time image recognition, helping to quickly and accurately distinguish between normal process smoke and fire smoke, significantly reducing the false alarm rate.Then, during real-time detection, smoke images are acquired and input into the fire target detection model, enabling rapid and accurate detection and location of smoke candidate areas. This allows for real-time monitoring of smoke, providing a foundation for timely fire early warning. By cropping smoke candidate area image blocks and performing unified preprocessing, the images are input into the smoke feature extraction network model to extract smoke feature vectors, ensuring the accuracy and consistency of feature extraction and providing reliable data for subsequent similarity calculations. The extracted smoke feature vectors are compared with the normal production smoke feature vectors in the common production smoke feature library using cosine similarity. The cosine similarity is calculated, and the highest value is selected. The smoke type is then determined by quantifying the similarity, providing an objective basis for intelligent discrimination. Based on the comparison between the highest cosine similarity and the similarity threshold, the smoke type is accurately determined, and corresponding early warning decisions are made. If the similarity is high, it is determined to be normal process emissions, and no alarm is triggered, reducing false alarms. If the similarity is low, it is determined to be suspected fire smoke, and an immediate warning is issued, ensuring timely fire detection and effectively improving the accuracy and timeliness of fire early warning in chemical industrial parks. This invention forms a complete fire smoke identification system for chemical industrial parks through three key steps: offline model construction, construction of a normal production smoke feature library, and real-time image recognition and intelligent early warning. From data augmentation to model training, and then to real-time discrimination and early warning, each link works closely together, which effectively improves the accuracy and timeliness of fire smoke identification and significantly reduces the false alarm rate.

[0047] This method is simple to implement and low in cost. It fully utilizes the advantages of YOLO detection and ResNet feature comparison to achieve intelligent discrimination upgrade from "presence or absence of smoke" to "what type of smoke," improving the model's ability to identify smoke in complex chemical industrial park environments. This method effectively solves the problems of high false alarm rates and ineffective unattended monitoring systems caused by the inability of existing technologies to distinguish between smoke from production processes and fire smoke. It significantly reduces the false alarm rate caused by normal production activities in chemical industrial parks, improves the accuracy of fire early warning and system reliability, and enables all-weather, unattended intelligent monitoring of chemical industrial parks. It fundamentally solves the problem of frequent false alarms caused by normal process emissions, achieves targeted adaptation to high-risk scenarios in chemical industrial parks, and provides reliable technical support for fire safety in chemical industrial parks. It has high practical value and promotion significance.

Claims

1. A method for identifying smoke from fires in chemical industrial parks based on YOLO detection and ResNet feature comparison, characterized in that, Includes the following steps: Step 1: Building the offline model; S11: Construct a fire dataset labeled with smoke candidate regions and a multi-class smoke dataset containing multiple types of smoke images; S12: Enhance the fire dataset by using color perturbation enhancement, small target copy-paste enhancement, background interference overlay enhancement, and alpha fusion enhancement to obtain an expanded fire dataset; S13: Use YOLO as the baseline model and introduce an attention mechanism. At the same time, construct a bounding box regression loss function and an improved classification loss function to make the model training more focused on difficult-to-classify samples; Based on the expanded fire dataset, the training set is divided. During the training process, the fire images in the training set are first randomly enhanced online by applying Mosaic data augmentation, random flipping and color dithering operations. Then, the images are input into the YOLO model for training. After training, a fire target detection model for detecting smoke candidate regions is obtained. S14: The pre-trained ResNet basic model is fine-tuned by end-to-end contrastive learning using a multi-class smoke dataset to obtain a smoke feature extraction network model for extracting smoke feature vectors. Step 2: Construction of the normal production smoke feature library; The smoke feature extraction network model is used to extract features from all sample images labeled as industrial production smoke in the multi-class smoke dataset, and a set of normal production smoke feature vectors is obtained to construct the initial normal production smoke feature library. Step 3: Real-time image recognition and intelligent early warning; S31: Real-time acquisition of smoke images and input into the fire target detection model to detect and locate candidate smoke regions in the smoke images; S32: Cropping out image patches corresponding to the candidate smoke regions, and inputting them into the smoke feature extraction network model after unified preprocessing to extract smoke feature vectors; S3 3: Calculate the cosine similarity between the smoke feature vector and all normal production smoke feature vectors, and select the highest cosine similarity; S34: If the highest cosine similarity is greater than or equal to the similarity threshold, it is determined to be a normal process emission condition and no fire alarm is triggered; if the highest cosine similarity is less than the similarity threshold, it is determined to be unknown smoke suspected of being from a fire, and a fire warning is immediately triggered.

2. The method for identifying smoke from fires in chemical industrial parks based on YOLO detection and ResNet feature comparison as described in claim 1, characterized in that, In step 1, S11, the process of constructing a fire dataset labeled with smoke candidate regions and a multi-class smoke dataset containing multiple types of smoke images is as follows: We collected fire images of different scenes, scales, and combustion states, and used the Labelling annotation tool to annotate smoke candidate regions in the form of rectangular boxes to construct a fire dataset for target detection training. We collected and organized three types of smoke images: fire smoke, industrial smoke, and smoke from natural environmental disturbances. We then performed unified preprocessing and segmentation operations on the smoke images to construct a multi-class smoke dataset for feature extraction training. The unified preprocessing included size scaling and normalization.

3. The method for identifying smoke from fires in chemical industrial parks based on YOLO detection and ResNet feature comparison as described in claim 1, characterized in that... In step 1, S12, the process of obtaining the extended fire dataset is as follows: During the color perturbation enhancement process, each fire image in the fire dataset is linearly transformed in the HSV color space, and the hue, saturation, and brightness are randomly adjusted to generate multiple color variant images. In the small target copy-paste enhancement process, all small-scale smoke targets are selected from the fire dataset. These small targets are randomly scaled and rotated, and then pasted into the non-smoke areas of other fire images at random positions to obtain small target pasted images. In the background interference overlay enhancement process, image segments that are easily confused with smoke are cropped from the natural environment interference data such as smoke, and these image segments are overlaid onto the fire images in the fire dataset with random transparency and random position to obtain the interference overlay image; During the Alpha fusion enhancement process, a smoke template image is selected. and different background images Alpha fusion technology was used to synthesize smoke samples of different concentrations, resulting in alpha fusion images. All color variant images, small target pasted images, interference overlay images, and alpha fused images are merged with the fire images in the fire dataset to form a unified extended fire dataset.

4. The method for identifying smoke from fires in chemical industrial parks based on YOLO detection and ResNet feature comparison as described in claim 3, characterized in that... In step 1, S13, the process of randomly applying Mosaic data augmentation, random flipping, and color dithering operations to the fire images in the training set is as follows: During the Mosaic data augmentation process, Mosaic augmentation is applied to the images in the training set at a preset frequency. Four fire images are randomly stitched into a large image. At the same time, the corresponding bounding box labels are automatically merged and adjusted. During random flipping, the image is flipped horizontally or vertically with a preset probability, or the horizontal equidistant, rotational and translational flipping effect is simulated in the target area of ​​some images, while the position coordinates of the bounding box are automatically adjusted. During the color jitter enhancement process, the brightness, contrast, and saturation of the image are adjusted slightly and randomly with a preset probability.

5. A method for identifying smoke from fires in chemical industrial parks based on YOLO detection and ResNet feature comparison, as described in claim 3, is characterized in that... In step S12 of step 1, during the color perturbation enhancement process, the hue, saturation, and brightness of the image are randomly linearly transformed in the HSV color space according to formulas (1), (2), and (3), respectively, to obtain new values ​​of the hue, saturation, and brightness components in the HSV color space. , , ; (1); (2); (3); In the formula, , , These are the original values ​​of the hue, saturation, and lightness components of the image in the HSV color space, respectively. , , These represent the new values ​​of the hue, saturation, and lightness components of the image in the HSV color space after the linear transformation; The perturbation parameters for hue, randomly sampled within a predetermined range, are used to adjust the hue values; , These are two different perturbation parameters about saturation, randomly sampled within a predetermined range; , These are two different perturbation parameters of brightness, randomly sampled within a predetermined range. During the Alpha fusion enhancement process, the smoke template image is fused using Alpha fusion technology according to formula (4). With background image Perform weighted fusion to generate new synthetic samples ; (4); In the formula, This is a transparency parameter used to control the density of the smoke.

6. The method for identifying smoke from fires in chemical industrial parks based on YOLO detection and ResNet feature comparison as described in claim 1, characterized in that... In step 1, S13, the process of obtaining the fire target detection model for detecting smoke candidate areas is as follows: S13-1: YOLOv8 or YOLOv5 is used as the baseline model. At the same time, an attention mechanism is embedded after the C2f module in the backbone part of the baseline model to enhance the model's attention to the features of the smoke candidate region. S13-2: Construct the bounding box regression loss function according to formula (5) An improved classification loss function is constructed based on formula (6). ; (5); In the formula, This is the ratio of the area of ​​the intersection of the predicted bounding box and the area of ​​the union of the predicted bounding box and the ground truth bounding box. For prediction boxes With real frame Euclidean distance between the center points; To include prediction boxes With real frame The length of the diagonal of the smallest bounding rectangle; These are the weighting coefficients; This is used to measure the consistency of the aspect ratio between the predicted bounding box and the ground truth bounding box; (6); In the formula, This represents the model's predicted probability for the correct category. As a category balance factor; As a regulating factor; S13-3: Divide the extended fire dataset into training, validation, and test sets in a 7:2:1 ratio. Then, use the training set to train the baseline model. At the same time, use the validation set to adjust the model's hyperparameters and use the test set to evaluate the model's performance. Finally, save the model with the best performance as the fire target detection model.

7. A method for identifying smoke from fires in chemical industrial parks based on YOLO detection and ResNet feature comparison, as described in claim 1, is characterized in that... In step S14 of step 1, the process of obtaining the smoke feature extraction network model is as follows: S14-1: Remove the fully connected classification layer at the end of the pre-trained ResNet network model and replace it with a feature projection head consisting of two fully connected layers to obtain an improved ResNet network model. The feature projection head is used to map the image to a low-dimensional normalized feature space and obtain the final output feature vector according to formula (7). ; (7); In the formula, It is the L2 normalization function; The second layer weight matrix ; For activation functions; This is the first layer weight matrix. ; The input feature vector; This is the first layer bias vector. ; This is the second layer bias vector. ; S14-2: Construct the triplet loss function according to formula (8) Triple loss function This is used to transform the training objective into making smoke features of the same type similar and smoke features of different types distant; (8); In the formula, Anchor point sample; Positive samples; Negative samples; This represents the feature vector extracted by the ResNet network along with the feature projection head; It is a distance metric for the feature space; It is a non-negative hyperparameter; S14-3: Divide the multi-class smoke dataset into training, validation, and test sets in a 7:2:1 ratio. Then, use the training set to train the improved ResNet network model. During training, based on the class labels in the multi-class smoke dataset, dynamically construct positive and negative sample pairs or triples for contrastive learning, and minimize the classification loss function. Fine-tune the network so that smoke features of the same type are close to each other in the feature space, while smoke features of different types are far apart from each other; After training, the feature projection head is removed, and the ResNet backbone is used as the smoke feature extraction network model.

8. A method for identifying smoke from fires in chemical industrial parks based on YOLO detection and ResNet feature comparison, as described in claim 1, is characterized in that... In step 2, after constructing the initial normal production smoke feature library, continuous learning and optimization are performed through an online update mechanism; the continuous learning and optimization process is as follows: New normal production smoke feature vectors are obtained through two methods: periodically capturing industrial production smoke images during normal processes and obtaining smoke images from confirmed false alarm events. This enables dynamic updates to the normal production smoke feature library. Simultaneously, a threshold is set for the number of feature vectors in the library. When the number exceeds this threshold, the earliest or least frequently used feature vector is discarded based on its entry time or usage frequency. Furthermore, all normal production smoke feature vectors in the library are periodically clustered, with the cluster center vector representing all normal smoke features within each cluster. This clustering and compression of the normal production smoke feature library effectively controls its size and ensures detection efficiency while continuously replenishing the library.

9. A method for identifying smoke from fires in chemical industrial parks based on YOLO detection and ResNet feature comparison, as described in claim 8, is characterized in that... In step 2, the process of dynamically updating the normal production smoke feature library is as follows: During normal production in the chemical industrial park, smoke images of the normal process are collected regularly through the park's monitoring system. Normal industrial production smoke images are obtained by manually selecting and labeling the areas. First, a fire target detection model is used to detect smoke candidate areas. Then, a smoke feature extraction network model is used to extract the smoke feature vectors of the smoke candidate areas and add the smoke feature vectors to the normal production smoke feature library. Meanwhile, when a fire alarm occurs and is verified to be a false alarm, the smoke detection area image is saved within a set time before and after the alarm time. The fire target detection model is used to detect the smoke candidate area in the smoke detection area image, and the smoke feature vector of the smoke candidate area is extracted using the smoke feature extraction network model. The smoke feature vector is then added to the normal production smoke feature library.

10. A method for identifying smoke from fires in chemical industrial parks based on YOLO detection and ResNet feature comparison, as described in claim 1, is characterized in that... In step 3, S33, the cosine similarity is obtained according to formula (9). ; (9); In the formula, For normal production smoke feature library The first in A normal production smoke feature vector ; This is the vector dot product operator; Let be the Euclidean norm of the vector.