# A Deep Learning Approach to Semantic Segmentation of Steel Microstructures
## 2 Materials and Methods
### Training Parameters, Metrics and Other Details  
The training process involved optimizing various parameters, including learning rates, batch sizes, and epochs. A validation set was used to monitor the model's performance and prevent overfitting. When conducting experiments, identical training parameters were chosen to ensure a more faithful comparison of results. Adam optimizer with a learning rate of 0.001 and a maximum number of epochs set to 3 were selected. Additionally, the 'Validation Patience' parameter was set to 4 to avoid unnecessary computation. All the aforementioned information is summarized in Table 2, which compiles essential data regarding the networks for computational time considerations. \begin{table}
\begin{tabular}{l c c c c c c} \hline \hline \multicolumn{1}{c}{**Network**} & \multicolumn{1}{c}{**Optimizer**} & \begin{tabular}{c} **Learning** \\ **Rate** \\ \end{tabular} & \begin{tabular}{c} **Max** \\ **Epochs** \\ \end{tabular} & \
\begin{tabular}{c} **Batch Size** \\ \end{tabular} &
\begin{tabular}{c} **Trainable** \\ **Parameters** \\ \end{tabular} & **Layers** \\ \hline U-Net & & & & 32 & 7,697,410 & 46 \\ SegNet & & & & 16 & 29,444,166 & 91 \\ DeepLabv3+ (Resnet50) & Adam & 0.001 & 3 & & 43,980,180 & 206 \\ DeepLabv3+ (Resnet18) & & & & 32 & 20,607,636 & 100 \\ DeepLabv3+ (MobileNet) & & & & & 6,784,276 & 186 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Training parameters and network information. Figure 4: DeepLabV3+ and Resnet50 segmentation network architecture (adapted from [26]). To evaluate the performance of the segmentation models, various metrics were employed. Accuracy measures the proportion of correctly classified pixels to the total number of pixels in each class, as defined by the ground truth, and its score is calculated using Equation (2), where TP represents true positives, and FN represents false negatives. Mean Accuracy, computed as the average Accuracy of all classes across all images, provides an aggregate assessment of model performance. Global Accuracy, on the other hand, considers the ratio of correctly classified pixels, irrespective of class, to the total number of pixels. \[\text{Accuracy\,score}=\frac{\text{TP}}{\text{TP}+\text{FN}} \tag{2}\]  
Additionally, the Boundary F1 (BF) score, known as the BF Score, evaluates the alignment between predicted boundaries and true boundaries. Calculated using Equation (3), precision assesses the accuracy of the predicted boundaries, while recall gauges the model's ability to capture true boundaries. A higher BF score indicates better agreement between predicted and true boundaries. The Mean BF Score offers an aggregate measure of boundary prediction performance across all classes and images. \[\text{BF\,score}\,=\,\frac{2\,\times\,\text{precision}\,\times\,\text{recall}}{ \text{precision}\,+\,\text{recall}} \tag{3}\]  
Furthermore, the Intersection over Union (IoU) score assesses the ratio of correctly classified pixels to the total number of ground truth and predicted pixels in each class. The IoU score is computed using Equation (4), where TP represents true positives, FP represents false positives, and FN represents false negatives. The Mean IoU provides an average IoU score across all classes and images, offering insights into the overall segmentation accuracy of the model. \[\text{IoU\,score}\,=\,\frac{\text{TP}}{\text{TP}+\text{FP}+\text{FN}} \tag{4}\]  
The trained segmentation models were evaluated on a separate test set of steel micrograph images not seen during training. The metrics used for the evaluation of the models have been previously specified. All experiments were conducted on a robust computing system equipped with an Intel(R) Core(TM) i7-5930K CPU @ 3.50 GHz, DIMM 64 GB RAM, and an NVIDIA(r) GEFORCE RTX 3080 (10 GB). MATLAB(r) (R2023b, The MathWorks, Inc., Natick, MA, USA) was utilized for coding and generating segmentation models, and ImageJ was employed for mask creation, guaranteeing a stable and reproducible computational environment.