1. Introduction
Fire is a natural disaster that poses a serious threat to human life and property [
1,
2]. In recent years, safety incidents caused by fires have been frequent. For example, there was a series of very large fires in Australia between September 2019 and January 2020, which exceeded 100,000 hectares [
3], and in the western United States, where up to 2.5 million hectares of land were burned due to fires between January and September 2020 [
4]. Failure to detect a fire in time will inevitably lead to its expansion and spread, which can have a significant negative impact on property, buildings, and ecosystems and can even pose a threat to human safety [
5,
6,
7]. Thus, prompt and efficient identification of flames and extinguishing fires is crucial to mitigate economic losses and ensure human safety.
For the proficient recognition of flames, we will employ the flame segmentation technique to effectively isolate the flame from its background. Flame segmentation is a specialised technique in machine learning that plays a crucial role in the detection of wildland fires. In simple terms, it involves breaking down an image or video into distinct parts, with the specific aim of identifying and isolating regions that correspond to flames or fire. This method harnesses the power of artificial intelligence to automatically recognise the characteristic patterns and shapes associated with fire in visual data.
In order to meet the real-time accuracy of fire detection, researchers have started to use machine learning methods for flame detection [
8,
9,
10]. Damir et al. [
11] used a histogram-based approach to segment smoke in order to segment forest fires at the pixel level. Chen et al. [
12] proposed an algorithm to fuse fire segmentation with multi-feature recognition. Firstly, an improved Ycbcr model is established for determining fire segmentation under reflective and non-reflective conditions, followed by an improved growing region algorithm for fine segmentation of fires, and finally, a quantitative index for final fire recognition is given. Pratik et al. [
13] used the CIE L*a*b algorithm to achieve accurate flame segmentation by detecting fire pixels in each image and using blur values ranging from 0.1 to 0.9.
Traditional flame segmentation, however, has some restrictions and frequently can only distinguish flames in particular settings. For this reason, numerous academics have suggested cutting-edge flame detection techniques. To assist users in iteratively choosing a number of frames for annotation that will inform video segmentation for contemporary flames, Yin [
14] and colleagues created an interactive video segmentation system called VOS. Akmalbek et al. [
15] implemented an improved implementation of fire recognition based on the Detectron2 model. By leveraging dark channels to perform picture defogging and using GhostNet, depth separable convolution, and SENet for lightweight development of the model, Huang et al. [
16] suggested a lightweight forest fire detection approach based on YOLOX-L and defogging methods. Considering that flame colour features are more prominent in RGB images, flame regions can be identified based on the colour features of the pixels. Therefore, this paper is based on RGB segmentation, using the three channels R, G, and B to extract the flame region. However, this method does not solve the following two problems in the flame segmentation process: (1) Some of the flame colours are outside the fixed threshold, resulting in incomplete flame segmentation; as shown in
Table 1 (a), RGB segmentation is not sensitive enough to flames other than red, i.e., these flames are outside the fixed threshold, ultimately resulting in incomplete segmentation results. (2) The presence of noise in the image affects the segmentation result; as shown in
Table 1 (b), the presence of high-frequency noise in the image will reduce the segmentation effect.
To solve the problem of incomplete flame segmentation, Zhen et al. [
17] proposed a multi-scale residual attention group attention combined with U-Net to extract multi-scale flame features. Chen et al. [
18] extracted fire pixels based on RGB processing and subjected the extracted fire pixels to growth and disorder dynamics for flame extraction. Manish et al. [
19] classified the colour pixels of the L*a*b spatial model by using K-means mean clustering to separate the smoke. Inspired by the K-means mean clustering approach, we used K-means mean clustering to adaptively determine cluster centres based on the distribution of colours, clustering pixels of similar colours together with the aim of solving the problem of incomplete flame segmentation.
To address the problem of noise in the image during segmentation, Wang et al. [
20] proposed a method based on FBM and region-growing smoke segmentation by selecting an appropriate Hurst threshold to obtain a binary image and using region growing to obtain an effective segmented region. Buades et al. [
21] proposed the method of non-local averaging, which calculates the non-local average of all pixels in an image aimed at removing image noise. Chen et al. [
22] proposed a novel non-linear filter that effectively suppresses noise while preserving image detail. The RBiFPN network was created by Li et al. [
23] and included Yolov5’s framework as the backbone network to help differentiate the subtle differences between clouds and cloudiness. In this study, we use Gaussian filtering to reduce the effect of noise by weighting each pixel and its surrounding pixels by averaging.
Specifically, in order to solve the problem of under-segmentation due to some of the flame colours being outside a fixed threshold and the problem of noise present in the image affecting the segmentation results, we propose an unsupervised flame segmentation method for GK-RGB, and the specific contributions regarding this work are as follows:
K-means mean clustering is invoked to determine the cluster centres adaptively by the colour distribution and to cluster similar pixel points into the same cluster, aiming to eliminate the problem of unsegmented parts of the flame colour beyond the threshold;
A Gaussian filtering method is invoked, where the image is smoothed and blurred to remove noise interference from the image by weighting each pixel and its surrounding pixels on average;
The experimental results show that the proposed method in this paper achieves good results in the segmentation of flames, in which the average values of Acc, IOU, and F1 reach 97.71%, 81.34%, and 89.61%, respectively. Compared with other methods, the GK-RGB flame segmentation method has higher recognition accuracy and provides a reference value for modern fire recognition and detection.
2. Materials and Methods
2.1. Data Set Preparation
The experimental dataset for this experiment is from the Bitbucket platform, and the name of the dataset is BowFire Dataset, with 119 included images. In order to ensure the integrity of the experiment, six images with different backgrounds at different times were selected as the main subjects for this experiment. As shown in
Table 2, where Figure (a) shows a blackout flame map containing a background of people and clutter, Figure (b) shows a daytime street containing people, trees, and a fire being fought, Figure (c) shows a blackout flame map outdoors, and Figure (d) shows a daytime airport containing people, aircraft, trees and a fire being fought. Figure (e) shows a red wine bottle and a red vase flame with obstructing elements. Figure (f) shows pictures of small fires with red street signs as well as images of street fires.
During the experiment, all images were sized at 640 × 480 with a resolution of 96 dpi. In the subsequent image presentations, the following six images will all be shown under the names (a), (b), (c), (d), (e) and (f).
2.2. GK-RGB
During the task of flame segmentation, the flames have distinct colour characteristics. That is, flames usually appear in bright red, orange, and yellow colours, which have high brightness values in the RGB colour space. By detecting and extracting these high-luminance pixels, we can effectively segment the flame area. Therefore, RGB colour features are chosen for flame segmentation in this paper. Specifically, this is achieved by setting the threshold range of the RGB colour channel. Equations (1) and (2) demonstrate the conditions that the flame pixel points (
x,
y) should satisfy:
where
,
, and
are the components of the pixel point
on the red, green, and blue colour channels, respectively, and the minimum threshold for the component of the red pixel point is indicated. After several experiments, the final value of
in this paper is 190.
However, in the task of flame colour segmentation on complex backgrounds, using only RGB colour segmentation methods faces two problems: (1) The presence of noise interference in the image affects the segmentation effect. (2) RGB segmentation is not sensitive enough to flames other than red, resulting in incomplete segmentation results. To solve these two problems, Gaussian filtering is used to pre-process the images to filter image noise; in addition, K-means mean clustering is used to optimise the RGB method to solve the problem of incomplete RGB segmentation of flames other than red.
Section 2.3 and
Section 2.4 will provide more detailed information.
The following is the general procedure for this experiment:
Input image: reads the folder for which flame splitting is required;
Gaussian filtering: Gaussian filtering is applied to the input image to remove the noise present in the image;
K-means clustering mean: the RGB value of each pixel is extracted, and after determining the K-value, the cluster centres are selected and iteratively clustered to calculate the best cluster centre;
RGB colour segmentation: based on the K-means clustering result, the cluster centre representing the flame is selected, and based on the selected flame colour, the pixel points similar to it are extracted to form the flame region.
2.3. K-Means Mean Clustering
To solve the problem of incomplete RGB colour segmentation for flames other than red, we used K-means mean clustering to optimise RGB segmentation. The method is capable of adaptively determining clustering centres based on the distribution of colours, clustering similarly coloured pixels together and, thus, segmenting the different colour regions of the flame more accurately. This allows better reproduction of the details and colour variations of the flame and compensates for the colour limitations of the RGB colour model. The steps regarding its operation are as follows:
First, the K-means algorithm identifies the different coloured regions of a flame by clustering the pixels in the flame image. Setting the number of clusters (K) to 4, K-means can group pixels of similar colours together and separate out regions of flame of different colours;
Subsequently, the position of the cluster centres is automatically adjusted to suit the different colours of the flames. The cluster centres are dynamically determined based on the distribution of the data, thus capturing subtle differences in flame colour. This adaptive nature gives K-means an advantage over fixed-threshold RGB segmentation when dealing with flames of multiple colour variations.
2.4. Gaussian Filtering
In the process of flame segmentation, the presence of noise in the image can cause noise to appear in the segmentation results, thus affecting the results. In order to solve the noise problem, we use a Gaussian filtering method that smoothes and blurs the effect of the values of the surrounding pixels on the current pixel, mainly by means of a weighted average. The detailed steps regarding this method are as follows:
- 1.
First, determine the size of the Gaussian filter, which in this paper is 5 × 5.
- 2.
Calculate the weight value of the Gaussian kernel based on the filter size and standard deviation (a). The Gaussian kernel is σ, a two-dimensional matrix where each element corresponds to a pixel position in the filter. The value of each element is calculated from a Gaussian function and indicates the weight of the pixel at that position in the filtering process. The formula for the Gaussian function is as follows:
where
x and
y represent the offset of the current pixel position relative to the pixel position at the centre of the filter, respectively, and
σ represents the standard deviation of the Gaussian function.
- 3.
Filtering is performed on each pixel in the image. For each pixel point, the neighbouring pixels within the size range of the filter around it are taken, and the element-level product and summation operations are performed with the Gaussian kernel at the corresponding position. This allows the average value of the current pixel to be calculated based on the weights of the neighbouring pixels, i.e., replacing the current pixel value with the weighted average of the surrounding pixels.
- 4.
The same filtering operation is applied to each pixel of the entire image, thus removing noise.
With Gaussian filtering, each pixel in the image is affected by a weighted average of its surrounding pixels, where the weights are determined by a Gaussian kernel. Since the Gaussian kernel is designed so that pixels closer to the central pixel have a higher weight and pixels further away from the central pixel have a lower weight, Gaussian filtering can be effective in removing noise in real flame segmentation.
4. Conclusions
In this paper, we propose the GK-RGB method, which aims to achieve accurate recognition of fire segmentation in complex backgrounds. First, a flame dataset with the dataset name BowFire Dataset is obtained through the Bitbucketpin platform. In order to ensure the integrity of the experiment, four images of flames with different backgrounds at different time periods were selected from the 119 data sets as the main subjects for this experiment. In the GK-RGB method, we selected RGB as the main algorithm for flame segmentation and extracted the main features of the flame by setting different thresholds for the three channels: R, G, and B. At the same time, we use a Gaussian filtering method aimed at eliminating the noise interference present in the image. In addition, to solve the problem of under-segmentation in RGB segmentation because some of the flame colours are outside the threshold, we use K-means mean clustering to cluster the flame colour pixels together and, thus, segment the flames completely.
The experimental results show that our GK-RGB method achieves excellent results with 97.71% Accuracy, 81.34% IOU and 89.61% F1-score. In the ablation experiment, it was further demonstrated that the effectiveness of using Gaussian filtering (Accuracy + 0.22%, IOU + 1.42%, F1-Score + 0.95%) and K-means mean clustering (Accuracy + 2.57%, IOU + 14.61%, F1-Score + 9.69%) has been proven. Compared to other methods, the GK-RGB method is able to segment the flame part more accurately and completely and is more suitable for the detection of flames. This provides a new reference value for modern fire protection construction as well as for the detection and identification of fires.
In order to make the work of fire identification more complete, in the future, we will make further improvements in the following two areas: (1) Realisation of real-time flame segmentation: fast real-time target detection and tracking techniques are used in combination with the GK-RGB segmentation method to improve the speed and real-time performance of flame segmentation. (2) Enabling multi-sensor data fusion: In addition to RGB colours, flames also produce heat and light radiation. In the future, the fusion of RGB images with thermal images or other sensor data is considered to improve the accuracy and robustness of flame segmentation. Overall, we are committed to improving flame-splitting technology to better meet fire construction as well as to reduce the incidence of fire.