Model training, image detection methods, devices, equipment, media and products

By using the pre-built feature extractor and the target calculation formula LfocalWIoU to optimize the loss value processing in the fire detection algorithm, the problem of long training cycle of the fire detection algorithm is solved, achieving faster training and higher detection accuracy.

CN118334474BActive Publication Date: 2024-09-17INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410760947.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-13
Publication Date
2024-09-17
Estimated Expiration
2044-06-13

AI Technical Summary

Technical Problem

Existing fire detection algorithms such as RCNN, Fast-RCNN, Faster-RCNN and Mask-RCNN have limited update gradients during training, resulting in a long training cycle and difficulty in meeting real-time detection requirements.

Method used

Using the pre-built feature extractor and target calculation formula LfocalWIoU=(1-LWIoU)rLWIoU, the loss value is processed by weighting and the hyperparameter r is introduced to control outlier suppression, optimizing the update gradient during model training and shortening the training cycle.

Benefits of technology

It effectively reduces the model training cycle, improves the real-time performance and accuracy of fire detection, and is suitable for smoke and fire detection in complex scenes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118334474B
    Figure CN118334474B
Patent Text Reader

Abstract

The present application discloses a model training, image detection method, device, equipment, medium and product in the field of computer technology. The loss calculation formula provided in the present application weights the loss value calculated by the WIoU loss function, thereby effectively suppressing the loss; in addition, a hyperparameter is introduced r To control the degree of outlier suppression, the size of the update gradient during model training can be controlled, thereby effectively controlling the model training cycle and making it possible to reduce the model training cycle.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a model training, image detection method, device, equipment, medium and product. Background Art

[0002] Currently, most fire detection algorithms based on deep learning are used, such as RCNN (Regions with CNN features) algorithm, Fast-RCNN algorithm, Faster-RCNN algorithm and Mask-RCNN algorithm. These detection algorithms have limited update gradients during training, resulting in a long training cycle.

[0003] Therefore, how to reduce the training cycle of the detection algorithm is a problem that those skilled in the art need to solve. Summary of the invention

[0004] In view of this, the purpose of this application is to provide a model training, image detection method, device, equipment, medium and product to reduce the training cycle of the detection algorithm. The specific scheme is as follows:

[0005] In a first aspect, the present application provides a model training method, comprising:

[0006] Acquire the image to be tested;

[0007] Detecting a frame to be tested from the image to be tested using a pre-built feature extractor;

[0008] The target loss value of the frame to be tested is calculated using a target calculation formula; wherein the target calculation formula is: L focalWIoU =(1- L WIoU ) r L WIoU ; L focalWIoU is the target loss value, L WIoU is the loss value calculated using the WIoU loss function, r are the preset hyperparameters;

[0009] If the target loss value meets the preset convergence condition, the current feature extractor is used as a fire detection model.

[0010] On the other hand, it also includes:

[0011] If the target loss value does not meet the preset convergence conditions, the target loss value is used to update the parameters of the current feature extractor to obtain an updated feature extractor. After replacing the current feature extractor with the updated feature extractor, the step of acquiring the image to be tested and other subsequent steps are executed until the target loss value meets the preset convergence conditions.

[0012] On the other hand, the pre-built feature extractor includes: a first feature extraction layer and a second feature extraction layer;

[0013] The first feature extraction layer includes: at least one first extraction module, at least one second extraction module and a fast feature pyramid pooling module;

[0014] The second feature extraction layer includes: at least one first extraction module, at least one second extraction module, at least one third extraction module, at least one fusion module and at least one target convolution module;

[0015] Any first extraction module, used for performing convolution function group processing and threshold function processing on input data in sequence, and calculating the dot product between the threshold function processing result and the current input data;

[0016] Any second extraction module, used to process input data using the first extraction module located at the input end thereof to obtain shallow features; process the shallow features using the convolution group in itself to obtain deep features; concatenate the shallow features and the deep features to obtain concatenated features; and process the concatenated features using the first extraction module located at the output end thereof;

[0017] The fast feature pyramid pooling module is used to perform fast pooling processing on the input data;

[0018] Any third extraction module, used for performing feature sampling processing and matrix adjustment function processing on the input data, and performing interpolation operation on the feature sampling results and the processing results of the matrix adjustment function;

[0019] Any fusion module, used to concatenate two input data;

[0020] Any target convolution module, used to perform convolution operations on input data.

[0021] On the other hand, the convolution group includes multiple convolution operation blocks, and any convolution operation block divides the input data according to a preset ratio to obtain first sub-data and second sub-data; after performing a convolution operation on the first sub-data, the corresponding convolution operation result is spliced ​​with the second sub-data; the splicing result is processed using two first extraction modules connected in series, and the processing result is summed with the current input data in a bitwise manner.

[0022] On the other hand, any third extraction module includes: a first feature sampling block, a second feature sampling block, a matrix adjustment function operation block, a summation operation block and an interpolation operation block;

[0023] The first feature sampling block is used to perform a sampling operation on the input data;

[0024] The second feature sampling block is used to perform a deformation operation on the convolution operation result after performing a convolution operation on the current input data;

[0025] The summing operation block is used to perform positional summing on the sampling operation result and the deformation operation result;

[0026] The matrix adjustment function operation block is used to process the current input data using the matrix adjustment function;

[0027] The interpolation operation block is used to perform an interpolation operation on the processing result of the matrix adjustment function and the bitwise summation result.

[0028] On the other hand, any first extraction module is specifically used to: process input data according to a first formula; the first formula is ; y i is the output result of the current first extraction module, x i is the current input data, Conv ( x i )express x i The convolution function group processing result is Indicates the result of threshold function processing.

[0029] On the other hand, using a pre-built feature extractor to detect a frame to be tested from the image to be tested includes:

[0030] Using a pre-built feature extractor to calibrate multiple object boxes in the image to be tested;

[0031] The multiple object frames are merged according to a preset merging strategy to obtain the frame to be tested.

[0032] on the other hand, L WIoU The calculation formula is: ;in, is the center coordinate of the label frame corresponding to the frame to be measured, is the center coordinate of the frame to be measured, ★ represents a separable symbol, S u represents the union size of the frame to be tested and the label frame, is the width of the minimum bounding box covering the frame to be tested and the label frame, is the height of the minimum bounding box covering the frame to be detected and the label frame.

[0033] On the other hand, if the width of the minimum bounding box and / or the height of the minimum bounding box meets the preset conditions, then L WIoU The calculation formula is: .

[0034] On the other hand, the minimum bounding box width and / or the minimum bounding box height satisfying the preset conditions include:

[0035] The width of the minimum enclosing box is greater than a preset first value and / or the height of the minimum enclosing box is greater than a preset second value; or the gradient value calculated based on the width of the minimum enclosing box and / or the height of the minimum enclosing box is less than a preset third value.

[0036] On the other hand, the gradient value is calculated based on the width of the minimum bounding box and / or the height of the minimum bounding box, including:

[0037] Calculate the gradient value according to the second formula or the third formula;

[0038] Wherein, the second formula is:

[0039] ; The third formula is: ; A , B represents the gradient value, is the center coordinate of the label frame corresponding to the frame to be measured, is the center coordinate of the frame to be measured, represents partial derivative, is the width of the minimum bounding box covering the frame to be tested and the label frame, is the height of the minimum bounding box covering the frame to be detected and the label frame.

[0040] On the other hand, the present application provides an image detection method, comprising:

[0041] Get the target image;

[0042] Inputting the target image into a fire detection model so that the fire detection model detects a fire area from the target image; the fire detection model is trained according to any of the methods described above;

[0043] The fire area is marked in the target image, and the image with the marked fire area is displayed.

[0044] On the other hand, obtaining the target image includes:

[0045] Intercepting the target image from the real-time monitoring video;

[0046] or

[0047] The target image is obtained by photographing with a drone.

[0048] On the other hand, marking the fire area in the target image and displaying the image marked with the fire area includes:

[0049] Using a preset marking frame to highlight the fire area in the target image;

[0050] The image marked with the fire area is sent to a preset control terminal, and the image marked with the fire area is displayed on a display screen connected to the preset control terminal.

[0051] On the other hand, it also includes:

[0052] While the image marked with the fire area is displayed on the display screen connected to the preset control terminal, the alarm device connected to the preset control terminal starts to alarm.

[0053] On the other hand, the present application provides a model training device, comprising:

[0054] The image acquisition module to be tested is used to acquire the image to be tested;

[0055] A detection module, used for detecting a frame to be tested from the image to be tested using a pre-built feature extractor;

[0056] The calculation module is used to calculate the target loss value of the frame to be tested by using a target calculation formula; wherein the target calculation formula is: L focalWIoU =(1- L WIoU ) r L WIoU ; L focalWIoU is the target loss value, L WIoU is the loss value calculated using the WIoU loss function, r are the preset hyperparameters;

[0057] The output module is used to use the current feature extractor as a fire detection model if the target loss value meets the preset convergence condition.

[0058] On the other hand, the present application provides an image detection device, comprising:

[0059] A target image acquisition module, used for acquiring a target image;

[0060] A processing module, used for inputting the target image into a fire detection model, so that the fire detection model detects a fire area from the target image; the fire detection model is trained according to any of the methods described above;

[0061] The display module is used to mark the fire area in the target image and display the image marked with the fire area.

[0062] On the other hand, the present application provides an electronic device, including:

[0063] Memory for storing computer programs;

[0064] The processor is used to execute the computer program to implement the method disclosed above.

[0065] On the other hand, the present application provides a non-volatile storage medium for storing a computer program, wherein the computer program implements the aforementioned disclosed method when executed by a processor.

[0066] On the other hand, the present application provides a computer program product, comprising a computer program / instruction, which implements the steps of the aforementioned disclosed method when executed by a processor.

[0067] It can be seen from the above scheme that the present application provides a model training method, including: obtaining an image to be tested; using a pre-built feature extractor to detect a frame to be tested from the image to be tested; and using a target calculation formula to calculate a target loss value of the frame to be tested; wherein the target calculation formula is: L focalWIoU =(1- L WIoU ) r L WIoU ; L focalWIoU is the target loss value, L WIoU is the loss value calculated using the WIoU loss function, r is a preset hyperparameter; if the target loss value meets the preset convergence condition, the current feature extractor is used as the fire detection model.

[0068] It can be seen that the beneficial effects of the present application are: the loss calculation formula weights the loss value calculated by the WIoU loss function, thereby effectively suppressing the loss; in addition, a hyperparameter is introduced r To control the degree of outlier suppression, the size of the update gradient during model training can be controlled, thereby effectively controlling the model training cycle and making it possible to reduce the model training cycle.

[0069] Correspondingly, the model training and image detection device, equipment, medium and program product provided by this application also have the above-mentioned technical effects. BRIEF DESCRIPTION OF THE DRAWINGS

[0070] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0071] Figure 1 A flow chart of a model training method disclosed in this application;

[0072] Figure 2 A schematic diagram of an image to be tested disclosed in this application;

[0073] Figure 3 A schematic diagram of a feature extractor disclosed in this application;

[0074] Figure 4 A flow chart of an image detection method disclosed in this application;

[0075] Figure 5 A schematic diagram of SimpleC3 disclosed in this application;

[0076] Figure 6 A schematic diagram of a ResConv module disclosed in this application;

[0077] Figure 7 A schematic diagram of a CSM module disclosed in this application;

[0078] Figure 8 A schematic diagram of a Dysample disclosed in this application;

[0079] Fig. 9 A schematic diagram for comparing thermal images disclosed in this application;

[0080] Fig.10 A schematic diagram of a loss function curve and a MAP0.5 curve disclosed in this application;

[0081] Fig.11 A schematic diagram of comparison between experimental accuracy and parameter quantity disclosed in this application;

[0082] Fig.12 A server structure diagram provided for this application;

[0083] Fig.13 A terminal structure diagram provided for this application. DETAILED DESCRIPTION

[0084] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other examples obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0085] Fire is one of the major disasters that threaten public safety and the safety of people's lives and property. Timely detection of fire and early warning are of great significance to maintaining public safety and social order. In the actual detection of fireworks, due to the influence of the external environment, such as sunlight, yellow objects and glass reflections, it is very easy to cause false detection. At present, sensor detection methods can be used for fireworks detection. This detection method has a small detection range and can only detect after the fire occurs, and it is impossible to warn in the early stage of the fire. Fireworks detection based on traditional image processing methods mainly identifies and detects RGB colors and edge features that are easy to identify in fireworks. Although it solves the interference problem under different light to a certain extent, it is greatly affected by the environment, cannot adapt to the needs of complex scenes, and has a high false detection rate. Edge devices use deep learning methods for fireworks detection, which has problems such as poor real-time performance, low accuracy, and high false detection rate.

[0086] At present, for fire detection, the detection algorithms based on deep learning include RCNN algorithm, Fast-RCNN algorithm, Faster-RCNN algorithm and Mask-RCNN algorithm. These detection algorithms have limited update gradients during training, resulting in a long training cycle. To this end, the present application provides a model training and image detection scheme that can control the size of the update gradient during the model training process, thereby effectively controlling the model training cycle and making it possible to reduce the model training cycle.

[0087] See also Figure 1 As shown, the embodiment of the present application discloses a model training method, including:

[0088] S101, obtaining an image to be tested.

[0089] In this embodiment, the image to be tested is one or more images containing smoke and / or fire in the training data set. Figure 2 .

[0090] S102: Detect and obtain a frame to be tested from the image to be tested using a pre-built feature extractor.

[0091] In one example, the pre-built feature extractor is designed and implemented with reference to the FPN network and the PANet network. Figure 3 , the specific structure of the pre-built feature extractor can be as follows Figure 3 As shown, Figure 3 The arrow direction in the figure is the data processing direction. Figure 3 The illustrated feature extractor can calibrate multiple object frames based on three different sizes, and then merge the multiple object frames according to a preset merging strategy to obtain the frame to be tested. Figure 3 , the modules illustrated in the first column constitute the first feature extraction layer, and the subsequent modules (that is, all modules not in the first column) constitute the second feature extraction layer.

[0092] In one embodiment, the pre-constructed feature extractor includes: a first feature extraction layer and a second feature extraction layer; the first feature extraction layer includes: at least one first extraction module, at least one second extraction module and a fast feature pyramid pooling module; the second feature extraction layer includes: at least one first extraction module, at least one second extraction module, at least one third extraction module, at least one fusion module and at least one target convolution module. Any first extraction module is used to perform convolution function group processing and threshold function processing on the input data in sequence, and calculate the dot product of the threshold function processing result and the current input data; any second extraction module is used to use the first extraction module located at the input end of itself to process the input data to obtain shallow features; use the convolution group in itself to process the shallow features to obtain deep features; splice the shallow features and the deep features to obtain spliced ​​features; use the first extraction module located at the output end of itself to process the spliced ​​features; a fast feature pyramid pooling module is used to perform fast pooling processing on the input data; any third extraction module is used to perform feature sampling processing and matrix adjustment function (reshape function) processing on the input data, and perform Grid Sample interpolation operation on the feature sampling results and the processing results of the matrix adjustment function; any fusion module is used to splice two input data; any target convolution module is used to perform convolution operation on the input data.

[0093] Among them, the convolution group includes multiple convolution operation blocks, and any convolution operation block divides the input data according to a preset ratio to obtain first sub-data and second sub-data; after performing a convolution operation on the first sub-data, the corresponding convolution operation result is spliced ​​with the second sub-data; the splicing result is processed using two first extraction modules connected in series, and the processing result is summed with the current input data in a bitwise manner.

[0094] Among them, any third extraction module includes: a first feature sampling block, a second feature sampling block, a matrix adjustment function operation block, a summation operation block and an interpolation operation block; the first feature sampling block is used to perform a Sample sampling operation on the input data; the second feature sampling block is used to perform a deformation operation on the convolution operation result after performing a convolution operation on the current input data; the summation operation block is used to perform a bitwise summation of the sampling operation result and the deformation operation result; the matrix adjustment function operation block is used to process the current input data using the matrix adjustment function; the interpolation operation block is used to perform an interpolation operation on the processing result of the matrix adjustment function and the bitwise summation result.

[0095] In one embodiment, any first extraction module is specifically used to: process input data according to a first formula; the first formula is ; y i is the output result of the current first extraction module, x i is the current input data, Conv ( x i )express x i The convolution function group processing result is Indicates the result of threshold function processing.

[0096] S103, calculating the target loss value of the frame to be tested using a target calculation formula.

[0097] The target calculation formula is: L focalWIoU =(1- L WIoU ) r L WIoU ; L focalWIoU is the target loss value, L WIoU is the loss value calculated using the WIoU loss function, r are the preset hyperparameters.

[0098] S104: If the target loss value meets the preset convergence condition, the current feature extractor is used as a fire detection model.

[0099] If the target loss value does not meet the preset convergence conditions, the target loss value is used to update the parameters of the current feature extractor to obtain an updated feature extractor. After replacing the current feature extractor with the updated feature extractor, the step of acquiring the image to be tested and other subsequent steps are executed until the target loss value meets the preset convergence conditions.

[0100] In one embodiment, a pre-built feature extractor is used to detect a frame to be tested from an image to be tested, including: using the pre-built feature extractor to calibrate multiple object frames in the image to be tested; and merging the multiple object frames according to a preset merging strategy to obtain the frame to be tested.

[0101] In one embodiment, L WIoU The calculation formula is: ;in, is the center coordinate of the label frame corresponding to the frame to be tested, is the center coordinate of the frame to be measured, ★ represents a separable symbol, S u Indicates the size of the union of the frame to be tested and the label frame, is the width of the minimum bounding box covering the frame to be tested and the label frame, is the height of the minimum bounding box covering the frame to be detected and the label frame. When the target loss value is hindered from converging, In one example, if the width of the minimum bounding box and / or the height of the minimum bounding box meets a preset condition, then L WIoU The calculation formula is: .

[0102] Among them, the width of the minimum enclosing box and / or the height of the minimum enclosing box satisfying the preset conditions include: the width of the minimum enclosing box is greater than a preset first value and / or the height of the minimum enclosing box is greater than a preset second value; or the gradient value calculated based on the width of the minimum enclosing box and / or the height of the minimum enclosing box is less than a preset third value.

[0103] The step of calculating the gradient value based on the width of the minimum bounding box and / or the height of the minimum bounding box includes: calculating the gradient value according to the second formula or the third formula; wherein the second formula is:

[0104] ; The third formula is: ; A , B represents the gradient value, A represents the gradient value calculated using the second formula, B represents the gradient value calculated using the third formula, is the center coordinate of the label frame corresponding to the frame to be measured, is the center coordinate of the frame to be measured, represents partial derivative, is the width of the minimum bounding box covering the frame to be tested and the label frame, is the height of the minimum bounding box covering the frame to be tested and the label frame. , .visible, and Provides a negative gradient when and When it increases, it will hinder the overlap of the label frames corresponding to the test frames, which means it will hinder the convergence of the target loss value.

[0105] It can be seen that the loss calculation formula provided in this embodiment weights the loss value calculated by the WIoU loss function, thereby effectively suppressing the loss; in addition, a hyperparameter is introduced r To control the degree of outlier suppression, the size of the update gradient during model training can be controlled, thereby effectively controlling the model training cycle and making it possible to reduce the model training cycle.

[0106] An image detection method provided in an embodiment of the present application is introduced below. The image detection method described below can be referenced to other embodiments described in this document.

[0107] See also Figure 4 As shown, the embodiment of the present application discloses an image detection method, including:

[0108] S401, acquiring a target image.

[0109] In one embodiment, obtaining the target image includes: capturing the target image from a real-time monitoring video; or photographing the target image using a drone.

[0110] S402: Input the target image into the fire detection model so that the fire detection model detects the fire area from the target image.

[0111] Among them, the fire detection model is trained according to the model training method provided in other embodiments.

[0112] S403: Mark the fire area in the target image, and display the image with the marked fire area.

[0113] In one embodiment, marking a fire area in a target image and displaying the image with the marked fire area includes: using a preset marking frame to highlight the fire area in the target image; sending the image with the marked fire area to a preset control terminal, and displaying the image with the marked fire area on a display screen connected to the preset control terminal. While the image with the marked fire area is displayed on the display screen connected to the preset control terminal, an alarm device connected to the preset control terminal starts to sound an alarm.

[0114] Among them, for more specific working processes of each step in this embodiment, reference can be made to the corresponding contents disclosed in other embodiments, which will not be repeated here.

[0115] It can be seen that this embodiment provides an image detection method that can detect fire in a timely manner, and promptly issue a fire alarm and display a real-time image.

[0116] See also Figure 3 , Figure 3 SimpleC3 in the algorithm can reduce model parameters, and ResConv in the algorithm can increase feature extraction capability. The single-input dynamic upsampler Dysample can better retain important features, reduce artifacts, and improve the detection accuracy of the model. After outputting the frame to be tested, Focal WIoU-loss is used to optimize the loss function, reduce the penalty of distance and aspect ratio on blurred targets, and improve the generalization ability of the model.

[0117] according to Figure 3 As shown in the figure, the feature extraction process is sampled at 8, 16, and 32 times in turn, and the shallow representation feature map obtained is passed through the FPN (Feature Pyramid Networks) network ( Figure 3 The first and second columns form the FPN network to fuse deep strong semantic features. The FPN network conveys strong semantic features from top to bottom. PANet (Path Aggregation Network) is used to fuse shallow representation information. Figure 3 The second and third columns form PANet. PANet conveys strong localization features from bottom to top. Finally, three detection heads with sizes of 20x20, 40x40, and 80x80 are obtained to detect the target respectively.

[0118] SimpleC3 can improve the detection efficiency of the model and achieve real-time detection. Figure 5 The input end of SimpleC3 has two branches, each of which has a CSM module. One CSM module is connected to the splicing block through the convolution group, and the other CSM module is directly connected to the splicing block. The splicing block splices the outputs of the two paths, and then passes through a CSM module to obtain the output data of SimpleC3. That is: the input features are extracted and encoded along two different directions at the same time to generate two sets of feature maps. One set of feature maps is used to fuse deeper semantic information, and the other set of feature maps retains the shallow information of the input features. Finally, the two sets of feature maps are aggregated and spliced. The aggregated and spliced ​​feature maps are further integrated with feature information through the CSM module to obtain the output y i The convolution group includes N convolution operation ResConv modules (i.e., convolution operation blocks). The cascaded ResConv modules can perform deep feature mining and extract deeper semantic information. SimpleC3's data processing is expressed as follows: y i=CSM([h1,h2])(1), h1=ResConv(CSM( x i ))(2)、h2=CSM( x i )(3), where h1 represents deeper semantic information and h2 represents shallower information.

[0119] The internal structure of the ResConv module can be found in Figure 6 The ResConv module first splits the input features in the channel dimension into two sets of features with a ratio of 1:3. The set of features with a smaller dimension (to reduce the amount of data) is concatenated with the set with a larger dimension after passing through the group convolution network. The concatenated features are then further extracted through two sets of CSM modules with kerenl=1, and then added point by point to the input features to obtain the output of the module. y i The ResConv module processes data using the formula: y i = x i +h4(4)、h4=CSM(CSM( h 3))(5)、 h 3=[h1,h2](6)、h2= x i [:3 / 4×channel,:,:] (7), h1=Conv( x i [3 / 4×channel:,:,:])(8); channel represents the feature dimension of the input feature, h1, h2, h3 and h4 represent the intermediate generation amount of the calculation process, assuming x i The three data dimensions are c, w, and h, so ":3 / 4×channel" means: x i The data from 0 to 3 / 4 of the c dimension in the image is represented by "3 / 4×channel:": x i The data from 3 / 4 to 1 of the c dimension in “,:,” indicates x i All the data of the w dimension in “,:]” indicates x i All data in the h dimension.

[0120] See also Figure 7The CSM module divides the input features into two directions, one direction performs the Conv convolution operation, the other direction performs the Sigmoid operation, and then performs the dot multiplication to obtain the output y i The CSM module's processing of data is expressed as follows: y i = x i ×h1(9), formula (9) can be transformed into (10); where Conv represents a set of processing functions, including a set of 2d convolution, regularization function BN (Batch Normalization) and SiLU activation function. h1 represents the intermediate generation amount of the calculation process.

[0121] The single-input dynamic upsampler Dysample is an important component of gradually restoring feature resolution in dense prediction models. It can increase flexibility, reduce artifacts, and better preserve important features. For its specific structure, please refer to Figure 8 The upsampler first performs feature sampling and deformation operations on the input features, and then obtains the upsampled features through the Grid Sample operation. y i Dysample's data processing is expressed as follows: y i =Grid Sample(h1+h2,h3)(11);where h1 represents the original sampling grid operation, h2 represents x i After convolution, scaling and shifting, h3 represents the result of x i Transformed to facilitate Grid Sample function operation. h1, h2 and h3 represent the intermediate quantities generated during the calculation process.

[0122] The design of the loss function of this embodiment is introduced below. This loss function has an IoU-based loss with dynamic non-monotonic FM, called Wise IoU (WIoU). Dynamic non-monotonic FM uses abnormality instead of IoU to evaluate the quality of anchor boxes and provides a wise gradient gain allocation strategy. This embodiment takes advantage of the Focal loss function and WIoU to create the FocalWise IoU loss.

[0123] The input data of the loss function in this embodiment include: the center coordinates of the frame to be measured (i.e., the target frame) , the center coordinates of the corresponding label box (ie, the actual box) , the width of the minimum bounding box covering the frame to be tested and the label frame , the height of the minimum bounding box covering the frame to be tested and the label frame ; Output data: loss value L focalWIoU .

[0124] The specific steps for calculating losses include:

[0125] 1. , S u Represents the size of the union between the target box and the actual box. W B is the width of the target box, H B The height of the target box. is the actual frame width, The actual frame height.

[0126] 2. , IoU represents the size of the intersection over union ratio between the target box and the actual box.

[0127] 3. Calculate using IoU loss function L IoU =1-IoU.

[0128] 4. , which is the complementary function of WIoU loss, ★ indicates separability. When the complementary function hinders L WIoU When convergence occurs, remove ,make L WIoU Fast convergence.

[0129] 5. Calculate using WIoU loss function L WIoU = R WIoU L IoU .

[0130] 6. α = e ×β, 1 / e ≤β≤1, α , β and C are hyperparameters, where β is a custom parameter. α and C can be obtained through β calculation.

[0131] 7. C=(2 αln β+ α ) / 4.

[0132] 8. Focal Loss Function .

[0133] 9. Combine the focus loss function and WIoU loss function calculation .

[0134] 10. Final loss calculation formula L focalWIoU =(1- L WIoU ) r L WIoU ; r is a hyperparameter, which can be set according to the training situation.

[0135] It should be noted that directly based on L f of L f(WIoU) This will weaken the weighting effect on the object box. L f(WIoU) The gradient of can be expressed as , is a variable, when the target box B i Close to the actual frame , the difference between the two becomes very small, L WIoU Approaching 0, the overall gradient will be very small. To solve this problem, this embodiment uses L WIoU The weighting factor is used to effectively re-suppress the loss. In addition, a parameter r is introduced to control the degree of outlier suppression.

[0136] The following provides relevant experimental results. On a 2*Intel (R) server, various related detection algorithms are compared with this application using CUDA10.2, PyTorch1.9.0, and Python3.7. The selected dataset contains 23,653 images, of which 80% are training sets, 10% are validation sets, and 10% are test sets. The collected data are annotated using LabelImg software. The network training parameters are set as follows: batch size 32, maximum number of iterations 300, input image size 640x640, and a strategy of dynamically adjusting the learning rate using cosine annealing with an initial learning rate of 0.01. This dataset was selected to train the network, conduct ablation experiments, and evaluate the effectiveness of the proposed improvements. This experiment is divided into five groups, of which experiment A is the basic version of YOLOv5s; the optimization comparisons of each experiment are shown in Table 1.

[0137]

[0138] In Table 1, YOLOv5s, YOLOv6s, YOLOv7, and YOLOv8s are existing target detection algorithms; B, C, and D represent Experiment B, Experiment C, and Experiment D. Focal WIoU-loss is the focal loss-free function. MAP0.5 represents the mean average precision when the intersection-over-union ratio is greater than or equal to 0.5. GFLOPs (Giga Floating-point Operations Per second) is the number of floating-point operations per second, which indicates the speed and computing power of performing calculations.

[0139] First, the feature extraction effect of each experiment is analyzed, and the final feature graphs of the models in the five groups of experiments are visualized to obtain the heat maps of the five groups of algorithms. Fig. 9 As shown. Fig. 9 It can be seen that YOLO-Fire is better than the original YOLOv5s (i.e. Fig. 9 As for the target algorithm in the detection, it extracts more target feature points and reduces the number of erroneous target positions, which effectively improves the detection accuracy of fireworks and reduces the false detection rate of the model.

[0140] Different methods use the same data set and parameter settings during the training process. Based on the parameter information during the training process, the loss function curves and MAP0.5 curves of different algorithm experiments during the improvement process are plotted, such as Fig.10 As shown. Fig.10 It can be seen that YOLO-Fire and YOLOv5s (i.e. Fig.10 Compared with the target algorithm in the algorithm, its loss function is lower and its convergence speed is faster, and its MAP0.5 value is improved by 1.1%. MAP (Mean Average Precision) is a commonly used evaluation indicator in target detection models. One epoch is equal to training once with all samples in the training set. In layman's terms, the value of epoch is how many times the entire data set is cycled (the number of times the data set is trained).

[0141] The MAP0.5 values ​​of each category in each experiment on the fireworks dataset are shown in Table 2. As can be seen from Table 2, YOLO-Fire's MAP0.5 detection value for each category in the dataset is significantly better than YOLOv5s. The accuracy of fireworks is improved from 72.3% to 73.1%, and the accuracy of smoke is improved from 41.9% to 43.4%.

[0142]

[0143] In Table 2, YOLOv5 refers to the existing target detection algorithm YOLOv5s; B, C, and D represent Experiment B, Experiment C, and Experiment D. YOLO-Fire is an algorithm provided by the present invention.

[0144] The overall performance indicators of each experiment on the fireworks dataset are shown in Table 3. As can be seen from Table 3, YOLO-Fire has improved to a certain extent in MAP0.5, MAP0.5:0.95 (meaning that the value is averaged every 0.05 steps in the interval 0.5~0.95) and precision P, among which MAP0.5 has increased by 1.1% and precision P has increased by 3.3%. The number of parameters of the model has been reduced by 1.9M, and the computing power required by the model has been reduced by 4.6GFLOPs.

[0145]

[0146] In Table 3, YOLOv5 is: the existing target detection algorithm YOLOv5s; B, C, and D represent experiments B, C, and D. YOLO-Fire is the algorithm provided by the present invention. MAP0.5 represents the average precision when the intersection-over-union ratio is greater than or equal to 0.5. P represents precision. R represents recall. Resolution represents resolution. Parameters represents parameter quantity. GFLOPs (Giga Floating-point Operations Per second) represents 1 billion floating-point operations per second, which represents the speed and computing power of performing calculations.

[0147] The above comparisons were made at a consistent input resolution of 640×640, see Fig.11 , the vertical axis represents the accuracy MAP0.5, and the horizontal axis represents the number of model parameters. In contrast, YOLO-Fire achieved better performance.

[0148] This embodiment is to solve the problems of poor real-time performance, low precision, high false detection rate, etc. of fireworks detection algorithm. A new fireworks detection algorithm YOLO-Fire is proposed. First, simlpeC3 is used to replace the C3 structure of the original yolov5 to improve the model feature extraction capability and reduce the number of model parameters; secondly, a dynamic upsampler is used to increase flexibility, reduce artifacts, and better retain effective features without increasing the amount of model calculation. Finally, Focal WIoU-loss is used to replace loss to reduce the penalty of distance and aspect ratio for fuzzy targets and improve the generalization ability of the model; the separable loss compensation function can also increase the loss efficiency of the model. Experimental results show that in the fireworks data set, the YOLO-Fire algorithm not only improves the accuracy of fireworks detection compared with YOLOv5s, but also improves the real-time performance of model detection, and is more suitable for deployment on edge devices for fireworks detection applications.

[0149] A model training device provided in an embodiment of the present application is introduced below. The model training device described below can be referenced to other embodiments described in this document.

[0150] The present application embodiment discloses a model training device, comprising:

[0151] The image acquisition module to be tested is used to acquire the image to be tested;

[0152] A detection module, used to detect a frame to be tested from the image to be tested using a pre-built feature extractor;

[0153] The calculation module is used to calculate the target loss value of the frame to be tested using the target calculation formula; wherein the target calculation formula is: L focalWIoU =(1- L WIoU ) r L WIoU ; L focalWIoU is the target loss value, L WIoU is the loss value calculated using the WIoU loss function, r are the preset hyperparameters;

[0154] The output module is used to use the current feature extractor as a fire detection model if the target loss value meets the preset convergence condition.

[0155] In one embodiment, it further includes:

[0156] The iterative module is used to update the parameters of the current feature extractor using the target loss value if the target loss value does not meet the preset convergence conditions, obtain an updated feature extractor, replace the current feature extractor with the updated feature extractor, and execute the step of acquiring the image to be tested and other subsequent steps until the target loss value meets the preset convergence conditions.

[0157] In one embodiment, the pre-built feature extractor includes: a first feature extraction layer and a second feature extraction layer;

[0158] The first feature extraction layer includes: at least one first extraction module, at least one second extraction module and a fast feature pyramid pooling module;

[0159] The second feature extraction layer includes: at least one first extraction module, at least one second extraction module, at least one third extraction module, at least one fusion module and at least one target convolution module;

[0160] Any first extraction module, used for performing convolution function group processing and threshold function processing on input data in sequence, and calculating the dot product between the threshold function processing result and the current input data;

[0161] Any second extraction module, used to process input data using the first extraction module located at the input end thereof to obtain shallow features; process shallow features using the convolution group thereof to obtain deep features; concatenate shallow features and deep features to obtain concatenated features; and process concatenated features using the first extraction module located at the output end thereof;

[0162] Fast feature pyramid pooling module, used to quickly pool input data;

[0163] Any third extraction module, used for performing feature sampling processing and matrix adjustment function processing on the input data, and performing interpolation operation on the feature sampling results and the processing results of the matrix adjustment function;

[0164] Any fusion module, used to concatenate two input data;

[0165] Any target convolution module, used to perform convolution operations on input data.

[0166] In one embodiment, the convolution group includes multiple convolution operation blocks, and any convolution operation block divides the input data according to a preset ratio to obtain first sub-data and second sub-data; after performing a convolution operation on the first sub-data, the corresponding convolution operation result is spliced ​​with the second sub-data; the splicing result is processed using two first extraction modules connected in series, and the processing result is summed with the current input data in a bitwise manner.

[0167] In one embodiment, any third extraction module includes: a first feature sampling block, a second feature sampling block, a matrix adjustment function operation block, a summation operation block, and an interpolation operation block;

[0168] The first feature sampling block is used to perform a sampling operation on the input data;

[0169] The second feature sampling block is used to perform a deformation operation on the convolution operation result after performing a convolution operation on the current input data;

[0170] A summing operation block is used to perform positional summing of the sampling operation result and the deformation operation result;

[0171] A matrix adjustment function operation block is used to process current input data using a matrix adjustment function;

[0172] The interpolation operation block is used to perform interpolation operations on the processing results of the matrix adjustment function and the bitwise summation results.

[0173] In one embodiment, any first extraction module is specifically used to: process input data according to a first formula; the first formula is ; y i is the output result of the current first extraction module, x i is the current input data, Conv ( x i )express x i The convolution function group processing result is Represents the processing result of the threshold function Sigmoid.

[0174] In one embodiment, the detection module is specifically used for:

[0175] Use pre-built feature extractors to calibrate multiple object boxes in the image to be tested;

[0176] Multiple object frames are merged according to a preset merging strategy to obtain a frame to be tested.

[0177] In one embodiment, L WIoU The calculation formula is:

[0178] ;in, is the center coordinate of the label frame corresponding to the frame to be tested, is the center coordinate of the frame to be measured, ★ represents a separable symbol, S u Indicates the size of the union of the frame to be tested and the label frame, is the width of the minimum bounding box covering the frame to be tested and the label frame, is the height of the minimum bounding box covering the frame to be detected and the label frame.

[0179] In one embodiment, when When the target loss value is hindered from converging, .

[0180] Among them, for more specific working processes of each module and unit in this embodiment, reference can be made to the corresponding contents disclosed in the aforementioned embodiments, which will not be repeated here.

[0181] It can be seen that this embodiment provides a model training device, so that the loss calculation formula weights the loss value calculated by the WIoU loss function, thereby effectively suppressing the loss; in addition, a hyperparameter is introduced r To control the degree of outlier suppression, the size of the update gradient during model training can be controlled, thereby effectively controlling the model training cycle and making it possible to reduce the model training cycle.

[0182] An image detection device provided in an embodiment of the present application is introduced below. The image detection device described below can be referenced to other embodiments described in this document.

[0183] The present application embodiment discloses an image detection device, comprising:

[0184] A target image acquisition module, used for acquiring a target image;

[0185] A processing module, used for inputting a target image into a fire detection model so that the fire detection model detects a fire area from the target image; the fire detection model is trained according to any of the above methods;

[0186] The display module is used to mark the fire area in the target image and display the image with the marked fire area.

[0187] In one embodiment, the acquisition module is specifically used to: capture the target image from the real-time monitoring video; or obtain the target image by photographing it with a drone.

[0188] In one embodiment, the display module is specifically used to: highlight the fire area in the target image using a preset marking frame; send the image marked with the fire area to a preset control terminal, and display the image marked with the fire area on a display screen connected to the preset control terminal.

[0189] In one embodiment, it further includes:

[0190] The alarm module is used to display an image marked with a fire zone on a display screen connected to a preset control terminal, and at the same time, enable an alarm device connected to the preset control terminal to start an alarm.

[0191] Among them, for more specific working processes of each module and unit in this embodiment, reference can be made to the corresponding contents disclosed in the aforementioned embodiments, which will not be repeated here.

[0192] It can be seen that this embodiment provides a model training device that can detect fire in a timely manner, and promptly issue fire alarms and display real-time images.

[0193] An electronic device provided in an embodiment of the present application is introduced below. The electronic device described below can be referenced to other embodiments described in this document.

[0194] The present application discloses an electronic device, including:

[0195] Memory, used to store computer programs;

[0196] A processor is used to execute the computer program to implement the method disclosed in any of the above embodiments.

[0197] In this embodiment, when the processor executes the computer program stored in the memory, the following steps may be specifically implemented: obtaining an image to be tested; detecting a frame to be tested from the image to be tested using a pre-built feature extractor; and calculating a target loss value of the frame to be tested using a target calculation formula; wherein the target calculation formula is: L focalWIoU =(1- L WIoU ) r L WIoU ; L focalWIoU is the target loss value, L WIoU is the loss value calculated using the WIoU loss function, r is the preset hyperparameter; if the target loss value meets the preset convergence condition, the current feature extractor is used as the fire detection model.

[0198] In this embodiment, when the processor executes the computer program stored in the memory, the following steps can be specifically implemented: if the target loss value does not meet the preset convergence conditions, the target loss value is used to update the parameters of the current feature extractor to obtain an updated feature extractor, and after replacing the current feature extractor with the updated feature extractor, the step of acquiring the image to be tested and other subsequent steps are executed until the target loss value meets the preset convergence conditions.

[0199] In this embodiment, when the processor executes the computer program stored in the memory, the following steps can be specifically implemented: using a pre-built feature extractor to calibrate multiple object frames in the image to be tested; merging the multiple object frames according to a preset merging strategy to obtain a frame to be tested.

[0200] In this embodiment, when the processor executes the computer program stored in the memory, the following steps can be specifically implemented: acquiring a target image; inputting the target image into a fire detection model so that the fire detection model detects a fire area from the target image; the fire detection model is trained according to any of the aforementioned methods; marking the fire area in the target image, and displaying an image with the marked fire area.

[0201] In this embodiment, when the processor executes the computer program stored in the memory, the following steps can be specifically implemented: capturing a target image from a real-time monitoring video; or obtaining a target image by photographing it using a drone.

[0202] In this embodiment, when the processor executes the computer program stored in the memory, the following steps can be specifically implemented: using a preset marking box to highlight the fire area in the target image; sending the image marked with the fire area to a preset control end, and displaying the image marked with the fire area on a display screen connected to the preset control end.

[0203] In this embodiment, when the processor executes the computer program stored in the memory, the following steps can be specifically implemented: while displaying an image marked with a fire area on a display screen connected to a preset control terminal, an alarm device connected to the preset control terminal starts to sound an alarm.

[0204] The fire detection model includes: a first feature extraction layer and a second feature extraction layer;

[0205] The first feature extraction layer includes: at least one first extraction module, at least one second extraction module and a fast feature pyramid pooling module;

[0206] The second feature extraction layer includes: at least one first extraction module, at least one second extraction module, at least one third extraction module, at least one fusion module and at least one target convolution module;

[0207] Any first extraction module, used for performing convolution function group processing and threshold function processing on input data in sequence, and calculating the dot product between the threshold function processing result and the current input data;

[0208] Any second extraction module, used to process input data using the first extraction module located at the input end thereof to obtain shallow features; process shallow features using the convolution group thereof to obtain deep features; concatenate shallow features and deep features to obtain concatenated features; and process concatenated features using the first extraction module located at the output end thereof;

[0209] Fast feature pyramid pooling module, used to quickly pool input data;

[0210] Any third extraction module, used for performing feature sampling processing and matrix adjustment function processing on the input data, and performing interpolation operation on the feature sampling results and the processing results of the matrix adjustment function;

[0211] Any fusion module, used to concatenate two input data;

[0212] Any target convolution module, used to perform convolution operations on input data.

[0213] In one embodiment, the convolution group includes multiple convolution operation blocks, and any convolution operation block divides the input data according to a preset ratio to obtain first sub-data and second sub-data; after performing a convolution operation on the first sub-data, the corresponding convolution operation result is spliced ​​with the second sub-data; the splicing result is processed using two first extraction modules connected in series, and the processing result is summed with the current input data in a bitwise manner.

[0214] In one embodiment, any third extraction module includes: a first feature sampling block, a second feature sampling block, a matrix adjustment function operation block, a summation operation block, and an interpolation operation block;

[0215] The first feature sampling block is used to perform a sampling operation on the input data;

[0216] The second feature sampling block is used to perform a deformation operation on the convolution operation result after performing a convolution operation on the current input data;

[0217] A summing operation block is used to perform positional summing of the sampling operation result and the deformation operation result;

[0218] A matrix adjustment function operation block is used to process current input data using a matrix adjustment function;

[0219] The interpolation operation block is used to perform interpolation operations on the processing results of the matrix adjustment function and the bitwise summation results.

[0220] Furthermore, the present application also provides an electronic device. The electronic device can be Fig.12 The server shown can also be Fig.13 Terminal shown. Fig.12 and Fig.13 All of them are structural diagrams of electronic devices according to an exemplary embodiment, and the contents in the diagrams cannot be regarded as any limitation on the scope of use of the present application.

[0221] Fig.12 A schematic diagram of the structure of a server provided in an embodiment of the present application. The server may specifically include: at least one processor, at least one memory, a power supply, a communication interface, an input / output interface, and a communication bus. The memory is used to store a computer program, which is loaded and executed by the processor to implement the relevant steps in the model training disclosed in any of the aforementioned embodiments.

[0222] In this embodiment, the power supply is used to provide working voltage for each hardware device on the server; the communication interface can create a data transmission channel between the server and external devices, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0223] In addition, the memory as a carrier for resource storage can be a read-only memory, random access memory, disk or CD, etc. The resources stored thereon include operating system, computer programs and data, etc. The storage method can be temporary storage or permanent storage.

[0224] The operating system is used to manage and control the hardware devices and computer programs on the server to realize the operation and processing of the data in the memory by the processor, which can be Windows Server, Netware, Unix, Linux, etc. In addition to computer programs that can be used to complete the model training method disclosed in any of the aforementioned embodiments, computer programs can also further include computer programs that can be used to complete other specific tasks. In addition to data such as application update information, data can also include data such as application developer information.

[0225] Fig.13 A schematic diagram of the structure of a terminal provided in an embodiment of the present application, the terminal may specifically include but is not limited to a smart phone, a tablet computer, a laptop computer or a desktop computer, etc.

[0226] Generally, the terminal in this embodiment includes: a processor and a memory.

[0227] Among them, the processor may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.

[0228] The memory may include one or more computer non-volatile storage media, which may be non-transitory. The memory may also include high-speed random access memory, and non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory is at least used to store the following computer program, wherein, after the computer program is loaded and executed by the processor, it can implement the relevant steps in the model training method performed by the terminal side disclosed in any of the aforementioned embodiments. In addition, the resources stored in the memory may also include an operating system and data, etc., and the storage method may be short-term storage or permanent storage. Among them, the operating system may include Windows, Unix, Linux, etc. The data may include, but is not limited to, update information of the application.

[0229] In some embodiments, the terminal may also include a display screen, an input and output interface, a communication interface, a sensor, a power supply, and a communication bus.

[0230] Those skilled in the art will understand that Fig.13 The structure shown in the figure does not constitute a limitation on the terminal, and may include more or fewer components than those shown in the figure.

[0231] A non-volatile storage medium provided in an embodiment of the present application is introduced below. The non-volatile storage medium described below can be cross-referenced with other embodiments described herein.

[0232] A non-volatile storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the related methods disclosed in the above embodiments. The non-volatile storage medium is a computer-readable non-volatile storage medium, which, as a carrier for storing resources, may be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon include an operating system, a computer program and data, etc., and the storage method may be temporary storage or permanent storage.

[0233] In this embodiment, when the processor executes the computer program stored in the non-volatile storage medium, the following steps may be specifically implemented: obtaining an image to be tested; detecting a frame to be tested from the image to be tested using a pre-built feature extractor; and calculating a target loss value of the frame to be tested using a target calculation formula; wherein the target calculation formula is: L focalWIoU =(1- L WIoU ) r L WIoU ; L focalWIoU is the target loss value, L WIoU is the loss value calculated using the WIoU loss function, r is the preset hyperparameter; if the target loss value meets the preset convergence condition, the current feature extractor is used as the fire detection model.

[0234] In this embodiment, when the processor executes a computer program stored in a non-volatile storage medium, the following steps can be specifically implemented: if the target loss value does not meet the preset convergence conditions, the target loss value is used to update the parameters of the current feature extractor to obtain an updated feature extractor, and after replacing the current feature extractor with the updated feature extractor, the step of acquiring the image to be tested and other subsequent steps are executed until the target loss value meets the preset convergence conditions.

[0235] In this embodiment, when the processor executes the computer program stored in the non-volatile storage medium, the following steps can be specifically implemented: using a pre-built feature extractor to calibrate multiple object frames in the image to be tested; merging the multiple object frames according to a preset merging strategy to obtain a frame to be tested.

[0236] In this embodiment, when the processor executes a computer program stored in a non-volatile storage medium, the following steps can be specifically implemented: acquiring a target image; inputting the target image into a fire detection model so that the fire detection model detects a fire area from the target image; the fire detection model is trained according to any of the aforementioned methods; marking the fire area in the target image, and displaying an image with the marked fire area.

[0237] In this embodiment, when the processor executes the computer program stored in the non-volatile storage medium, the following steps can be specifically implemented: capturing the target image from the real-time monitoring video; or obtaining the target image by photographing with a drone.

[0238] In this embodiment, when the processor executes the computer program stored in the non-volatile storage medium, the following steps can be specifically implemented: using a preset marking box to highlight the fire area in the target image; sending the image marked with the fire area to a preset control end, and displaying the image marked with the fire area on a display screen connected to the preset control end.

[0239] In this embodiment, when the processor executes the computer program stored in the non-volatile storage medium, the following steps can be specifically implemented: while displaying an image marked with a fire area on a display screen connected to a preset control terminal, an alarm device connected to the preset control terminal starts to sound an alarm.

[0240] A computer program product provided in an embodiment of the present application is introduced below. The computer program product described below can be cross-referenced with other embodiments described in this document.

[0241] A computer program product comprises a computer program / instruction, which implements the steps of the aforementioned related method when executed by a processor.

[0242] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0243] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of non-volatile storage medium known in the art.

[0244] Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A model training method, characterized in that: include: Acquire the image to be tested; Detecting a frame to be tested from the image to be tested using a pre-built feature extractor; The target loss value of the frame to be tested is calculated using a target calculation formula; wherein the target calculation formula is: L focalWIoU =(1- L WIoU ) r L WIoU ; L focalWIoU is the target loss value, L WIoU is the loss value calculated using the WIoU loss function, r are the preset hyperparameters; If the target loss value meets the preset convergence condition, the current feature extractor is used as a fire detection model.

2. The method according to claim 1, characterized in that Also includes: If the target loss value does not meet the preset convergence conditions, the target loss value is used to update the parameters of the current feature extractor to obtain an updated feature extractor. After replacing the current feature extractor with the updated feature extractor, the step of acquiring the image to be tested and other subsequent steps are executed until the target loss value meets the preset convergence conditions.

3. The method according to claim 1, characterized in that The pre-built feature extractor includes: a first feature extraction layer and a second feature extraction layer; The first feature extraction layer includes: at least one first extraction module, at least one second extraction module and a fast feature pyramid pooling module; The second feature extraction layer includes: at least one first extraction module, at least one second extraction module, at least one third extraction module, at least one fusion module and at least one target convolution module; Any first extraction module, used for performing convolution function group processing and threshold function processing on input data in sequence, and calculating the dot product between the threshold function processing result and the current input data; Any second extraction module, used to process input data using the first extraction module located at the input end thereof to obtain shallow features; process the shallow features using the convolution group in itself to obtain deep features; concatenate the shallow features and the deep features to obtain concatenated features; and process the concatenated features using the first extraction module located at the output end thereof; The fast feature pyramid pooling module is used to perform fast pooling processing on the input data; Any third extraction module, used for performing feature sampling processing and matrix adjustment function processing on the input data, and performing interpolation operation on the feature sampling results and the processing results of the matrix adjustment function; Any fusion module, used to concatenate two input data; Any target convolution module, used to perform convolution operations on input data.

4. The method according to claim 3, characterized in that The convolution group includes a plurality of convolution operation blocks, and any convolution operation block divides the input data according to a preset ratio to obtain first sub-data and second sub-data; after performing a convolution operation on the first sub-data, the corresponding convolution operation result is concatenated with the second sub-data; The splicing result is processed using two first extraction modules connected in series, and the processing result is summed with the current input data in a bitwise manner.

5. The method according to claim 3, characterized in that: Any third extraction module includes: a first feature sampling block, a second feature sampling block, a matrix adjustment function operation block, a summation operation block and an interpolation operation block; The first feature sampling block is used to perform a sampling operation on the input data; The second feature sampling block is used to perform a deformation operation on the convolution operation result after performing a convolution operation on the current input data; The summing operation block is used to perform positional summing on the sampling operation result and the deformation operation result; The matrix adjustment function operation block is used to process the current input data using the matrix adjustment function; The interpolation operation block is used to perform an interpolation operation on the processing result of the matrix adjustment function and the bitwise summation result.

6. The method according to claim 3, characterized in that Any first extraction module is specifically used to: process input data according to a first formula; the first formula is ; y i is the output result of the current first extraction module, x i is the current input data, Conv ( x i )express x i The convolution function group processing result is Indicates the result of threshold function processing.

7. The method according to any one of claims 1 to 6, characterized in that: Detecting a frame to be tested from the image to be tested using a pre-built feature extractor, including: Using a pre-built feature extractor to calibrate multiple object boxes in the image to be tested; The multiple object frames are merged according to a preset merging strategy to obtain the frame to be tested.

8. The method according to any one of claims 1 to 6, characterized in that: L WIoU The calculation formula is: ;in, is the center coordinate of the label frame corresponding to the frame to be measured, is the center coordinate of the frame to be measured, ★ represents a separable symbol, S u represents the union size of the frame to be tested and the label frame, is the width of the minimum bounding box covering the frame to be tested and the label frame, is the height of the minimum bounding box covering the frame to be detected and the label frame.

9. The method according to claim 8, characterized in that If the width of the minimum bounding box and / or the height of the minimum bounding box meet the preset conditions, then L WIoU The calculation formula is: .

10. The method according to claim 9, characterized in that The minimum bounding box width and / or the minimum bounding box height satisfying the preset conditions include: The width of the minimum enclosing box is greater than a preset first value and / or the height of the minimum enclosing box is greater than a preset second value; or the gradient value calculated based on the width of the minimum enclosing box and / or the height of the minimum enclosing box is less than a preset third value.

11. The method according to claim 10, characterized in that The gradient value is calculated based on the width of the minimum bounding box and / or the height of the minimum bounding box, including: Calculate the gradient value according to the second formula or the third formula; Wherein, the second formula is: ; The third formula is: ; A , B represents the gradient value, is the center coordinate of the label frame corresponding to the frame to be measured, is the center coordinate of the frame to be measured, represents partial derivative, is the width of the minimum bounding box covering the frame to be tested and the label frame, is the height of the minimum bounding box covering the frame to be detected and the label frame.

12. An image detection method, characterized in that: include: Get the target image; Inputting the target image into a fire detection model so that the fire detection model detects a fire area from the target image; The fire detection model is trained according to the method described in any one of claims 1 to 11; The fire area is marked in the target image, and the image with the marked fire area is displayed.

13. The method according to claim 12, characterized in that Get the target image, including: Intercepting the target image from the real-time monitoring video; or The target image is obtained by photographing with a drone.

14. The method according to claim 12, characterized in that Marking the fire area in the target image and displaying the image marked with the fire area, comprising: Using a preset marking frame to highlight the fire area in the target image; The image marked with the fire area is sent to a preset control terminal, and the image marked with the fire area is displayed on a display screen connected to the preset control terminal.

15. The method according to claim 14, characterized in that Also includes: While the image marked with the fire area is displayed on the display screen connected to the preset control terminal, the alarm device connected to the preset control terminal starts to alarm.

16. A model training device, characterized in that: include: The image acquisition module to be tested is used to acquire the image to be tested; A detection module, used for detecting a frame to be tested from the image to be tested using a pre-built feature extractor; The calculation module is used to calculate the target loss value of the frame to be tested by using a target calculation formula; wherein the target calculation formula is: L focalWIoU =(1- L WIoU ) r L WIoU ; L focalWIoU is the target loss value, L WIoU is the loss value calculated using the WIoU loss function, r are the preset hyperparameters; The output module is used to use the current feature extractor as a fire detection model if the target loss value meets the preset convergence condition.

17. An image detection device, characterized in that: include: A target image acquisition module, used for acquiring a target image; A processing module, used for inputting the target image into a fire detection model, so that the fire detection model detects a fire area from the target image; The fire detection model is trained according to the method described in any one of claims 1 to 11; The display module is used to mark the fire area in the target image and display the image marked with the fire area.

18. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to execute the computer program to implement the method according to any one of claims 1 to 15.

19. A non-volatile storage medium, characterized in that: Used to store a computer program, wherein when the computer program is executed by a processor, the method according to any one of claims 1 to 15 is implemented.

20. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the method according to any one of claims 1 to 15 is implemented.