# OD-XAI: Explainable AI-Based Semantic Object Detection for Autonomous Vehicles
## 4 The Proposed Approach
### Preprocessing
### Evaluation Metric

Evaluation metrics provide us with a clear picture about the model performance. They are calculated on train and test sets to measure the goodness of a model. Evaluation of a trained semantic segmentation model is typically conducted using two performance criteria--intersection over union (IOU) value and accuracy score. #### 6.1.1 Intersection over Union

IOU, also known as the Jaccard index, is the most commonly used metric for measuring the similarity between two arbitrary shapes [44]. IOU can also be used as a loss function so it can be backpropagated [45]; however, in our case, we utilize it as a metric to measure the merit of the anticipated segmentation map. For semantic segmentation, pixel-wise mapping was done between a ground truth segmentation map (\(G\)) and a model-predicted segmentation map (\(P\)). Note: the semantic maps '\(G\)' and '\(P\)' are image matrices of the same shape. \[\frac{\partial t_{c}}{\partial F^{k}} \tag{3}\]5

\[\frac{\partial t_{c}}{\partial F^{k}} \tag{3}\]6 \begin{table}
\begin{tabular}{p{85.4 pt} p{113.8 pt} p{113.8 pt} p{113.8 pt}} \hline \multicolumn{2}{c}{**Grad-CAM**} & **Saliency Map** & **Observational Explanations** \\ \hline \multirow{4}{*}{Methodology} & Grad-CAM employs gradients associated with a certain output class that flow into the penultimate convolutional layer to provide coarse localizations, emphasizing crucial portions of the picture. & Saliency maps compute the gradients of the loss function with respect to the input pixels for a specific output class. This will return a map of the size of the input layer containing negative and positive values. & \multirow{2}{*}{This technique leverages model API for constructing the output of a given hidden layer for a particular model.} \\ \cline{3-3} \cline{4-4} \multirow{2}{*}{Advantages} & Faster to calculate than model-independent approaches, such as LIME and SHAP. & Faster to calculate than model-independent approaches, such as LIME and SHAP. & Any hidden convolution layer’s output can be readily constructed. \\ \hline \multirow{4}{*}{Disadvantages} & Grad-CAM heat map for multiple entity occurrences belonging to a particular class in an image can become distorted, i.e., it is not able to localize on the target entity. & When ReLU is used as an activation function, if the value falls below zero, the activation becomes stuck at zero, resulting in activation saturation. & Only the feature maps conceived by a few layers at the beginning and end are genuinely useful. \\ \hline \end{tabular}
\end{table} 
Table 7: Comparison of XAI techniques. The intersection in Equation (7) can be taken as a number of actually predicted positive pixel values or true positives (_TP_); the union in Equation (7) refers to a collection of all the predicted as well as ground truth pixels. Thus, the IOU value can be expressed as follows:

\[\text{IoU}=\frac{TP}{TP+FP+FN} \tag{8}\]

IOU can be computed class-wise as well, since for each class label we have separate ground truth and anticipated segmentation maps. IOU values are between 0 and 1. An IOU value closer to 1 mathematically denotes an equal or nearly equal intersection and union values, suggesting that the ground truth and forecasts are comparable and closely resemble each other. In this paper, we computed IOU for the predicted segmentation maps according to Algorithm 4. ```
1:Input:ground_truth_images, model_predicted_images
2:Output:overall IOU of the model predictions. 3:class_num \(\leftarrow\) 2
4:G \(\leftarrow\) ground_truth_images
5:P \(\leftarrow\) model_predicted_images
6:ifG.shape == P.shape then
7:IOU \(\leftarrow\) keras.MeanIoU(num_classes = class_num)
8:IOU.update_state(G,P)
9:IOU_overall \(\leftarrow\) IOU.result().numpy()
10:endif
11:returnIOU_overall
```

**Algorithm 4** Functions used to calculate IOU in this paper. Another metric that can be used to evaluate the performance of a semantic segmentation model is the accuracy score.