# OD-XAI: Explainable AI-Based Semantic Object Detection for Autonomous Vehicles
## 4 The Proposed Approach
### Preprocessing  
The original KITTI dataset image size was 375 \(\times\) 1242 \(\times\) 3 for the road images and 375 \(\times\) 1242 \(\times\) 2 for the annotated images. However for our purpose, we changed the dimensions to 192 \(\times\) 640 \(\times\) 3 for the road images and 192 \(\times\) 640 \(\times\) 2 for the annotated images. This was done to save computational time and resources. An image with relatively lower resolution could significantly reduce the computational time, thereby speeding up the whole process. Along with the resizing operation, the image brightness, saturation, and hue values were also altered, as shown in Algorithm 1. The original image input stream acquired from AV is specified by the variable _road_images_ in Algorithm 1. These input images were conventional BGR images captured by the camera installed on the AV. The BGR color space images were converted to HSV images for easier manipulation of brightness, hue, and saturation values. The KITTI dataset with 289 images was further split into train and test sets with 20% test size ratios. Road image shape: (289, 192, 640, 3), annotated images shape: (289, 192, 640, 2), train set shape: (231, 192, 640, 3), and test set shape: (58, 192, 640, 2). ```
0:road_images
0:processed image
1:rand \(\leftarrow\) random()
2:image \(\leftarrow\) road_image
3:image \(\leftarrow\) resize(image,(192,640))
4:hsv \(\leftarrow\) cvtColor(image,(BGR2 HV)) \(\triangleright\) Changing image brightness values
5:hsv[.;.;.] \(\leftarrow\) (rand-0.2) * 255. 6:hsv[.;.;.] \(\leftarrow\) clip(hsv[.;.;. ],min = 0, max = 255) \(\triangleright\) Changing image saturation values
7:hsv[.;.;.] \(\leftarrow\) (rand-0.2) * 255. 8:hsv[.;.;.] \(\leftarrow\) clip(hsv[.;.;. ],min = 0, max = 255) \(\triangleright\) Changing image hue values
9:hsv[.;.;.] \(\leftarrow\) (rand-0.2) * 255. 10:hsv[.;.;.] \(\leftarrow\) clip(hsv[.;.;. ],min = 0, max = 255)
11:processed_image \(\leftarrow\) cvtColor(hsv,(HSV2 BGR)) return processed_image
```  
**Algorithm 1** Preprocessing the images to make them trainable. ```
0:road_images
0:processed image
1:rand \(\leftarrow\) random()
2:image \(\leftarrow\) road_image
3:image \(\leftarrow\) resize(image,(192,640))
4:hsv \(\leftarrow\) cvtColor(image,(BGR2 HV)) \(\triangleright\) Changing image brightness values
5:hsv[.;.;.] \(\leftarrow\) (rand-0.2) * 255. 6:hsv[.;.] \(\leftarrow\) clip(hsv[.;. ],min = 0, max = 255) \(\triangleright\) Changing image saturation values
7:hsv[.;.;.] \(\leftarrow\) (rand-0.2) * 255. 8:hsv[.;.] \(\leftarrow\) clip(hsv[.;. ],min = 0, max = 255) \(\triangleright\) Changing image hue values
9:hsv[.;.] \(\leftarrow\) (rand-0.2) * 255. 10:

### Image Segmentation Architectures

This section discusses the architectures of DL models trained for image segmentation, specifically on the KIITI road dataset. #### 4.3.1 Residual Networks (ResNets)

ResNets are a form of DNNs, which were introduced in 2015 [30]. Traditionally, it was believed that adding more layers to the NN would increase the accuracy; however, adding numerous layers without residual blocks would either diminish the accuracy or make it stagnant. In residual blocks, each layer's output is sent as input to the following layer and to a layer that is two or more hops distant [31]. The issue of accuracy becoming stagnant is known as the vanishing gradient. The vanishing gradient problem occurs because the weights become sparser with every gradient descent step during backpropagation. Due to this issue, the model either learns at a protracted rate or does not learn at all. Shallow networks produce considerably better outcomes than DNNs when few layers are added to them. Thus, skip connections are formed to produce outcomes, such as a shallow network, which connects early layers with the deeper layers in a neural network. These are seen in ResNets [32].