Although the network architecture is not that of an image classifier and the labels are not scalars, semantic segmentation can be seen as a traditional classification problem and therefore the training and evaluation processes can be the same.
For this reason, instead of writing a custom training loop, we can use the compile and fit Keras models to build the training loop and execute it respectively.