# Using Drones to Estimate and Reduce the Risk of Wildfire Propagation in Wildland-Urban Interfaces
## 2 Materials and Methods
### Defining the Buffer Zones Around Buildings and Roads  
The pre-processor module should be able to define the relevant objects (buildings, roads) and calculate the mandatory buffer zones around them, in accordance with the law. The goal was to use AI methodologies to detect these zones and then automatically calculate the buffer zones around these objects. It should also allow the user to define those zones or edit the results generated by the AI components because they are not 100% accurate.  
After some research, it was decided to use YOLOv11 [23] as the AI model for detecting and segmenting buildings and roads from aerial images, due to its speed and efficiency. However, a pretrained model with these characteristics was not found; therefore, a new model had to be trained from scratch. Training YOLO models requires a large dataset  
Figure 8: Orthophoto and 3D point cloud of the Oleiros use case.  
Figure 7: Orthophoto and 3D point cloud of the Castanheira use case.  
with a specific format. After some research, the Inria Aerial Image Labeling Dataset [24] was selected as the most suitable source to train the model to detect buildings. However, the images in this dataset are large, and the training labels are delivered as image masks instead of polygons, so this dataset had to be converted to smaller images and polygon metadata compatible with YOLO segmentation training. The converted dataset contains 8820 images with a resolution of 640 \(\times\) 640 pixels, 8379 of which were used for training and 441 for validation.  
Training the model required a powerful GPU with many GB of NVRAM, so it was trained on the cloud platform Paperspace [25], using an instance with 8 vCPUs, 45 GB RAM, and an NVIDIA A6000 GPU with 48 GB of NVRAM. Training started with a learning rate of 0.01 (the default) and a batch size of 8. During training, the learning rate was dynamically adjusted by the learning rate scheduler of YOLO. After 64 epochs, the model converged, and the training was stopped. The segmentation performance metrics of the model are as follows: precision: 0.871, recall: 0.835, and mAP50: 0.888.  
The trained model was embedded in a Pythonv3.11.9-based API, which is then consumed by the WebGIS JavaScript interface of the tool. To use the AI segmentation, the user just needs to move the map to the desired location and press a button. Figure 9 shows an example of AI segmentation on a site with a building (the building in the Oleiros use case).  
The lines around the building delimit the buffer zones that are automatically calculated after the building's contour is detected. The first buffer zone is a 10 m buffer around the walls of the building, and the second one is a 50 m buffer zone from the walls of the building (40 m from the first buffer zone). Each one of these buffer zones must comply with different requirements defined by law: In the first buffer zone, trees and wild vegetation are basically forbidden, whereas in the second buffer zone, trees are allowed, but with a minimum distance of 4 m between their crowns.  
These buffer zones are calculated by a JavaScript module that encodes the rules determined by Portuguese laws, since at this stage, the aim was only to check compliance with Portuguese legislation. However, this module can easily be swapped with different versions, each capable of calculating buffer zones according to different national laws.