# Wheel Odometry with Deep Learning-Based Error Prediction Model for Vehicle Localization
## 3 Transformer Model
### Testing  
Two evaluation metrics, the cumulative root mean square error (CRSE) and the cumulative true error (CTE), are listed in [22]. The CRSE describes the cumulative root mean square of the prediction error per 1 s within the total duration \(N_{t}\). This metric ignores the negative sign of the estimation error and thus provides a better understanding of the performance of the positioning technique. CTE measures the sum of the prediction errors per 1 s within the total duration \(N_{t}\). The CTE metric mainly reflects whether the estimated value is higher or lower than the actual value. Compared with the CRSE, the CTE is less realistic when comparing the performances of positioning techniques. Therefore, the CRSE is used to evaluate the model performance in this paper. The CRSE is defined as follows:  
\[\text{CRSE}=\sum_{t=1}^{N_{t}}\sqrt{e_{pred}{}^{2}} \tag{10}\]  
where \(t\) is the sampling period and \(e_{pred}\) is the prediction error.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Serial Number** & **IO-VNB Data Subset** & **Serial Number** & **IO-VNB Data Subset** \\ \hline  
\\ \hline \hline \end{tabular}
\end{table}
Table 2: IO-VNB data subsets used for the Transformer model training.  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Parameters** & **Transformer-NDC** & **Transformer-DC** \\ \hline Number of encoders and decoders \(N\) & 6 & 6 \\ Output dimension \(d_{model}\) of the sublayers and the embedding layer & 512 & 256 \\ Layer number \(d_{ff}\) of the intermediate layer in fully connected feed-forward networks & 32 & 64 \\ Number of attention heads \(h\) & 8 & 8 \\ Batch size & 32 & 32 \\ Epochs & 100 & 100 \\ Time step (sliding window) & 11 s & 11 s \\ Random inactivation ratio _Dropout_ & 0 & 0 \\ Activation function & ReLU & ReLU \\ \hline \hline \end{tabular}
\end{table}
Table 3: Training parameters of Transformer-NDC and Transformer-DC.  
Mean (\(\mu\)): the average value of the CRSE for all series to reveal the average prediction accuracy of the model in each driving condition.  
\[\mu=\frac{1}{N_{s}}\sum_{i=1}^{N_{s}}\text{CRSE} \tag{11}\]  
where \(N_{s}\) is the total number of sequences in each driving condition.  
Standard deviation (\(\sigma\)): this metric indicates the variation in the CRSE in all series. It demonstrates the stability of the model.  
\[\sigma=\sqrt{\frac{\Sigma(\text{CRSE}_{i}-\mu)^{2}}{N_{s}}} \tag{12}\]  
Maximum (max): the maximum CRSE value among all sequences evaluated in each driving condition. It indicates the model's reliability, which means the model cannot be applied to odometry error correction if the maximum CRSE is too large.  
Minimum (min): the minimum CRSE value of all sequences evaluated in each driving condition. It indicates the model's highest possible accuracy.  
The data subsets for performance evaluation are shown in Table 4. The test was first performed on the V-Vw12 dataset, which depicts near-straight-line driving on a highway, to assess the model's performance under relatively easy driving conditions. Nevertheless, the highway scenario can be considered challenging due to the large distances covered per second. Since more challenging driving conditions, such as wet roads, roundabouts, and hard brake, are pretty challenging for the localization algorithm [26] and introduce high uncertainty to wheel odometry measurements, the model's performance was simultaneously evaluated under challenging driving conditions. The data subsets used in these tests were divided into a number of test sequences of 10 s lengths each that predicted the changes in the subsequent 1 s. In addition, the data subsets were split into several test sequences of 30, 60, 120, or 180 s depending on the outage driving condition being evaluated to test the model's performance in longer-term GNSS outage driving conditions.