# LW-FIRE: A Lightweight Wildfire Image Classification with a Deep Convolutional Neural Network
## 3 Materials and Methods
### Pre-Processing
#### 3.2.1 Image Tessellation  
The principal idea behind this algorithm is to mitigate the problem of information loss due to a common practice of deep learning models to resize an input image to a tensor of a specific dimension. A dimension is usually defined by a neural model that is being used. For example, VGG, InceptionNet, ResNet, and many other models resize an image into a \(224\times 224\times 3\) tensor before the training and testing process begins. Resizing an image implies changing its dimension, which can be accomplished by changing only the width or the height, or both at the same time. The preferred method for resizing is resampling using pixel area relation. If a dataset consists of images of different resolutions, this means that all images will be resized into \(224\times 224\times 3\). This inevitably leads to information loss, and it was one of our motivations for our work. To prevent unnecessary information loss, we propose a new method based on an image tessellation scheme to produce sub-images of comparable sizes. This method will also increase the number of dataset samples. To the best of our knowledge, this is the first time that this method was used for training a deep learning network.  
Every image \(I\) in the dataset is divided into an even number of sub-images, denoted as \(N\). The total number of sub-images, \(T_{N}\), depends only on a selected number \(N\). It is independent of the image size. Image \(I\) is divided into \(X\times Y\) sub-images, where \(X\) and \(Y\) are chosen to preserve the approximate proportion of each sub-image. Since \(N\) is an even number, at least one number, \(X\) or \(Y\), has to be an even number. Two image tessellation scenarios are considered in this paper, as shown in Table 1. Other scenarios are possible, but the CNN models developed under the considered scenarios exhibit satisfactory accuracy. In the first sub-stage, every image \(I\) from the dataset is divided into an even number of sub-images \(N\).  
When \(N=12\), the image width is divided by \(X=4\), and the height is divided by \(Y=3\). When \(N=42\), the image width is divided by \(X=7\), and the height is divided by \(Y=6\). If \(N=10\) or \(N=40\), the image tessellation tool can result in sub-image sizes that are disproportional, e.g., \(5\times 2\) or \(8\times 5\), which should generally be avoided because images are resized before training, so data loss might occur. A better tessellation scheme can be attained with \(N=42\), which results in \(7\times 6\) tiles. It is important to carefully choose an adequate number of sub-images so that the aspect ratio of the resulting sub-images is similar to the original image.  
Irrespective of image resolution, the total number of sub-images derived from a given image is completely defined by the value assigned to the parameter \(N\). If there are \(T=500\) images in the dataset, then the total number of sub-images is calculated as \(T_{N}=T\times N\). For different tessellation scenarios, the total number of sub-images is provided in Table 1. It is evident that for a relatively small number of \(N\), a substantial number of dataset samples is generated. These sub-images (dataset samples) may or may not contain pixels associated with fire.  
Two examples of images and the results of an image tessellation scheme based on \(N=20\) are presented in Figure 4, where sub-images containing fire are shown with a red overlay. For example, a \(4000\times 3000\) image is tessellated into 20 sub-images with a resolution of \(800\times 750\). A sub-image of this size is considered suitable to be used in the process of training a deep learning model. Once the results of the selected image tessellation scheme are obtained, it is necessary to assign a label (fire or not fire) to all individual sub-images.