# OD-XAI: Explainable AI-Based Semantic Object Detection for Autonomous Vehicles
## 4 The Proposed Approach
### Preprocessing
Various XAI techniques can be implemented on the model, but choosing the most appropriate ones is important for better explanations. We also observe the outputs of various individual hidden layers of the model and attempt to generate explanations by visualizing them. Applying XAI over the DL architectures for vision in AVs can help to encapsulate the 'nitty gritty' of the model. ### Taxonomy of XAI

Some prior published survey papers classified XAI techniques based on scope, usage, and methodology [37; 38]. This section provides a brief overview about XAI terminologies and the technique categories. * _Scope_: Scope refers to the extent of the explanation of the XAI technique. According to scope, the XAI technique can be categorized into locally or globally explainable models [38]. Locally explainable techniques generally focus on explaining individual features and attributions to a single datum. In contrast, global explanation methods focus more on obtaining the generalized view of the model. * _Methodology_: Methodology of a technique refers to the algorithmic strategy employed to obtain the explanations. It can be further categorized into two types: _backpropagation-based_ and _perturbation-based_[37]. * _Usage_: Use of a specific XAI algorithm can be classified into two two types: _model-specific_ and _model-agnostic_[38]. ### XAI Techniques

In this section, we present XAI approaches fitting under the above-discussed categories. We first examine those techniques briefly and then execute and analyze their outcomes. #### 5.2.1 Gradient Class Activation Mapping (Grad-CAM)

Grad-CAM is a backpropagation-based explainability approach that is mainly utilized for image data predictions [39]. Grad-CAM generated outputs involve localized class-specific areas in an image created within a single pass [37]. We may utilize these images and compare them with the model predictions. The heat map created as the output of the Grad-CAM unit involves the gradients that are most stressed by the model. The Grad-CAM result on the semantic segmentation model appears remarkably similar to the segmentation predictions. The reason for their similarities is the pixel-wise class localization of images. Though the Grad-CAM approach has a global scope, it may also be utilized to explain activations of every sublayer in a DNN [39]. A mathematical description of Grad-CAM is presented below [40]. Grad-CAM computes on the final convolution layer because it catches high-level information and retains critical image areas. \begin{table}
\begin{tabular}{c c} \hline \hline \multicolumn{2}{c}{**Dataset Configuration**} \\ \hline Dataset Size & 289 \\ \hline Road Image Shape & 192 \(\times\) 640 \(\times\) 3 \\ \hline Annotated Image Shape & 192 \(\times\) 640 \(\times\) 2 \\ \hline \multicolumn{2}{c}{**System Configuration (Google Collab)**} \\ \hline Programming Language & Python 3.7.12 \\ \hline System RAM & 12.69 GB \\ \hline System GPU & Tesla K80 \\ \hline \hline \end{tabular}
\end{table} 
Table 6: Dataset and system configurations. In order to compute the gradient of \(t_{c}\) concerning feature map \(F^{k}\) of a convolution layer, the value of the gradient being calculated depends on the input image because the feature map \(F^{k}\) depends on the image shape. \[\frac{\partial t_{c}}{\partial F^{k}} \tag{3}\]

Here, \(t_{c}\) is the score of class \(c\) just before the softmax layer and \(F\) indicates the last convolution layer. \(k\) indicates the feature map number, which has height \(h\) and width \(u\). Therefore the gradient will also have the same shape as \((k,h,u)\). The gradients are global average-pooled over the width and the height. This will lead to the neuron importance for a feature map \(k\) of class \(c\). \[\beta_{k}^{c}=\frac{1}{S}\sum_{i}\sum_{j}\frac{\partial t^{c}}{ \partial F^{k}_{i,j}} \tag{4}\] \[S=u\times h.\]

The gradient is pooled over height \(h\) and width \(u\), which provides us with the final shapes of the alpha values as \((k,1,1)\) or \((k)\).