## 5 Experiments and Results
### Implementation Details  
The models (i.e., in the first and second stages) were trained using Adam optimizer [70] with a learning rate starting at 0.0001, which was incrementally reduced by a factor of 0.1 when the models reached a plateau in learning. The localization models were trained with a batch size of 10 pre-disaster images, randomly cropped into patches of 256 \(\times\) 256 \(\times\) 3 pixels, while the damage assessment models were trained with a batch size of 5 pairs of pre- and post-disaster images, randomly cropped into patches of 256 \(\times\) 256 \(\times\) 3 pixels. The localiza  
Figure 11: (**a**) Interpretation of the confusion matrix into useful evaluation metrics; and (**b**) visual comparison of IoU and F1-score based on [69]. tion and damage assessment networks were trained for 70 and 30 epochs, respectively. The selection of the number of epochs was based on the observations from the literature, which used more epochs for the localization stage and less for the classification stage, and several try-and-error attempts to find the most suitable numbers. Moreover, we configured them in such a way as to avoid overfitting in the models. It is worth mentioning that the ground truth masks for the localization task were 256 \(\times\) 256 \(\times\) 1 pixels, while for the damage assessment stage, we used one-hot encoded masks. One-hot encoded masks contain pixels of each class in a separate channel. Thus, the masks of the second stage had 256 \(\times\) 256 \(\times\) 5 shapes, where the last four were for the four damage classes, and the first channel was selected to contain building localization masks (see Figure 12). Figure 12 illustrates the above-mentioned preparations in a schematic diagram. On the left, the random 256 \(\times\) 256 cropping procedure is shown. In particular, in each iteration during the training phase, one random 256 \(\times\) 256 patch is extracted from the 1024 \(\times\) 1024 input image. This step is highly important in increasing the generalization power of the model, as it decreases the chance of the model to see one similar patch in every iteration. On the right side, a schematic illustration of the augmentation process and the one-hot encoded classes, along with their corresponding weights, are shown. A combination of Focal loss (\(\lambda_{Focal}\)) [71], Dice loss (\(\lambda_{Dice}\)) [72], and Cross Entropy loss functions were utilized in the localization model training stage [73]. Focal loss function addresses data imbalance, while Dice loss tries to fit the prediction masks with ground truth building masks by maximizing their overlaps. Moreover, for the multi-class semantic segmentation model training, Binary Cross Entropy was replaced with a Weighted Categorical Cross Entropy loss function (\(\lambda_{WCE}\)) which takes into account data imbalance by applying different weights to classes. The weights were propo  
Figure 12: Demonstration of the image preparation steps, i.e., random 256 \(\times\) 256 patch extraction, augmentation, and arrangement of masks for the damage assessment stage and the corresponding weights for each class, obtained based on their proportional number of samples. samples in each damage category [73]. Equation (5) clarifies the utilized loss function. Finally, on the last layer of the model, a Sigmoid activation function was used. \[ \begin{split}\text{Total Loss}&=\{\lambda_{WCE}:- \frac{1}{N}\sum_{n=1}^{N}r_{n}\omega_{n}\text{log}\,p_{n}+(1-r_{n})\text{log}(1 -p_{n})\}\ +\ \dots\\ &\dots\ \{\lambda_{Focal}:-(1-p_{n})^{\gamma}\text{log}\,p_{n}\}\ +\ \{\lambda_{Dice}:\ 1-\frac{\sum_{n=1}^{N}2_{n}p_{n}+\epsilon}{\sum_{n=1}^{N}r_{n}+p_{n}+ \epsilon}\},\end{split}  \tag{5}\]  
where \(r_{n}\) refers to reference pixels and \(p_{n}\) is the predicted pixels for class \(n\). After training the localization networks, they were used as weight initializers for the second stage.