# Unsupervised Driving Situation Detection in Latent Space for Autonomous Cars
## 3 Preliminaries  
In this section, we provide the addressed problem and a general overview of the solution. First, we assume that the vehicle is a car-like robot whose state, \(x\in X\), is defined as its position and velocity with respect to the body frame. In a formal way, the state is defined as follows:  
\[x=[x,y,v_{x},v_{y}] \tag{1}\]  
where \(x\) and \(y\) define the body frame, \(v_{x}\) is the speed of the car along the longitudinal axis of the car, and \(v_{y}\) is the speed of the car along the transverse axis of the car. An observation of the car, \(z\in Z\), is the set of reading from the sensors. In particular, our car is capable of obtaining the following readings:  
\[z=[Im,\theta,\beta,rpm,track] \tag{2}\]  
where each element is described in Table 1.  
The car can change its state by applying an action, \(a\in A\). In this work, the action is a vector of four elements:  
\[a=[accel,break,clutch,gear,steering]\]where each element is defined in Table 2.  
Previous works solved the problem of autonomous driving [27; 28] by defining a global policy, \(\Pi\), which is a function that takes the image coming from the observations of the car and maps it directly to the action set, formally:  
\[\Pi(z,x):Z\times X\to A \tag{4}\]  
However, one problem of the global driving policy occurs when it is trained with a small amount of data of a single driving situation, because the driving policy cannot learn the appropriate responses and it might ignore what it has to do because of the reduced probability of this driving situation to happen. Our hypothesis is that several specialized policies can be learned easier and can achieve better results.This is because the data are similar under the same context. So, instead of a global policy, in Equation (4), we propose to split it into several ones, i.e. :  
\[\Pi\approx\{\pi_{1},\pi_{2},\pi_{3},\ldots\pi_{n}\} \tag{5}\]  
where \(\pi_{n}\) is the nth driving policy. So that, \(\Pi\) can be approximated by smaller policies. Under this scheme, each small driving policy is applied to a particular situation. The previous modeling leads us to the following research questions: How can we determine the amount of driving policies, \(n\), so that they improve the global driving policy performance? How do we create those policies? To answer them, we are going to define driving situations, and for each one, we are going to assign it a driving policy. Let us define the driving situations as partitions of car observations, which means that every set of similar observations can be considered as a situation of the car. Formally:  
\[Z=\bigcup_{i=1}^{n}s_{i} \tag{6}\]  
where \(s_{i}\) are the situations and \(i=1,2,3,\ldots,n\). Given that the situations are disjoint sets, then:  
\[s_{i}\cap s_{j}=\emptyset;\quad i\
eq j \tag{7}\] \begin{table}
\begin{tabular}{c c c} \hline \hline
**Elements** & **Observations** & **Range** \\ \hline \(1m\) & Image & \(\mathbb{R}^{224\times 224\times 3}\) \\  & The angle between car & \\ \(\theta\) & direction and the direction of & \([-\pi,\pi]\) \\  & track axis & \\ \(\beta\) & Gear & \(\{-1,0,\ldots,6\}\) \\ \(rpm\) & Number of rotations per & \\  & minute of the car engine & \(\mathbb{R}\) \\ \(track\) & Distance between the car and & \\  & the track axis & \(\mathbb{R}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Observation space of the car. These are the elements that can be read from the car’s sensors. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Elements** & **Actions of the Car** & **Range** \\ \hline \(acel\) & Accelerator pedal & \([0,1]\) \\ \(break\) \Next, let us define the task of situation classification as a function that takes the observation and maps it to the set of situations:  
\[f(z):Z\to S \tag{8}\]  
where \(S\) is the set of situations. We define the function \(f(z_{im})\) based on the car's observation as follows:  
\[f(z_{im}):\mathrm{I\!R}^{224\times 224\times 3}\to S \tag{9}\]  
Finally, we relate each situation to one policy.