Logistics center flame smoke detection method, apparatus and device, and storage medium
By using an improved YOLOv12 model and a multi-scale large-core attention mechanism module, combined with the Focaler-IoU loss function, the problems of delay and high false alarm rate in fire detection in logistics centers were solved, high-precision recognition and rapid detection of flames and smoke were achieved, and the system development process was simplified.
Patent Information
- Application Number
- CN202510786952.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-13
- Publication Date
- 2025-09-16
AI Technical Summary
Existing fire detection technology in logistics centers has problems such as detection delay, high false alarm rate and insufficient detection capability for small targets, making it difficult to meet the needs of rapid and accurate fire warning.
An improved YOLOv12 model is used, combined with a multi-scale large-core attention mechanism module and the Focaler-IoU loss function. Multi-scale convolution kernels are used to capture the subtle texture and overall shape of flames and smoke, and a web interactive interface is built through the Streamlit framework to simplify the development of the detection system.
It improves the recognition accuracy of small targets, reduces missed detections and false detections, enhances the overall capability of flame and smoke detection, and accelerates system launch by simplifying the development process, lowering the user threshold.
Smart Images

Figure CN120655985A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of intelligent security technology, and specifically relates to a flame and smoke detection method, device, equipment and storage medium for a logistics center. Background Art
[0002] In the modern logistics industry, logistics centers are key locations for cargo storage, sorting, and transshipment. Due to the densely packed cargo and frequent movement of personnel and equipment, they present significant fire hazards. A fire can easily cause serious casualties, property damage, and business interruption.
[0003] Currently, traditional fire detection methods commonly used in logistics centers are primarily based on smoke alarms and other devices. However, these traditional detection methods have numerous drawbacks: First, they suffer from detection delays, making it difficult to detect early-stage fires and provide early warnings before a fire develops. Second, they suffer from high false alarm rates and are susceptible to interference from environmental factors (such as dust and moisture), leading to frequent false alarms and disrupting normal operations. With the rapid development of the logistics industry, traditional fire detection technologies are no longer able to meet the demand for rapid and accurate fire warnings.
[0004] To address these issues, artificial intelligence and deep learning technologies are increasingly being applied to fire detection. However, existing deep learning-based fire detection solutions also have limitations, such as insufficient detection of small targets (such as early-stage faint smoke and small flames), limited model generalization, and decreased detection accuracy in diverse scenarios, such as complex lighting and varying camera angles. Summary of the Invention
[0005] In view of the shortcomings of the existing technology, the purpose of the present invention is to provide a logistics center flame and smoke detection method, device, equipment and storage medium to solve the problem of low recognition accuracy of small targets in the existing technology.
[0006] According to one aspect of the present application, a method for detecting flames and smoke in a logistics center is disclosed, the method comprising: Acquire a training data set, the training data set including a plurality of training images, the training images including sample images with marked boxes and expanded images expanded based on the sample images, the sample images including flame scene images, smoke scene images, mixed scene images, and normal scene images; Construct an initial YOLOv12 model, which includes a backbone network, a neck network, a multi-scale large-core attention mechanism module, and a detection head. The backbone network is used to extract features from the input image to obtain an initial feature map. The neck network is used to perform feature fusion on the initial feature map output by the backbone network to obtain a fused feature map. The multi-scale large-core attention mechanism module is embedded in front of the detection head and is used to convolve the fused feature map through a multi-scale convolution kernel to obtain an enhanced feature map that highlights key features. The detection head is used to perform category detection on the input enhanced feature map to output category information of the input image. Optimize and train the initial YOLOv12 model based on the training data set to obtain a target YOLOv12 model. During the optimization training process, the loss function adopts the Focaler-IoU loss function. The target image to be detected is input into the target YOLOv12 model for detection, and the flame and smoke category of the target image to be detected is determined based on the output type of the target YOLOv12 model.
[0007] In some embodiments, obtaining a training data set includes: Acquire multiple original images, wherein the original images include multiple flame scene images, multiple smoke scene images, multiple mixed scene images, and multiple normal scene images; Annotate each original image with a rectangular frame to obtain a sample image with an annotated frame, where each annotated frame corresponds to a category; Each sample image is enhanced using data enhancement technology to obtain multiple enhanced images; Performing expansion processing on each enhanced image to obtain multiple expanded images; The training data set is obtained by mixing a plurality of the sample images and a plurality of the expanded images.
[0008] In some embodiments, the multi-scale large-kernel attention mechanism module includes at least two scale branches, each scale branch having a convolution kernel of a different scale.
[0009] In some embodiments, the multi-scale large-core attention mechanism module includes three scale branches, including a small-scale branch, a medium-scale branch and a large-scale branch. The small-scale branch is a 3×3 convolution kernel with 32 channels, the medium-scale branch is a 5×5 convolution kernel with 64 channels, and the large-scale branch is a 7×7 convolution kernel with 128 channels.
[0010] In some embodiments, the method further comprises: Use the Streamlit framework to build a web interactive architecture; The target YOLOv12 model is loaded into the memory of the Web interaction architecture based on the target saving format, so that the Web interaction architecture is endowed with the detection capability of the target image to be detected.
[0011] In some embodiments, the method further comprises: A file upload area is set based on the interactive component of Streamlit, and the file upload area includes an upload button for uploading the target image to be detected.
[0012] In some embodiments, the method further comprises: A CSS file is created for the web interaction architecture built by Streamlit based on CSS. The CSS file is used to define the page style of the web interaction architecture. The page style includes at least page layout, color matching, and font style.
[0013] According to another aspect of the present application, a flame and smoke detection device for a logistics center is also disclosed, the device comprising: a training data set acquisition module, configured to acquire a training data set, wherein the training data set includes a plurality of training images, wherein the training images include sample images with annotated boxes and expanded images expanded based on the sample images, wherein the sample images include flame scene images, smoke scene images, mixed scene images, and normal scene images; An initial YOLOv12 model construction module is used to construct an initial YOLOv12 model. The initial YOLOv12 model includes a backbone network, a neck network, a multi-scale large-core attention mechanism module, and a detection head. The backbone network is used to extract features from the input image to obtain an initial feature map. The neck network is used to perform feature fusion on the initial feature map output by the backbone network to obtain a fused feature map. The multi-scale large-core attention mechanism module is embedded in front of the detection head and is used to convolve the fused feature map through a multi-scale convolution kernel to obtain an enhanced feature map that highlights key features. The detection head is used to perform category detection on the input enhanced feature map to output category information of the input image. A model optimization module is used to optimize the initial YOLOv12 model based on the training data set to obtain a target YOLOv12 model. During the optimization training process, the loss function adopts the Focaler-IoU loss function; The detection module is used to input the target image to be detected into the target YOLOv12 model for detection, so as to determine the flame and smoke category of the target image to be detected based on the output type of the target YOLOv12 model.
[0014] According to another aspect of the present application, an electronic device is also disclosed, which includes a memory and at least one processor, wherein the memory stores instructions; the at least one processor calls the instructions in the memory so that the electronic device executes each step of the logistics center flame and smoke detection method as described in any one of the above items.
[0015] According to another aspect of the present application, a computer-readable storage medium is also disclosed, wherein the computer-readable storage medium stores instructions, wherein when the instructions are executed by a processor, each step of the logistics center flame and smoke detection method as described above is implemented. The present invention includes but is not limited to the following beneficial effects: (1) This solution embeds a multi-scale large-core attention mechanism module in front of the detection head, and simultaneously captures features of different scales through multi-scale branches. Based on the small-scale convolution kernel, it focuses on the detail features, and the large-scale convolution kernel obtains the large-scale features, so that the model can capture both the subtle texture (such as the subtle jump of the flame and the filamentous structure of the smoke) and the overall shape (such as the overall shape of the flame and the diffusion range of the smoke) of targets such as flames and smoke, enrich the feature dimensions, and improve the recognition accuracy of small target features; (2) This solution replaces the loss function in the model with the Focaler-IoU loss function. Through the Focal focusing mechanism, the weight of difficult samples with low IoU values (far from 1) is increased, and in flames and smoke, the weight of difficult samples with low IoU values (far from 1) is increased. During the detection model training, for samples whose predicted boxes differ greatly from the true boxes and are difficult to accurately predict (such as those where the smoke is obscured or the flame is weak), the model will pay more attention and devote more energy to learning their features, thereby improving the recognition of the characteristics of flames and smoke in complex and difficult-to-identify scenes, reducing missed detections and false detections. Furthermore, for easy samples with high IoU values (close to 1), their weights are reduced to avoid the model from over-learning simple samples during training and prevent the model from overfitting. This allows the model to learn evenly on various samples, thereby improving the overall ability of flame and smoke detection in different scenarios. Furthermore, the Focaler-IoU loss function can dynamically adjust training parameters (such as learning rate) according to the convergence trend of the loss value during the training cycle. When the loss value continues to decrease slowly, the learning rate is appropriately reduced so that the model can adjust the parameters more finely in the later stage of training to avoid missing the optimal solution; if the loss value fluctuates violently, the training is suspended to investigate the cause or the model structure and parameters are readjusted to make the training process more scientific and reasonable, which helps the model converge to a better state faster, improves the training efficiency and the final performance of the model; (3) The Web interaction architecture is constructed through the Streamlit framework, which greatly shortens the development cycle. Compared with traditional Web development, which requires separate processing of complex processes such as front-end page construction, back-end logic writing, and front-end and back-end interaction, Streamlit can achieve the transformation from model to application through simple code, reducing development time and labor cost investment, and accelerating the launch of the flame and smoke intelligent detection system. In addition, the Streamlit interactive component is used to set the file upload area. The clear and convenient interaction method allows users to easily upload the images to be detected, lowering the user threshold. Even non-professionals can quickly get started with flame and smoke detection operations. By creating CSS files, the page layout, color matching, font style and other aspects are designed to improve the visual effect of the interface. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for describing the embodiments or the prior art.
[0017] Figure 1 This is a flow chart of a method for detecting flames and smoke in a logistics center according to an embodiment of the present application; Figure 2 This is another flow chart of the flame and smoke detection method for a logistics center according to an embodiment of the present application; Figure 3 This is another flow chart of the flame and smoke detection method for a logistics center according to an embodiment of the present application; Figure 4 This is a structural block diagram of a flame and smoke detection device for a logistics center according to an embodiment of the present application; Figure 5 It is a structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0018] An embodiment of the present invention provides a method for detecting flames and smoke in a logistics center, the method comprising: Obtain a training data set, which includes multiple training images. The training images include sample images with labeled boxes and expanded images based on the sample images. The sample images include flame scene images, smoke scene images, mixed scene images, and normal scene images; construct an initial YOLOv12 model. The initial YOLOv12 model includes a backbone network, a neck network, a multi-scale large-core attention mechanism module, and a detection head. The backbone network is used to extract features from the input image to obtain an initial feature map. The neck network is used to perform feature fusion on the initial feature map output by the backbone network to obtain a fused feature map. The multi-scale large-core attention mechanism module Embedded in front of the detection head, it convolves the fused feature map with multi-scale convolution kernels to produce an enhanced feature map that highlights key features. The detection head then performs category detection on the input enhanced feature map and outputs the input image's category information. The initial YOLOv12 model is optimized and trained based on the training dataset to produce a target YOLOv12 model. During the optimization training, the Focaler-IoU loss function is used. The target image is then input into the target YOLOv12 model for detection. Based on the output type of the target YOLOv12 model, the flame / smoke category of the target image is determined. This solution embeds a multi-scale large-kernel attention mechanism module in front of the detection head. Through multi-scale branching, it simultaneously captures features at different scales. Small-scale convolution kernels focus on detailed features, while large-scale convolution kernels capture broad-scale features. This enables the model to capture both subtle textures (such as the subtle pulsation of a flame or the filamentary structure of smoke) and overall morphology (such as the overall shape of a flame or the spread of smoke) for targets such as flames and smoke, enriching the feature dimensionality and improving the recognition accuracy of small target features.
[0019] The terms "first," "second," "third," "fourth," and so on (if any) in the description and claims of the present invention and in the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that shown or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus that includes a series of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, product, or apparatus.
[0020] For ease of understanding, the specific process of the embodiment of the present invention is described below. Specifically, Figure 1 This is a flow chart of the flame and smoke detection method for the logistics center according to an embodiment of the present application. Figure 1 , including the following steps: S100: Obtain a training data set.
[0021] Specifically, the training data set includes multiple training images, the training images include sample images with labeled boxes and expanded images based on the sample images, and the sample images include flame scene images, smoke scene images, mixed scene images, and normal scene images.
[0022] In one example, Figure 2 This is another flow chart of the flame and smoke detection method for the logistics center according to the embodiment of the present application. This flow chart is an exemplary description of step S100. Figure 2 , including the following steps: S200: Acquire multiple original images.
[0023] Specifically, the original images include multiple images of flame scenes, multiple images of smoke scenes, multiple images of mixed scenes, and multiple images of normal scenes. In one example, web crawler technology can be used to search for images of flame and smoke scenes on major public image resource websites (such as Baidu Images and Bing Images), professional image libraries, and academic databases. A certain number of images of normal scenes are also collected to ensure that the four states of flame, smoke, mixed scenes, and normal scenes are covered. Search keywords may include "flame images," "smoke images," "fire scene images," and "normal scenes without fire."
[0024] S202 , annotate each original image with a rectangular frame to obtain a sample image with an annotated frame, where each annotated frame corresponds to a category.
[0025] In one example, the X-Pic annotation tool can be launched. For each collected picture, the image content is carefully observed to identify the pixel ranges corresponding to flames, smoke, mixtures, and normal areas. A rectangular box is drawn to accurately define the boundary of the target object, which is the bounding box. At the same time, each bounding box is assigned a corresponding category label, namely flame, smoke, mixture, or normal.
[0026] S204: Perform enhancement processing on each sample image using data enhancement technology to obtain multiple enhanced images.
[0027] S206 , performing expansion processing on each enhanced image to obtain multiple expanded images.
[0028] S208 , mixing multiple sample images and multiple expanded images to obtain a training data set.
[0029] In one example, a variety of data augmentation techniques, such as random cropping, scaling, rotation, and color adjustment, can be used to simulate diverse flame and smoke scenes and enhance the model's generalization capabilities. For random cropping, the size range of the cropped area is set. For example, the cropping side length is randomly selected between 30% and 70% of the original image side length, and the cropping position is randomly determined within the image range to ensure that the cropped image still contains key information. During the scaling operation, the scaling ratio is randomly selected between 0.8 and 1.2 with a uniform distribution to produce an appropriate magnification or reduction effect on the image. The rotation angle is randomly set between -45° and 45° with a uniform distribution to simulate the appearance of flames and smoke observed from different angles. For color adjustment, the brightness adjustment range is set to randomly change within the grayscale value range of -30 to 30, the contrast adjustment coefficient is randomly selected between 0.8 and 1.5, and the saturation adjustment range is randomly determined between -0.3 and 0.3. These color transformations are used to simulate the appearance of flames and smoke under different lighting and environmental conditions. The labeled original image dataset is processed in sequence. For each original image, random cropping, scaling, rotation, color adjustment and other operations are performed according to the randomly generated enhancement parameters to generate a series of enhanced new images. These new images are integrated with the original sample images to form an expanded training dataset.
[0030] S102. Build an initial YOLOv12 model.
[0031] Specifically, the initial YOLOv12 model includes a backbone network, a neck network, a multi-scale large-core attention mechanism module and a detection head. The backbone network is used to extract features from the input image to obtain an initial feature map. The neck network is used to perform feature fusion on the initial feature map output by the backbone network to obtain a fused feature map. The multi-scale large-core attention mechanism module is embedded in the front of the detection head and is used to convolve the fused feature map through a multi-scale convolution kernel to obtain an enhanced feature map that highlights key features. The detection head is used to perform category detection on the input enhanced feature map to output category information of the input image.
[0032] The multi-scale large kernel attention (MLKA) module includes at least two scale branches, each with a convolution kernel of a different scale. In one example, the number of multi-scale branches can be defined, for example, three. Each branch uses a convolution kernel of a different scale to capture features of different receptive fields. In this example, these branches can include small-scale, medium-scale, and large-scale branches. For the small-scale branch, a 3×3 convolution kernel is used, for the medium-scale branch a 5×5 convolution kernel is used, and for the large-scale branch a 7×7 convolution kernel is used. Furthermore, each branch is configured with a corresponding number of channels. Based on the overall model complexity and feature dimensionality requirements, the initial number of channels for each branch is set. For example, the number of channels for the scale branch, the number of channels for the medium-scale branch, and the number of channels for the large-scale branch can be 32, 64, or 128, respectively. A channel fusion mechanism is implemented within the module, typically using point-by-point addition or concatenation followed by dimensionality reduction and fusion through 1×1 convolution, to ensure that the output feature dimensionality matches the input requirements of subsequent model layers. In the model architecture, find a suitable position before the detection head as the embedding point of the MLKA module, analyze the current feature extraction process of the model, so that after inserting the MLKA module, the features extracted by the previous layer can be effectively utilized, and its output features can smoothly connect with the input requirements of the detection head; after the MLKA module is embedded in the model, modify the forward propagation path of the model. During the forward reasoning process, when the feature flow reaches the embedding point, it first flows into the MLKA module. According to the design of multi-scale large kernel convolution, each branch processes the input features in parallel, respectively capturing feature information of different scales, and then merges the multi-scale features into a unified output feature through the internal fusion mechanism, and then passes this output feature to the subsequent detection head. Specifically, the forward propagation process is described as follows: The input flame and smoke image (training image or target image) enters the model's backbone network. Through a series of convolution and downsampling operations, the backbone network extracts basic features from the image, such as edges and texture, and outputs an initial feature map. This initial feature map flows into the neck network, where it fuses features, integrating feature information from different levels to produce a fused feature map. This feature map now contains richer semantic information. The fused feature map reaches a predetermined embedding point before the detection head, where it enters the MLKA module. The MLKA module is internally divided into multiple branches (for example, three branches are set). Each branch uses convolution kernels of different scales (3×3, 5×5, and 7×7) to process the input fused feature map in parallel. Small-scale branches capture detailed features of the flame and smoke, such as the subtle texture of the flame and the filamentous structure of the smoke. Large-scale branches capture broad-scale features, such as the overall shape of the flame and the diffusion range of the smoke. After each branch extracts feature information at different scales, the module's internal channel fusion mechanism (such as point-by-point addition or concatenation followed by 1×1 convolution for dimensionality reduction) combines these multi-scale features into a unified enhanced feature map. This enhanced feature map highlights key features of the input image, such as flames and smoke, enhancing feature representation. The enhanced feature map processed by the MLKA module is passed to the subsequent detection head, which processes it, performing object category prediction and bounding box regression calculations through convolutional and fully connected layers. It ultimately outputs the category information (flame, smoke, mixed objects, etc.) and location information (bounding box coordinates) of the flame and smoke targets in the image, completing the entire forward propagation process.
[0033] It can be understood that by embedding a multi-scale large-core attention mechanism module in front of the detection head, multi-scale branches are used to simultaneously capture features of different scales. Small-scale convolution kernels focus on detail features, and large-scale convolution kernels obtain large-scale features. This enables the model to capture subtle textures (such as the subtle beating of flames and the filamentous structure of smoke) for targets such as flames and smoke, as well as grasp the overall form (such as the overall shape of the flame and the diffusion range of the smoke), enrich the feature dimensions, and improve the recognition accuracy of small target features.
[0034] S104: Optimize and train the initial YOLOv12 model based on the training data set to obtain a target YOLOv12 model.
[0035] Specifically, during the optimization training process, the loss function uses the Focaler-IoU loss function. Specifically, the IoU value is calculated by comparing the intersection area of the predicted box with the ground-truth box to the union area of their two areas. Then, a focal focusing mechanism is introduced to assign different weights to samples based on the IoU value. For example, samples with high IoU values (close to 1) are weighted lower, as these samples are close to being correctly predicted and the marginal benefit of model learning is small. Conversely, samples with low IoU values (far from 1) are weighted higher, encouraging the model to pay more attention to these difficult-to-predict samples. At each iteration of model training, the Focaler-IoU loss is calculated for each predicted box relative to its corresponding ground-truth box. The IoU value is first calculated, and then, based on a set focusing parameter, such as the gamma value (which can be set experimentally between 2 and 5 to adjust the degree of weight decay), the sample weight is calculated and multiplied by the IoU loss value to obtain the final Focaler-IoU loss value. During model initialization, specify the Focaler-IoU loss function as the loss function. During the training loop, ensure that after each forward propagation prediction, the new loss function is correctly called to calculate the loss value, and the loss value is passed to the optimizer for backpropagation to update the model parameters. Simultaneously, monitor the change in loss value during training and adjust training parameters, such as the learning rate, based on its convergence trend. If the loss value continues to decrease slowly, reduce the learning rate appropriately. If it fluctuates dramatically, pause training to investigate the cause or readjust the model structure and parameters.
[0036] It can be understood that by replacing the loss function in the model with the Focaler-IoU loss function, the weight of difficult samples with low IoU values (far from 1) is increased through the Focal focusing mechanism. In the training of the flame and smoke detection model, for those samples whose predicted boxes are greatly different from the true boxes and are difficult to accurately predict (such as the part blocked by smoke and the situation when the flame is weak), the model will pay more attention and devote more energy to learning their features, thereby improving the recognition of the characteristics of flames and smoke in complex and difficult-to-identify scenes, reducing missed detections and false detections, and further, for easy samples with high IoU values (close to 1), their weights are reduced to avoid the model from over-learning simple samples during training and preventing the model from overfitting, so that the model can learn evenly on various samples and improve the overall ability of flame and smoke detection in different scenarios; further, the Focaler-IoU loss function can dynamically adjust training parameters (such as learning rate) according to the convergence trend of the loss value in the training loop. When the loss value continues to decrease slowly, appropriately reduce the learning rate so that the model can adjust parameters more finely in the later stages of training to avoid missing the optimal solution. If the loss value fluctuates violently, pause training to investigate the cause or readjust the model structure and parameters to make the training process more scientific and reasonable, which will help the model converge to a better state faster, improve training efficiency and the final performance of the model.
[0037] S106 : Input the target image to be detected into the target YOLOv12 model for detection, and determine the flame and smoke category of the target image to be detected based on the output type of the target YOLOv12 model.
[0038] Further, such as Figure 3 , is another flow chart of the flame and smoke detection method for the logistics center of the embodiment of the present application, see Figure 3 , including the following steps: S300: Obtain a training data set.
[0039] S302: Build an initial YOLOv12 model.
[0040] S304: Optimize and train the initial YOLOv12 model based on the training data set to obtain a target YOLOv12 model.
[0041] S306 : Input the target image to be detected into the target YOLOv12 model for detection, and determine the flame and smoke category of the target image to be detected based on the output type of the target YOLOv12 model.
[0042] The introduction of steps S300-S306 can refer to the above introduction of steps S100-S106, which will not be repeated here.
[0043] S308. Use the Streamlit framework to build a Web interaction architecture.
[0044] S310: Load the target YOLOv12 model into the memory of the Web interactive architecture based on the target saving format, so that the Web interactive architecture is endowed with the detection capability of the target image to be detected.
[0045] Choose Streamlit as the web application framework for developing intelligent flame and smoke detection. Install Streamlit and its dependencies, create a new Python project directory, and create a main program file in it. In the main program file, import the Streamlit library and initialize the framework using the Streamlit.run() function to build a basic web application skeleton. Based on the established Streamlit framework, implement model loading and integration. Use the format in which the model was saved to load the trained flame and smoke detection model into memory.
[0046] S312. Create CSS files for the web interaction architecture built by Streamlit based on CSS.
[0047] Specifically, you can use Streamlit's interactive components to design a user-friendly interface. Set up a prominent file upload area on the page to prompt users to upload images to be tested. Use CSS to beautify the web app built with Streamlit. Create a separate CSS file to define style rules such as page layout, color matching, and font style.
[0048] It is understandable that building a Web interactive architecture through the Streamlit framework significantly shortens the development cycle. Compared to traditional Web development, which requires separate processing of complex processes such as front-end page construction, back-end logic writing, and front-end and back-end interaction, using Streamlit can achieve the transformation from model to application through simple code, reducing development time and labor cost investment, and accelerating the launch of the intelligent flame and smoke detection system. In addition, the Streamlit interactive component is used to set the file upload area. The clear and convenient interaction method allows users to easily upload images to be detected, lowering the user threshold. Even non-professionals can quickly get started with flame and smoke detection operations. By creating CSS files, design from aspects such as page layout, color matching, and font style to improve the visual effect of the interface.
[0049] Further, Figure 4 This is the structural diagram of the flame and smoke detection device in the logistics center, such as Figure 5 As shown, the device includes: A training data set acquisition module is used to acquire a training data set, wherein the training data set includes multiple training images, the training images include sample images with annotation boxes and expanded images based on the sample images, and the sample images include flame scene images, smoke scene images, mixed scene images, and normal scene images; The initial YOLOv12 model construction module is used to build the initial YOLOv12 model. The initial YOLOv12 model includes a backbone network, a neck network, a multi-scale large-core attention mechanism module, and a detection head. The backbone network is used to extract features from the input image to obtain an initial feature map. The neck network is used to perform feature fusion on the initial feature map output by the backbone network to obtain a fused feature map. The multi-scale large-core attention mechanism module is embedded in the front of the detection head and is used to convolve the fused feature map with a multi-scale convolution kernel to obtain an enhanced feature map that highlights key features. The detection head is used to perform category detection on the input enhanced feature map to output category information of the input image. The model optimization module is used to optimize the initial YOLOv12 model based on the training dataset to obtain the target YOLOv12 model. During the optimization training process, the loss function adopts the Focaler-IoU loss function; The detection module is used to input the target image to be detected into the target YOLOv12 model for detection, so as to determine the flame and smoke category of the target image to be detected based on the output type of the target YOLOv12 model.
[0050] The application introduction of the relevant modules of the device in this example can refer to the relevant introduction of the above method principles, which will not be repeated here.
[0051] above Figure 4 The flame and smoke detection device for a logistics center in an embodiment of the present invention is described in detail from the perspective of modular functional entities. The electronic device in an embodiment of the present invention is described in detail from the perspective of hardware processing.
[0052] Figure 5: This is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. The electronic device 500 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 510 (for example, one or more processors) and memory 520, and one or more storage media 530 (for example, one or more mass storage devices) storing application programs 533 or data 532. The memory 520 and storage medium 530 may be temporary storage or permanent storage. The program stored in the storage medium 530 may include one or more modules (not shown in the figure), each of which may include a series of instruction operations on the electronic device 500. Furthermore, the processor 510 may be configured to communicate with the storage medium 530 to execute the series of instruction operations in the storage medium 530 on the electronic device 500.
[0053] The electronic device 500 may further include one or more power supplies 540, one or more wired or wireless network interfaces 550, one or more input and output interfaces 560, and / or one or more operating systems 531, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. It will be understood by those skilled in the art that Figure 5 The illustrated electronic device structure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0054] The present invention also provides a computer-readable storage medium, which can be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. The computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the steps of the logistics center flame and smoke detection method.
[0055] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described systems, devices, and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0056] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the various embodiments of the method of the present invention. The aforementioned storage medium includes various media that can store program code, such as USB flash drives, mobile hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0057] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that the technical solutions described in the above embodiments can still be modified, or some of the technical features thereof can be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A flame and smoke detection method for a logistics center, characterized in that: The method comprises: Acquire a training data set, the training data set including a plurality of training images, the training images including sample images with marked boxes and expanded images expanded based on the sample images, the sample images including flame scene images, smoke scene images, mixed scene images, and normal scene images; Construct an initial YOLOv12 model, which includes a backbone network, a neck network, a multi-scale large-core attention mechanism module, and a detection head. The backbone network is used to extract features from the input image to obtain an initial feature map. The neck network is used to perform feature fusion on the initial feature map output by the backbone network to obtain a fused feature map. The multi-scale large-core attention mechanism module is embedded in front of the detection head and is used to convolve the fused feature map through a multi-scale convolution kernel to obtain an enhanced feature map that highlights key features. The detection head is used to perform category detection on the input enhanced feature map to output category information of the input image. Optimize and train the initial YOLOv12 model based on the training data set to obtain a target YOLOv12 model. During the optimization training process, the loss function adopts the Focaler-IoU loss function. The target image to be detected is input into the target YOLOv12 model for detection, and the flame and smoke category of the target image to be detected is determined based on the output type of the target YOLOv12 model.
2. The flame and smoke detection method for a logistics center according to claim 1, characterized in that: The obtaining of the training data set comprises: Acquire multiple original images, wherein the original images include multiple flame scene images, multiple smoke scene images, multiple mixed scene images, and multiple normal scene images; Annotate each original image with a rectangular frame to obtain a sample image with an annotated frame, where each annotated frame corresponds to a category; Each sample image is enhanced using data enhancement technology to obtain multiple enhanced images; Performing expansion processing on each enhanced image to obtain multiple expanded images; The training data set is obtained by mixing a plurality of the sample images and a plurality of the expanded images.
3. The flame and smoke detection method for a logistics center according to claim 1, characterized in that: The multi-scale large-core attention mechanism module includes at least two scale branches, each scale branch having a convolution kernel of a different scale.
4. The flame and smoke detection method for a logistics center according to claim 3, characterized in that: The multi-scale large-core attention mechanism module includes three scale branches, including a small-scale branch, a medium-scale branch and a large-scale branch. The small-scale branch is a 3×3 convolution kernel with 32 channels, the medium-scale branch is a 5×5 convolution kernel with 64 channels, and the large-scale branch is a 7×7 convolution kernel with 128 channels.
5. The flame and smoke detection method for a logistics center according to claim 1, characterized in that: The method further comprises: Use the Streamlit framework to build a web interactive architecture; The target YOLOv12 model is loaded into the memory of the Web interaction architecture based on the target saving format, so that the Web interaction architecture is endowed with the detection capability of the target image to be detected.
6. The flame and smoke detection method for a logistics center according to claim 1, characterized in that: The method further comprises: A file upload area is set based on the interactive component of Streamlit, and the file upload area includes an upload button for uploading the target image to be detected.
7. The flame and smoke detection method for a logistics center according to claim 1, characterized in that: The method further comprises: A CSS file is created for the web interaction architecture built by Streamlit based on CSS. The CSS file is used to define the page style of the web interaction architecture. The page style includes at least page layout, color matching, and font style.
8. A flame and smoke detection device for a logistics center, characterized in that: The device comprises: a training data set acquisition module, configured to acquire a training data set, wherein the training data set includes a plurality of training images, wherein the training images include sample images with annotated boxes and expanded images expanded based on the sample images, wherein the sample images include flame scene images, smoke scene images, mixed scene images, and normal scene images; An initial YOLOv12 model construction module is used to construct an initial YOLOv12 model. The initial YOLOv12 model includes a backbone network, a neck network, a multi-scale large-core attention mechanism module, and a detection head. The backbone network is used to extract features from the input image to obtain an initial feature map. The neck network is used to perform feature fusion on the initial feature map output by the backbone network to obtain a fused feature map. The multi-scale large-core attention mechanism module is embedded in front of the detection head and is used to convolve the fused feature map through a multi-scale convolution kernel to obtain an enhanced feature map that highlights key features. The detection head is used to perform category detection on the input enhanced feature map to output category information of the input image. A model optimization module is used to optimize the initial YOLOv12 model based on the training data set to obtain a target YOLOv12 model. During the optimization training process, the loss function adopts the Focaler-IoU loss function; The detection module is used to input the target image to be detected into the target YOLOv12 model for detection, so as to determine the flame and smoke category of the target image to be detected based on the output type of the target YOLOv12 model.
9. An electronic device, characterized in that: The electronic device includes a memory and at least one processor, wherein the memory stores instructions; the at least one processor calls the instructions in the memory so that the electronic device executes each step of the logistics center flame and smoke detection method as described in any one of claims 1-7.
10. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions are executed by the processor, the various steps of the logistics center flame and smoke detection method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Flame smoke detection method and system based on improved YOLOv8s
CN120997967A
Traffic sign detection method based on space completion and multi-scale focusing
CN121600495A
Fire risk adaptive monitoring method based on YOLOv12-AFE
CN121883910A