A fire real-time early warning method based on optical image coding
By fusing spectral and chromatographic information through optical image encoding and sine/cosine temperature encoding, combined with lightweight detection methods, the problems of fire alarm delay and false alarms in open deck spaces have been solved, achieving efficient and accurate real-time fire detection.
Patent Information
- Application Number
- CN202510991566.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-18
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2045-07-18
AI Technical Summary
In open deck spaces, smoke spreads rapidly, and the smoke concentration is insufficient to activate sensors. The flame shape and heat distribution change quickly, leading to fire alarm delays and high false alarm rates. Existing infrared thermal imaging technology has poor accuracy in multi-heat source environments.
A real-time fire early warning method based on optical image coding is adopted. It utilizes sine and cosine temperature coding to fuse spectral and chromatographic information, and combines it with a lightweight detection method to train a classification model for fire detection.
It improves the accuracy and real-time performance of fire detection, reduces the computational resource requirements, and is suitable for real-time fire detection in open deck spaces.
Smart Images

Figure CN120510676B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of fire situation prediction, in particular, especially relates to a fire situation real-time early warning method based on optical image coding. BACKGROUND
[0002] The deck is usually in the ocean and is affected by wind, so the smoke can spread rapidly without accumulating, resulting in insufficient smoke concentration to activate the sensor. In addition, the non-enclosed space means that the smoke sensor may need a longer time to capture a sufficient amount of smoke, which delays the issuance of the fire alarm and reduces the effective window period for responding to the fire. Although infrared thermal imaging technology is commonly used in fire detection, there may be multiple heat sources on the deck, such as engines or direct sunlight on metal surfaces, which can increase the false positive rate. In addition, under the action of wind, the shape and heat distribution of the flame can change rapidly, which increases the difficulty of accurately identifying the flame and excluding false positive signals. In order to overcome the influence of the open space of the deck on fire situation early warning, researchers have developed various technologies and methods to make the fire situation early warning system more capable of accurately providing fire situation early warning results in the open space of the deck. SUMMARY
[0003] According to the above-mentioned technical problems, a fire situation real-time early warning method based on optical image coding is provided. The present application introduces sine-cosine temperature coding to obtain image feature information with both frequency spectrum and color spectrum, and by fusing frequency spectrum and color spectrum information, the accuracy of fire situation detection is improved, especially in complex environments with multiple heat sources on the deck. At the same time, in view of the requirement of real-time, the lightweight detection method significantly reduces the demand for computing resources and processing time while ensuring detection accuracy, so that the fire situation early warning system can realize real-time detection in the open space of the deck. Finally, based on real fire situation data sets for training, reasoning, fire situation detection is carried out in various open scenarios.
[0004] The technical means adopted by the present application are as follows:
[0005] A fire situation real-time early warning method based on optical image coding, comprising the following steps:
[0006] Obtain a fire situation optical image data set, and construct training data based on the fire situation optical image data set;
[0007] Preprocess the training data to obtain target data, the preprocessing at least including aspect ratio preserving processing, padding processing, center cropping processing, data standardization processing and data normalization processing;
[0008] Use sine-cosine temperature coding to convert the features of the target data to obtain image feature information;
[0009] According to the image feature information, a lightweight fire detection method is used to obtain a fire class probability distribution of the images in the target data;
[0010] A preset classification model is trained based on the target data, and a cross-entropy loss of the preset classification model is calculated based on the fire class probability distribution, until the cross-entropy loss converges, to obtain a target classification model, and real-time fire warning is completed based on the target classification model.
[0011] Optionally, the step of preprocessing the training data to obtain target data comprises:
[0012] The aspect ratio preserving processing in preprocessing the training data obtains primary data;
[0013] The actual size of each image in the primary data is matched with a preset target size to obtain a matching result, and the filling processing in preprocessing the primary data is performed according to the matching result to obtain secondary data satisfying the preset target size;
[0014] The center cropping processing in preprocessing the secondary data obtains cropped data;
[0015] The data standardization processing in preprocessing the cropped data obtains standardized data;
[0016] The data normalization processing in preprocessing the standardized data obtains the target data.
[0017] Optionally, the step of using the sine-cosine temperature coding to convert the features of the target data to obtain image feature information comprises:
[0018] Based on the width of the target data, the height of the target data, the grid coordinates of the target data in the width direction, the grid coordinates of the target data in the height direction, the embedding dimension, the frequency factor of the target data, and the temperature parameter of the target data, the sine-cosine position embedding is performed through the sine-cosine temperature coding to obtain the first sine-cosine embedding data of the target data in the width direction and the second sine-cosine embedding data of the target data in the height direction;
[0019] The position embedding data of the target data is determined according to the first sine-cosine embedding data and the second sine-cosine embedding data;
[0020] The feature shape of the target data is adjusted according to the position embedding data through a tensor dimension changing method and a size adjusting method to obtain adjusted data;
[0021] The repeated position embedding data of the adjusted data is determined.
[0022] Splicing the target data and the repetitive position embedded data to obtain splicing data;
[0023] Feature extraction is performed on the splicing data through a 2D convolution operation to obtain image feature information.
[0024] Optionally, the step of obtaining a fire class probability distribution of an image in the target data according to the image feature information by using a lightweight fire detection method comprises:
[0025] ;
[0026] 2D convolution operation is performed on the image feature information to obtain convolution data;
[0027] The advanced feature data of the target data is calculated based on the image feature information after batch normalization by using an h-Swish activation function.
[0028] The advanced feature data is input into a preset neck feature extraction module to obtain complex feature, and the mathematical representation of the preset neck feature extraction module is:
[0029] ;
[0030] wherein, represents a feature extraction operation, x represents an input operation, and SE() represents a channel attention mechanism, and the advanced feature data f 2 is input as an input feature;
[0031] The fire class probability distribution of the image in the target data is obtained by using a lightweight fire detection method based on the complex feature, and the mathematical representation of the lightweight fire detection method is:
[0032] ;
[0033] wherein, represents a global average pooling operation, represents a fully connected layer, represents a fully connected layer weight, represents a bias term, represents a fire class probability distribution.
[0034] Optionally, the step of calculating the cross-entropy loss of the preset classification model based on the fire class probability distribution comprises:
[0035] The cross-entropy loss of the preset classification model is calculated based on the fire class probability distribution by using a cross-entropy loss function, and the mathematical representation of the cross-entropy loss function is:
[0036] ;
[0037] wherein represents a cross-entropy loss function, represents the total number of classifications, represents the batch size, represents an indicator function of the real label on the n class of the i sample, represents the probability predicted by the preset classification model on the n class of the i sample, is a probability distribution matrix output by the preset classification model, is a one-hot encoding matrix of the real label.
[0038] Compared with the prior art, the present application has the following advantages:
[0039] 1. To solve the problem of fusion of spectral and color spectrum information in fire detection tasks, the present application introduces a sine-cosine temperature coding strategy, which effectively fuses spectral and color spectrum information together, and helps to identify the spectral characteristics unique to flames and distinguish different types of flames and backgrounds.
[0040] 2. To effectively extract features in the image while ensuring the efficiency of the early warning method, the present application proposes a lightweight fire detection method, which uses an efficient inverted residual block design to significantly reduce the computational load while maintaining high accuracy.
[0041] Based on the above reasons, the present application is widely used in the field of fire detection, and is especially suitable for real-time detection of fire in complex scenes such as optical equipment. BRIEF DESCRIPTION OF DRAWINGS
[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or prior art description will be briefly introduced below. Obviously, the drawings in the following description are some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor.
[0043] Figure 1 The model flowchart of the present application.
[0044] Figure 2 The fire detection results of the present application and other algorithms in low-resolution outdoor open fire scenes;
[0045] Figure 3 The fire detection results of the present application and other algorithms in complex open fire scenes;
[0046] Figure 4 Results of the fire detection of the present application and other algorithms in the outdoor smoke scene;
[0047] Figure 5 Results of the fire detection of the present application and other algorithms in the indoor smoke scene. DETAILED DESCRIPTION
[0048] In order for those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor should fall within the scope of protection of the present application.
[0049] It should be noted that the terms "first", "second", and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0050] In order to verify the generalization of the present application to complex underwater scenes, underwater images of different scenes are selected as the test set, and the experimental results of InceptionV3, MobilOne and ShuffleNet algorithms are compared and analyzed from qualitative and quantitative aspects. The specific steps and principles are as follows:
[0051] As shown in Figure 1 The present application provides a fire real-time early warning method based on optical image coding, which includes the following steps:
[0052] Obtain a fire optical image data set, and construct training data based on the fire optical image data set;
[0053] Preprocess the training data to obtain target data, the preprocessing at least includes maintaining aspect ratio processing, padding processing, center cropping processing, data standardization processing and data normalization processing;
[0054] Feature conversion is performed on the target data by using sine-cosine temperature coding to obtain image feature information;
[0055] According to the image feature information, a lightweight fire detection method is used to obtain a fire class probability distribution of the image in the target data;
[0056] A preset classification model is trained based on the target data, and a cross-entropy loss of the preset classification model is calculated based on the fire class probability distribution until the cross-entropy loss converges, thereby obtaining a target classification model, and completing real-time fire warning based on the target classification model.
[0057] Exemplarily, a fire real-time warning method based on optical image coding includes S01: obtaining a fire optical image dataset, and randomly dividing the dataset into a training set, a validation set, and a test set according to a ratio of 8:1:1.
[0058] S02: Compress the image size through image preprocessing operations; the image preprocessing operations include size adjustment to maintain the aspect ratio, center cropping, data standardization, and data normalization.
[0059] S03: Use sine-cosine temperature coding to perform feature conversion on the compressed image in S02 as input to obtain image feature information with both frequency spectrum and color spectrum.
[0060] S04: Use a lightweight fire detection method to obtain a fire class probability distribution of the image in S02 based on the compressed image in S02 and the image feature information in S03.
[0061] S05: Calculate the cross-entropy loss using the detection result in S04, wait for the loss to converge, and complete model training.
[0062] In a possible implementation, the step of preprocessing the training data to obtain target data includes:
[0063] The aspect ratio maintaining processing in preprocessing the training data obtains primary data;
[0064] The actual size of each image in the primary data is matched with a preset target size to obtain a matching result, and the filling processing in preprocessing the primary data is performed according to the matching result to obtain secondary data that satisfies the preset target size;
[0065] The center cropping processing in preprocessing the secondary data obtains cropped data;
[0066] The data standardization processing in preprocessing the cropped data obtains standardized data;
[0067] The standardized data is preprocessed by data normalization to obtain the target data. For example, the image preprocessing operation keeps the aspect ratio of the size adjustment method as follows:
[0068] ;
[0069] wherein (w, h) represents the width and height of the input image, (w', h') represents the width and height of the target size, and s represents the scaling ratio. W H w h s
[0070] Based on the scaling ratio s, the input image is adjusted as follows: s I :
[0071] ;
[0072] ;
[0073] ;
[0074] wherein img_in represents the input image, img_out represents the output image, resize() represents the image scaling method, and w, h represent the width and height of the output image. I I I
[0075] In order to match the adjusted image to the target size, padding is performed in the width or height direction as follows:
[0076] ;
[0077] ;
[0078] ;
[0079] wherein img_pad represents the padded image, w_pad represents the padding size in the width direction, h_pad represents the padding size in the height direction, pad() represents the padding operation, and 114 represents the pixel value used for padding. I I
[0080] The image preprocessing operation is a center cropping method as follows:
[0081] ;
[0082] ;
[0083] ;
[0084] ;
[0085] wherein (w, h) represents the width and height of the padding image w , h , (w1, h1) represents the width and height of the target cropped image, (x, y) represents the top-left corner coordinate of the cropped region, (x+w, y+h) represents the bottom-right corner coordinate of the cropped region. I w h x , y x’ , y’
[0086] ;
[0087] wherein I 3 represents the cropped image, represents the cropping operation, the cropped image I 3 is a region in the padding image I 2 from (x, y) to (x+w, y+h). x y The image preprocessing data standardization method is: x’ y’
[0088] The image preprocessing data standardization method is:
[0089] ;
[0090] wherein represents the mean value of the cropped image I 3, represents the standard deviation of the cropped image I 3, I 4 represents the standardized image.
[0091] The image preprocessing data normalization method is:
[0092] ;
[0093] wherein represents the minimum value of the cropped image I 4, represents the maximum value of the cropped image I 4, I 5 represents the normalized image.
[0094] In one possible implementation, the step of using the sine-cosine temperature coding to perform feature conversion on the target data to obtain image feature information comprises:
[0095] based on the width of the target data, the height of the target data, the grid coordinates of the target data in the width direction, the grid coordinates of the target data in the height direction, the embedding dimension, the frequency factor of the target data and the temperature parameter of the target data, performing sine-cosine position embedding by sine-cosine temperature encoding to obtain first sine-cosine embedding data of the target data in the width direction and second sine-cosine embedding data of the target data in the height direction;
[0096] determining the position embedding data of the target data according to the first sine-cosine embedding data and the second sine-cosine embedding data;
[0097] adjusting the feature shape of the target data according to the position embedding data by a tensor dimension changing method and a size adjusting method to obtain adjustment data;
[0098] determining the repeated position embedding data of the adjustment data;
[0099] splicing the target data and the repeated position embedding data to obtain splicing data;
[0100] performing feature extraction on the splicing data by a 2D convolution operation to obtain image feature information. ;
[0101] ;
[0102] wherein represents an encoded input image I 4, the width and height of represents the grid coordinates in the width direction, represents the grid coordinates in the height direction.
[0103] ;
[0104] wherein represents the embedding dimension, represents the frequency factor, represents the temperature parameter.
[0105] based on the above parameters, performing sine-cosine position embedding:
[0106] exemplarily, define:
[0107] ;
[0108] ;
[0109] wherein represents the sine-cosine embedding in the width direction, sin-cos embedding representing the height direction.
[0110] Final position embedding:
[0111] ;
[0112] wherein represents the position embedding.
[0113] Adjusting the image feature shape:
[0114] ;
[0115] wherein represents the position embedding after shape adjustment, permute() represents a tensor dimension change method, and reshape() represents a size adjustment method.
[0116] Repeating the position embedding:
[0117] ;
[0118] wherein represents the position embedding after repetition, permute() represents a tensor dimension change method, reshape() represents a size adjustment method, and b represents the batch size of the input image.
[0119] Further combining the encoded input image I 4 with the position embedding after repetition to provide more abundant input features for subsequent convolution operations:
[0120] ;
[0121] wherein represents the image position feature, and concat() represents a concatenation operation.
[0122] Further performing feature extraction on f :
[0123] ;
[0124] wherein represents the image feature, act() represents a Relu activation function, and fconv() represents a 2D convolution operation.
[0125] In one possible implementation, the step of obtaining the fire class probability distribution of the image in the target data according to the image feature information by using a lightweight fire detection method comprises:
[0126] ;
[0127] performing 2D convolution operation on the image feature information to obtain convolution data;
[0128] calculating advanced feature data of the target data based on the image feature information after batch normalization through an h-Swish activation function;
[0129] inputting the advanced feature data into a preset neck feature extraction module to obtain complex feature, and the mathematical representation of the preset neck feature extraction module is:
[0130] ;
[0131] wherein, represents a feature extraction operation, x represents an input operation, and SE() represents a channel attention mechanism, f 2 as input feature;
[0132] obtaining a fire class probability distribution of the image in the target data based on the complex feature by using a lightweight fire detection method, wherein the mathematical representation of the lightweight fire detection method is:
[0133] ;
[0134] wherein represents a global average pooling operation, represents a fully connected layer, represents a fully connected layer weight, represents a bias term, represents a fire class probability distribution.
[0135] For example, the initial feature extraction method in the lightweight fire detection method is:
[0136] ;
[0137] wherein represents an image feature, fconv() represents a 2D convolution operation, BN() represents a batch normalization operation, and h-Swish() represents an h-Swish activation function, represents an image initial feature.
[0138] To further extract features in the image, the neck feature extraction module is designed as:
[0139] ;
[0140] wherein represents a feature extraction operation, x represents an input operation, and SE() represents a channel attention mechanism, fUsing 2 as input features, the `neck()` operation is repeated eight times to obtain complex features. f 3.
[0141] ;
[0142] in This indicates a global average pooling operation. Indicates a fully connected layer. Indicates the weights of the fully connected layer. Indicates the bias term. The output tensor represents the probability distribution of fire types.
[0143] The step of calculating the cross-entropy loss of the preset classification model based on the fire category probability distribution includes:
[0144] The cross-entropy loss of the preset classification model is calculated based on the probability distribution of the fire category using the cross-entropy loss function, wherein the mathematical representation of the cross-entropy loss function is:
[0145] ;
[0146] in Represents the cross-entropy loss function. Indicates the total number of categories. Indicates batch size. Indicates the true label in the first place n The first sample i Indicator functions on the class, This indicates that the pre-defined classification model predicts the value at the 1st... n The first sample i Probability on class, It is the probability distribution matrix output by the preset classification model. It is the one-hot encoded matrix of the real label.
[0147] For example, the cross-entropy loss is calculated as follows:
[0148] ;
[0149] in Represents the cross-entropy loss function. Indicates the total number of categories. Indicates batch size. Indicates the true label in the first place n The first sample i The indicator function on the class takes a value of 1 or 0. For the tags encoded in this invention, the position corresponding to the actual fire category is 1, and the other positions are 0. This indicates that the model predicts the value in the 1st... n The first samplei probabilities on classes. is a probability distribution matrix of model output, is a one-hot encoding matrix of true labels.
[0150] As Figure 2 shown, the present application provides fire detection results of outdoor open fire scene at low resolution with other algorithms, from which Figure 2 (b), Figure 2 (c) and Figure 2 (d) can be seen, MobilOne, ShuffleNet and the algorithm of the present application all detect the correct fire results, which are affected by the open scene, as shown in Figure 2 (a), InceptionV3 incorrectly detects the fire scene as no fire. Although MobilOne and ShuffleNet correctly detect the scene fire information, the confidence of MobilOne is 0.61 and the confidence of ShuffleNet is 0.55, both of which are lower than the confidence 0.63 of the algorithm of the present application. The algorithm of the present application correctly detects the scene fire information and achieves the highest confidence.
[0151] As Figure 3 shown, the present application provides fire detection results of complex fire scene with other algorithms, from which the experimental effect diagram can be seen, and four kinds of algorithms all correctly detect the scene fire information. Since the optical image scene contains too much object information, as shown in Figure 3 (c), although ShuffleNet correctly detects the scene information, it obtains a lower confidence of 0.83. As shown in Figure 3 (a) and Figure 3 (b), although the confidence of InceptionV3 and MobilOne reaches 0.91 and 0.90, they are both lower than the confidence 0.92 of the algorithm of the present application. As shown in Figure 3 (d), the algorithm of the present application correctly detects the scene fire information and achieves the highest confidence.
[0152] As Figure 4 shown, the present application provides fire detection results of outdoor smoke scene with other algorithms, from which the experimental effect diagram can be seen, and four kinds of algorithms all correctly detect the scene fire information. As shown in Figure 4 (a), Figure 4 (b) and Figure 2 (c), since the scene does not contain explicit flame information but only smoke information, InceptionV3, MobilOne and ShuffleNet all obtain a lower confidence (0.77, 0.87 and 0.85), as shown in Figure 4As shown in (d), the algorithm of the present application achieves the highest confidence of 0.92. The algorithm of the present application correctly detects the fire information of the scene and achieves the highest confidence.
[0153] As shown in (a), (b) and (c), the algorithm of the present application achieves the highest confidence of 0.97. The algorithm of the present application correctly detects the fire information of the scene and achieves the highest confidence. Figure 5 As shown in (a), (b) and (c), the algorithm of the present application achieves the highest confidence of 0.97. The algorithm of the present application correctly detects the fire information of the scene and achieves the highest confidence. Figure 5 (a), (b) and (c) show that since the picture scene is located indoors and does not contain explicit smoke information, only the thin smoke state is shown, therefore, InceptionV3, MobilOne and ShuffleNet all achieve lower confidence (0.85, 0.87 and 0.91), as shown in (d), the algorithm of the present application achieves the highest confidence of 0.97. The algorithm of the present application correctly detects the fire information of the scene and achieves the highest confidence. Figure 5 As shown in (a), (b) and (c), the algorithm of the present application achieves the highest confidence of 0.97. The algorithm of the present application correctly detects the fire information of the scene and achieves the highest confidence. Figure 5 Figure 5 The present embodiment compares different algorithms from the objective indicators of Top-1 accuracy, Flops and Params; Top-1 accuracy represents whether the most likely category in the prediction result of the model is consistent with the true label, which is a basic indicator for measuring the performance of a classification model. The higher the Top-1 accuracy, the better the classification effect of the model. Flops (Floating Point Operations Per Second) represents the number of floating point operations required in one forward propagation process of the model, with the unit of G. The smaller the Fops, the lower the computational complexity of the model, which means that the model is more efficient in inference. Params (parameter quantity): parameter quantity represents the number of trainable parameters of the model, with the unit of M (Million). The smaller the parameter quantity, the lower the storage requirement of the model, which also means that the model is easier to deploy on resource-constrained devices. The model of the present application is superior to ShuffleNet, MobilOne and InceptionV3 in terms of Top-1 accuracy, Flops (floating point operation times) and Params (parameter quantity). Specifically, the model of the present application not only performs best in the accuracy of the fire detection data set, but also has the lowest computational complexity and the most lightweight model. Therefore, the model of the present application has great advantages in the fire detection task, and is especially suitable for deployment and use in resource-constrained practical application scenarios.
[0154] Table 1 Comparison of Top-1 accuracy of processing results of the model of the present application and other advanced algorithms
[0155]
[0156]
[0157] Table 2 Comparison of Flops of processing results of the model of the application and other advanced algorithms (unit: G)
[0158]
[0159] Table 3 Comparison of Params of processing results of the model of the application and other advanced algorithms (unit: M)
[0160]
[0161] The above-mentioned embodiment numbers of the application are only for description, and do not represent the advantages and disadvantages of the embodiments. In the above-mentioned embodiments of the application, the description of each embodiment has its own emphasis, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments. In the several embodiments provided in the present application, it should be understood that the disclosed technical contents can be realized by other means.
[0162] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the application, and not to limit them; although the application has been described in detail with reference to the above embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the above-mentioned embodiments, or make equivalent replacement for part or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the application.
Claims
1. A fire real-time early warning method based on optical image coding, characterized in that, The method comprises the following steps: obtaining a fire optical image data set and constructing training data based on the fire optical image data set; preprocessing the training data to obtain target data, wherein the preprocessing at least includes aspect ratio maintaining processing, padding processing, center cropping processing, data standardization processing and data normalization processing; performing feature conversion on the target data by using sine-cosine temperature coding to obtain image feature information; the step of performing feature conversion on the target data by using sine-cosine temperature coding to obtain image feature information comprises: based on the width of the target data, the height of the target data, the grid coordinates of the target data in the width direction, the grid coordinates of the target data in the height direction, the embedding dimension, the frequency factor of the target data and the temperature parameter of the target data, performing sine-cosine position embedding by using sine-cosine temperature coding to obtain first sine-cosine embedding data of the target data in the width direction and second sine-cosine embedding data of the target data in the height direction; determining the position embedding data of the target data according to the first sine-cosine embedding data and the second sine-cosine embedding data; adjusting the feature shape of the target data according to the position embedding data by using a tensor dimension changing method and a size adjusting method to obtain adjusted data; determining repeated position embedding data of the adjusted data; splicing the target data and the repeated position embedding data to obtain spliced data; performing feature extraction on the spliced data by using a 2D convolution operation to obtain image feature information; obtaining a fire class probability distribution of an image in the target data according to the image feature information by using a lightweight fire detection method; training a preset classification model based on the target data, calculating a cross-entropy loss of the preset classification model based on the fire class probability distribution, until the cross-entropy loss converges, obtaining a target classification model, and completing real-time fire warning based on the target classification model.
2. The fire real-time warning method based on optical image coding according to claim 1, characterized in that, The step of preprocessing the training data to obtain target data comprises: performing aspect ratio maintaining processing on the training data to obtain primary data; matching the actual size of each image in the primary data with a preset target size to obtain a matching result, and performing padding processing on the primary data according to the matching result to obtain secondary data satisfying the preset target size; performing center cropping processing on the secondary data to obtain cropped data; performing data standardization processing on the cropped data to obtain standardized data; performing data normalization processing on the standardized data to obtain the target data.
3. The fire real-time warning method based on optical image coding according to claim 1, characterized in that, The step of obtaining a fire class probability distribution of an image in the target data according to the image feature information by using a lightweight fire detection method comprises: ; wherein represents an image feature; performing a 2D convolution operation on the image feature information to obtain convolution data; calculating advanced feature data of the target data based on the image feature information after batch normalization by using an h-Swish activation function. The advanced feature data is input into a preset neck feature extraction module to obtain complex features, and a mathematical representation of the preset neck feature extraction module is: ; wherein, denotes a feature extraction operation, x denotes an input operation, SE() denotes a channel attention mechanism, and the advanced feature data f 2 as input features; Based on the complex features, a lightweight fire detection method is used to obtain a fire category probability distribution of the images in the target data, and a mathematical representation of the lightweight fire detection method is: ; wherein denotes a global average pooling operation, denotes a fully connected layer, denotes a fully connected layer weight, denotes a bias term, denotes a fire class probability distribution, f 3 is f 2 as input features, the complex features obtained by repeating the neck() operation eight times.
4. The fire real-time warning method based on optical image coding according to claim 1, characterized in that, The step of calculating the cross-entropy loss of the preset classification model based on the fire category probability distribution includes: The cross-entropy loss of the preset classification model is calculated based on the fire category probability distribution through a cross-entropy loss function, and a mathematical representation of the cross-entropy loss function is: ; wherein represents a cross-entropy loss function, represents the total number of classifications, represents the batch size, represents an indicator function of the real label on the n th class of the i th sample, represents the probability predicted by the preset classification model on the n th class of the i th sample, is a probability distribution matrix output by the preset classification model, is a one-hot encoding matrix of the real label.
Citation Information
Patent Citations
Attention mechanism-based end-to-end forest fire detection algorithm
CN115512225A
Fire inspection early warning method based on unmanned aerial vehicle and improved YOLOv8 target detection algorithm
CN117409191A