Electric vehicle charging station fire detection method based on YOLOv8R model
Through the electric vehicle charging station fire detection method based on the YOLOv8R model, combined with the convolutional layer structure Rf module of CoarseDropout data enhancement and Retinex theory, the problem of insufficient real-time and accuracy of fire detection in complex environments in the existing technology is solved, efficient and accurate fire detection is achieved, and the safe operation of the charging station is ensured.
Patent Information
- Application Number
- CN202411714210.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-03-14
AI Technical Summary
Existing fire detection technology is difficult to meet the requirements of real-time and accuracy in complex environments of electric vehicle charging stations, especially under noise interference and different lighting conditions in complex environments.
The fire detection method based on the YOLOv8R model is adopted, and the car fire data set is established by acquiring and labeling the images related to electric vehicle fires, and a dual-branch fire detection method is proposed, combining CoarseDropout data augmentation and the convolutional layer structure Rf module based on Retinex theory to improve the robustness and generalization ability of the model.
It realizes rapid and accurate detection in the early stage of the fire, improves the real-time and accuracy of fire detection, enhances the model's adaptability to complex scenes and low-light environments, and ensures the safe operation of the charging station.
Smart Images

Figure CN119625495A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of fire detection, and in particular to a fire detection method for an electric vehicle charging station based on a YOLOv8R model. Background Art
[0002] With the popularity of electric vehicles, the construction of charging infrastructure is becoming increasingly important. Electric vehicle charging stations provide convenient charging services for electric vehicles, but they also bring potential safety hazards, especially fire risks. Fires may not only cause property losses, but also threaten personal safety, especially during peak charging hours, when there are a large number of vehicles and equipment in the charging station, and the consequences of fire may be more serious. Therefore, it is particularly important to develop an effective fire detection method.
[0003] Existing fire detection technologies mainly include smoke detectors, temperature sensors, and video surveillance systems. These traditional methods have their own advantages and disadvantages, but in the complex environment of electric vehicle charging stations, a single detection method often fails to meet the real-time and accuracy requirements. For example, smoke detectors may give false alarms during charging, and temperature sensors often react to fires with lags and fail to detect early signs of fire in time. In addition, although video surveillance systems can provide real-time monitoring, they rely on manual analysis and cannot achieve all-weather, fully automatic detection.
[0004] In recent years, with the development of deep learning and computer vision technology, fire detection methods based on image and video analysis have gradually attracted attention. These methods use advanced image processing algorithms to analyze surveillance videos in charging stations in real time, thereby detecting potential fire risks more quickly and accurately. However, current research still faces challenges, including noise interference in complex environments and the impact of different lighting conditions on image quality.
[0005] Therefore, developing a new fire detection method that integrates multiple detection methods can effectively identify fire risks in the special environment of electric vehicle charging stations, which has important theoretical value and practical significance. The present invention proposes a fire detection method for electric vehicle charging stations, which aims to improve the real-time and accuracy of fire detection and provide guarantee for the safe operation of charging stations. Summary of the invention
[0006] Purpose of the invention: Based on the technical problems existing in the background technology, the present invention proposes a fire detection method for electric vehicle charging stations based on the YOLOv8R model, which can perform rapid and accurate detection in the early stage of a fire, providing guarantee for the safe operation of the charging station.
[0007] Technical solution: The present invention discloses a fire detection method for electric vehicle charging stations based on the YOLOv8R model, comprising the following steps:
[0008] S1: Obtain images related to electric vehicle fires, and use annotation tools to accurately annotate the flame and smoke features in the collected images to establish an automobile fire dataset;
[0009] S2: A YOLOv8R model is proposed to detect the type and location information of flames; the YOLOv8R model is based on the YOLOv8n architecture and introduces an auxiliary branch, the auxiliary branch has the same priority as the main branch, and is calculated at the same time, and the auxiliary branch and the main branch are connected and fused; the auxiliary branch includes two convolutional layers connected in sequence, multiple convolutional layer structures Rf modules based on Retinex theory, and a maximum pooling operation MaxPool2d connected to the back of the Rf module;
[0010] S3: Use the established car fire image dataset to train and test the YOLOv8R model to obtain a trained YOLOv8R flame detection model;
[0011] S4: Evaluate the performance of the YOLOv8R flame detection model and use the YOLOv8R flame detection model for fire detection in electric vehicle charging stations.
[0012] Furthermore, the car fire image is enhanced in S1, and data enhancement is performed through CoarseDropout, which randomly removes some pixel areas, generates diversified image data, and improves the generalization ability of the model; the CoarseDropout data enhancement process is:
[0013] S1.1 Define parameters;
[0014] The size of the electric vehicle fire image I is (H, W, C), where H represents the height of the image, W represents the width of the image, and C represents the number of channels of the image, that is, the number of color channels; the maximum number of pixel deletion areas during data enhancement is M hoels , the maximum height of the deleted area is H max , the maximum width is W max , the filling value is F, each image has a probability of p to perform CoarseDropout, and the label data of the electric vehicle fire image is L = {(x i ,y i ,w i ,h i ,c i )}, where i = 1, 2, ..., N is the number of objects in the image, (x i ,y i ) represents the position coordinates, h i and w i Indicates the height and width of the area, c irepresents the category label of the target, c i =0 means the target is flame, c i =1 means the target is smoke;
[0015] S1.2 decide whether to apply CoarseDropout data enhancement;
[0016] Based on the enhancement probability p, decide whether to apply CoarseDropout, randomly generate a value r∈[0,1], and perform the following operations:
[0017]
[0018] If r≤p, CoarseDropout data enhancement is applied, otherwise not applied;
[0019] S1.3 Randomly generate deletion areas;
[0020] Randomly select the number of deleted regions m, so that m∈{1,2,……,M hoels}, for each pixel, delete the prefetch and randomly generate a position coordinate (x j ,y j ) and region size (h j ,w j ),in:
[0021] x j ∈[0,Ww j ],y j ∈[0,Hh j ]
[0022] And the height of the area h j and width w j satisfy:
[0023] h j ∈[0,W max ]
[0024] S1.4 performs CoarseDropout data enhancement;
[0025] For each deleted area, the corresponding area R in the electric vehicle fire image I is j Replace with fill value F:
[0026]
[0027] Among them, I'(x,y,c) is the enhanced image. j In the area, all pixel values will be filled with F, and other areas will remain as they are;
[0028] S1.5 process label data;
[0029] For each electric car fire image label (x i ,y i ,w i ,h i ,c i ), determine whether the target label is covered by the deleted area, pixel deletion area R j From the position coordinates (x j ,y j ) and size (h j ,w j ) description, whether the target bounding box is covered is determined by the following conditions:
[0030]
[0031] If the above conditions are met, it means that the bounding box of target i and the deleted area R j If there is overlap, the target label needs to be adjusted or deleted;
[0032] S1.6 Save the enhanced image and label, and save the enhanced image I' and the updated label data L'.
[0033] Furthermore, the YOLOv8R model in S2 is as follows:
[0034] 2.1) The electric vehicle fire image enters the first convolution Conv, using 16 3*3 convolution kernels to extract local information of the electric vehicle fire feature map, providing basic low-level features for subsequent layers;
[0035] 2.2) The feature map extracted in 2.1) enters the second convolution Conv, using 32 3*3 convolution kernels to further abstract the feature map of electric vehicle fire and enhance high-level semantic information;
[0036] 2.3) The feature map after two convolutions is input into the first Rf module for processing to enhance the details and contrast of the flame area;
[0037] 2.4) Perform the maximum pooling operation MaxPool2d on the features processed in 2.3) to reduce the size of the feature map by downsampling while retaining important spatial information;
[0038] 2.5) The flames are separated and identified by alternating two Rf modules and the maximum pooling operation MaxPool2d again. The maximum pooling operation MaxPool2d downsamples the spatial dimension to reduce the size of the feature map.
[0039] 2.6) The features after operation in 2.5) are further subjected to Rf module operation to further refine the extraction of flame features.
[0040] Furthermore, the convolutional layer structure Rf module based on Retinex theory is as follows:
[0041] Electric car fire images is decomposed into and It is expressed as I = R ⊙ L, where ⊙ represents element-by-element multiplication;
[0042] The Rf module runs as follows:
[0043] 3.1) The Rf module receives the three-channel features of fire characteristics after convolution, converts them into floating point format, and converts the image data Use a natural log transformation:
[0044] I log =log(1+x I )
[0045] in, is a three-dimensional matrix, x I is the value of each pixel in the image; the image I after logarithmic transformation is obtained log ;
[0046] 3.2) Use Gaussian filter to perform logarithmic operation on image data Perform smoothing to obtain the illumination estimation component;
[0047] Electric car fire images Among them, 3 represents the three color channels of RGB. Gaussian blur is to apply a Gaussian kernel to each pixel of the image, that is, to apply Gaussian blur to each color channel separately. The formula of Gaussian function G is:
[0048]
[0049] Among them, the two-dimensional Gaussian kernel G has a size of k*k, σ is the standard deviation of the two-dimensional Gaussian kernel G, and x and y are the indices of the elements in the Gaussian kernel;
[0050] For each color channel C∈{r,g,b} of the image, Gaussian blur is performed using the following formula:
[0051]
[0052] Among them, G(i,j) is the weight coefficient of the Gaussian kernel, I C (x, y) represents the value of the image in the color channel C after Gaussian blur, reflecting the local illumination component of the image. i and j are the offsets of the elements in the Gaussian kernel.R (x+i,y+j) represents the original image I R The pixel value of the red channel at position (x+i, y+j) is used to obtain the Gaussian blurred image I smooth , I smooth Represents the illumination estimation result obtained after Gaussian blurring of all color channels C in the entire image;
[0053] 3.3) According to the Retinex theory, the reflection component I is obtained by subtracting the logarithmic transformation of the image from the smoothed image data. ref :
[0054] I ref =I log -I smooth
[0055] 3.4) The reflection component I ref The image is restored by exponential operation, so that the details of the image are restored to a higher dynamic range, the details in the image are enhanced, and the restored image I is obtained. enh :
[0056] I enh =exp(I ref )
[0057] 3.5) Will I enh After processing by the convolution module Convr, the enhanced features are further extracted and the results are output:
[0058] output=Convr(I enh ).
[0059] Furthermore, the convolution module Convr is specifically:
[0060] 4.1) Output image feature I enh Perform convolution operation;
[0061] Y = conv(X; W, b)
[0062] Among them, image features The convolution kernel is Size is K h *K w , there are C1 input channels, C2 output channels, is the bias vector, the length of the output channel C2; output feature map Where H'*W' represents the size of the output image, which is affected by the stride and the convolution kernel size K h *K w and fill impact;
[0063] The calculation formula for convolution is:
[0064]
[0065] Among them, Y(i,j,C2) is the value at position (i,j) and channel C2 in the output tensor, and the weighted sum is performed for each position (i,j) of the input tensor and each convolution kernel channel C2;
[0066] 4.2) Perform batch normalization on the image features Y after the above convolution operation to obtain the normalized image features
[0067]
[0068] Where μY and σY are the mean and standard deviation of each channel in the batch, ∈ is a small constant to prevent division by zero errors, and γ and β are learned parameters;
[0069] 4.3) Normalized image features Apply activation functions to increase nonlinearity;
[0070]
[0071] ReLU(x)=max(0,x)
[0072] That is, the ReLU operation sets all negative values to 0 and keeps the positive values unchanged.
[0073] Out is Get the activated feature map.
[0074] Furthermore, the second c2f module output of the YOLOv8n architecture backbone network is fused with the second Rf module output in the concat module of the 22nd layer, and the fourth c2f module output of the YOLOv8n architecture backbone network is fused with the third Rf module output in the concat module of the 25th layer.
[0075] Furthermore, in S3, when the YOLOv8R model is trained and tested, a YOLOv8R.yaml file is created, epochs is set to 150, batch-size is 32, and model training is performed.
[0076] Furthermore, three indicators are used for evaluation in S4, including average precision mAP, precision rate Precision and recall rate Recall, and the calculation formula is as follows:
[0077]
[0078] Among them, TP represents the number of electric vehicle fires that are detected and detected correctly; FP represents the number of electric vehicle fires that are detected but detected incorrectly; FN represents the number of electric vehicle fires that are missed;
[0079]
[0080] Among them, P A represents the average recognition accuracy of electric vehicle fire, N C is the total number of categories of electric vehicle fires. The higher the mAP value, the better the detection performance.
[0081] Beneficial effects:
[0082] 1. The present invention proposes CoarseDropout for data enhancement, which can help the model learn to accurately identify key features such as fire under image loss or low-light conditions, improve the model's adaptability to complex scenes, improve its robustness in low-light environments, and enhance the model's generalization ability.
[0083] 2. The present invention proposes a dual-branch fire detection method, and the model can perform multi-task parallel processing, so that the model can perform independent feature extraction specifically for night flames, reduce the impact of night flame photo exposure on detection accuracy, and enhance the robustness of the model.
[0084] 3. The present invention proposes a convolutional layer structure Rf module based on Retinex theory and integrates it into the auxiliary branch of the flame detection model to enhance the details and contrast of the flame and improve the efficiency and accuracy of fire detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0085] Figure 1 This is the YOLOv8R network structure diagram proposed by the present invention;
[0086] Figure 2 The YOLOv8R auxiliary branch processing flow proposed by the present invention;
[0087] Figure 3 The present invention proposes CoarseDropout data enhancement for YOLOv8R application;
[0088] Figure 4 The present invention proposes an Rf module operation process of the YOLOv8R application. DETAILED DESCRIPTION
[0089] In order to better explain the purpose, technical solution and advantages of the present invention, the following will be described in detail with reference to the accompanying drawings in the embodiments of the present invention. It should be noted that the specific implementation described below is only used to explain the principle of the present invention and does not limit the scope of the present invention.
[0090] The present invention proposes a fire detection method for electric vehicle charging station based on YOLOv8R, comprising the following steps:
[0091] Step S1: Obtain images related to electric vehicle fires through visual monitoring systems, public video datasets, and web crawlers, and use annotation tools to accurately annotate the flame and smoke features in the collected images to generate a label file containing fire area information, providing high-quality annotated data for subsequent model training. The specific steps are as follows:
[0092] S1-1: Data Collection
[0093] Specifically, car fire images containing flames, smoke, and possible other fire features are collected through monitoring equipment and network data crawler technology to ensure that the data covers various possible fire scenarios and environmental conditions.
[0094] S1-2: Image screening and preprocessing
[0095] Specifically, the collected image data are screened to remove irrelevant or blurred images to ensure data quality. At the same time, according to the particularity of the electric vehicle charging station scene, the present invention selects 200 pictures of cars on fire at night to increase the robustness and comprehensiveness of the model.
[0096] S1-3: Image Enhancement
[0097] Specifically, the car fire image of the above step S1-2 is enhanced, especially data enhancement is performed through CoarseDropout, some pixel areas are randomly removed, and diversified image data is generated to improve the generalization ability of the model.
[0098] In order to further enhance image diversity and improve model robustness, in step S1-3 image enhancement, the present invention uses CoarseDropout data enhancement. The specific steps are as follows:
[0099] The CoarseDropout data enhancement process is:
[0100] Step 1: Define parameters;
[0101] The size of the electric car fire image I is (H, W, C), where H represents the height of the image, W represents the width of the image, and C represents the number of channels of the image, that is, the number of color channels. The maximum number of pixel deletion areas during data enhancement is M. hoels , the maximum height of the deleted area is H max , the maximum width is W max , the filling value is F, each image has a probability of p to perform CoarseDropout, and the label data of electric vehicle fire images is L=
[0102] {(x i ,y i ,w i ,h i ,c i )}, where i = 1, 2, ..., N is the number of objects in the image, (x i ,y i ) represents the position coordinates, h i and w i Indicates the height and width of the area, c i represents the category label of the target, c i =0 means the target is flame, c i =1 means the target is smoke.
[0103] Step 2: Decide whether to apply CoarseDropout data enhancement;
[0104] Based on the enhancement probability p, decide whether to apply CoarseDropout. Specifically, randomly generate a value r∈[0,1] and perform the following operations:
[0105]
[0106] If r≤p, CoarseDropout data augmentation is applied, otherwise not.
[0107] Step 3: Randomly generate deletion areas;
[0108] Randomly select the number of deleted regions m, so that m∈{1,2,……,M hoels}, for each pixel, delete the prefetch and randomly generate a position coordinate (x j ,y j ) and region size (h j ,w j ),in:
[0109] x j ∈[0,Ww j ],y j ∈[0,Hh j ]
[0110] And the height of the area h j and width w j satisfy:
[0111] h j ∈[0,W max ]
[0112] Step 4: Perform CoarseDropout data enhancement;
[0113] For each deleted area, the corresponding area R in the electric vehicle fire image I is j Replace with fill value F:
[0114]
[0115] Among them, I'(x,y,c) is the enhanced image. j All pixel values in the area will be filled with F, and the other areas will remain as they are.
[0116] Step 5: Process label data;
[0117] For each electric car fire image label (x i ,y i ,w i ,h i ,c i ), it is necessary to determine whether the target label is covered by the deleted area. Pixel deletion area R j From the position coordinates (x j ,y j ) and size (h j ,w j ) description, whether the target bounding box is covered is determined by the following conditions:
[0118]
[0119] If the above conditions are met, it means that the bounding box of target i and the deleted area R j If there is overlap, the label of the target needs to be adjusted or deleted.
[0120] Step 6: Save the enhanced image and label. Save the enhanced image I' and the updated label data L'.
[0121] Step S2: Propose the YOLOv8R model to detect the category and location information of electric vehicle fires. The specific steps are as follows:
[0122] S2-1 Environment Construction
[0123] Specifically, install the dependent libraries and tools required by YOLOv8, including the Python environment and deep learning framework;
[0124] S2-2 builds a model and proposes a dual-branch YOLOv8R model to detect the category and location information of flames.
[0125] A dual-branch fire detection method is proposed, and the implementation process of the auxiliary branch structure is as follows:
[0126] 1) The electric vehicle fire image enters the first convolution Conv, using 16 3*3 convolution kernels to extract local information of the electric vehicle fire feature map, providing basic low-level features for subsequent layers.
[0127] 2) The feature map extracted above is fed into the second convolution Conv, and 32 3*3 convolution kernels are used to further abstract the feature map of electric vehicle fires and enhance high-level semantic information. Through continuous convolution operations, the model can learn more complex spatial features, thereby improving the representation ability of the model.
[0128] 3) The feature map after the two convolutions is input into the first Retinex (Rf) module for processing to enhance the details and contrast of the flame area, which can effectively improve the recognizability of the flame, especially in low-light and high-noise environments.
[0129] 4) Perform the maximum pooling operation MaxPool2d on the above processed features to reduce the size of the feature map by downsampling while retaining important spatial information.
[0130] 5) After the above operations, the two Rf modules and the MaxPool2d module are alternated again. Through continuous Rf processing, the model is able to better separate and identify flames. The MaxPool2d module downsamples the spatial dimension, thereby reducing the size of the feature map. Through the two applications of the Rf-MaxPool2d layer, the model gradually abstracts higher-level and more representative features and gradually focuses on the flame area, thereby reducing the interference of irrelevant background and enhancing the separability of the flame area.
[0131] 6) The features after the above operation are further subjected to Rf module operation to further refine the extraction of flame features, improve contrast, and remove the influence of ambient light, especially in complex backgrounds or low-brightness environments at night, to help the model retain richer feature information, thereby more effectively detecting fires.
[0132] Preferably, the convolutional layer structure Rf module based on Retinex theory is integrated into the auxiliary branch of the fire detection model to enhance the characteristics of the flame. The specific implementation steps are as follows:
[0133] Electric vehicle fire image based on Retinex theory Can be decomposed into and It can be expressed as I = R ⊙ L, where ⊙ represents element-by-element multiplication.
[0134] The Rf module runs as follows:
[0135] Step 1: The Rf module receives the three-channel features of fire characteristics after convolution and converts them into floating point format first. Use natural log transformation.
[0136] I log =log(1+x I )
[0137] in, is a three-dimensional matrix, x I is the value of each pixel in the image; the image I after logarithmic transformation is obtained log .
[0138] Step 2: Use Gaussian filter to perform logarithmic operation on the image data above Smoothing is performed to obtain the illumination estimation component.
[0139] Electric car fire images Among them, 3 represents the three color channels of RGB. Gaussian blur is to apply the Gaussian kernel to each pixel of the image, that is, to apply Gaussian blur to each color channel separately. The formula of Gaussian function G is:
[0140]
[0141] Among them, the two-dimensional Gaussian kernel G has a size of k*k, σ is the standard deviation of the two-dimensional Gaussian kernel G, and x and y are the indices of the elements in the Gaussian kernel.
[0142] For each color channel C∈{r,g,b} of the image, Gaussian blur is performed using the following formula:
[0143]
[0144] Among them, G(i,j) is the weight coefficient of the Gaussian kernel, I C (x, y) represents the value of the image in the color channel C after Gaussian blur, reflecting the local illumination component of the image. i and j are the offsets of the elements in the Gaussian kernel. R (x+i,y+j) represents the original image I R The pixel value of the red channel at position (x+i, y+j) is used to obtain the Gaussian blurred image I smooth , I smooth Represents the illumination estimation result obtained after Gaussian blurring of all color channels C in the entire image.
[0145] Step 3: According to the Retinex theory, the reflection component is obtained by subtracting the logarithmic transformation of the image from the smoothed image data.
[0146] I ref =I log -Ismooth
[0147] Get the image reflection component I ref .
[0148] Step 4: Reflection Component I ref Through exponential operation, the image details are restored to a higher dynamic range, thus enhancing the details in the image.
[0149] I enh =exp(I ref )
[0150] Get the restored image I enh .
[0151] Step 5: I enh After being processed by the convolution module Convr, the enhanced features are further extracted and the results are output.
[0152] output=Convr(I enh )
[0153] Preferably, the custom convolutional layer module Convr used above is used for efficient extraction of image features in fire detection tasks, and the specific implementation steps are as follows:
[0154] The custom convolution module Convr further includes
[0155] Step 1: Output image feature I enh Perform convolution operation;
[0156] Y = conv(X; W, b)
[0157] The image features The convolution kernel is Size is K h *K w , there are C1 input channels, C2 output channels, is the bias vector, with a length of output channel C2
[0158] Output feature map Where H'*W' represents the size of the output image, which is affected by the stride and the convolution kernel size K h *K w and fill impact.
[0159] The calculation formula for convolution is:
[0160]
[0161] Among them, Y(i,j,C2) is the value at position (i,j) and channel C2 in the output tensor, and the weighted sum is performed on each position (i,j) of the input tensor and each convolution kernel channel C2.
[0162] Step 2: Perform batch normalization on the image features Y after the above convolution operation;
[0163]
[0164] where μY and σY are the mean and standard deviation of each channel in the batch, ∈ is a small constant to prevent division by zero errors, and γ and β are learned parameters.
[0165] Get the normalized image features
[0166] Step 3: Normalize the image features Apply activation functions to increase nonlinearity;
[0167]
[0168] ReLU(x)=max(0,x)
[0169] That is, the ReLU operation sets all negative values to 0 and leaves positive values unchanged. The output of the ReLU activation function is Get the activated feature map.
[0170] The process of fusing the above auxiliary branches with the YOLOv8n architecture backbone network is as follows: the second c2f module output of the YOLOv8n architecture backbone network is fused with the second Rf module output in the concat module of the 22nd layer, and the fourth c2f module output of the YOLOv8n architecture backbone network is fused with the third Rf module output in the concat module of the 25th layer.
[0171] Step S3: Use the established flame image dataset to train and test the YOLOv8R model to obtain a trained YOLOv8R flame detection model.
[0172] Step S4: Perform an ablation experiment on the YOLOv8R model to compare its performance. The results are shown in the following table:
[0173] Model P / % R / % <![CDATA[mAP 0.5 ]]> <![CDATA[mAP 0.5:0.95 ]]> Yolov10n 0.79 0.73 0.81 0.47 Yolov8n+CD 0.8 0.73 0.81 0.48 Yolov10n+CD+Rf 0.81 0.74 0.82 0.48 Yolov8n 0.78 0.75 0.8 0.48 Yolov8n+CD 0.79 0.77 0.81 0.49 Yolov8n+CD+Rf 0.81 0.79 0.83 0.51
[0174] Where CD represents CoarseDropout data enhancement;
[0175] It can be seen from the above ablation experiment results that the YOLOv8R model of the present invention has an accuracy (Precision) improved by 3%, a recall rate (Recall) improved by 4%, and a mAP improved by 3% in the detection of electric vehicle fires compared with the original YOLOv8.
[0176] Through different comparative experiments, it can be concluded that compared with the original YOLOv8, the Rf module and CoarseDropout data enhancement proposed in the present invention both improve the performance of the model to varying degrees. The accuracy, recall rate and average precision of the YOLOv8R model in the detection of electric vehicle fires have been significantly improved, which effectively solves the current problems of low average precision, slow speed and high missed detection rate of the algorithm in the detection of electric vehicle fires.
[0177] Therefore, the trained YOLOv8R flame detection model can be deployed to the visual monitoring and shooting equipment, and alarm information can be generated based on the fire detection results.
[0178] The above description is only a specific embodiment of the present invention. Without violating the spirit and scope of the present invention, anyone familiar with the technology can modify or change the above embodiment. Therefore, any equivalent modification or change made by researchers familiar with the technology to the present invention should be included in the scope of the claims of the present invention.
Claims
1. A fire detection method for electric vehicle charging stations based on the YOLOv8R model, characterized in that: The steps include: S1: Obtain images related to electric vehicle fires, and use annotation tools to accurately annotate the flame and smoke features in the collected images to establish an automobile fire dataset; S2: A YOLOv8R model is proposed to detect the type and location information of flames; the YOLOv8R model is based on the YOLOv8n architecture and introduces an auxiliary branch, the auxiliary branch has the same priority as the main branch, and is calculated at the same time, and the auxiliary branch and the main branch are connected and fused; the auxiliary branch includes two convolutional layers connected in sequence, multiple convolutional layer structures Rf modules based on Retinex theory, and a maximum pooling operation MaxPool2d connected to the back of the Rf module; S3: Use the established car fire image dataset to train and test the YOLOv8R model to obtain a trained YOLOv8R flame detection model; S4: Evaluate the performance of the YOLOv8R flame detection model and use the YOLOv8R flame detection model for fire detection in electric vehicle charging stations.
2. According to the method of fire detection in electric vehicle charging station based on YOLOv8R model in claim 1, it is characterized in that: In S1, the car fire image is also enhanced by using CoarseDropout to perform data enhancement, randomly remove some pixel areas, generate diversified image data, and improve the generalization ability of the model; the CoarseDropout data enhancement process is as follows: S1.1 Define parameters; The size of the electric vehicle fire image I is (H, W, C), where H represents the height of the image, W represents the width of the image, and C represents the number of channels of the image, that is, the number of color channels; the maximum number of pixel deletion areas during data enhancement is M hoels , the maximum height of the deleted area is H max , the maximum width is W max , the filling value is F, each image has a probability of p to perform CoarseDropout, the label data of the electric vehicle fire image L = {(x i ,y i ,w i ,h i ,c i )}, where i = 1, 2, ..., N is the number of objects in the image, (x i ,y i ) represents the position coordinates, h i and w i Indicates the height and width of the area, c i represents the category label of the target, c i =0 means the target is flame, c i =1 means the target is smoke; S1.2 decide whether to apply CoarseDropout data enhancement; Based on the enhancement probability p, decide whether to apply CoarseDropout, randomly generate a value r∈[0,1], and perform the following operations: If r≤p, CoarseDropout data enhancement is applied, otherwise not applied; S1.3 Randomly generate deletion areas; Randomly select the number of deleted regions m, so that m∈{1,2,……,M hoels }, for each pixel, delete the prefetch and randomly generate a position coordinate (x j ,y j ) and region size (h j ,w j ),in: x j ∈[0,W-w j ],y j ∈[0,H-h j ] And the height of the area h j and width w j satisfy: h j ∈[0,W max ] S1.4 performs CoarseDropout data enhancement; For each deleted area, the corresponding area R in the electric vehicle fire image I is j Replace with fill value F: Among them, I'(x,y,c) is the enhanced image. j In the area, all pixel values will be filled with F, and other areas will remain as they are; S1.5 process label data; For each electric car fire image label (x i ,y i ,w i ,h i ,c i ), determine whether the target label is covered by the deleted area, pixel deletion area R j From the position coordinates (x j ,y j ) and size (h j ,w j ) description, whether the target bounding box is covered is determined by the following conditions: If the above conditions are met, it means that the bounding box of target i and the deleted area R j If there is overlap, the target label needs to be adjusted or deleted; S1.6 Save the enhanced image and label, and save the enhanced image I' and the updated label data L'.
3. The electric vehicle charging station fire detection method based on the YOLOv8R model according to claim 1 is characterized in that: The YOLOv8R model in S2 is as follows: 2.1) The electric vehicle fire image enters the first convolution Conv, using 16 3*3 convolution kernels to extract local information of the electric vehicle fire feature map, providing basic low-level features for subsequent layers; 2.2) The feature map extracted in 2.1) enters the second convolution Conv, using 32 3*3 convolution kernels to further abstract the feature map of electric vehicle fire and enhance high-level semantic information; 2.3) The feature map after two convolutions is input into the first Rf module for processing to enhance the details and contrast of the flame area; 2.4) Perform the maximum pooling operation MaxPool2d on the features processed in 2.3) to reduce the size of the feature map by downsampling while retaining important spatial information; 2.5) The flames are separated and identified by alternating two Rf modules and the maximum pooling operation MaxPool2d again. The maximum pooling operation MaxPool2d downsamples the spatial dimension to reduce the size of the feature map. 2.6) The features after operation in 2.5) are further subjected to Rf module operation to further refine the extraction of flame features.
4. A fire detection method for electric vehicle charging station based on YOLOv8R model according to claim 3, characterized in that: The convolutional layer structure Rf module based on Retinex theory is as follows: Electric car fire images is decomposed into and It is expressed as I = R ⊙ L, where ⊙ represents element-by-element multiplication; The Rf module runs as follows: 3.1) The Rf module receives the three-channel features of fire characteristics after convolution, first converts them into floating point format, and converts the image data Use a natural log transformation: I log =log(1+x I ) in, is a three-dimensional matrix, x I is the value of each pixel in the image; the image I after logarithmic transformation is obtained log ; 3.2) Use Gaussian filter to perform logarithmic operation on image data Perform smoothing to obtain the illumination estimation component; Electric car fire images Among them, 3 represents the three color channels of RGB. Gaussian blur is to apply a Gaussian kernel to each pixel of the image, that is, to apply Gaussian blur to each color channel separately. The formula of Gaussian function G is: Among them, the two-dimensional Gaussian kernel G has a size of k*k, σ is the standard deviation of the two-dimensional Gaussian kernel G, and x and y are the indices of the elements in the Gaussian kernel; For each color channel C∈{r,g,b} of the image, Gaussian blur is performed using the following formula: Among them, G(i,j) is the weight coefficient of the Gaussian kernel, I C (x, y) represents the value of the image in the color channel C after Gaussian blur, reflecting the local illumination component of the image. i and j are the offsets of the elements in the Gaussian kernel. R (x+i,y+j) represents the original image I R The pixel value of the red channel at position (x+i, y+j) is used to obtain the Gaussian blurred image I smooth , I smooth Represents the illumination estimation result obtained after Gaussian blurring of all color channels C in the entire image; 3.3) According to the Retinex theory, the reflection component I is obtained by subtracting the logarithmic transformation of the image from the smoothed image data. ref : I ref =I log -I smooth 3.4) The reflection component I ref The image is restored by exponential operation, so that the details of the image are restored to a higher dynamic range, the details in the image are enhanced, and the restored image I is obtained. enh : I enh =exp(I ref ) 3.5) Will I enh After processing by the convolution module Convr, the enhanced features are further extracted and the results are output: output=Convr(I enh )。 5. A fire detection method for electric vehicle charging station based on YOLOv8R model according to claim 4, characterized in that: The convolution module Convr is specifically: 4.1) Output image feature I enh进 Row convolution operation; Y = conv(X; W, b) Among them, image features The convolution kernel is Size is K h *K w , there are C1 input channels, C2 output channels, is the bias vector, the length of the output channel C2; output feature map Where H'*W' represents the size of the output image, which is affected by the stride and the convolution kernel size K h *K w and fill impact; The calculation formula for convolution is: Among them, Y(i,j,C2) is the value at position (i,j) and channel C2 in the output tensor, and the weighted sum is performed for each position (i,j) of the input tensor and each convolution kernel channel C2; 4.2) Perform batch normalization on the image features Y after the above convolution operation to obtain the normalized image features Where μY and σy are the mean and standard deviation of each channel in the batch, ∈ is a small constant to prevent division by zero errors, and γ and β are learned parameters; 4.3) Normalized image features Apply activation functions to increase nonlinearity; ReLU(x)=max(0,x) That is, the ReLU operation sets all negative values to 0 and leaves the positive values unchanged. The output of the ReLU activation function is Get the activated feature map.
6. A fire detection method for electric vehicle charging station based on YOLOv8R model according to claim 4, characterized in that: The second c2f module output of the YOLOv8n architecture backbone network is fused with the second Rf module output in the concat module of the 22nd layer, and the fourth c2f module output of the YOLOv8n architecture backbone network is fused with the third Rf module output in the concat module of the 25th layer.
7. The electric vehicle charging station fire detection method based on the YOLOv8R model according to claim 1 is characterized in that: In the S3, when training and testing the YOLOv8R model, a YOLOv8R.yaml file is created, epochs is set to 150, batch-size is 32, and model training is performed.
8. The electric vehicle charging station fire detection method based on the YOLOv8R model according to claim 1 is characterized in that: Three indicators are used for evaluation in S4, including average precision mAP, precision Precision and recall Recall. The calculation formula is as follows: Among them, TP represents the number of electric vehicle fires that are detected and detected correctly; FP represents the number of electric vehicle fires that are detected but detected incorrectly; FN represents the number of electric vehicle fires that are missed; Among them, P A represents the average recognition accuracy of electric vehicle fire, N c is the total number of categories of electric vehicle fires. The higher the mAP value, the better the detection performance.