# A Deep Learning Approach to Semantic Segmentation of Steel Microstructures
## 3 Results  
Five different models were trained using 5141 training images and 1469 validation images. The training results are presented in Table 3, and the training progress can be observed in Figures 5-9 for each of the models. The progression of both accuracy and the loss function is depicted. \begin{table}
\begin{tabular}{l l l l l l l} \hline \hline \multirow{2}{*}{**Model**} & \multirow{2}{*}{**Training Accuracy (\%)**} & \multirow{2}{*}{**Training Loss**} & **Final** & **Final** & **Output** & \multirow{2}{*}{**Time Elapsed**} \\  & & & **Validation** & **Validation** & **Network** & **(hh:mm:ss)** \\ \hline U-Net & 95.874 & 0.128 & 96.553 & 0.095 & 320 & 00:06:50 \\ DeepLabv3+resn50 & 97.185 & 0.068 & 97.485 & 0.060 & 480 & 00:08:14 \\ DeepLabv3+resn18 & 97.229 & 0.068 & 97.177 & 0.071 & 480 & 00:04:49 \\ DeepLabv3+mobn & **97.379** & **0.063** & **97.969** & **0.050** & 480 & 00:07:41 \\ SegNet & 95.359 & 0.236 & 96.773 & 0.169 & 963 & 00:20:23 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Training results (LR = 0.001) (bold numbers represent the maximum values). The model was then applied to 734 test images that it had not seen previously. The results of the test experiments are included in Table 4, which displays the usual metrics for segmentation problems. Additionally, the confusion matrices are shown in Figure 10. It can be inferred that the DeepLabv3+ model with MobileNetv2 achieves a performance improvement, though only slightly surpassing the other networks that also accurately solve the segmentation problem. Figure 5: Training progress of U-Net: (**a**) training and validation accuracy; (**b**) training and validation loss. Figure 6: Training progress of SegNet: (**a**) training and validation accuracy; (**b**) training and validation loss. Figure 7: Training progress of DeepLabv3+/ResNet50: (**a**) training and validation accuracy; (**b**) training and validation loss. To visually explore the results, two test images were utilized, and each was processed by every trained model. These images are depicted in Figure 11. The segmentation performed by each model can be observed for comparison with the original sample, as well as with the mask or ground truth generated during data preprocessing before training. The objective is to distinguish between the two microconstituents: ferrite as the matrix element represented by the lighter zone in the micrograph and pearlite composed of alternating layers of cementie and ferrite. It is crucial to emphasize that the ferrite constituting the pearlite should not be segmented together with the ferrite, forming the matrix of the microstructure. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Model** & **Global Accuracy** & **Mean Accuracy** & **Mean IOU** & **Weighted IOU** & **Mean BF Score** \\ \hline U-Net & 0.9667 & 0.9551 & 0.9202 & 0.9359 & 0.8578 \\ DeepLabv3+ResNet50 & 0.9757 & 0.9722 & 0.9418 & 0.9529 & 0.8798 \\ DeepLabv3+ResNet18 & 0.9725 & 0.9717 & 0.9349 & 0.9472 & 0.8471 \\ DeepLabv3+MobNetv2 & **0.9802** & **0.9743** & **0.9521** & **0.9614** & **0.9149** \\ SegNet & 0.9675 & 0.9596 & 0.9229 & 0.9377 & 0.8127 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Test image metrics (bold numbers represent the maximum values). Figure 8: Training progress of DeepLabv3+/ResNet18: (**a**) training and validation accuracy; (**b**) training and validation loss. Figure 9: Training progress of DeepLabv3+/MobileNetv2: (**a**) training and validation accuracy; (**b**) training and validation loss. In the training phase, it can be observed that the SegNet model requires more iterations and, consequently, more computational time to achieve maximum accuracy, as depicted in Figure 6, exceeding more than twice the others. However, its final training accuracy does not differ significantly from the rest, trailing only by a couple of percentage points compared to DeepLabv3+, which yields the best results. This increased number of iterations and the number of iterations increases, as depicted in Figure 10.  
Figure 11: Segmented samples.