A forest fire identification method, system, device, and medium based on edge computing

By constructing and training a forest fire identification neural network, the problem that the YOLO network cannot be deployed on the STM32F407 microcontroller was solved, achieving efficient forest fire identification and improving identification speed and accuracy.

CN121305379BActive Publication Date: 2026-04-03XICHANG COLLEGE
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-12
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

The existing YOLO network cannot be deployed on the STM32F407 microcontroller, making it impossible to achieve efficient forest fire identification on low-cost, low-power devices.

Method used

By removing the C2PSA module from the YOLOv11 model, a forest fire identification neural network was constructed. The weights of the basic structure and performance/speed enhancement structure were trained on a server and then deployed to a microcontroller for identification.

Benefits of technology

The deployment of the YOLO neural network on the STM32F407 microcontroller was realized, which improved the speed and accuracy of forest fire identification, and the inference speed reached high-precision detection within 1 second.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121305379B_ABST
    Figure CN121305379B_ABST
Patent Text Reader

Abstract

This invention relates to the field of fire identification technology, specifically to a forest fire identification method, system, device, and medium based on edge computing. The method first removes the C2PSA module from the YOLOv11 model to construct a forest fire identification neural network. Then, based on acquired forest and forest fire images, a basic structure for forest fire identification is trained on a server to obtain the weights of this basic structure. Finally, the trained basic structure and its weights are deployed to a microcontroller, and the identification results are used to determine whether a forest fire has occurred. This achieves the deployment of the YOLO neural network on a microcontroller and improves the speed of forest fire identification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of fire identification technology, and more specifically, to a forest fire identification method, system, device, and medium based on edge computing. Background Technology

[0002] Forest fires are a serious global natural disaster that threatens the ecological environment and human lives and property. Vision-based detection systems deploy dedicated cameras, drones, or satellites in protected areas to monitor forest regions, using image processing techniques to analyze real-time images or video streams to detect forest fires. In recent years, deep learning has shown superior performance compared to traditional machine learning, leading to extensive and rapid research and development. YOLO (You Only Look Once), a typical deep learning method, excels in both real-time performance and accuracy. Since its inception in 2015, YOLO has undergone rapid iteration and development. Following the release of YOLOv8 in 2023, versions YOLOv9, YOLOv10, and YOLOv11 were released in 2024, and YOLOv12 was released in 2025. Many researchers have also focused their attention on YOLO in forest fire identification research.

[0003] Regardless of the version of YOLO, it cannot be deployed on the STM32F407 microcontroller. However, the STM32F407 microcontroller is low in cost and power consumption and has a wide range of applications. Therefore, it is of great significance to deploy a neural network similar to YOLO on the STM32F407 microcontroller. Summary of the Invention

[0004] This invention addresses the problem that existing YOLO networks cannot be deployed on microcontrollers by proposing a forest fire identification method, system, device, and medium based on edge computing. First, the C2PSA module of the YOLOv11 model is removed to construct a forest fire identification neural network. Then, based on acquired forest and forest fire images, a basic structure for forest fire identification is trained on a server, yielding the weights of this basic structure. Finally, the trained basic structure and its weights are deployed on a microcontroller, and the identification results are used to determine whether a forest fire has occurred. This achieves the deployment of the YOLO neural network on a microcontroller and improves the speed of forest fire identification.

[0005] The specific implementation details of this invention are as follows:

[0006] A forest fire identification method based on edge computing specifically includes the following steps:

[0007] Step S1: Remove the C2PSA module from the YOLOv11 model to construct the forest fire identification neural network;

[0008] Step S2: Based on the acquired forest images and forest fire images, train the forest fire recognition infrastructure on the server to obtain the weights of the forest fire recognition infrastructure.

[0009] Step S3: Deploy the trained forest fire identification infrastructure and its weights to the microcontroller, and determine whether a forest fire has occurred based on the identification results of the forest fire identification infrastructure.

[0010] To better realize the present invention, the forest fire identification neural network further includes a forest fire identification basic structure; the forest fire identification basic structure includes an S1 forest fire identification basic structure, an S2 forest fire identification basic structure, an S3 forest fire identification basic structure, and an S4 forest fire identification basic structure.

[0011] The S1 forest fire identification infrastructure includes a first Conv layer, a second Conv layer, a C3k2 module, a third Conv layer, a global average pooling layer, and a softmax layer connected in sequence.

[0012] The S2 forest fire identification infrastructure includes a first Conv layer, a second Conv layer, a first C3k2 module, a third Conv layer, a second C3k2 module, a fourth Conv layer, a global average pooling layer, and a softmax layer connected in sequence.

[0013] The S3 forest fire identification infrastructure includes a first Conv layer, a second Conv layer, a first C3k2 module, a third Conv layer, a second C3k2 module, a fourth Conv layer, a third C3k2 module, a fifth Conv layer, a global average pooling layer, and a softmax layer, connected in sequence.

[0014] The S4 forest fire identification infrastructure includes a first Conv layer, a second Conv layer, a first C3k2 module, a third Conv layer, a second C3k2 module, a fourth Conv layer, a third C3k2 module, a fifth Conv layer, a fourth C3k2 module, a sixth Conv layer, a global average pooling layer, and a softmax layer, all connected in sequence.

[0015] To better realize the present invention, the forest fire identification neural network further includes a forest fire identification enhancement structure; the forest fire identification enhancement structure includes a forest fire identification performance improvement structure and a forest fire identification speed improvement structure;

[0016] The forest fire identification performance enhancement structure is obtained by replacing the C3k2 module of the basic forest fire identification structure with the C3Dense module, resulting in the S1D forest fire identification performance enhancement structure, S2D forest fire identification performance enhancement structure, S3D forest fire identification performance enhancement structure, and S4D forest fire identification performance enhancement structure.

[0017] The forest fire identification speed enhancement structure is obtained by replacing the C3k2 module of the basic forest fire identification structure with the C3Light module and replacing the Conv layer with the LightConv layer, resulting in the S1L forest fire identification performance enhancement structure, S2L forest fire identification performance enhancement structure, S3L forest fire identification performance enhancement structure, and S4L forest fire identification performance enhancement structure.

[0018] To better implement the present invention, the C3Dense module further includes a first Conv layer, a Split function, a DenseBottleneck module, a Concat function, a second Conv layer, and an Attention module connected in sequence.

[0019] The DenseBottleneck module includes a first Conv layer, a Concat function, and a second Conv layer connected in sequence.

[0020] To better implement the present invention, the C3Light module further includes a first LightConv layer, a Split function, a LightBottleneck module, a Concat function, and a second LightConv layer connected in sequence.

[0021] To better realize the present invention, step S2 further includes the following steps:

[0022] Step S21: Construct a training dataset based on the acquired forest images and forest fire images;

[0023] Step S22: Obtain the weight file of the forest fire identification infrastructure based on the set number of channels;

[0024] Step S23: Based on the set number of channels and the set number of network layers for inference deployment, obtain the trained forest fire identification infrastructure weight file;

[0025] Step S24: Based on the relationship between the basic structure for forest fire identification and the performance enhancement structure for forest fire identification, copy the weight file of the trained basic structure for forest fire identification to the performance enhancement structure for forest fire identification to obtain the weight file of the performance enhancement structure for forest fire identification.

[0026] Step S25: According to the relationship between the forest fire recognition basic structure and the forest fire recognition speed improvement structure, copy the weight file of the trained forest fire recognition basic structure to the forest fire recognition speed improvement structure to obtain the forest fire recognition speed improvement weight file.

[0027] To better implement the present invention, further, step S3 specifically includes the following steps:

[0028] Step S31: Convert the obtained forest fire recognition basic structure weight file, forest fire recognition performance improvement structure weight file, and forest fire recognition speed improvement weight file into the onnx format;

[0029] Step S32: Import the onnx format file into the X-CUBE-AI tool and generate C code according to the X-CUBE-AI tool;

[0030] Step S33: Download the C code to the microcontroller development board and send the captured images obtained from the microcontroller camera to the microcontroller development board;

[0031] Step S34: Normalize the captured images and convert them into floating-point numbers, and input the floating-point numbers into the forest fire recognition neural network;

[0032] Step S35: Judge whether there is a fire according to the recognition result of the forest fire recognition neural network. If the floating-point number aiout0 output by the neural network is ≥ aiout1, it means that there is a forest fire. If aiout0 < aiout1, it means that there is no forest fire.

[0033] Based on the above-mentioned forest fire recognition method based on edge computing, to better implement the present invention, further, a forest fire recognition system based on edge computing is proposed for executing the above-mentioned forest fire recognition method based on edge computing; it includes a neural network construction unit, a weight calculation unit, and an identification unit;

[0034] The neural network construction unit is used to remove the C2PSA module of the YOLOv11 model and construct a forest fire recognition neural network;

[0035] The weight calculation unit is used to train the forest fire recognition basic structure on the server according to the obtained forest pictures and forest fire pictures to obtain the forest fire recognition basic structure weights;

[0036] The identification unit is used to deploy the trained forest fire recognition basic structure and the forest fire recognition basic structure weights to the microcontroller and judge whether there is a forest fire according to the recognition result of the forest fire recognition basic structure.

[0037] Based on the aforementioned edge computing-based forest fire identification method, to better realize the present invention, an electronic device is further proposed, including a memory and a processor; the memory stores a computer program; when the computer program is executed on the processor, the aforementioned edge computing-based forest fire identification method is implemented.

[0038] Based on the aforementioned edge computing-based forest fire identification method, and to better realize this invention, a computer-readable storage medium is further proposed, wherein computer instructions are stored on the computer-readable storage medium; when the computer instructions are executed on the aforementioned electronic device, the aforementioned edge computing-based forest fire identification method is realized.

[0039] The present invention has the following beneficial effects:

[0040] (1) This invention realizes the deployment of YOLO's neural network on a microcontroller and improves the speed of forest fire identification.

[0041] (2) The basic structure of this invention uses an OV2640 camera for input on an STM32F407 development board. The top-1 accuracy is equivalent to an inference speed of 1.00 seconds when the detection accuracy reaches 93.2%; the top-1 accuracy is equivalent to an inference speed of 1.19 seconds when the detection accuracy reaches 96.8%; and the top-1 accuracy is equivalent to an inference speed of 6.00 seconds when the detection accuracy reaches 97.2%.

[0042] (3) The performance enhancement structure of the present invention uses an OV2640 camera input on an STM32F407 development board. When the inference speed is 1.30 seconds, the top-1 accuracy is equivalent to the detection accuracy reaching 97.0%; when the inference speed is 6.26 seconds, the top-1 accuracy is equivalent to the detection accuracy reaching 98.4%.

[0043] (4) The speed enhancement structure of the present invention uses an OV2640 camera input on an STM32F407 development board. The top-1 accuracy is equivalent to an inference speed of 0.77 seconds when the detection accuracy reaches 92.1%. Attached Figure Description

[0044] Figure 1 This is a schematic diagram of the existing YOLOv11 network structure.

[0045] Figure 2 A schematic diagram of the basic structure for forest fire identification provided by this invention.

[0046] Figure 3 This is a schematic diagram of the structure for improving forest fire identification performance provided by the present invention.

[0047] Figure 4 This is a schematic diagram of the C3Dense module structure provided by the present invention.

[0048] Figure 5 A schematic diagram of the structure for improving the speed of forest fire identification provided by the present invention.

[0049] Figure 6 This is a schematic diagram of the C3Light module structure provided by the present invention.

[0050] Figure 7 This is a schematic diagram illustrating the performance of YOLOv11n after training on a server, as provided in an embodiment of the present invention.

[0051] Figure 8 This is a schematic diagram of the inference performance curves of an RGB888 image provided in an embodiment of the present invention on the basic and enhanced structures.

[0052] Figure 9 A schematic diagram of the inference performance curves of the RGB565 image provided in the embodiments of the present invention on the basic structure and the enhanced structure. Detailed Implementation

[0053] To more clearly illustrate the technical solutions of the embodiments of the present invention, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments, and therefore should not be regarded as a limitation on the scope of protection. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0054] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "set up," "connected," and "linked" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.

[0055] Example 1:

[0056] This embodiment proposes a forest fire identification method based on edge computing, which specifically includes the following steps:

[0057] Step S1: Remove the C2PSA module from the YOLOv11 model to construct the forest fire identification neural network;

[0058] The forest fire identification neural network includes a basic structure for forest fire identification; the basic structure for forest fire identification includes S1 forest fire identification basic structure, S2 forest fire identification basic structure, S3 forest fire identification basic structure, and S4 forest fire identification basic structure.

[0059] The S1 forest fire identification infrastructure includes a first Conv layer, a second Conv layer, a C3k2 module, a third Conv layer, a global average pooling layer, and a softmax layer connected in sequence.

[0060] The S2 forest fire identification infrastructure includes a first Conv layer, a second Conv layer, a first C3k2 module, a third Conv layer, a second C3k2 module, a fourth Conv layer, a global average pooling layer, and a softmax layer connected in sequence.

[0061] The S3 forest fire identification infrastructure includes a first Conv layer, a second Conv layer, a first C3k2 module, a third Conv layer, a second C3k2 module, a fourth Conv layer, a third C3k2 module, a fifth Conv layer, a global average pooling layer, and a softmax layer, connected in sequence.

[0062] The S4 forest fire identification infrastructure includes a first Conv layer, a second Conv layer, a first C3k2 module, a third Conv layer, a second C3k2 module, a fourth Conv layer, a third C3k2 module, a fifth Conv layer, a fourth C3k2 module, a sixth Conv layer, a global average pooling layer, and a softmax layer, all connected in sequence.

[0063] The forest fire identification neural network also includes a forest fire identification enhancement structure; the forest fire identification enhancement structure includes a forest fire identification performance improvement structure and a forest fire identification speed improvement structure.

[0064] The forest fire identification performance enhancement structure is obtained by replacing the C3k2 module of the basic forest fire identification structure with the C3Dense module, resulting in the S1D forest fire identification performance enhancement structure, S2D forest fire identification performance enhancement structure, S3D forest fire identification performance enhancement structure, and S4D forest fire identification performance enhancement structure.

[0065] The C3Dense module includes a first Conv layer, a Split function, a DenseBottleneck module, a Concat function, a second Conv layer, and an Attention module connected in sequence.

[0066] The DenseBottleneck module includes a first Conv layer, a Concat function, and a second Conv layer connected in sequence.

[0067] The forest fire identification speed enhancement structure is obtained by replacing the C3k2 module of the basic forest fire identification structure with the C3Light module and replacing the Conv layer with the LightConv layer, resulting in the S1L forest fire identification performance enhancement structure, S2L forest fire identification performance enhancement structure, S3L forest fire identification performance enhancement structure, and S4L forest fire identification performance enhancement structure.

[0068] The C3Light module includes a first LightConv layer, a Split function, a LightBottleneck module, a Concat function, and a second LightConv layer connected in sequence.

[0069] Step S2: Based on the acquired forest images and forest fire images, train the forest fire recognition infrastructure on the server to obtain the weights of the forest fire recognition infrastructure.

[0070] Step S2 specifically includes the following steps:

[0071] Step S21: Construct a training dataset based on the acquired forest images and forest fire images;

[0072] Step S22: Obtain the weight file of the forest fire identification infrastructure based on the set number of channels;

[0073] Step S23: Based on the set number of channels and the set number of network layers for inference deployment, obtain the trained forest fire identification infrastructure weight file;

[0074] Step S24: Based on the relationship between the basic structure for forest fire identification and the performance enhancement structure for forest fire identification, copy the weight file of the trained basic structure for forest fire identification to the performance enhancement structure for forest fire identification to obtain the weight file of the performance enhancement structure for forest fire identification.

[0075] Step S25: Based on the relationship between the basic structure for forest fire identification and the structure for improving the speed of forest fire identification, copy the weight file of the trained basic structure for forest fire identification to the structure for improving the speed of forest fire identification to obtain the weight file for improving the speed of forest fire identification.

[0076] Step S3: Deploy the trained forest fire identification infrastructure and its weights to the microcontroller, and determine whether a forest fire has occurred based on the identification results of the forest fire identification infrastructure.

[0077] Step S3 specifically includes the following steps:

[0078] Step S31: Convert the obtained forest fire recognition basic structure weight file, forest fire recognition performance improvement structure weight file, and forest fire recognition speed improvement weight file into the onnx format;

[0079] Step S32: Import the onnx format file into the X-CUBE-AI tool and generate C code according to the X-CUBE-AI tool;

[0080] Step S33: Download the C code to the single-chip microcomputer development board and send the captured images obtained from the single-chip microcomputer camera to the single-chip microcomputer development board;

[0081] Step S34: Normalize the captured images and convert them into floating-point numbers, and input the floating-point numbers into the forest fire recognition neural network;

[0082] Step S35: Determine whether there is a fire according to the recognition result of the forest fire recognition neural network. If the floating-point number aiout0 ≥ aiout1 output by the neural network, it means that there is a forest fire. If aiout0 < aiout1, it means that there is no forest fire.

[0083] Working principle: In this embodiment, the C2PSA module of the YOLOv11 model is first removed to construct a forest fire recognition neural network; then, based on the obtained forest images and forest fire images, the forest fire recognition basic structure is trained on the server to obtain the forest fire recognition basic structure weights; finally, the trained forest fire recognition basic structure and the forest fire recognition basic structure weights are deployed to the single-chip microcomputer, and it is determined whether there is a forest fire according to the recognition result of the forest fire recognition basic structure, realizing the deployment of the YOLO neural network on the single-chip microcomputer and improving the forest fire recognition speed.

[0084] Embodiment 2:

[0085] Based on the above Embodiment 1, as Figure 2 、 Figure 3 shown, a specific embodiment is used to illustrate the forest fire recognition neural network structure.

[0086] As Figure 1 shown is the result of the existing YOLOv11, where H is the height of the input image and W is the width of the input image.

[0087] Aiming at the problem that the complexity of YOLOv11 is too high to be deployed to STM32F407, a neural network structure suitable for different deployment requirements is generated. The basic structure of this embodiment is as Figure 2 shown. Among them, the value range of C is 1, 2, 3, 4, and the value range of b0 is an integer from 2 to 128.

[0088] The enhancement structure in this embodiment includes a performance enhancement structure and a speed enhancement structure.

[0089] The performance enhancement structure in this embodiment is as follows: Figure 3 As shown, the performance is improved compared to the basic structure of this embodiment.

[0090] The C3Dense structure is as follows: Figure 4 As shown. Figure 4 The Attention module can be selected from ECAEfficientChannel Attention (ECAEfficientChannel Attention), CBAM (Convolutional Block Attention Module), or direct connection. Split, Concat, Conv1d, Conv2d, Sigmoid, mean, and max are common functions in open-source PyTorch. GAP (Global Average Pooling) is global average pooling, using the PyTorch function AdaptiveAvgPool2d. Softmax uses the open-source PyTorch function Softmax.

[0091] The speed enhancement structure in this embodiment is as follows: Figure 5 As shown, compared to the basic structure of this embodiment, the inference speed of each image is improved, especially the inference speed of the structure S1 with the fastest inference speed is further improved.

[0092] LightConv refers to one of DWConv and GhostConv. DWConv is a depthwise separable convolution, composed of depthwise convolution and pointwise convolution, and is a commonly used convolution method, implemented by setting certain parameters of the Conv. GhostConv is implemented in two steps: first, a small kernel standard convolution is used to generate a small number of intrinsic feature maps; then, a large kernel is used to expand these features to approximately obtain a complete feature set. After fusing the outputs of the two steps, GhostConv can achieve performance comparable to standard convolution with a significant reduction in the number of parameters and computational cost. GhostConv is also a commonly used convolution method, implemented by fusing two Convs with different parameters. The C3Light module structure is as follows: Figure 6 As shown. Figure 6 In this context, LightBottleneck can be either LightBottleneck1 or LightBottleneck2. FlexConv in LightBottleneck refers to one of Conv, DWConv, or GhostConv. Two FlexConvs can be the same or different, but two identical Convs cannot be selected.

[0093] The other parts of this embodiment are the same as those in Embodiment 1 above, so they will not be described again.

[0094] Example 3:

[0095] This embodiment, based on any one of Embodiments 1-2 above, illustrates the training and inference process using a specific embodiment.

[0096] The neural network structure in this embodiment is trained on a computer or server to obtain the weights of the neural network structure. Then, the trained neural network and its weights are deployed to a server or microcontroller. The microcontroller chip used in this embodiment is STM32F407ZGT6. Inference is performed by acquiring images through a camera on the microcontroller. The camera used in this embodiment is OV2640.

[0097] The training process for this implementation case is as follows:

[0098] 1) Obtain the training dataset.

[0099] 1.1) Obtain forest images and forest fire images, and place them in two separate folders to form two categorized datasets: images with forest fires and images of forests without fires;

[0100] 1.2) The dataset is randomly divided into a training dataset, a validation dataset, and a test set, usually in a ratio of 8:1:1. In the implementation of this invention, the validation dataset and the test dataset are the same, and the ratio of the training dataset to the validation dataset is 8:2.

[0101] 2) Obtain the weight file S4full.pt for S4 when C=8.

[0102] 2.1) Obtain the pre-trained weight file yolo11n-cls.pt for YOLOv11 image classification from the website.

[0103] 2.2) Import the dataset and yolo11n-cls.pt, set certain parameters, train on the server, and obtain the trained weight file best.pt. Rename it to forestfire.pt. This step can also be skipped.

[0104] 2.3) Remove the C2PSA module from YOLOv11n and modify the number of Conv output channels b0 in classify to 4, which corresponds to the S4 structure when C=8. Based on the correspondence between yolov11 and S4 structures, copy the weights of yolo11n-cls.pt or forestfire.pt to the corresponding module, including the weights of backbone and classify, to form the S4fulltemp.pt weight file.

[0105] 2.4) Import the dataset and S4fulltemp.pt, set certain parameters, train on the server, and after completion, obtain the trained weight file best.pt, rename it to S4full.pt.

[0106] 3) Based on the set number of channels C, which ranges from 1 to 4, and the desired number of network layers for inference deployment, obtain the weight files S1C.pt, S2C.pt, S3C.pt, or S4C.pt.

[0107] 3.1) Sparse Training

[0108] 3.1.1) Modify the training loss function, in the original loss function Add a regularization term to the existing one This yields a new loss function, Loss:

[0109]

[0110] in, This is the regularization coefficient; the larger the value, the sparser the weights w. Let j be the weight.

[0111] When using L2 regularization, It can be represented as:

[0112]

[0113] Alternatively, L1 regularization can be used. It can be represented as:

[0114]

[0115] When using regularization, the regularization coefficient is:

[0116]

[0117] in, , .

[0118] 3.1.2) Import the dataset and S4full.pt, set certain parameters, train on the server, and obtain the trained weight file last.pt after completion. Rename it to S4sparse.pt.

[0119] 3.2) Generate temporary weight files S1Ctemp.pt, S2Ctemp.pt, S3Ctemp.pt or S4Ctemp.pt.

[0120] 3.2.1) Based on the set number of channels C, which ranges from 1 to 4, run the open-source code torch_pruning to prune the channels in the backbone. After pruning, copy the weights from S4sparse.pt and assign them to the remaining channels to form the S4Ctemp.pt weight file.

[0121] 3.2.2) Based on the common parts of S3 and S4, copy the weights from S4Ctemp.pt and assign them to S3 to form the S3Ctemp.pt weight file. Similarly, form the S2Ctemp.pt and S1Ctemp.pt weight files.

[0122] 3.4) Fine-tuning: Import the dataset and S1Ctemp.pt, set certain parameters, and train on the server. After completion, you will obtain the trained weight file best.pt. Rename it to S1C.pt. Import the dataset and S2Ctemp.pt, set certain parameters, and train on the server. After completion, you will obtain the trained weight file best.pt. Rename it to S2C.pt. Similarly, you will obtain S3C.pt and S4C.pt files.

[0123] 4) Based on the set number of channels C, which ranges from 1 to 4, and the desired number of network layers for inference deployment, obtain the weight files S1DC.pt, S2DC.pt, S3DC.pt, or S4DC.pt.

[0124] 4.1) Based on the relationship between S1 and S1D, copy the weights of the module corresponding to S1C.pt to S1D to obtain the weight file S1DCtemp.pt. Based on the relationship between S2 and S2D, copy the weights of the module corresponding to S2C.pt to S2D to obtain the weight file S2DCtemp.pt. Similarly, obtain the files S3DCtemp.pt and S4DCtemp.pt.

[0125] 4.2) Fine-tuning: Import the dataset and S1DCtemp.pt, set certain parameters, and train on the server. After completion, you will obtain the trained weight file best.pt, which you will then rename to S1DC.pt. Similarly, import the dataset and S2DCtemp.pt, set certain parameters, and train on the server. After completion, you will obtain the trained weight file best.pt, which you will then rename to S2DC.pt. Likewise, you will obtain the S3DC.pt and S4DC.pt files.

[0126] 5) Based on the set number of channels C, which ranges from 1 to 4, and the desired number of network layers for inference deployment, obtain the weight files S1LC.pt, S2LC.pt, S3LC.pt, or S4LC.pt.

[0127] 5.1) Based on the relationship between S1 and S1L, copy the weights of the module corresponding to S1C.pt to S1L to obtain the weight file S1LCtemp.pt. Based on the relationship between S2 and S2L, copy the weights of the module corresponding to S2C.pt to S2L to obtain the weight file S2LCtemp.pt. Similarly, obtain the files S3LCtemp.pt and S4LCtemp.pt.

[0128] 5.2) Fine-tuning: Import the dataset and S1LCtemp.pt, set certain parameters, and train on the server. After completion, you will obtain the trained weight file best.pt, which you will then rename to S1LC.pt. Import the dataset and S2LCtemp.pt, set certain parameters, and train on the server. After completion, you will obtain the trained weight file best.pt, which you will then rename to S2LC.pt. Similarly, you will obtain the S3LC.pt and S4LC.pt files.

[0129] The reasoning process for implementing the present invention is as follows:

[0130] 1) Convert the pt files to ONNX files. Generate the corresponding ONNX files from the trained S1C.pt / S2C.exe.pt / S3C.pt / S4C.pt, S1DC.pt / S2DC.pt / S3DC.pt / S4DC.pt or S1LC.pt / S2LC.pt / S3LC.pt / S4LC.pt files: S1C.onnx / S2C.onnx / S3C.onnx / S4C.onnx, S1DC.onnx / S2DC.onnx / S3DC.onnx / S4DC.onnx or S1LC.onnx / S2LC.onnx / S3LC.onnx / S4LC.onnx.

[0131] 2) Import the ONNX file into the X-CUBE-AI tool, which is a free development tool配套 with the STM32F407 chip. Use this tool to generate code that can be deployed to the STM32F407 development board.

[0132] 3) Download the generated C code to the STM32F407 development board.

[0133] 4) Collect images from the camera or send images from the computer to the STM32F407 development board.

[0134] 5) Perform normalization on the images and convert them to floating-point numbers, then input them into the neural network of this embodiment and run.

[0135] 6) Determine whether a forest fire has occurred based on the results of the neural network operation. The determination method is as follows: The output results of the neural network are two floating-point numbers: aiout0 and aiout1. If aiout0 >= aiout1, it indicates that a forest fire has occurred; if aiout0 < aiout1, it indicates that no forest fire has occurred.

[0136] 7) Output the determination result.

[0137] The other parts of this embodiment are the same as any one of the above Embodiment 1 - Embodiment 2, so they will not be elaborated here.

[0138] Embodiment 4:

[0139] Based on any one of the above Embodiment 1 - Embodiment 3, in order to illustrate the beneficial effects, first define the performance indicators. TP (True Positive) represents the pictures that correctly detect a forest fire, FP (False Positive) represents the pictures that detect a forest fire when there is no forest fire, FN (False Negative) represents the pictures that detect no forest fire when there is a forest fire, TN (True Negative) represents the pictures that correctly detect no forest fire. The top1 accuracy rate of forest fire recognition can be expressed by the following formula:

[0140]

[0141] The miss probability represents not detecting when there is a fire:

[0142]

[0143] The false-alarm probability represents detecting a fire when there is no fire:​​

[0145] The performance of YOLOv11n (the version of YOLOv11 with the fewest parameters) after training on a server is as follows: Figure 7 As shown. By Figure 7 As can be seen, the top-1 accuracy has converged. After convergence, the highest top-1 accuracy of YOLOv11 is 99.28%.

[0146] The best-performing structure S4C4 (S4 structure with C=4, others are similar), the structures with a trade-off between inference and performance S3C1 / S1C2 / S2C1, and the fastest inference speed S1C1 are selected. The inference performance of the neural network basic structure in this embodiment using RGB888 image (ordinary image on a computer) format input on the STM32F407 development board is shown in Table 1.

[0147] Table 1. Inference performance of the basic architecture with RGB888 image format input.

[0148] Model S4C4 S3C1 S1C2 S2C1 S1C1 Top 1 accuracy 0.97836 0.96787 0.95607 0.95213 0.93115 Probability of missed detection 0.01168 0.0241 0.03151 0.04449 0.04449 False alarm probability 0.03587 0.05157 0.07399 0.05830 0.12780

[0149] After deploying the network model and its weights onto the STM32F407 development board, timers are set at both the neural network input and output. The difference between the two timers yields the neural network inference time, i.e., the inference speed. The inference speeds of different models are shown in Table 2.

[0150] Table 2 Inference speed of different models

[0151] Model S4C4 S3C1 S1C2 S2C1 S1C1 Speed ​​(milliseconds / image) 5996.841 1215.628 1191.964 1114.569 996.729

[0152] The inference performance of the neural network performance enhancement and speed enhancement structure in this embodiment using RGB888 images (common images on a computer) as input on the STM32F407 development board is shown in Table 3.

[0153] Table 3. Inference performance of the enhanced architecture with RGB888 image format input.

[0154] Model S4DC4CBAM S4DC4CBAM S1DC2ECA S2DC1ECA S1LC1LB2G S1LC1LB2DW S1LC1LB1DW Top 1 accuracy 0.98361 0.9823 0.97049 0.96981 0.95016 0.92131 0.9259 Probability of missed detection 0.01483 0.01668 0.02410 0.02317 0.02873 0.03985 0.03892 False alarm probability 0.02018 0.02018 0.04260 0.04933 0.10314 0.17265 0.15919 Speed ​​(milliseconds / image) 6255.101 6020.147 1296.473 1181.350 1022.283 769.433 802.495

[0155] In Table 3, S4D4C4CBAM indicates that the Attention module uses a CBAM S4D structure with C=4, S4D4C4ECA indicates that the Attention module uses an ECA S4D structure with C=4, S1DC2ECA indicates that the Attention module uses an ECA S1D structure with C=2, S2DC1ECA indicates that the Attention module uses an ECA S2D structure with C=1, S1LC1LB1G indicates that the Attention module uses a direct connection with a C=1 LightBottleneck using LightBottleneck2 and FlexConv using GhostConv in an S1L structure, S1LC1LB2DW indicates that the Attention module uses a direct connection with a C=1 LightBottleneck using LightBottleneck2 and FlexConv using DWConv in an S1L structure, and S1LC1LB1DW indicates that the Attention module uses a direct connection with a C=1 LightBottleneck using LightBottleneck1 and FlexConv using DWConv in an S1L structure.

[0156] The horizontal axis represents inference speed (milliseconds / image), and the vertical axis represents top-1 accuracy. A curve is plotted showing the basic structure and performance / speed improvement structures of this embodiment. Figure 8 As shown.

[0157] Figure 8 In the diagram, blue represents the basic structure of this embodiment, and red represents the enhanced structure of the embodiment. Figure 8 The results show that both the enhanced structure and the basic structure in this embodiment achieve a top-1 accuracy of over 92%. The enhanced structure in this embodiment shows a significant gain compared to the basic structure. The best performance of the basic structure is less than 2% lower than that of YOLOv11n, while the best performance of the performance enhancement structure is less than 1% lower than that of YOLOv11n. The fastest inference speed is improved from 997 milliseconds for the basic structure to 769 milliseconds for the speed enhancement structure.

[0158] The inference performance of the neural network infrastructure in this embodiment using RGB565 images (output from cameras such as OV2640) as input on the STM32F407 development board is shown in Table 4.

[0159] Table 4. Inference performance of the basic architecture with RGB565 image format input.

[0160] Model S4C4 S3C1 S1C2 S2C1 S1C1 TOP1 accuracy 0.97180 0.96787 0.95344 0.95738 0.93246 Probability of missed detection 0.0213 0.02688 0.03892 0.03800 0.04727 False alarm probability 0.04484 0.04484 0.06502 0.05381 0.11659

[0161] Table 5 shows the inference performance of the neural network performance enhancement and speed enhancement structure in this embodiment on the STM32F407 development board using RGB565 image format input.

[0162] Table 5. Inference performance of the enhanced architecture with RGB565 image format input.

[0163] Model S4DC4CBAM S4DC4CBAM S1DC2ECA S2DC1ECA S1LC1LB2G S1LC1LB2DW S1LC1LB1DW TOP1 accuracy 0.98230 0.98098 0.96984 0.96787 0.94557 0.92 0.92328 Probability of missed detection 0.01576 0.01761 0.02410 0.02410 0.03892 0.04634 0.04171 False alarm probability 0.02242 0.02242 0.04484 0.05157 0.09193 0.16143 0.16143 Speed ​​(milliseconds / image) 6255.101 6020.147 1296.473 1181.350 1022.283 769.433 802.495

[0164] The horizontal axis represents inference speed (milliseconds / image), and the vertical axis represents top-1 accuracy. A curve is plotted showing the basic structure and performance / speed improvement structures of this embodiment. Figure 9 As shown. Figure 9 In the diagram, blue represents the basic structure of this embodiment, and red represents the enhanced structure of this embodiment. Figure 9 The results show that both the enhanced structure and the basic structure in this embodiment achieved a top-1 accuracy of over 92%. The enhanced structure in this embodiment showed a significant gain compared to the basic structure. The best performance of the basic structure was about 2% lower than that of YOLOv11n, while the best performance of the performance enhancement structure was less than 1% lower than that of YOLOv11n.

[0165] The other parts of this embodiment are the same as any one of the embodiments 1-3 above, so they will not be described again.

[0166] Example 5:

[0167] Based on any one of Embodiments 1-4 above, this embodiment proposes a forest fire identification system based on edge computing, used to execute the above-described forest fire identification method based on edge computing; it includes a neural network construction unit, a weight calculation unit, and an identification unit;

[0168] The neural network construction unit is used to remove the C2PSA module of the YOLOv11 model and construct a forest fire identification neural network.

[0169] The weight calculation unit is used to train the forest fire identification infrastructure on the server based on the acquired forest images and forest fire images, and obtain the weights of the forest fire identification infrastructure.

[0170] The identification unit is used to deploy the trained forest fire identification infrastructure and its weights to a microcontroller and determine whether a forest fire has occurred based on the identification results of the forest fire identification infrastructure.

[0171] This embodiment also proposes an electronic device, including a memory and a processor; the memory stores a computer program; when the computer program is executed on the processor, it implements the above-described edge computing-based forest fire identification method.

[0172] This embodiment also proposes a computer-readable storage medium storing computer instructions; when the computer instructions are executed on the aforementioned electronic device, the aforementioned edge computing-based forest fire identification method is implemented.

[0173] The other parts of this embodiment are the same as any one of the embodiments 1-4 above, so they will not be described again.

[0174] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Any simple modifications or equivalent changes made to the above embodiments based on the technical essence of the present invention shall fall within the protection scope of the present invention.

Claims

1. A forest fire identification method based on edge computing, characterized in that, Specifically, the following steps are included: Step S1: Remove the C2PSA module from the YOLOv11 model to construct the forest fire identification neural network; Step S2: Based on the acquired forest images and forest fire images, train the forest fire recognition infrastructure on the server to obtain the weights of the forest fire recognition infrastructure. Step S3: Deploy the trained forest fire identification infrastructure and its weights to the microcontroller, and determine whether a forest fire has occurred based on the identification results of the forest fire identification infrastructure. The forest fire identification neural network includes a basic structure for forest fire identification; the basic structure for forest fire identification includes an S1 forest fire identification basic structure, an S2 forest fire identification basic structure, an S3 forest fire identification basic structure, or an S4 forest fire identification basic structure. The S1 forest fire identification infrastructure includes a first Conv layer, a second Conv layer, a C3k2 module, a third Conv layer, a global average pooling layer, and a softmax layer connected in sequence. The S2 forest fire identification infrastructure includes a first Conv layer, a second Conv layer, a first C3k2 module, a third Conv layer, a second C3k2 module, a fourth Conv layer, a global average pooling layer, and a softmax layer connected in sequence. The S3 forest fire identification infrastructure includes a first Conv layer, a second Conv layer, a first C3k2 module, a third Conv layer, a second C3k2 module, a fourth Conv layer, a third C3k2 module, a fifth Conv layer, a global average pooling layer, and a softmax layer, which are connected in sequence. The S4 forest fire identification infrastructure includes the following layers connected in sequence: first Conv layer, second Conv layer, first C3k2 module, third Conv layer, second C3k2 module, fourth Conv layer, third C3k2 module, fifth Conv layer, fourth C3k2 module, sixth Conv layer, global average pooling layer, and softmax layer. The forest fire identification neural network also includes a forest fire identification enhancement structure; the forest fire identification enhancement structure includes a forest fire identification performance improvement structure or a forest fire identification speed improvement structure. The forest fire identification performance enhancement structure is obtained by replacing the C3k2 module of the basic forest fire identification structure with the C3Dense module, resulting in the S1D forest fire identification performance enhancement structure, S2D forest fire identification performance enhancement structure, S3D forest fire identification performance enhancement structure, and S4D forest fire identification performance enhancement structure. The forest fire identification speed enhancement structure is obtained by replacing the C3k2 module of the basic forest fire identification structure with the C3Light module and replacing the Conv layer with the LightConv layer, resulting in the S1L forest fire identification performance enhancement structure, S2L forest fire identification performance enhancement structure, S3L forest fire identification performance enhancement structure, and S4L forest fire identification performance enhancement structure.

2. The forest fire identification method based on edge computing according to claim 1, characterized in that, The C3Dense module includes a first Conv layer, a Split function, a DenseBottleneck module, a Concat function, a second Conv layer, and an Attention module connected in sequence; The DenseBottleneck module includes a first Conv layer, a Concat function, and a second Conv layer connected in sequence.

3. The forest fire identification method based on edge computing according to claim 1, characterized in that, The C3Light module includes a first LightConv layer, a Split function, a LightBottleneck module, a Concat function, and a second LightConv layer connected in sequence.

4. The forest fire identification method based on edge computing according to claim 1, characterized in that, The specific steps of step S2 are as follows: Step S21: Construct a training dataset according to the obtained forest pictures and forest fire pictures; Step S22: Obtain the weight file of the forest fire recognition basic structure according to the set number of channels; Step S23: Obtain the weight file of the trained forest fire recognition basic structure according to the set number of channels and the set number of network layers for inference deployment; Step S24: Copy the weight file of the trained forest fire recognition basic structure to the forest fire recognition performance improvement structure according to the relationship between the forest fire recognition basic structure and the forest fire recognition performance improvement structure, and obtain the weight file of the forest fire recognition performance improvement structure; 5. The forest fire identification method based on edge computing according to claim 4, characterized in that, Step S25: Copy the weight file of the trained forest fire recognition basic structure to the forest fire recognition speed improvement structure according to the relationship between the forest fire recognition basic structure and the forest fire recognition speed improvement structure, and obtain the weight file of the forest fire recognition speed improvement. The specific steps of step S3 are as follows: [[ID=lo]]Step S31: Convert the obtained weight files of the forest fire recognition basic structure, the forest fire recognition performance improvement structure, and the forest fire recognition speed improvement to the onnx format; Step S32: Import the onnx format file into the X-CUBE-AI tool and generate C code according to the X-CUBE-AI tool; Step S33: Download the C code to the microcontroller development board and send the captured pictures obtained from the microcontroller camera to the microcontroller development board; Step S34: Normalize the captured pictures and convert them to floating-point numbers, and input the floating-point numbers into the forest fire recognition neural network; 6. A forest fire identification system based on edge computing, used to execute the forest fire identification method based on edge computing as described in claim 1; characterized in that, Step S35: Judge whether there is a fire according to the recognition result of the forest fire recognition neural network. If the floating-point number aiout0 output by the neural network is ≥ aiout1, it means that there is a forest fire. If aiout0 < aiout1, it means that there is no forest fire. It includes a neural network construction unit, a weight calculation unit, and an identification unit; The neural network construction unit is used to remove the C2PSA module of the YOLOv11 model and construct a forest fire recognition neural network; The weight calculation unit is used to train the forest fire recognition basic structure on the server according to the obtained forest pictures and forest fire pictures, and obtain the weights of the forest fire recognition basic structure; The identification unit is used to deploy the trained forest fire identification infrastructure and its weights to a microcontroller and determine whether a forest fire has occurred based on the identification results of the forest fire identification infrastructure.

7. An electronic device, characterized in that, It includes a memory and a processor; the memory stores a computer program; when the computer program is executed on the processor, it implements the forest fire identification method based on edge computing as described in any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions; when the computer instructions are executed on the electronic device as described in claim 7, the forest fire identification method based on edge computing as described in any one of claims 1-5 is implemented.

Citation Information

Patent Citations

  • Landslide detection method and device, program product and electronic equipment

    CN120472322A

  • Forest disaster detection method and device

    CN120708349A