# OD-XAI: Explainable AI-Based Semantic Object Detection for Autonomous Vehicles
## 4 The Proposed Approach
### Preprocessing
ResNets are named residual networks; in standard NNs, the network layers strive to learn the outputs of the immediately preceding layers, whereas in ResNets, the layers that do not immediately precede a specific layer also influence activation. \[R(x)=P(x)-x \tag{1}\]

Rearranging the above equation, we have:

\[P(x)=R(x)+x \tag{2}\]

\(x\) represents the activations of the immediately preceding layer. \(R(x)\) symbolizes the residual layers and \(P(x)\) specifies the current or present layer. The equations primarily show that the influences on the current layer are functions of residual \(R(x)\) and \(x\). The architectures for ResNet-18 and ResNet-50 were adopted from the [33] repository. The network architecture employs an UNet network structure with ResNet-18 or ResNet-50 encoders. The encoder and decoder model structures have several functions in computer vision; object detection, pose estimation, and semantic segmentation, to mention a few. The functionality of encoders and decoders is relatively straightforward. Encoders gradually decrease the size of feature maps to capture higher semantic information, whereas decoders are exactly the opposite to encoders; they gradually increase the size of feature maps to recover the spatial information [34]. Figure 4 shows the architecture of UNet with a ResNet-18 encoder. Figure 4: ResNet architecture for semantic segmentation. #### 4.3.2 SegNet

SegNet is another DNN that is employed in this paper. The architecture for the model in this study is inspired by the [34] repository. SegNet uses the capabilities of encoders and decoders. There are 13 encoder layers that are similar to the first 13 VGG16 convolution layers [35; 36]. The encoder is not entirely attached, which helps to lower the overall amount of parameters. For each encoder layer, related decoders use upsampling to expand the spatial size. The decoder provides sparse feature maps that are of high resolution. The last layer in the decoder features a softmax activation function that allows categorization of each pixel [35]. Figure 5 demonstrates the SegNet architecture, which is utilized in this paper. Table 4 shows the total number of layers and the total number of model parameters in all three models. ### Training

Deep learning ResNet-18, ResNet-50, and SegNet are proposed above; they further fit on the training set. The proposed architectures have discrete complexities and structures. Hence, we trained them in such a way that we acquired appropriate train and test accuracies while guaranteeing that the models did not under-fit or over-fit. The models were constructed and trained using python-TensorFlow 2.6.0. The final training parameters of all the designs are as per Table 5. Moreover, the specifications of the system in which the models were trained may be viewed in Table 6. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Model** & **Layers** & **Model Parameters** \\ \hline ResNet-18 & 111 & 17,271,149 \\ ResNet-50 & 215 & 39,030,637 \\ SegNet & 65 & 73,613,762 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Layers and model parameters of all three models. Figure 5: SegNet architecture for semantic segmentation. \begin{table}
\begin{tabular}{c c c c c} \hline \hline  & & **Training Configuration** & & \\ \hline
**Model** & **Batch Size** & **Optimizer** & **Loss Function** & **Training Metrics** & **Epochs** \\ \hline ResNet-18 & 3 & Adam (learning rate = 0.001) & Binary Cross Entropy & Accuracy & 20 \\ ResNet-50 & 3 & Adam (learning rate = 0.001) & Binary Cross Entropy & Accuracy & 10 \\ \hline SegNet & 3 & Adam (learning rate = 0.001) & Binary Cross Entropy & Accuracy & 25 \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Training configuration. ## 5 XAI Integration

In this section, we explore some existing XAI algorithms; we integrate them with our trained segmentation models to explain the predictions and ensure that they are in the right intended directions (and not just flukes).