Forest fire image expansion method and device
By identifying the optimal seed points of the skyline and flames and smoke, the sun and cloud images are fused to expand the mountain fire images, solving the problem of misdetection of sunlight and clouds in the existing technology, and improving the accuracy of mountain fire detection and the accuracy of the model. .
Patent Information
- Application Number
- CN202410617311.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-17
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2044-05-17
AI Technical Summary
Existing wildfire detection algorithms easily misdetect sunlight and clouds as flames and smoke, resulting in low detection accuracy.
By preprocessing the mountain fire image, identify the skyline, flames and smoke, calculate the optimal sunlight seed point and the optimal cloud fog seed point, and fuse the sunlight image and the cloud fog image based on these points to expand the mountain fire image to increase the amount of light in the background. false detection elements to improve the accuracy of model training.
It effectively reduces the false detection rate of sunlight and cloud and fog targets, improves the accuracy of mountain fire detection, enhances the diversity of data samples, and improves the detection accuracy of the model.
Smart Images

Figure CN118537638A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a method and device for expanding a wildfire image. Background Art
[0002] Inflammable and explosive materials such as trees and thatch under the transmission lines in the transmission corridor can easily cause forest fires, which greatly reduces the insulation of the air gap around the transmission lines and causes the transmission lines to trip.
[0003] Existing research on wildfire target detection algorithms for power transmission corridors is generally based on wildfire image samples collected on site. After the flames and smoke are labeled, the wildfire image dataset is added as a training set to the target detection model for training. However, due to the small number of wildfire image samples, when the detection model is trained for on-site wildfire detection, it is easy to misdetect targets such as sunlight and clouds as flames and smoke, resulting in low wildfire detection accuracy. Summary of the invention
[0004] The present invention provides a method and device for expanding a wildfire image, so as to solve the problem that targets such as sunlight and fog are easily misdetected as flames and smoke in the existing wildfire detection, resulting in low detection accuracy.
[0005] In order to solve the above technical problems, an embodiment of the present invention provides a method for expanding a wildfire image, comprising:
[0006] Collecting a wildfire image dataset of a power transmission corridor, and performing a preprocessing operation on the wildfire image dataset, wherein the preprocessing operation includes image screening and image segmentation;
[0007] Detect the wildfire image in the preprocessed wildfire image data set according to the target detection algorithm, and obtain coordinate information of a first detection frame and a second detection frame of the wildfire image; the first detection frame is a target detection frame of the skyline of the wildfire image, and the second detection frame is a target detection frame of flames and smoke;
[0008] Calculating an optimal daylight seed point and an optimal smoke seed point of the wildfire image according to coordinate information of a first detection frame and a second detection frame of the wildfire image;
[0009] The daylight image and the cloud image are fused respectively according to the optimal daylight seed point and the optimal cloud seed point in the wildfire image to obtain an expanded wildfire image.
[0010] The present invention detects and identifies the skyline, flames and smoke of the wildfire image, and determines the optimal daylight seed point and the optimal cloud seed point in the wildfire image according to the skyline, flames and smoke, so as to fuse the daylight image and the cloud image according to the optimal daylight seed point and the optimal cloud seed point, thereby expanding the background of the collected wildfire image and increasing the false detection elements in the background, which not only avoids the irrationality caused by arbitrary fusion, but also makes the data samples more diverse, thereby improving the accuracy of the model trained according to the sample data.
[0011] Furthermore, the wildfire image dataset of the power transmission corridor is collected, and a preprocessing operation is performed on the wildfire image dataset, specifically:
[0012] The wildfire image dataset is screened according to a preset image selection rule, and the wildfire image is compressed according to a preset size to generate a first wildfire image dataset; the image selection rule includes resolution, time, image elements and weather;
[0013] The first wildfire image in the first wildfire image dataset is segmented according to the semantic segmentation model, the skyline of the first wildfire image and its corresponding position information are determined, and the preprocessing operation is completed.
[0014] Furthermore, before detecting the mountain fire image in the mountain fire image data set according to the target detection algorithm and obtaining the coordinate information of the first detection frame and the second detection frame of the mountain fire image, it also includes:
[0015] Establishing a coordinate system for the preprocessed wildfire image according to the reference point, and determining the image coordinate information of all segmentation points of the skyline according to the position information of the skyline;
[0016] The image coordinate information of all segmentation points of the skyline is filled into a one-dimensional matrix according to the size of the horizontal coordinates to generate the skyline position matrix, and the vertical coordinates of the points that are not successfully segmented in the skyline position matrix are set to null values.
[0017] Furthermore, the mountain fire image in the preprocessed mountain fire image data set is detected according to the target detection algorithm to obtain the coordinate information of the first detection frame and the second detection frame of the mountain fire image, specifically:
[0018] Detecting the wildfire image in the preprocessed wildfire image dataset according to the target detection algorithm, and obtaining position information of a first detection frame and a second detection frame of the wildfire image;
[0019] Coordinate information of the first detection frame and the second detection frame is determined according to the coordinate system, where the coordinate information includes center coordinates of the detection frame and size information of the detection frame.
[0020] Furthermore, the optimal daylight seed point and the optimal smoke seed point of the wildfire image are calculated according to the coordinate information of the first detection frame and the second detection frame of the wildfire image, specifically:
[0021] Obtaining pixel coordinates of the wildfire image and generating a pixel matrix;
[0022] Randomly extracting a number of elements in the pixel matrix as seed points according to a preset number threshold, and obtaining the position coordinates of each seed point;
[0023] The optimal daylight seed point and the optimal smoke seed point of the wildfire image are calculated according to the position matrix of the skyline and the coordinate information of the second detection frame.
[0024] Furthermore, the optimal daylight seed point and the optimal smoke seed point of the wildfire image are calculated according to the position matrix of the skyline and the coordinate information of the second detection frame, specifically:
[0025] Traversing the position coordinates of each seed point, and eliminating the seed points whose horizontal coordinates are the same as the first horizontal coordinate, where the first horizontal coordinate is the horizontal coordinate of the element whose vertical coordinate is a null value in the skyline position matrix;
[0026] Screening each seed point according to the distance between each seed point and the center point of the second detection frame, the distance between the diagonal of the second detection frame, and the radius of the image to be generated to obtain a first seed point set;
[0027] Traversing the first seed point set, screening out second seed points having the same horizontal coordinate as the elements in the skyline position matrix;
[0028] An optimal daylight seed point and an optimal smoke seed point are determined according to a distance between the second seed point and a longitudinal coordinate of a first element and a distance between the second seed point and an edge of an image, wherein the first element is an element in the position matrix of the skyline whose transverse coordinate is the same as that of the second seed point.
[0029] Furthermore, the determining of the optimal daylight seed point and the optimal smoke seed point according to the distance between the second seed point and the ordinate of the first element and the distance between the second seed point and the edge of the image is specifically as follows:
[0030] According to the difference between the ordinates of the second seed point and the first element, the second seed point is divided into a sunlight seed point set and a cloud seed point set, wherein the difference between the ordinates of the seed point and the first element in the sunlight seed point set is greater than zero, and the difference between the ordinates of the seed point and the first element in the cloud seed point set is less than zero;
[0031] Calculate the first difference square between each daylight seed point in the daylight seed point set and the ordinate of the first element corresponding to it, and calculate the first distance square between each daylight seed point and the top of the wildfire image, and determine the point with the smallest absolute value of the difference between the first difference square and the first distance square as the optimal daylight seed point;
[0032] The second square difference between each cloud seed point in the cloud seed point set and the ordinate of the corresponding first element is calculated, and the second square distance between each cloud seed point and the bottom of the wildfire image is calculated, and the point with the smallest absolute value of the difference between the two square differences and the second square distance is determined as the optimal cloud seed point.
[0033] Furthermore, the method of fusing the daylight image and the cloud image according to the optimal daylight seed point and the optimal cloud seed point in the mountain fire image to obtain the expanded mountain fire image is specifically as follows:
[0034] Collecting daylight images and cloud images, and performing background removal and compression processing on the daylight images and cloud images;
[0035] The center points of the processed daylight image and cloud image are placed on the optimal daylight seed point and the optimal cloud seed point respectively for fusion to obtain an expanded wildfire image.
[0036] In a second aspect, the present invention provides a wildfire image expansion device, comprising: a preprocessing module, a detection module, a seed point determination module and a fusion module;
[0037] The preprocessing module is used to collect a wildfire image dataset of the power transmission corridor and perform a preprocessing operation on the wildfire image dataset, wherein the preprocessing operation includes image screening and image segmentation;
[0038] The detection module is used to detect the mountain fire image in the preprocessed mountain fire image data set according to the target detection algorithm, and obtain the coordinate information of the first detection frame and the second detection frame of the mountain fire image; the first detection frame is the target detection frame of the skyline of the mountain fire image, and the second detection frame is the target detection frame of the flame and the smoke;
[0039] The seed point determination module is used to calculate the optimal daylight seed point and the optimal smoke seed point of the wildfire image according to the coordinate information of the first detection frame and the second detection frame of the wildfire image;
[0040] The fusion module is used to fuse the daylight image and the cloud image respectively according to the optimal daylight seed point and the optimal cloud seed point in the wildfire image to obtain an expanded wildfire image.
[0041] In a third aspect, the present invention further provides a computer device, comprising: a processor, a communication interface and a memory, wherein the processor, the communication interface and the memory are interconnected, wherein the memory stores an executable program code, and the processor is used to call the executable program code to execute the wildfire image expansion method. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 A schematic diagram of a flow chart of a method for expanding a wildfire image provided by an embodiment of the present invention;
[0043] Figure 2 Another schematic flow chart of a method for expanding a wildfire image provided by an embodiment of the present invention;
[0044] Figure 3 A schematic diagram of target detection for a wildfire image expansion method provided by an embodiment of the present invention;
[0045] Figure 4 A daylight image of the method for expanding a wildfire image provided by an embodiment of the present invention;
[0046] Figure 5 A fog image of a mountain fire image expansion method provided by an embodiment of the present invention;
[0047] Figure 6 An expanded forest fire image according to the forest fire image expansion method provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0048] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0049] Embodiment 1
[0050] Please refer to Figure 1 , Figure 1 A flowchart of a method for expanding a wildfire image provided by an embodiment of the present invention includes steps 101 to 104, which are specifically as follows:
[0051] Step 101: collecting a wildfire image dataset of a power transmission corridor, and performing a preprocessing operation on the wildfire image dataset, wherein the preprocessing operation includes image screening and image segmentation;
[0052] In this embodiment, a wildfire image dataset of the power transmission corridor is collected using photographic equipment or radar equipment, and wildfire images that do not meet the requirements are eliminated from the wildfire image dataset according to preset image selection rules.
[0053] In this embodiment, the wildfire image dataset of the power transmission corridor is collected and preprocessed, specifically:
[0054] The wildfire image dataset is screened according to a preset image selection rule, and the wildfire image is compressed according to a preset size to generate a first wildfire image dataset; the image selection rule includes resolution, time, image elements and weather;
[0055] The first wildfire image in the first wildfire image dataset is segmented according to the semantic segmentation model, the skyline of the first wildfire image and its corresponding position information are determined, and the preprocessing operation is completed.
[0056] In this embodiment, the preset image selection rules stipulate that images with a resolution less than a preset resolution threshold, night images, cloudy images, images without sky, and images with sunlight or clouds in the wildfire image dataset are eliminated.
[0057] In this embodiment, by removing images with a resolution less than 640×640, images at night or on cloudy days, images without the sky, and images with sunlight or clouds, a fusible wildfire image is obtained for image expansion, and the irrationality of the image after fusion is eliminated.
[0058] In this embodiment, the forest fire image is compressed according to a preset size. Specifically, the larger side of the length and width of the forest fire image is selected and compressed to a preset resolution threshold, and the compression ratio is calculated based on its original size and the resolution threshold. The other side of the forest fire image is compressed proportionally according to the compression ratio, and the rest is filled with the background color.
[0059] As a specific example of an embodiment of the present invention, the remaining wildfire image size is compressed to 640×640. The compression method adopts proportional scaling, compressing the larger length and width value to 640, and the other value is proportionally compressed, and the other parts are filled with the background color.
[0060] In this embodiment, the trained DeepLabV3 semantic segmentation model is used to segment the sky and the ground of the screened image to obtain the dividing line of the sky and the ground in the image and the dividing line position information. Specifically, a semantic segmentation model is constructed according to the DeepLabV3 semantic segmentation original model, and the annotation software Labelme is used to annotate 200 randomly selected images with the sky and ground dividing line (i.e., the skyline). After the annotation work is completed, the semantic segmentation model is directly trained as a training set. After the training is completed, all pictures in the first mountain fire map data set are segmented to obtain the dividing line and the dividing line position information.
[0061] Step 102: Detect the wildfire image in the preprocessed wildfire image dataset according to the target detection algorithm to obtain coordinate information of a first detection frame and a second detection frame of the wildfire image; the first detection frame is a target detection frame of the skyline of the wildfire image, and the second detection frame is a target detection frame of flames and smoke;
[0062] In this embodiment, before detecting the mountain fire image in the mountain fire image dataset according to the target detection algorithm and obtaining the coordinate information of the first detection frame and the second detection frame of the mountain fire image, the method further includes:
[0063] Establishing a coordinate system for the preprocessed wildfire image according to the reference point, and determining the image coordinate information of all segmentation points of the skyline according to the position information of the skyline;
[0064] The image coordinate information of all segmentation points of the skyline is filled into a one-dimensional matrix according to the size of the horizontal coordinates to generate the skyline position matrix, and the vertical coordinates of the points that are not successfully segmented in the skyline position matrix are set to null values.
[0065] In this embodiment, the lower left corner of the wildfire image is selected as the reference point, that is, the origin of the coordinate axis (0, 0), the horizontal direction of the image is the x-axis, and the vertical direction is the y-axis, to establish a coordinate system. Then a one-dimensional empty matrix A is generated, and the empty matrix is an empty matrix of 1 row and N columns, where N is the preset resolution threshold size, and the resolution threshold is set to 640 by default, that is, the empty matrix is 1 row and 640 columns.
[0066] In this embodiment, the mountain fire image in the preprocessed mountain fire image data set is detected according to the target detection algorithm to obtain the coordinate information of the first detection frame and the second detection frame of the mountain fire image, specifically:
[0067] Detecting the wildfire image in the preprocessed wildfire image dataset according to the target detection algorithm, and obtaining position information of a first detection frame and a second detection frame of the wildfire image;
[0068] Coordinate information of the first detection frame and the second detection frame is determined according to the coordinate system, where the coordinate information includes center coordinates of the detection frame and size information of the detection frame.
[0069] In this embodiment, flame and smoke are detected on the pre-processed mountain fire image dataset after screening according to the trained YOLOv8 target detection model, and the position information of the first detection frame and the second detection frame is obtained, wherein the first detection frame is the target detection frame of the skyline of the mountain fire image, and the second detection frame is the target detection frame of the flame and smoke. The trained YOLOv8 target detection model first uses the labeling software Label img to label the flame and smoke targets of 1,000 randomly selected images, and then adds them to the YOLOv8 target detection model as a training set for training. After the training is completed, all images in the pre-processed mountain fire image dataset are detected to obtain the target detection frame and the detection frame position information.
[0070] In this embodiment, the image coordinate information of each segmentation point of the skyline is obtained by using the obtained segmentation line position information (x sk ,y sk ), fill the coordinate information into the empty matrix A from top to bottom in the order of the horizontal coordinate from small to large, and set the vertical coordinate of the point that is not successfully segmented to the null value 0. Use the target detection frame information to determine the coordinates of the center point of the target detection frame (x pr ,y pr ) and the size information of the detection frame, wherein the size information of the detection frame includes the width and height information w of the target detection frame pr 、h pr .
[0071] Step 103: Calculating the optimal daylight seed point and the optimal smoke seed point of the wildfire image according to the coordinate information of the first detection frame and the second detection frame of the wildfire image;
[0072] In this embodiment, the optimal daylight seed point and the optimal smoke seed point of the mountain fire image are calculated according to the coordinate information of the first detection frame and the second detection frame of the mountain fire image, specifically:
[0073] Obtaining pixel coordinates of the wildfire image and generating a pixel matrix;
[0074] Randomly extracting a number of elements in the pixel matrix as seed points according to a preset number threshold, and obtaining the position coordinates of each seed point;
[0075] The optimal daylight seed point and the optimal smoke seed point of the wildfire image are calculated according to the position matrix of the skyline and the coordinate information of the second detection frame.
[0076] In this embodiment, based on the acquired wildfire image, the position matrix of the skyline and the coordinate information of the second detection frame, the optimal daylight seed point and the optimal cloud seed point are determined. Specifically, the pixel coordinates of the wildfire image are read one by one to generate a 640×640 matrix B, and each element of the matrix is expressed in the form of original pixel coordinates. 1000 elements in the matrix are randomly selected as seed points by a random but non-repetitive extraction method, and at the same time, the position information of each seed point is confirmed to be expressed in the form of coordinates (x se ,y se ), and then calculate the optimal daylight seed point and the optimal smoke seed point of the wildfire image according to the position matrix of the skyline and the coordinate information of the second detection frame.
[0077] In this embodiment, the optimal daylight seed point and the optimal smoke seed point of the wildfire image are calculated according to the position matrix of the skyline and the coordinate information of the second detection frame, specifically:
[0078] Traversing the position coordinates of each seed point, and eliminating the seed points whose horizontal coordinates are the same as the first horizontal coordinate, where the first horizontal coordinate is the horizontal coordinate of the element whose vertical coordinate is a null value in the position matrix of the skyline;
[0079] Screening each seed point according to the distance between each seed point and the center point of the second detection frame, the distance between the diagonal of the second detection frame, and the radius of the image to be generated to obtain a first seed point set;
[0080] Traversing the first seed point set, screening out second seed points having the same horizontal coordinate as the elements in the skyline position matrix;
[0081] An optimal daylight seed point and an optimal smoke seed point are determined according to a distance between the second seed point and a longitudinal coordinate of a first element and a distance between the second seed point and an edge of an image, wherein the first element is an element in the position matrix of the skyline whose transverse coordinate is the same as that of the second seed point.
[0082] In this embodiment, the optimal daylight seed point and the optimal smoke seed point are determined according to the distance between the second seed point and the ordinate of the first element and the distance between the second seed point and the edge of the image, specifically:
[0083] According to the difference between the ordinates of the second seed point and the first element, the second seed point is divided into a sunlight seed point set and a cloud seed point set, wherein the difference between the ordinates of the seed point and the first element in the sunlight seed point set is greater than zero, and the difference between the ordinates of the seed point and the first element in the cloud seed point set is less than zero;
[0084] Calculate the first difference square between each daylight seed point in the daylight seed point set and the ordinate of the first element corresponding to it, and calculate the first distance square between each daylight seed point and the top of the wildfire image, and determine the point with the smallest absolute value of the difference between the first difference square and the first distance square as the optimal daylight seed point;
[0085] The second square difference between each cloud seed point in the cloud seed point set and the ordinate of the corresponding first element is calculated, and the second square distance between each cloud seed point and the bottom of the wildfire image is calculated, and the point with the smallest absolute value of the difference between the two square differences and the second square distance is determined as the optimal cloud seed point.
[0086] In this embodiment, each generated seed point position information is traversed, and the seed point position information is compared with each element in the skyline position matrix A one by one, excluding the horizontal coordinate x se The horizontal coordinate x of the point where the vertical coordinate is 0 sk Same seed point; then determine the distance between the seed point and the center point coordinate of the second detection frame (x pr ,y pr ) is the distance greater than half of the diagonal distance of the second detection frame r pr The sum of the radius r of the image to be generated is retained if it is greater than r, otherwise it is removed to obtain the first seed point set.
[0087] In this embodiment, the distance between the seed point and the center point coordinate (x pr ,y pr ) distance, specifically:
[0088]
[0089] In this embodiment, half of the diagonal distance r of the second detection frame pr And the sum of the image radius r that needs to be generated, specifically:
[0090]
[0091] Among them, (x se ,y se ) represents the seed point coordinates, (x pr ,y pr ) represents the coordinates of the center point of the box, w pr 、h pr Represent the width and height of the box respectively, r represents the radius of the image to be generated, r pr Represents half the distance of the box diagonal.
[0092] In this embodiment, the first seed point set is traversed to screen out second seed points with the same horizontal coordinate as the elements in the skyline position matrix, and then the optimal daylight seed point and the optimal smoke seed point are determined based on the distance between the second seed point and the vertical coordinate of the first element and the distance between the second seed point and the edge of the image.
[0093] In this embodiment, the optimal daylight seed point and the optimal smoke seed point are determined according to the distance between the second seed point and the ordinate of the first element and the distance between the second seed point and the edge of the image, specifically:
[0094] According to the difference between the ordinates of the second seed point and the first element, the second seed point is divided into a sunlight seed point set and a cloud seed point set, wherein the difference between the ordinates of the seed point and the first element in the sunlight seed point set is greater than zero, and the difference between the ordinates of the seed point and the first element in the cloud seed point set is less than zero;
[0095] Calculate the first difference square between each daylight seed point in the daylight seed point set and the ordinate of the first element corresponding to it, and calculate the first distance square between each daylight seed point and the top of the wildfire image, and determine the point with the smallest absolute value of the difference between the first difference square and the first distance square as the optimal daylight seed point;
[0096] The second square difference between each cloud seed point in the cloud seed point set and the ordinate of the corresponding first element is calculated, and the second square distance between each cloud seed point and the bottom of the wildfire image is calculated, and the point with the smallest absolute value of the difference between the two square differences and the second square distance is determined as the optimal cloud seed point.
[0097] In this embodiment, the first seed point set is traversed, and the horizontal coordinate x of the seed point in the first seed point set is selected. se Same as skyline x sk point.
[0098] In this embodiment, the difference s between the ordinates of the two points is taken. If s is greater than 0, it indicates that the seed point is located above the segmented skyline and is a daylight seed point. The square of the first difference s between the ordinates is taken. 2 And the first distance square s1 from the top of the image to the daylight seed point 2 The absolute value d of the difference between the two, the seed point with the smallest d is the optimal daylight seed point.
[0099] In this embodiment, the difference s between the two points’ ordinates is taken. If s is less than 0, it indicates that the seed point is below the segmented skyline and is a cloud seed point. The square of the second difference s between the ordinates is taken. 2 And the second distance square s2 from the cloud seed point to the bottom of the image 2 The absolute value d of the difference between them is the smallest, and the seed point with the smallest d is the optimal cloud seed point.
[0100] In this embodiment, the two points are the horizontal coordinates x and y of the seed points in the first seed point set. se Same as skyline x sk point.
[0101] In this embodiment, the difference of the ordinate is specifically:
[0102] s=y se -y s k (3)
[0103] In this embodiment, the distance from the top of the image to the daylight seed point is:
[0104] s1=640-y se (4)
[0105] In this embodiment, the distance from the cloud seed point to the bottom of the image is:
[0106] s2=y se (5)
[0107] In this embodiment, the optimal seed point determination formula is specifically:
[0108] d best =min{|s 2 -s i=1,2 2 |} (6)
[0109] Among them, s represents the difference between the ordinate of the seed point and the corresponding skyline segmentation point, s1 represents the distance between the daylight seed point and the top of the image, and s2 represents the distance between the cloud seed point and the bottom of the image.
[0110] Step 104: According to the optimal daylight seed point and the optimal cloud seed point in the wildfire image, the daylight image and the cloud image are fused respectively to obtain an expanded wildfire image.
[0111] In this embodiment, the method of fusing the daylight image and the cloud image according to the optimal daylight seed point and the optimal cloud seed point in the mountain fire image to obtain the expanded mountain fire image is as follows:
[0112] Collecting daylight images and cloud images, and performing background removal and compression processing on the daylight images and cloud images;
[0113] The center points of the processed daylight image and cloud image are placed on the optimal daylight seed point and the optimal cloud seed point respectively for fusion to obtain an expanded wildfire image.
[0114] In this embodiment, daylight images and cloud images are collected, compressed according to a default size, and fused based on the optimal daylight seed points and cloud seed points in each image.
[0115] In this embodiment, daylight images and cloud images collected from the Internet are segmented by an image segmentation algorithm to obtain daylight element images and cloud element images, and the rest of the background is removed. The 100 daylight element images and cloud element images with the best segmentation effect are selected respectively, and the collected images are compressed to 40×40 by a proportional scaling method. The larger length and width value is compressed to 40, and the other value is proportionally compressed. The other parts are filled with the background color, and the compressed daylight element images and cloud element images are respectively placed on the optimal daylight seed point and the optimal smoke seed point of each wildfire image in the wildfire image dataset to obtain the expanded transmission corridor wildfire image dataset.
[0116] In this embodiment, after completing the image expansion, it is also necessary to verify the effectiveness of image expansion in reducing false detection of sunlight and cloud targets in the image according to the YOLOv8 target detection original model. Specifically, the expanded power transmission line corridor wildfire image dataset is divided into a training verification set and a test set in a ratio of 8:2. The training verification set is added to the YOLOv8 target detection model for training. After obtaining the optimal weight W, the images that are prone to false detection are detected, and the false detection rate is calculated according to the detection results. The effectiveness of the expanded power transmission corridor wildfire image dataset is evaluated according to the false detection rate.
[0117] Please refer to Figure 2 , Figure 2 Another flowchart of the wildfire image expansion method provided by the embodiment of the present invention includes S1 to S4, specifically:
[0118] S1: Collect the transmission corridor wildfire image dataset, screen and preprocess the images;
[0119] S2: Based on the image data information obtained after the preprocessing, coordinate axes are set for the image, the position information of the dividing line between the sky and the ground and the target detection frame of the flame and the smoke are confirmed, and the position information of the dividing line and the detection frame is expressed in the form of coordinates;
[0120] S3: Based on the acquired image data information, determine the optimal sunlight and cloud generation seed points;
[0121] S4: Based on the obtained optimal daylight seed point and cloud seed point in each image, the daylight image and the cloud image are fused respectively, and the effectiveness is verified.
[0122] In this embodiment, a total of 2622 wildfire image data sets are collected and preprocessed. The preprocessing process specifically includes: eliminating images with a resolution less than 640×640, eliminating images of night and cloudy days, eliminating images without the sky, and eliminating images with sunlight or clouds. The remaining images are then compressed to 640×640. After manual preprocessing, 2106 images remain.
[0123] Please refer to Figure 3 , Figure 3 A schematic diagram of target detection for a wildfire image expansion method provided in an embodiment of the present invention.
[0124] In this embodiment, 200 images are selected and the label making tool label me is used to make segmentation line labels, and then DeepLabV3 is trained as a training set. After obtaining the optimal weight, the remaining images are trained, and 97.8% of the images, a total of 1956 images, successfully obtain the skyline segmentation line, obtain the location information of each segmentation point of the skyline, and record it in a txt file with the same name as the image; the label making tool Label img is used to annotate 1000 randomly selected images from the wildfire image sample library into the Pascal VOC dataset format, and flames and smoke are selected as the recognition objects, and are annotated and named 'f ire', 'smoke', divide the training set and the test set into two sets, and then train the YOLOv8 model. Then, the YOLOv8 model with the optimal weight is used to predict the flame and smoke targets in 1956 images, and the prediction box and prediction box information are obtained. All images are successfully predicted. In the subsequent inspection, some false detections are found. After deleting some images, 1832 images are left. Then, the falsely detected prediction boxes in these 1832 images are deleted to obtain the final 1832 images. These 1832 images have both segmented skylines and prediction boxes, such as Figure 3 As shown in the figure, the yellow line is the dividing line and the red box is the target detection box.
[0125] In this embodiment, based on the image data information obtained after the preprocessing, the coordinate axis is set for the image, the dividing line between the sky and the ground of the image and the position information of the target detection frame of the flame and smoke are confirmed, and the position information of the dividing line and the detection frame is expressed in the form of coordinates.
[0126] In this embodiment, the lower left corner of the image is set as the origin of the coordinate axis (0, 0), the horizontal axis of the image is the x-axis, and the vertical axis is the y-axis. After obtaining the coordinates of the dividing line and each dividing point on the dividing line, the position of the dividing line in the image is represented in matrix form. The matrix elements are all point coordinates, and the minimum coordinate of each point is controlled to be a single digit by rounding. If there are some empty values, the vertical coordinate is set to 0; the position information of the detection frame is also rounded to a single digit. The first column of information indicates the type of detection target, '0' indicates smoke, and '1' indicates flame. The second and third columns of information indicate the horizontal and vertical coordinates of the center point of the detection frame, and the fourth and fifth columns of information indicate the width and height of the detection frame, and the unit is one pixel.
[0127] In this embodiment, the pixel coordinates of the image are read one by one to generate a 640×640 matrix B, and each element of the matrix is expressed in the form of original pixel coordinates. 1000 elements in the matrix are randomly selected as seed points by a random but non-repeated extraction method, and at the same time, the position information of each seed point is confirmed to be expressed in the form of coordinates (x se ,y se ); then select the optimal seed point. The specific process of selecting the optimal seed point includes: traversing each generated seed point position information, comparing the seed point position information with each element in the matrix A one by one, excluding the horizontal coordinate x se The horizontal coordinate x of the point where the vertical coordinate is 0 sk The same seed point; then determine the coordinates of the center point of the frame of the flame and smoke target of the wildfire image (x pr ,y pr ) Is the distance greater than half of the box diagonal distance r pr The sum of the radius r of the image to be generated, if it is greater than that, it is retained, otherwise it is removed; finally, the optimal seed point is selected, the remaining seed points are traversed and eliminated, and then the horizontal coordinate x of the seed point is selected se Same as skyline x sk The difference s between the two points’ ordinates is taken. If s is greater than 0, it indicates that this seed point is above the segmented skyline and is a daylight seed point. The square of the difference s is taken. 2 And the square of the distance s1 from the top of the image to the daylight seed point 2 The absolute value d of the difference between the two points, the seed point with the smallest d is the optimal daylight seed point; if s is less than 0, it means that this seed point is below the segmented skyline and is a cloud seed point. The square of the ordinate difference s is taken. 2 And the square of the distance s2 from the cloud seed point to the bottom of the image 2 The absolute value d of the difference between them is the smallest, and the seed point with the smallest d is the optimal cloud seed point.
[0128] In this embodiment, python is used to call the numpy library to randomly but non-repeatedly extract 1000 coordinate elements in a 640×640 matrix. After the optimal seed point selection process is performed, the following situations occur: most images normally generate two optimal seed points; some images have only one optimal seed point, and these images are retained; a small number of images have multiple optimal daylight seed points and optimal cloud seed points, and the optimal seed points are manually selected to delete these images; some images do not have the optimal daylight seed points and the optimal cloud seed points, and these images are also deleted; finally, there are 1488 images left that can normally fuse daylight or cloud images.
[0129] Please refer to Figure 4 , Figure 5 and Figure 6 , Figure 4 A daylight image of the forest fire image expansion method provided by an embodiment of the present invention, Figure 5 A fog image of a mountain fire image expansion method provided by an embodiment of the present invention; Figure 6 An expanded forest fire image according to the forest fire image expansion method provided by an embodiment of the present invention.
[0130] In this embodiment, a large number of daylight images and cloud images are collected from the Internet. The daylight images and cloud images in the images are segmented by color space segmentation, threshold adjustment and other methods to obtain images with only daylight and cloud, and the rest of the background is completely removed. The 100 daylight images and cloud images with the best quality are selected, as shown in Figure 1. Figure 4 and Figure 5 As shown, the collected images are compressed to 40×40 by proportional scaling, the larger length and width are compressed to 40, the other value is proportionally compressed, and the other parts are filled with background color. The sunlight and cloud are fused for all the original transmission line corridor forest fire images, and the center points of the compressed sunlight and cloud images are placed at the optimal seed point position, as shown in FIG. Figure 6As shown in the figure, 1488 images of the expanded transmission corridor wildfire image dataset are obtained; the expanded images are added to the original transmission line corridor wildfire image dataset, replacing the original 1488 images; the expanded transmission line corridor wildfire image dataset is divided into a training validation set and a test set with a ratio of 8:2, and the training validation set is added to the YOLOv8 target detection model for training. During the training process, the number of training rounds is set to 200, the batch size is 16, the maximum learning rate is set to 0.01, the minimum learning rate is set to 0.0001, and verification evaluation is added, and each round is performed. First, the optimal training weight W is obtained by comparing the loss values, and the most optimal training weight W is input into the YOLOv8 target detection model. A total of 1202 images that are easy to misdetect are used for testing. There are no flames and smoke targets in the images. Most of them are targets that are easy to misdetect, such as fluorescent lights, clouds, etc. The resulting false detection rate is 10.74%, which is 74.56% compared to the false detection rate of the unexpanded power transmission line corridor wildfire image dataset. It can be clearly concluded that the false detection rate has dropped significantly, which effectively verifies the image expansion method for reducing the false detection rate of wildfire targets that are easy to misdetect.
[0131] The embodiment of the present invention also provides a wildfire image expansion device, comprising: a preprocessing module, a detection module, a seed point determination module and a fusion module;
[0132] The preprocessing module is used to collect a wildfire image dataset of the power transmission corridor and perform a preprocessing operation on the wildfire image dataset, wherein the preprocessing operation includes image screening and image segmentation;
[0133] The detection module is used to detect the mountain fire image in the preprocessed mountain fire image data set according to the target detection algorithm, and obtain the coordinate information of the first detection frame and the second detection frame of the mountain fire image; the first detection frame is the target detection frame of the skyline of the mountain fire image, and the second detection frame is the target detection frame of the flame and the smoke;
[0134] The seed point determination module is used to calculate the optimal daylight seed point and the optimal smoke seed point of the wildfire image according to the coordinate information of the first detection frame and the second detection frame of the wildfire image;
[0135] The fusion module is used to fuse the daylight image and the cloud image respectively according to the optimal daylight seed point and the optimal cloud seed point in the wildfire image to obtain an expanded wildfire image.
[0136] An embodiment of the present invention also provides a computer device, comprising: a processor, a communication interface and a memory, wherein the processor, the communication interface and the memory are interconnected, wherein the memory stores executable program code, and the processor is used to call the executable program code to execute the wildfire image expansion method.
[0137] In this embodiment, the skyline, flames and smoke are detected and identified in the wildfire image, and the optimal daylight seed point and the optimal cloud seed point in the wildfire image are determined based on the skyline, flames and smoke, so that the daylight image and the cloud image are fused based on the optimal daylight seed point and the optimal cloud seed point, thereby expanding the background of the collected wildfire image and increasing the false detection elements in the background, which not only avoids the irrationality caused by arbitrary fusion, but also makes the data samples more diverse, thereby improving the accuracy of the model trained based on the sample data.
[0138] The specific embodiments described above further illustrate the purpose, technical solutions and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. It is particularly pointed out that for those skilled in the art, any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for expanding a wildfire image, characterized in that: include: Collecting a wildfire image dataset of a power transmission corridor, and performing a preprocessing operation on the wildfire image dataset, wherein the preprocessing operation includes image screening and image segmentation; Detecting the wildfire image in the preprocessed wildfire image data set according to the target detection algorithm, and obtaining coordinate information of a first detection frame and a second detection frame of the wildfire image; The first detection frame is a target detection frame of the skyline of the wildfire image, and the second detection frame is a target detection frame of flames and smoke; Calculating an optimal daylight seed point and an optimal smoke seed point of the wildfire image according to coordinate information of a first detection frame and a second detection frame of the wildfire image; The daylight image and the cloud image are fused respectively according to the optimal daylight seed point and the optimal cloud seed point in the wildfire image to obtain an expanded wildfire image.
2. The method for expanding a wildfire image according to claim 1, wherein: The collecting of the wildfire image dataset of the power transmission corridor and the preprocessing of the wildfire image dataset are specifically as follows: The wildfire image dataset is screened according to a preset image selection rule, and the wildfire image is compressed according to a preset size to generate a first wildfire image dataset; the image selection rule includes resolution, time, image elements and weather; The first wildfire image in the first wildfire image dataset is segmented according to the semantic segmentation model, the skyline of the first wildfire image and its corresponding position information are determined, and the preprocessing operation is completed.
3. The method for expanding a wildfire image as claimed in claim 2, characterized in that: Before detecting the mountain fire image in the mountain fire image data set according to the target detection algorithm and obtaining the coordinate information of the first detection frame and the second detection frame of the mountain fire image, the method further includes: Establishing a coordinate system for the preprocessed wildfire image according to the reference point, and determining the image coordinate information of all segmentation points of the skyline according to the position information of the skyline; The image coordinate information of all segmentation points of the skyline is filled into a one-dimensional matrix according to the size of the horizontal coordinates to generate the skyline position matrix, and the vertical coordinates of the points that are not successfully segmented in the skyline position matrix are set to null values.
4. The method for expanding a wildfire image as claimed in claim 3, characterized in that: The method of detecting the mountain fire image in the preprocessed mountain fire image data set according to the target detection algorithm to obtain the coordinate information of the first detection frame and the second detection frame of the mountain fire image is specifically as follows: Detecting the wildfire image in the preprocessed wildfire image dataset according to the target detection algorithm, and obtaining position information of a first detection frame and a second detection frame of the wildfire image; Coordinate information of the first detection frame and the second detection frame is determined according to the coordinate system, where the coordinate information includes center coordinates of the detection frame and size information of the detection frame.
5. The method for expanding a wildfire image as claimed in claim 4, characterized in that: The calculating of the optimal daylight seed point and the optimal smoke seed point of the mountain fire image according to the coordinate information of the first detection frame and the second detection frame of the mountain fire image is specifically: Obtaining pixel coordinates of the wildfire image and generating a pixel matrix; Randomly extracting a number of elements in the pixel matrix as seed points according to a preset number threshold, and obtaining the position coordinates of each seed point; The optimal daylight seed point and the optimal smoke seed point of the wildfire image are calculated according to the position matrix of the skyline and the coordinate information of the second detection frame.
6. The method for expanding a wildfire image as claimed in claim 5, characterized in that: The optimal daylight seed point and the optimal smoke seed point of the wildfire image are calculated according to the position matrix of the skyline and the coordinate information of the second detection frame, specifically: Traversing the position coordinates of each seed point, and eliminating the seed points whose horizontal coordinates are the same as the first horizontal coordinate, where the first horizontal coordinate is the horizontal coordinate of the element whose vertical coordinate is a null value in the position matrix of the skyline; Screening each seed point according to the distance between each seed point and the center point of the second detection frame, the distance between the diagonal of the second detection frame, and the radius of the image to be generated to obtain a first seed point set; Traversing the first seed point set, screening out second seed points having the same horizontal coordinate as the elements in the skyline position matrix; An optimal daylight seed point and an optimal smoke seed point are determined according to a distance between the second seed point and a longitudinal coordinate of a first element and a distance between the second seed point and an edge of an image, wherein the first element is an element in the position matrix of the skyline whose transverse coordinate is the same as that of the second seed point.
7. The method for expanding a wildfire image as claimed in claim 6, characterized in that: The step of determining the optimal daylight seed point and the optimal smoke seed point according to the distance between the second seed point and the ordinate of the first element and the distance between the second seed point and the edge of the image is specifically as follows: According to the difference between the ordinates of the second seed point and the first element, the second seed point is divided into a sunlight seed point set and a cloud seed point set, wherein the difference between the ordinates of the seed point and the first element in the sunlight seed point set is greater than zero, and the difference between the ordinates of the seed point and the first element in the cloud seed point set is less than zero; Calculate the first difference square between each daylight seed point in the daylight seed point set and the ordinate of the first element corresponding to it, and calculate the first distance square between each daylight seed point and the top of the wildfire image, and determine the point with the smallest absolute value of the difference between the first difference square and the first distance square as the optimal daylight seed point; The second square difference between each cloud seed point in the cloud seed point set and the ordinate of the corresponding first element is calculated, and the second square distance between each cloud seed point and the bottom of the wildfire image is calculated, and the point with the smallest absolute value of the difference between the two square differences and the second square distance is determined as the optimal cloud seed point.
8. The method for expanding a wildfire image as claimed in claim 7, characterized in that: The step of fusing the daylight image and the cloud image according to the optimal daylight seed point and the optimal cloud seed point in the mountain fire image to obtain the expanded mountain fire image is as follows: Collecting daylight images and cloud images, and performing background removal and compression processing on the daylight images and cloud images; The center points of the processed daylight image and cloud image are placed on the optimal daylight seed point and the optimal cloud seed point respectively for fusion to obtain an expanded wildfire image.
9. A wildfire image expansion device, characterized in that: include: Preprocessing module, detection module, seed point determination module and fusion module; The preprocessing module is used to collect a wildfire image dataset of the power transmission corridor and perform a preprocessing operation on the wildfire image dataset, wherein the preprocessing operation includes image screening and image segmentation; The detection module is used to detect the mountain fire image in the preprocessed mountain fire image data set according to the target detection algorithm, and obtain the coordinate information of the first detection frame and the second detection frame of the mountain fire image; The first detection frame is a target detection frame of the skyline of the wildfire image, and the second detection frame is a target detection frame of flames and smoke; The seed point determination module is used to calculate the optimal daylight seed point and the optimal smoke seed point of the wildfire image according to the coordinate information of the first detection frame and the second detection frame of the wildfire image; The fusion module is used to fuse the daylight image and the cloud image respectively according to the optimal daylight seed point and the optimal cloud seed point in the wildfire image to obtain an expanded wildfire image.
10. A computer device, characterized in that: include: A processor, a communication interface and a memory, wherein the processor, the communication interface and the memory are interconnected, wherein the memory stores an executable program code, and the processor is used to call the executable program code to execute the wildfire image expansion method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Forest fire smoke detection method based on image segmentation
CN110222644A
Forest fire smoke detection model training method and forest fire smoke identification method
CN116071612A
Mountain fire detection method and device for power transmission line, computer equipment and storage medium
CN117523326A
Image processing system for automatically detecting early forest fire using gaussian mixture model and HSL color space analysis, and method for same
KR101366198B1
