Flame detection method, device and equipment, readable storage medium and program product

By introducing the attention mechanism sublayer and the MCIR sublayer into the flame detection model for multi-level feature fusion, the problem of low flame detection accuracy of convolutional neural networks in tunnel environments is solved, and more efficient recognition of flames, smoke, and flame-smoke mixtures is achieved.

CN120599533APending Publication Date: 2025-09-05GUANGZHOU POWER SUPPLY BUREAU GUANGDONG POWER GRID CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510675317.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-23
Publication Date
2025-09-05

AI Technical Summary

Technical Problem

Traditional flame detection methods using convolutional neural networks have the problem of low detection accuracy, especially in tunnel environments, which are affected by factors such as smoke, light changes, and dust, and cannot effectively extract multi-scale features.

Method used

A method based on the flame detection model is adopted. By adding the first attention mechanism sublayer and the MCIR sublayer to the feature extraction layer, multi-level feature fusion is performed. Combined with the second attention mechanism sublayer, richer spatial feature information is output, ultimately improving the accuracy of flame detection.

Benefits of technology

The accuracy of flame detection is improved, and flames, smoke, and flame-smoke mixtures in tunnels can be more effectively identified, overcoming the limitation of convolutional neural networks that can only extract local features.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120599533A_ABST
    Figure CN120599533A_ABST
Patent Text Reader

Abstract

The invention relates to a flame detection method, device and equipment based on a flame detection model, a readable storage medium and a program product. The method comprises the steps that a flame detection model comprises a feature extraction layer, a feature fusion layer and an output layer, the feature extraction layer comprises a first attention mechanism sub-layer and an MCIR sub-layer, the feature fusion layer comprises a second attention mechanism sub-layer, and a tunnel image corresponding to a target tunnel is obtained based on the flame detection model. A first spatial feature is output through a first attention mechanism sub-layer based on the tunnel image, a multi-level fusion feature can be output through an MCIR sub-layer based on the first spatial feature, a second spatial feature can be output through a second attention mechanism sub-layer based on the first spatial feature and the multi-level fusion feature, and then the multi-level fusion feature is output. And outputting a flame detection result based on the second spatial feature through an output layer. By adopting the method, the flame detection accuracy can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of cable protection technology, and in particular to a flame detection method, device, equipment, readable storage medium and program product. Background Art

[0002] In order to protect the safety of cables in tunnels, it is necessary to identify flames in tunnels to avoid fires.

[0003] Traditional flame detection methods usually use convolutional neural networks to identify and process images in tunnels. However, due to the limitations of convolutional neural networks themselves, this method has the problem of low detection accuracy. Summary of the Invention

[0004] Based on this, it is necessary to provide a flame detection method, device, equipment, readable storage medium and program product that can improve detection accuracy in response to the above technical problems.

[0005] In a first aspect, the present application provides a flame detection method based on a flame detection model, wherein the flame detection model includes a feature extraction layer, a feature fusion layer, and an output layer. The feature extraction layer includes a first attention mechanism sublayer and an MCIR (Multi-scale Context Interaction and Refinement) sublayer, and the feature fusion layer includes a second attention mechanism sublayer. The method includes:

[0006] Obtaining a tunnel image corresponding to the target tunnel;

[0007] Output the first spatial feature based on the tunnel image through the first attention mechanism sub-layer, and output the multi-level fusion feature based on the first spatial feature through the MCIR sub-layer;

[0008] Output the second spatial features based on the first spatial features and multi-level fusion features through the second attention mechanism sub-layer;

[0009] The flame detection result is outputted based on the second spatial feature through the output layer, where the flame detection result is used to characterize whether one or more of flame, smoke, and a mixture of flame and smoke exists in the target tunnel.

[0010] In one embodiment, the first attention mechanism sublayer includes multiple first attention mechanism modules, each of which is cascaded in sequence. The first attention mechanism sublayer outputs a first spatial feature based on the tunnel image, including:

[0011] Perform spatial feature extraction on the input features through each first attention mechanism module to obtain the first spatial feature corresponding to the first attention mechanism module;

[0012] Among them, the features input by the first attention mechanism module in each first attention mechanism module are obtained by extracting local features of the tunnel image, the first spatial features output by the intermediate attention mechanism module in each first attention mechanism module are also input into the feature fusion layer, and the first spatial features output by the last attention mechanism module in each first attention mechanism module are input into the MCIR sublayer after pooling.

[0013] In one embodiment, the intermediate attention mechanism module includes a first intermediate attention mechanism module and a second intermediate attention mechanism module; the second attention mechanism sublayer includes a second attention mechanism module and a third attention mechanism module; the feature fusion layer also includes a first upsampling module, a first fusion module, a second upsampling module, and a second fusion module, and the second attention mechanism sublayer outputs a second spatial feature based on the first spatial feature and the multi-level fusion feature, including:

[0014] Performing upsampling processing on the multi-level fusion features through a first upsampling module to obtain a first upsampling feature;

[0015] The first up-sampled feature and the first spatial feature output by the first intermediate attention mechanism module are fused through the first fusion module to obtain a first fused feature;

[0016] The second attention mechanism module extracts spatial features from the first fusion feature to obtain fusion spatial features;

[0017] Upsampling the fused spatial features through a second upsampling module to obtain second upsampling features;

[0018] The second up-sampled feature and the first spatial feature output by the second intermediate attention mechanism module are fused through the second fusion module to obtain a second fused feature;

[0019] The second spatial feature is obtained by performing spatial feature extraction on the second fusion feature through the third attention mechanism module.

[0020] In one embodiment, the second attention mechanism sublayer further includes a fourth attention mechanism module, the feature fusion layer further includes a first convolution module and a third fusion module, and the method further includes:

[0021] Performing local feature extraction on the tunnel image through a first convolution module to obtain a first local feature;

[0022] The first local feature and the fused spatial feature are fused by a third fusion module to obtain a third fused feature;

[0023] The third fusion feature is extracted through the fourth attention mechanism module, and the extracted spatial feature is input into the output layer as the second spatial feature.

[0024] In one embodiment, the second attention mechanism sublayer further includes a fifth attention mechanism module, the feature fusion layer further includes a second convolution module and a fourth fusion module, and the method further includes:

[0025] The second convolution module performs local feature extraction on the spatial features extracted by the fourth attention mechanism module to obtain the second local features;

[0026] The second local feature and the multi-level fusion feature are fused by a fourth fusion module to obtain a fourth fusion feature;

[0027] The fourth fusion feature is extracted through the fifth attention mechanism module, and the extracted spatial feature is input into the output layer as the second spatial feature.

[0028] In a second aspect, the present application also provides a flame detection model, which includes:

[0029] Feature extraction layer, which includes a first attention mechanism sublayer and an MCIR sublayer. The first attention mechanism sublayer is used to output a first spatial feature based on the tunnel image, and the MCIR sublayer is used to output a multi-level fusion feature based on the first spatial feature.

[0030] The feature fusion layer includes a second attention mechanism sublayer, which is used to output a second spatial feature based on the first spatial feature and the multi-level fusion feature;

[0031] The output layer is used to output the flame detection result based on the second spatial feature, and the flame detection result is used to characterize whether there is one or more of flame, smoke, and a mixture of flame and smoke in the target tunnel.

[0032] In a third aspect, the present application further provides a flame detection device based on a flame detection model, the flame detection model including a feature extraction layer, a feature fusion layer, and an output layer, the feature extraction layer including a first attention mechanism sublayer and an MCIR sublayer, the feature fusion layer including a second attention mechanism sublayer, and the device including:

[0033] An acquisition module, used for acquiring a tunnel image corresponding to a target tunnel;

[0034] A first spatial feature output module is configured to output a first spatial feature based on the tunnel image through a first attention mechanism sublayer, and output a multi-level fusion feature based on the first spatial feature through an MCIR sublayer;

[0035] A second spatial feature output module is configured to output a second spatial feature based on the first spatial feature and the multi-level fusion feature through a second attention mechanism sublayer;

[0036] The detection result output module is used to output the flame detection result based on the second spatial feature through the output layer, and the flame detection result is used to characterize whether there is one or more of flame, smoke, and flame-smoke mixture in the target tunnel.

[0037] In a fourth aspect, an embodiment of the present application provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method of the first aspect described above when executing the computer program.

[0038] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the method of the first aspect described above when the computer program is executed by a processor.

[0039] In a sixth aspect, the present application further provides a computer program product, comprising a computer program, which, when executed by a processor, implements the steps of the method in the first aspect.

[0040] The flame detection method, device, equipment, readable storage medium and program product based on the flame detection model mentioned above, the flame detection model includes a feature extraction layer, a feature fusion layer and an output layer, the feature extraction layer includes a first attention mechanism sublayer and an MCIR sublayer, the feature fusion layer includes a second attention mechanism sublayer, based on the flame detection model, the tunnel image corresponding to the target tunnel can be obtained, and then the first spatial feature can be output based on the tunnel image through the first attention mechanism sublayer, and the multi-level fusion feature can be output based on the first spatial feature through the MCIR sublayer, and the second spatial feature can be output based on the first spatial feature and the multi-level fusion feature through the second attention mechanism sublayer, and then the flame detection result can be output based on the second spatial feature through the output layer, wherein the flame detection result is used to characterize whether there is one or more of flame, smoke and flame-smoke mixture in the target tunnel. In this way, the present application improves the flame detection model by adding a first attention mechanism sublayer to its feature extraction layer so that when extracting features from the tunnel image to be detected, spatial features of the spatial dimension can be extracted, avoiding the limitation of traditional technology that only local features can be extracted using convolutional neural networks. By adding the MCIR sublayer, multi-level feature fusion can be performed on the first spatial features before the feature fusion layer, so that the feature information of the multi-level fusion features input into the feature fusion layer is more accurate. Subsequently, a second attention mechanism sublayer is added to the feature fusion layer, so that richer spatial feature information can be proposed when performing multi-level feature fusion. Finally, the second spatial features output by the feature fusion are used to perform flame detection, and the detection accuracy is higher. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments of the present application or related technical descriptions. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying any creative work.

[0042] Figure 1 A diagram showing an application environment of a flame detection method in one embodiment;

[0043] Figure 2 is a model structure diagram of an exemplary flame detection model in one embodiment;

[0044] Figure 3 is a structural diagram of an exemplary attention mechanism module in one embodiment;

[0045] Figure 4 is a structural diagram of an exemplary MCIR sublayer in one embodiment;

[0046] Figure 5 1 is a flow chart of a flame detection method according to an embodiment;

[0047] Figure 6 is a schematic structural diagram of an exemplary feature extraction layer in one embodiment;

[0048] Figure 7 is a structural diagram of an exemplary feature fusion layer in one embodiment;

[0049] Figure 8 is a structural diagram of another exemplary feature fusion layer in one embodiment;

[0050] Figure 9 is a structural diagram of a third exemplary feature fusion layer in one embodiment;

[0051] Figure 10 Schematic diagram of iterative changes of loss value in one embodiment;

[0052] Figure 11 1 is a flow chart of a flame detection method according to another embodiment;

[0053] Figure 12 is a structural block diagram of a flame detection device in one embodiment;

[0054] Figure 13 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0055] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.

[0056] In order to protect the safety of cables in tunnels, it is necessary to identify flames in tunnels to avoid fires.

[0057] Traditional flame detection methods usually use deep learning methods, such as using convolutional neural networks to identify and process images in the tunnel to be detected. However, convolutional neural networks themselves have limitations. Their convolution kernels can only identify local features when extracting features from images. However, the environment inside the tunnel is complex, and flame recognition is often affected by many factors, such as smoke, light changes, dust, and tunnel structure. Flame recognition using convolutional neural networks alone cannot effectively extract multi-scale features. Therefore, traditional flame detection methods based on convolutional neural networks have the problem of low detection accuracy.

[0058] In view of this, the present application proposes a flame detection method, apparatus, device, readable storage medium and program product based on a flame detection model. The flame detection model includes a feature extraction layer, a feature fusion layer and an output layer. The feature extraction layer includes a first attention mechanism sublayer and an MCIR sublayer. The feature fusion layer includes a second attention mechanism sublayer. Based on the flame detection model, a tunnel image corresponding to the target tunnel can be obtained, and then a first spatial feature can be output based on the tunnel image through the first attention mechanism sublayer, and a multi-level fusion feature can be output based on the first spatial feature through the MCIR sublayer. A second spatial feature can be output based on the first spatial feature and the multi-level fusion feature through the second attention mechanism sublayer. Then, a flame detection result can be output based on the second spatial feature through the output layer, wherein the flame detection result is used to characterize whether there is one or more of flame, smoke and a flame-smoke mixture in the target tunnel. In this way, the present application improves the flame detection model by adding a first attention mechanism sublayer to its feature extraction layer so that when extracting features from the tunnel image to be detected, spatial features of the spatial dimension can be extracted, avoiding the limitation of traditional technology that only local features can be extracted using convolutional neural networks. By adding the MCIR sublayer, multi-level feature fusion can be performed on the first spatial features before the feature fusion layer, so that the feature information of the multi-level fusion features input into the feature fusion layer is more accurate. Subsequently, a second attention mechanism sublayer is added to the feature fusion layer, so that richer spatial feature information can be proposed when performing multi-level feature fusion. Finally, the second spatial features output by the feature fusion are used to perform flame detection, and the detection accuracy is higher.

[0059] The flame detection method based on the flame detection model provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown, the data storage system can store data that server 1041 needs to process. The data storage system can be integrated on server 101, or it can be placed on the cloud or other network servers. Server 101 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.

[0060] In one embodiment, an exemplary flame detection model is provided, which may include:

[0061] Feature extraction layer, the feature extraction layer includes a first attention mechanism sublayer and an MCIR sublayer. The first attention mechanism sublayer is used to output a first spatial feature based on the tunnel image, and the MCIR sublayer is used to output a multi-level fusion feature based on the first spatial feature; feature fusion layer, the feature fusion layer includes a second attention mechanism sublayer. The second attention mechanism sublayer is used to output a second spatial feature based on the first spatial feature and the multi-level fusion feature; output layer, the output layer is used to output a flame detection result based on the second spatial feature. The flame detection result is used to characterize whether there is one or more of flame, smoke, and a flame-smoke mixture in the target tunnel.

[0062] In a possible implementation, the model structure of the flame detection model can refer to the following Figure 2 In the embodiment of the present application, the first attention mechanism sublayer and the second attention mechanism sublayer are both network layers including the attention mechanism module. The specific structure of the attention mechanism module can be referred to Figure 3 , including CBS (convolution Conv2d, batch normalization BN and activation function SiLU) module, Split feature segmentation module, N Bottle Neck bottleneck structure modules and Concat feature splicing module. Among them, the Bottle Neck module is a residual structure composed of multiple CBS and attention mechanism units CBAM. When the feature map is convolved by the attention mechanism module including CBAM, a spatial level attention map can be generated, thereby outputting the spatial features of comprehensive spatial information.

[0063] The structure of the MCIR sublayer can be found in Figure 4 , including CBR (Convolution Conv2d, Batch Normalization BN and Activation Function ReLU), Channel Spliting channel segmentation module, multiple Inverted Residual inverted residual modules, and Concat, among which Convolution Conv2d can perform channel dimensionality reduction on the input feature map to reduce the subsequent computational complexity, and the channel segmentation module can be used to divide the feature into multiple parts to Figure 5 Taking the structure in as an example, one part directly passes on the original information to avoid the loss of the original scale information. The remaining three parts are respectively passed through the inverted residual module to realize the step-by-step fusion of features of different scales. Finally, the features output by all the inverted residual modules are spliced ​​together by the feature splicing module Concat and fused by a convolution Conv2d to realize the multi-level feature fusion of the first spatial feature before the feature fusion layer, so that the feature information of the multi-level fusion features input to the feature fusion layer is more accurate.

[0064] In an exemplary embodiment, Figure 5As shown in FIG, a flame detection method based on a flame detection model is provided, wherein the flame detection model includes a feature extraction layer, a feature fusion layer and an output layer, the feature extraction layer includes a first attention mechanism sublayer and an MCIR sublayer, and the feature fusion layer includes a second attention mechanism sublayer. Figure 1 The server 101 in the example is used for explanation, including the following steps 501 to 504.

[0065] Step 501: Acquire a tunnel image corresponding to a target tunnel.

[0066] In the embodiment of the present application, the target tunnel is the tunnel to be detected. The server can obtain a tunnel image of the target tunnel and perform flame detection based on the tunnel image.

[0067] Optionally, the server may acquire the tunnel image corresponding to the target tunnel in real time through an image acquisition device, such as a camera; alternatively, the server may acquire the tunnel image from a database.

[0068] In step 502 , a first attention mechanism sub-layer is used to output a first spatial feature based on the tunnel image, and a multi-level fusion feature is output based on the first spatial feature through the MCIR sub-layer.

[0069] After acquiring the tunnel image, the server may input the tunnel image into the flame detection model to perform flame detection.

[0070] After the server inputs the tunnel image into the flame detection model, it can use the feature extraction layer included in the flame detection model to perform feature extraction. In an embodiment of the present application, the feature extraction layer of the flame detection model may include a first attention mechanism sublayer. Optionally, the number of attention mechanism modules included in the first attention mechanism sublayer may be one. Optionally, the number of attention mechanism modules included in the first attention mechanism sublayer may be multiple.

[0071] After passing through the first attention mechanism sub-layer, the server can obtain the first spatial feature of the current tunnel image. After obtaining the first spatial feature, the server can input the first spatial feature into the MCIR sub-layer to obtain the multi-level fusion feature after the multi-level feature fusion.

[0072] In a possible implementation, the feature extraction layer may further include multiple convolutional layers, so that the flame detection model can extract basic local features and learn features at different levels and degrees of abstraction.

[0073] In another possible implementation, the feature extraction layer may further include a pyramid pooling module SPPF to perform multi-scale pooling on the first spatial features, thereby improving the subsequent feature fusion performance and facilitating the subsequent multi-level feature fusion in the MCIR module to obtain multi-level fusion features.

[0074] Step 503: Output the second spatial feature based on the first spatial feature and the multi-level fusion feature through the second attention mechanism sub-layer.

[0075] After the server obtains the first spatial feature and the multi-level fusion feature through the feature extraction layer, the server can input the two into the feature fusion layer for feature fusion.

[0076] In an embodiment of the present application, the feature fusion layer includes a second attention mechanism sublayer. Optionally, the number of attention mechanism modules included in the second attention mechanism sublayer may be one. Optionally, the number of attention mechanism modules included in the second attention mechanism sublayer may be multiple.

[0077] In a possible embodiment, the feature fusion layer may also include an upsampling module Upsample and a feature splicing module to perform multi-level feature fusion of features of different scales. It can be understood that the first spatial feature and the multi-level fusion feature are at different levels. The feature fusion of the two can be achieved through the upsampling module and the feature splicing module, thereby obtaining a second spatial feature that integrates features of different levels.

[0078] Step 504: Output the flame detection result based on the second spatial feature through the output layer.

[0079] Through the above steps, the server obtains the second spatial features output by the first attention mechanism sublayer, the MCIR sublayer, and the second attention mechanism sublayer. The server can process the second spatial features based on the output layer to obtain the final output flame detection result, wherein the flame detection result is used to characterize whether there is one or more of flame, smoke, and a flame-smoke mixture in the target tunnel.

[0080] In the above embodiment, the flame detection model is improved by adding a first attention mechanism sublayer to its feature extraction layer so that when extracting features from the tunnel image to be detected, spatial features of the spatial dimension can be extracted, thereby avoiding the limitation of the traditional technology of using convolutional neural networks to extract only local features. By adding the MCIR sublayer, multi-level feature fusion can be performed on the first spatial features before the feature fusion layer, so that the feature information of the multi-level fusion features input into the feature fusion layer is more accurate. Subsequently, a second attention mechanism sublayer is added to the feature fusion layer, so that richer spatial feature information can be proposed when performing multi-level feature fusion. Finally, the second spatial features output by the feature fusion are used to perform flame detection, and the detection accuracy is higher.

[0081] In one embodiment, based on the above Figure 2 In the illustrated embodiment, this embodiment involves outputting first spatial features based on a tunnel image via a first attention mechanism sublayer. The first attention mechanism sublayer includes multiple first attention mechanism modules, each of which is cascaded sequentially. Step 502 may include performing spatial feature extraction on the input features by each first attention mechanism module to obtain first spatial features corresponding to the first attention mechanism module.

[0082] Among them, the features input to the first attention mechanism module in each first attention mechanism module are obtained by extracting local features of the tunnel image. Therefore, in an embodiment of the present application, the first attention mechanism sublayer can also include convolution modules interspersed and cascaded between each first attention mechanism module.

[0083] The first spatial features output by the intermediate attention mechanism module in each first attention mechanism module are also input into the feature fusion layer, and the first spatial features output by the last attention mechanism module in each first attention mechanism module are pooled and input into the MCIR sublayer.

[0084] In one possible implementation, refer to Figure 6 , which is a structural diagram of an exemplary feature extraction layer. It can be seen that the first attention mechanism sub-layer includes four first attention mechanism modules, which are located at the third, fifth, seventh and ninth positions respectively. Each first attention mechanism module and multiple convolution modules Conv are cascaded in sequence.

[0085] In one embodiment, based on the above examples, this embodiment involves a process of outputting a second spatial feature based on the first spatial feature and the multi-level fusion feature through the second attention mechanism sublayer, wherein the intermediate attention mechanism module includes a first intermediate attention mechanism module and a second intermediate attention mechanism module; the second attention mechanism sublayer includes a second attention mechanism module and a third attention mechanism module, and the feature fusion layer also includes a first upsampling module, a first fusion module, a second upsampling module and a second fusion module.

[0086] In an embodiment of the present application, step 503 may include: upsampling the multi-level fusion features through the first upsampling module to obtain the first upsampling feature; fusing the first upsampling feature and the first spatial feature output by the first intermediate attention mechanism module through the first fusion module to obtain the first fusion feature; performing spatial feature extraction on the first fusion feature through the second attention mechanism module to obtain the fused spatial feature; upsampling the fused spatial feature through the second upsampling module to obtain the second upsampling feature; fusing the second upsampling feature and the first spatial feature output by the second intermediate attention mechanism module through the second fusion module to obtain the second fusion feature; performing spatial feature extraction on the second fusion feature through the third attention mechanism module to obtain the second spatial feature.

[0087] Reference Figure 7 , is a structural diagram of an exemplary feature fusion layer. It can be seen that the second spatial feature finally outputted integrates multiple levels of first spatial features and multi-level fusion features. The feature information reflected by the final second spatial feature is more accurate.

[0088] Based on the above embodiment, in a possible implementation, the second attention mechanism sublayer further includes a fourth attention mechanism module, and the feature fusion layer further includes a first convolution module and a third fusion module. The structure of the feature fusion layer can refer to Figure 8 , is an exemplary structure of a feature fusion layer. Based on this, the method may further include: extracting local features of the tunnel image through a first convolution module to obtain a first local feature; fusing the first local feature and the fused spatial feature through a third fusion module to obtain a third fused feature; extracting spatial features of the third fused feature through a fourth attention mechanism module, and inputting the extracted spatial features as second spatial features into the output layer.

[0089] Based on the above embodiment, in a possible implementation, the second attention mechanism sub-layer further includes a fifth attention mechanism module, and the feature fusion layer further includes a second convolution module and a fourth fusion module. The structure can be referred to Figure 9, is an exemplary structure of a feature fusion layer. Based on this, the method also includes: performing local feature extraction on the spatial features extracted by the fourth attention mechanism module through the second convolution module to obtain a second local feature; performing fusion processing on the second local feature and the multi-level fusion feature through the fourth fusion module to obtain a fourth fusion feature; performing spatial feature extraction on the fourth fusion feature through the fifth attention mechanism module, and inputting the extracted spatial feature into the output layer as the second spatial feature.

[0090] In this way, based on the above embodiment, the feature fusion layer can ultimately output three different levels of second spatial features, and ultimately the flame detection result obtained when the output layer is used for flame detection is more accurate.

[0091] In a possible implementation, a flame detection model training process is also involved. In the embodiment of the present application, the training process may include the following steps:

[0092] Obtain multiple original sample detection images corresponding to the target tunnel. It is understandable that the number of original sample detection images obtained by the server is limited. In order to improve the accuracy of training, the server can expand each original sample detection image to obtain more sample detection images. The expansion processing can be cropping, rotation, adding noise, etc.

[0093] After obtaining multiple sample detection images, the server can annotate each sample detection image so that different sample detection images correspond to different detection annotations. In an embodiment of the present application, the detection annotation may include at least one of the presence of flame, the presence of smoke, the presence of a mixture of flame and smoke, and the absence of both.

[0094] For these labeled sample detection images, the server can divide each sample detection image to obtain a training set, a test set, and a verification set including multiple sample detection images. The server can use the sample detection images in the training set to iteratively train the initial flame detection model, use the sample detection images in the test set to test the trained model, and use the sample detection images in the verification set to verify the trained model, and finally obtain a flame detection model that meets the requirements.

[0095] For each iterative training process, the server can input the sample detection image into the intermediate flame detection model to obtain the intermediate detection result corresponding to the current iterative training process. Then, the intermediate flame detection model is adjusted according to the intermediate detection result and the detection annotation corresponding to the sample detection image to obtain the adjusted intermediate flame detection model. If the adjusted intermediate flame detection model meets the preset convergence condition, the adjusted intermediate flame detection model is determined to be the target flame detection model; if the adjusted intermediate flame detection model does not meet the preset convergence condition, the next round of iterative training process is entered until the adjusted intermediate flame detection model meets the preset convergence condition.

[0096] In a possible implementation, the preset convergence condition may be that the number of iterations reaches a preset value, for example, the preset iterative training is 100 times. When the number of iterative training reaches 100 times, the server may determine that the adjusted intermediate flame detection model meets the preset convergence condition.

[0097] In another possible implementation, the preset convergence condition may be that the loss function value reaches a preset threshold. During each iterative training process, the server may calculate the loss function value based on the preset loss function. When the loss function value reaches the preset threshold, the server may determine that the adjusted intermediate flame detection model meets the preset convergence condition. In an embodiment of the present application, the preset convergence condition may be set by the parameter quantity, the number of floating-point operations, the precision rate, the recall rate, and the average precision mean, wherein the parameter quantity refers to the total number of parameters in the flame detection model; the number of floating-point operations is used to measure the algorithm complexity of the flame detection model, with the standard being 1e9 floating-point operations; the precision rate is used to measure the proportion of correct detections among all targets predicted by the flame detection model; the recall rate is used to measure the proportion of correctly detected targets among all real targets when the flame detection model performs flame detection; and the average precision mean is used to measure the detection accuracy of the flame detection model.

[0098] During the training process, the server can use sample detection images from the validation set and test set to verify and test the trained model.

[0099] For example, refer to Figure 10, are the loss values ​​corresponding to different loss functions, and the smoothed values ​​represent the values ​​after smoothing each loss value. The figure shows the changes in the bounding box loss (i.e., "train / box_loss") on the training set during training iterations, the changes in the classification loss (i.e., "train / cls_loss") on the training set during training iterations, and the changes in the distribution focus loss (i.e., "train / dfl_loss") on the training set during training iterations. It can be seen that during the training process, as the number of iterations increases, the smaller the loss value, the closer the model recognition result is to the true label, and the recognition ability of the model is improving; the precision index on the training set (i.e., "metrics / precision(B)") represents the change during the training iteration, the recall rate on the training set (i.e., "metrics / recall(B)") represents the change during the training iteration, the mean average precision with an IOU threshold of 50% on the test set (i.e., "metrics / mAP50(B)") represents the change during the test iteration, and on the test set, the mean average precision with an IOU threshold of 50%-95% (i.e., "metrics / mAP50-95(B)") represents the change during the test iteration.

[0100] In a possible implementation, the flame detection model before the model structure change is compared with the flame detection model proposed in this solution. The comparison results can be seen in Table 1:

[0101]

[0102] Table 1

[0103] In one embodiment, referring to Figure 11 , provides an exemplary flame detection method based on a flame detection model, wherein the flame detection model includes a feature extraction layer, a feature fusion layer and an output layer, and the feature extraction layer includes a first attention mechanism sublayer and an MCIR sublayer. This method can be applied to Figure 1 Servers in the depicted implementation.

[0104] Step 1101: Acquire a tunnel image corresponding to a target tunnel.

[0105] Step 1102: Perform spatial feature extraction on the input features through each first attention mechanism module to obtain the first spatial features corresponding to the first attention mechanism module.

[0106] The first attention mechanism sublayer includes multiple first attention mechanism modules, which are cascaded in sequence and output first spatial features based on the tunnel image through the first attention mechanism sublayer. The features input to the first attention mechanism module in each first attention mechanism module are obtained by extracting local features of the tunnel image. The first spatial features output by the intermediate attention mechanism modules in each first attention mechanism module are also input to the feature fusion layer. The first spatial features output by the last attention mechanism module in each first attention mechanism module are pooled and input to the MCIR sublayer.

[0107] Step 1103: Output a multi-level fusion feature based on the first spatial feature through the MCIR sublayer.

[0108] Step 1104 : Upsampling the multi-level fusion features through a first upsampling module to obtain first upsampling features.

[0109] Step 1105: The first up-sampled feature and the first spatial feature output by the first intermediate attention mechanism module are fused through the first fusion module to obtain a first fused feature.

[0110] Step 1106: Perform spatial feature extraction on the first fusion feature through the second attention mechanism module to obtain a fusion spatial feature.

[0111] Step 1107: upsample the fused spatial features through a second upsampling module to obtain second upsampled features.

[0112] Step 1108: The second up-sampled feature and the first spatial feature output by the second intermediate attention mechanism module are fused through the second fusion module to obtain a second fused feature.

[0113] Step 1109: Perform spatial feature extraction on the second fusion feature through the third attention mechanism module to obtain a second spatial feature.

[0114] The intermediate attention mechanism module includes a first intermediate attention mechanism module and a second intermediate attention mechanism module. The second attention mechanism sublayer includes a second attention mechanism module and a third attention mechanism module, and the feature fusion layer also includes a first upsampling module, a first fusion module, a second upsampling module, and a second fusion module. The second attention mechanism sublayer also includes a fourth attention mechanism module, and the feature fusion layer also includes a first convolution module and a third fusion module. The second attention mechanism sublayer also includes a fifth attention mechanism module, and the feature fusion layer also includes a second convolution module and a fourth fusion module.

[0115] Step 1110: extract local features from the tunnel image using a first convolution module to obtain first local features.

[0116] Step 1111: The first local feature and the fused spatial feature are fused by a third fusion module to obtain a third fused feature.

[0117] In step 1112, spatial features are extracted from the third fusion features through the fourth attention mechanism module, and the extracted spatial features are input into the output layer as the second spatial features.

[0118] In step 1113, local features are extracted from the spatial features extracted by the fourth attention mechanism module through the second convolution module to obtain second local features.

[0119] Step 1114: The second local feature and the multi-level fusion feature are fused by a fourth fusion module to obtain a fourth fusion feature.

[0120] In step 1115, spatial features are extracted from the fourth fusion features through the fifth attention mechanism module, and the extracted spatial features are input into the output layer as the second spatial features.

[0121] Step 1116: Output the flame detection result based on the second spatial feature through the output layer.

[0122] The flame detection result is used to indicate whether there is one or more of flame, smoke, and a mixture of flame and smoke in the target tunnel.

[0123] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the instructions of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above can include multiple steps or multiple stages, and these steps or stages are not necessarily executed and completed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of steps or stages in other steps.

[0124] Based on the same inventive concept, embodiments of the present application further provide a flame detection device for implementing the flame detection method based on the flame detection model described above. The implementation solution provided by this device is similar to the implementation solution described in the above method. Therefore, the specific limitations of one or more flame detection device embodiments provided below can be referred to the limitations of the flame detection method above and will not be repeated here.

[0125] In an exemplary embodiment, Figure 12 As shown, a flame detection device based on a flame detection model is provided, comprising: an acquisition module 1201, a first spatial feature output module 1202, a second spatial feature output module 1203, and a detection result output module 1204, wherein:

[0126] An acquisition module 1201 is configured to acquire a tunnel image corresponding to a target tunnel;

[0127] A first spatial feature output module 1202 is configured to output a first spatial feature based on the tunnel image through the first attention mechanism sub-layer, and output a multi-level fusion feature based on the first spatial feature through the MCIR sub-layer;

[0128] A second spatial feature output module 1203 is configured to output a second spatial feature based on the first spatial feature and the multi-level fusion feature through the second attention mechanism sub-layer;

[0129] The detection result output module 1204 is configured to output a flame detection result based on the second spatial feature through the output layer, wherein the flame detection result is used to characterize whether one or more of flame, smoke, and a flame-smoke mixture exists in the target tunnel.

[0130] In one embodiment, the first attention mechanism sublayer includes multiple first attention mechanism modules, each of which is cascaded in sequence, and the first spatial feature output module 1202 includes:

[0131] a first extraction unit, configured to perform spatial feature extraction on the input features through each of the first attention mechanism modules to obtain a first spatial feature corresponding to the first attention mechanism module;

[0132] Among them, the features input by the first attention mechanism module in each of the first attention mechanism modules are obtained by extracting local features of the tunnel image, the first spatial features output by the intermediate attention mechanism modules in each of the first attention mechanism modules are also input into the feature fusion layer, and the first spatial features output by the last attention mechanism module in each of the first attention mechanism modules are input into the MCIR sublayer after pooling.

[0133] In one embodiment, the intermediate attention mechanism module includes a first intermediate attention mechanism module and a second intermediate attention mechanism module; the second attention mechanism sublayer includes a second attention mechanism module and a third attention mechanism module; the feature fusion layer further includes a first upsampling module, a first fusion module, a second upsampling module and a second fusion module; the second spatial feature output module 1203 includes:

[0134] A first upsampling unit is configured to perform upsampling processing on the multi-level fusion feature through the first upsampling module to obtain a first upsampling feature;

[0135] a first fusion unit, configured to fuse the first up-sampled feature and the first spatial feature output by the first intermediate attention mechanism module through the first fusion module to obtain a first fused feature;

[0136] A second extraction unit is configured to perform spatial feature extraction on the first fused feature through the second attention mechanism module to obtain a fused spatial feature;

[0137] A second upsampling unit is configured to perform upsampling processing on the fused spatial features through the second upsampling module to obtain second upsampling features;

[0138] A second fusion unit is configured to fuse the second up-sampled features and the first spatial features output by the second intermediate attention mechanism module through the second fusion module to obtain a second fused feature;

[0139] The third extraction unit is used to perform spatial feature extraction on the second fusion feature through the third attention mechanism module to obtain the second spatial feature.

[0140] In one embodiment, the second attention mechanism sublayer further includes a fourth attention mechanism module, the feature fusion layer further includes a first convolution module and a third fusion module, and the second spatial feature output module 1203 further includes:

[0141] a first local extraction unit, configured to extract local features from the tunnel image using the first convolution module to obtain first local features;

[0142] a third fusion unit, configured to fuse the first local feature and the fused spatial feature through the third fusion module to obtain a third fused feature;

[0143] A fourth extraction unit is used to extract spatial features from the third fusion features through the fourth attention mechanism module, and input the extracted spatial features as the second spatial features into the output layer.

[0144] In one embodiment, the second attention mechanism sublayer further includes a fifth attention mechanism module, the feature fusion layer further includes a second convolution module and a fourth fusion module, and the second spatial feature output module 1203 further includes:

[0145] A second local extraction unit is configured to perform local feature extraction on the spatial features extracted by the fourth attention mechanism module through the second convolution module to obtain a second local feature;

[0146] a fourth fusion unit, configured to fuse the second local feature and the multi-level fusion feature through the fourth fusion module to obtain a fourth fusion feature;

[0147] A fifth extraction unit is used to extract spatial features from the fourth fusion features through the fifth attention mechanism module, and input the extracted spatial features as the second spatial features into the output layer.

[0148] Each module in the flame detection device based on the flame detection model can be implemented in whole or in part through software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of each module.

[0149] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 13 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O) and a communication interface. The processor, memory and input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is used to store flame detection data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a flame detection method is implemented.

[0150] Those skilled in the art will understand that Figure 13 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0151] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the following steps when executing the computer program. These steps are implemented based on a flame detection model, wherein the flame detection model includes a feature extraction layer, a feature fusion layer, and an output layer, wherein the feature extraction layer includes a first attention mechanism sublayer and an MCIR sublayer, and the feature fusion layer includes a second attention mechanism sublayer.

[0152] Obtaining a tunnel image corresponding to the target tunnel;

[0153] Outputting a first spatial feature based on the tunnel image through the first attention mechanism sublayer, and outputting a multi-level fusion feature based on the first spatial feature through the MCIR sublayer;

[0154] Outputting a second spatial feature based on the first spatial feature and the multi-level fusion feature through the second attention mechanism sub-layer;

[0155] A flame detection result is outputted based on the second spatial feature through the output layer, where the flame detection result is used to characterize whether one or more of flame, smoke, and a flame-smoke mixture exists in the target tunnel.

[0156] In one embodiment, the first attention mechanism sublayer includes multiple first attention mechanism modules, each of which is cascaded in sequence, and the processor further implements the following steps when executing the computer program:

[0157] Performing spatial feature extraction on the input features through each of the first attention mechanism modules to obtain a first spatial feature corresponding to the first attention mechanism module;

[0158] Among them, the features input by the first attention mechanism module in each of the first attention mechanism modules are obtained by extracting local features of the tunnel image, the first spatial features output by the intermediate attention mechanism modules in each of the first attention mechanism modules are also input into the feature fusion layer, and the first spatial features output by the last attention mechanism module in each of the first attention mechanism modules are input into the MCIR sublayer after pooling.

[0159] In one embodiment, the intermediate attention mechanism module includes a first intermediate attention mechanism module and a second intermediate attention mechanism module; the second attention mechanism sublayer includes a second attention mechanism module and a third attention mechanism module; the feature fusion layer further includes a first upsampling module, a first fusion module, a second upsampling module, and a second fusion module; when the processor executes the computer program, it further implements the following steps:

[0160] Performing upsampling processing on the multi-level fusion features through the first upsampling module to obtain first upsampling features;

[0161] fusing the first up-sampled feature and the first spatial feature output by the first intermediate attention mechanism module through the first fusion module to obtain a first fused feature;

[0162] Performing spatial feature extraction on the first fusion feature through the second attention mechanism module to obtain a fusion spatial feature;

[0163] Performing upsampling processing on the fused spatial features by the second upsampling module to obtain second upsampling features;

[0164] fusing the second up-sampled features and the first spatial features output by the second intermediate attention mechanism module through the second fusion module to obtain a second fused feature;

[0165] The second spatial feature is obtained by performing spatial feature extraction on the second fusion feature through the third attention mechanism module.

[0166] In one embodiment, the second attention mechanism sublayer further includes a fourth attention mechanism module, the feature fusion layer further includes a first convolution module and a third fusion module, and the processor further implements the following steps when executing the computer program:

[0167] Performing local feature extraction on the tunnel image using the first convolution module to obtain a first local feature;

[0168] fusing the first local feature and the fused spatial feature through the third fusion module to obtain a third fused feature;

[0169] The third fusion feature is extracted using the fourth attention mechanism module, and the extracted spatial feature is input into the output layer as the second spatial feature.

[0170] In one embodiment, the second attention mechanism sublayer further includes a fifth attention mechanism module, the feature fusion layer further includes a second convolution module and a fourth fusion module, and the processor further implements the following steps when executing the computer program:

[0171] Performing local feature extraction on the spatial features extracted by the fourth attention mechanism module through the second convolution module to obtain a second local feature;

[0172] fusing the second local feature and the multi-level fusion feature through the fourth fusion module to obtain a fourth fusion feature;

[0173] The fourth fusion feature is extracted using the fifth attention mechanism module, and the extracted spatial feature is input into the output layer as the second spatial feature.

[0174] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented. These steps are implemented based on a flame detection model. The flame detection model includes a feature extraction layer, a feature fusion layer, and an output layer. The feature extraction layer includes a first attention mechanism sublayer and an MCIR sublayer. The feature fusion layer includes a second attention mechanism sublayer.

[0175] Obtaining a tunnel image corresponding to the target tunnel;

[0176] Outputting a first spatial feature based on the tunnel image through the first attention mechanism sublayer, and outputting a multi-level fusion feature based on the first spatial feature through the MCIR sublayer;

[0177] Outputting a second spatial feature based on the first spatial feature and the multi-level fusion feature through the second attention mechanism sub-layer;

[0178] A flame detection result is outputted based on the second spatial feature through the output layer, where the flame detection result is used to characterize whether one or more of flame, smoke, and a flame-smoke mixture exists in the target tunnel.

[0179] In one embodiment, the first attention mechanism sublayer includes multiple first attention mechanism modules, each of which is cascaded in sequence, and the computer program further implements the following steps when executed by the processor:

[0180] Performing spatial feature extraction on the input features through each of the first attention mechanism modules to obtain a first spatial feature corresponding to the first attention mechanism module;

[0181] Among them, the features input by the first attention mechanism module in each of the first attention mechanism modules are obtained by extracting local features of the tunnel image, the first spatial features output by the intermediate attention mechanism modules in each of the first attention mechanism modules are also input into the feature fusion layer, and the first spatial features output by the last attention mechanism module in each of the first attention mechanism modules are input into the MCIR sublayer after pooling.

[0182] In one embodiment, the intermediate attention mechanism module includes a first intermediate attention mechanism module and a second intermediate attention mechanism module; the second attention mechanism sub-layer includes a second attention mechanism module and a third attention mechanism module; the feature fusion layer further includes a first upsampling module, a first fusion module, a second upsampling module, and a second fusion module. When the computer program is executed by the processor, the following steps are further implemented:

[0183] Performing upsampling processing on the multi-level fusion features through the first upsampling module to obtain first upsampling features;

[0184] fusing the first up-sampled feature and the first spatial feature output by the first intermediate attention mechanism module through the first fusion module to obtain a first fused feature;

[0185] Performing spatial feature extraction on the first fusion feature through the second attention mechanism module to obtain a fusion spatial feature;

[0186] Performing upsampling processing on the fused spatial features by the second upsampling module to obtain second upsampling features;

[0187] fusing the second up-sampled features and the first spatial features output by the second intermediate attention mechanism module through the second fusion module to obtain a second fused feature;

[0188] The second spatial feature is obtained by performing spatial feature extraction on the second fusion feature through the third attention mechanism module.

[0189] In one embodiment, the second attention mechanism sub-layer further includes a fourth attention mechanism module, and when the computer program is executed by a processor, the computer program further implements the following steps:

[0190] Performing local feature extraction on the tunnel image using the first convolution module to obtain a first local feature;

[0191] fusing the first local feature and the fused spatial feature through the third fusion module to obtain a third fused feature;

[0192] The third fusion feature is extracted using the fourth attention mechanism module, and the extracted spatial feature is input into the output layer as the second spatial feature.

[0193] In one embodiment, the second attention mechanism sub-layer further includes a fifth attention mechanism module, and when the computer program is executed by a processor, the computer program further implements the following steps:

[0194] Performing local feature extraction on the spatial features extracted by the fourth attention mechanism module through the second convolution module to obtain a second local feature;

[0195] fusing the second local feature and the multi-level fusion feature through the fourth fusion module to obtain a fourth fusion feature;

[0196] The fourth fusion feature is extracted using the fifth attention mechanism module, and the extracted spatial feature is input into the output layer as the second spatial feature.

[0197] In one embodiment, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the following steps, which are implemented based on a flame detection model, wherein the flame detection model comprises a feature extraction layer, a feature fusion layer, and an output layer, wherein the feature extraction layer comprises a first attention mechanism sublayer and an MCIR sublayer, and the feature fusion layer comprises a second attention mechanism sublayer.

[0198] Obtaining a tunnel image corresponding to the target tunnel;

[0199] Outputting a first spatial feature based on the tunnel image through the first attention mechanism sublayer, and outputting a multi-level fusion feature based on the first spatial feature through the MCIR sublayer;

[0200] Outputting a second spatial feature based on the first spatial feature and the multi-level fusion feature through the second attention mechanism sub-layer;

[0201] A flame detection result is outputted based on the second spatial feature through the output layer, where the flame detection result is used to characterize whether one or more of flame, smoke, and a flame-smoke mixture exists in the target tunnel.

[0202] In one embodiment, the first attention mechanism sublayer includes multiple first attention mechanism modules, each of which is cascaded in sequence, and the computer program further implements the following steps when executed by the processor:

[0203] Performing spatial feature extraction on the input features through each of the first attention mechanism modules to obtain a first spatial feature corresponding to the first attention mechanism module;

[0204] Among them, the features input by the first attention mechanism module in each of the first attention mechanism modules are obtained by extracting local features of the tunnel image, the first spatial features output by the intermediate attention mechanism modules in each of the first attention mechanism modules are also input into the feature fusion layer, and the first spatial features output by the last attention mechanism module in each of the first attention mechanism modules are input into the MCIR sublayer after pooling.

[0205] In one embodiment, the intermediate attention mechanism module includes a first intermediate attention mechanism module and a second intermediate attention mechanism module; the second attention mechanism sub-layer includes a second attention mechanism module and a third attention mechanism module; the feature fusion layer further includes a first upsampling module, a first fusion module, a second upsampling module, and a second fusion module. When the computer program is executed by the processor, the following steps are further implemented:

[0206] Performing upsampling processing on the multi-level fusion features through the first upsampling module to obtain first upsampling features;

[0207] fusing the first up-sampled feature and the first spatial feature output by the first intermediate attention mechanism module through the first fusion module to obtain a first fused feature;

[0208] Performing spatial feature extraction on the first fusion feature through the second attention mechanism module to obtain a fusion spatial feature;

[0209] Performing upsampling processing on the fused spatial features by the second upsampling module to obtain second upsampling features;

[0210] fusing the second up-sampled features and the first spatial features output by the second intermediate attention mechanism module through the second fusion module to obtain a second fused feature;

[0211] The second spatial feature is obtained by performing spatial feature extraction on the second fusion feature through the third attention mechanism module.

[0212] In one embodiment, the second attention mechanism sub-layer further includes a fourth attention mechanism module, and when the computer program is executed by a processor, the computer program further implements the following steps:

[0213] Performing local feature extraction on the tunnel image using the first convolution module to obtain a first local feature;

[0214] fusing the first local feature and the fused spatial feature through the third fusion module to obtain a third fused feature;

[0215] The third fusion feature is extracted using the fourth attention mechanism module, and the extracted spatial feature is input into the output layer as the second spatial feature.

[0216] In one embodiment, the second attention mechanism sub-layer further includes a fifth attention mechanism module, and when the computer program is executed by a processor, the computer program further implements the following steps:

[0217] Performing local feature extraction on the spatial features extracted by the fourth attention mechanism module through the second convolution module to obtain a second local feature;

[0218] fusing the second local feature and the multi-level fusion feature through the fourth fusion module to obtain a fourth fusion feature;

[0219] The fourth fusion feature is extracted using the fifth attention mechanism module, and the extracted spatial feature is input into the output layer as the second spatial feature.

[0220] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0221] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile memory and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processor involved in the various embodiments provided herein may be, but are not limited to, a general-purpose processor, a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processor (DSP), a programmable logic unit (PLC), a data processing logic unit based on quantum computing, an artificial intelligence (AI) processor, and the like.

[0222] The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0223] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.

Claims

1. A flame detection method based on a flame detection model, characterized in that: The flame detection model includes a feature extraction layer, a feature fusion layer, and an output layer. The feature extraction layer includes a first attention mechanism sublayer and an MCIR sublayer. The feature fusion layer includes a second attention mechanism sublayer. The method includes: Obtaining a tunnel image corresponding to the target tunnel; Outputting a first spatial feature based on the tunnel image through the first attention mechanism sublayer, and outputting a multi-level fusion feature based on the first spatial feature through the MCIR sublayer; Outputting a second spatial feature based on the first spatial feature and the multi-level fusion feature through the second attention mechanism sub-layer; A flame detection result is outputted based on the second spatial feature through the output layer, where the flame detection result is used to characterize whether one or more of flame, smoke, and a flame-smoke mixture exists in the target tunnel.

2. The method according to claim 1, characterized in that The first attention mechanism sublayer includes a plurality of first attention mechanism modules, each of which is cascaded in sequence. Outputting a first spatial feature based on the tunnel image through the first attention mechanism sublayer includes: Performing spatial feature extraction on the input features through each of the first attention mechanism modules to obtain a first spatial feature corresponding to the first attention mechanism module; Among them, the features input by the first attention mechanism module in each of the first attention mechanism modules are obtained by extracting local features of the tunnel image, the first spatial features output by the intermediate attention mechanism modules in each of the first attention mechanism modules are also input into the feature fusion layer, and the first spatial features output by the last attention mechanism module in each of the first attention mechanism modules are input into the MCIR sublayer after pooling.

3. The method according to claim 2, characterized in that The intermediate attention mechanism module includes a first intermediate attention mechanism module and a second intermediate attention mechanism module; the second attention mechanism sublayer includes a second attention mechanism module and a third attention mechanism module, the feature fusion layer also includes a first upsampling module, a first fusion module, a second upsampling module and a second fusion module, and the second attention mechanism sublayer outputs a second spatial feature based on the first spatial feature and the multi-level fusion feature, including: Performing upsampling processing on the multi-level fusion features through the first upsampling module to obtain first upsampling features; fusing the first up-sampled feature and the first spatial feature output by the first intermediate attention mechanism module through the first fusion module to obtain a first fused feature; Performing spatial feature extraction on the first fusion feature through the second attention mechanism module to obtain a fusion spatial feature; Performing upsampling processing on the fused spatial features by the second upsampling module to obtain second upsampling features; fusing the second up-sampled features and the first spatial features output by the second intermediate attention mechanism module through the second fusion module to obtain a second fused feature; The second spatial feature is obtained by performing spatial feature extraction on the second fusion feature through the third attention mechanism module.

4. The method according to claim 3, characterized in that The second attention mechanism sub-layer further includes a fourth attention mechanism module, the feature fusion layer further includes a first convolution module and a third fusion module, and the method further includes: Performing local feature extraction on the tunnel image using the first convolution module to obtain a first local feature; fusing the first local feature and the fused spatial feature through the third fusion module to obtain a third fused feature; The third fusion feature is extracted using the fourth attention mechanism module, and the extracted spatial feature is input into the output layer as the second spatial feature.

5. The method according to claim 4, characterized in that The second attention mechanism sub-layer further includes a fifth attention mechanism module, the feature fusion layer further includes a second convolution module and a fourth fusion module, and the method further includes: Performing local feature extraction on the spatial features extracted by the fourth attention mechanism module through the second convolution module to obtain a second local feature; fusing the second local feature and the multi-level fusion feature through the fourth fusion module to obtain a fourth fusion feature; The fourth fusion feature is extracted using the fifth attention mechanism module, and the extracted spatial feature is input into the output layer as the second spatial feature.

6. A flame detection model, characterized in that: include: A feature extraction layer, the feature extraction layer including a first attention mechanism sublayer and an MCIR sublayer, wherein the first attention mechanism sublayer is used to output a first spatial feature based on the tunnel image, and the MCIR sublayer is used to output a multi-level fusion feature based on the first spatial feature; a feature fusion layer, the feature fusion layer including a second attention mechanism sublayer, the second attention mechanism sublayer being configured to output a second spatial feature based on the first spatial feature and the multi-level fusion feature; An output layer is used to output a flame detection result based on the second spatial feature, where the flame detection result is used to characterize whether one or more of flame, smoke, and a flame-smoke mixture exists in the target tunnel.

7. A flame detection device based on a flame detection model, characterized in that: The flame detection model includes a feature extraction layer, a feature fusion layer, and an output layer. The feature extraction layer includes a first attention mechanism sublayer and an MCIR sublayer. The feature fusion layer includes a second attention mechanism sublayer. The device includes: An acquisition module, used for acquiring a tunnel image corresponding to a target tunnel; A first spatial feature output module is configured to output a first spatial feature based on the tunnel image through the first attention mechanism sublayer, and output a multi-level fusion feature based on the first spatial feature through the MCIR sublayer; A second spatial feature output module is configured to output a second spatial feature based on the first spatial feature and the multi-level fusion feature through the second attention mechanism sublayer; The detection result output module is used to output the flame detection result based on the second spatial feature through the output layer, and the flame detection result is used to characterize whether there is one or more of flame, smoke and flame-smoke mixture in the target tunnel.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.

10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.