# Unsupervised Driving Situation Detection in Latent Space for Autonomous Cars
## 5 Experiments
### Data Clustering  
We encode all the images using the proposed Neural Network Autoencoder in order to obtain the latent space representation from each image. Using this representation, the driving situations will be obtained using the K-means algorithm.  
To select the number of driving situations, we first run the K-means algorithm to obtain between 2 and 39 clusters. We calculate the SSE between the centroid and each cluster member, and it is plotted as a function of the number of clusters (see Figure 7). This give us a general view of the behavior of the SSE and the average silhouette. After that, we focus the analysis in the range of 2 to 20 clusters. This is because, after 20 clusters, the silhouette coefficient diverges from the SSE (see Figure 8).  
We use the elbow method to obtain the curve's point of inflection and use it as the number of situations. Generally, a higher average silhouette coefficient indicates better clustering quality. In this view, the optimal clustering number of grid cells in the study area should be 2, at which the value of the average silhouette coefficient is highest. However, the SSE of this clustering solution (\(k=2\)) is too large. At \(k=7\), the SSE is much lower; according to the elbow method, this is the best \(k\). In addition, the value of the average silhouette coefficient at \(k=7\) is also locally high. Therefore, we decided to use it as a number of driving situations detected. In this case, we obtain a total of seven driving situations.  
Visualization of the Data Using t-SNE and the Decoder Output  
To visualize the obtained data according to each driving situation, we use T-distributed Stochastic Neighbor Embedding (t-SNE). This algorithm allows us to transform high-dimensionality spatial representations as in the case of our latent space representation of the data and let us have a 2D representation, and each situation is colored accordingly, as shown in Figure 9. In general, we can see that most of the situations are clustered correctly  
Figure 6: The architecture of the policies is a convolutional neural network. The input to the Neural Network is a fixed size \(7\times 7\times 512\) from the latent space representation. The output is a vector composed of the values of \([accelerator,brake,clutch,gear,andsteering]\).  
in a 2D representation. Although some situations appear uncoupled, we assume that this may be due to the loss of information produced by the dimensional reduction of this plot.  
The number of data division examples of our dataset by each driving situation is presented in Table 4. These data clustering results, according to the driving situations, cannot be compared in an objective manner until we use it to train the policies individually and compare the results against a global driving policy.  
Figure 8: Graph of the SSE vs. Number of clusters. The point of inflection of the curve is at 7 according to the elbow method and in combination with the silhouette method.  
Figure 7: Graph of the SSE and Coefficient Silhouette vs. Number of clusters. We observe that the average silhouette diverges from the SSE curve after 20 clusters.