# Magnetic Localization Method for Vehicles Based on Transformer
## 4 Experiments and Discussions
### Positioning Performance  
Several experiments were conducted to prove the superiority of our method over the traditional approaches. Tables 2 and 3 show the mean and maximum positioning errors, respectively, induced for sequences with different lengths concerning 8 tracks, which were obtained on the evaluation dataset by our method and three other methods, including the method in [12,27] and the traditional MAGCOM method. Considering that the dataset used in this work is different from the datasets used in [12,27], we reconstructed the same network structure as that in [12,27], respectively. For MAGCOM, we used an MAD metric, which has high accuracy and a simple calculation process as shown in Equation (8):  
\[\mathrm{MAD}_{AB}=\frac{1}{3W}\sum_{i=1}^{3}\sum_{k=1}^{W}\left[\left|\left(A_{ k}^{i}-mean(A^{i})\right)-\left(B_{k}^{i}-mean(B^{i})\right)\right|\right]\right. \tag{8}\]  
where \(A\) is the measured sequence, \(B\) is a possible matching sequence of length \(W\) in the constructed database, \(i\) is an index representing each axis of a magnetic field vector, and \(k\) is an index representing the \(k\)-th point in the sequence. \begin{table}
\begin{tabular}{c c} \hline \hline
**Category** & **Machine/Tools** \\ \hline CPU & Intel(R) Core(TM) i9-12900H CPU (Intel Corporation, Santa Clara, CA, USA) \\ GPU & NVIDIA GeForce RTX 2050 GPU (NVIDIA, Santa Clara, CA, USA) \\ Operating System & Windows 11 \\ Language & Python 3.8 \\ Library & PyTorch 1.13 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Experimental configuration. Figure 10: The data were collected from the test environment. As shown in Table 2, the mean positioning accuracies of our method were greater than those of traditional MAGCOM methods and the method in [12] with the same sequence length for all the evaluation data, and an average improvement of 2.67 m (70.08%) and 2.26 m (70.73%) were observed. In addition, we compared our method with the method in [27]. In most cases, the results indicated that the mean errors are less than those of the method in [27], with an average reduction of 2.09 m (49.96%). \begin{table}
\begin{tabular}{c c c c c c c c c} \hline \hline \multirow{2}{*}{**Method**} & \multirow{2}{*}{**Sequence Length**} & \multicolumn{8}{c}{**Evaluation Data**} \\ \cline{3-10}  & & **1** & **2** & **3** & **4** & **5** & **6** & **7** & **8** \\ \hline \multirow{10}{*}{Proposed method} & 5 m & 2.31 & 4.66 & 1.58 & 2.15 & 2.60 & 2.80 & 4.05 & 1.93 \\  & 6 m & 1.08 & 1.48 & 0.71 & 0.85 & 0.87 & 1.10 & 1.54 & 0.86 \\  & 7 m & 0.98 & 1.29 & 0.58 & 0.71 & 0.71 & 1.00 & 1.34 & 0.72 \\  & 8 m & 0.95 & 1.04 & 0.56 & 0.74 & 0.72 & 0.89 & 1.15 & 0.61 \\  & 9 m & 0.92 & 1.04 & 0.50 & 0.60 & 0.56 & 0.86 & 1.21 & 0.68 \\  & 10 m & 0.90 & 0.98 & 0.52 & 0.63 & 0.58 & 0.83 & 1.12 & 0.68 \\  & 11 m & 0.87 & 1.02 & 0.47 & 0.63 & 0.60 & 0.79 & 1.07 & 0.51 \\  & 12 m & 0.93 & 1.06 & 0.51 & 0.60 & 0.58 & 0.87 & 1.13 & 0.61 \\  & 13 m & 0.85 & 0.99 & 0.39 & 0.55 & 0.51 & 0.75 & 1.06 & 0.56 \\  & 14 m & 0.84 & 0.98 & 0.42 & 0.63 & 0.57 & 0.77 & 1.02 & 0.54 \\  & 15 m & 0.82 & 0.93 & 0.40 & 0.60 & 0.55 & 0.70 & 1.06 & 0.62 \\ \hline \multirow{10}{*}{Traditional MAGCOM method using the MAD metric} & 5 m & 9.70 & 6.39 & 9.65 & 8.54 & 9.42 & 7.64 & 8.18 & 10.80 \\  & 6 m & 7.15 & 4.77 & 8.04 & 7.10 & 6.27 & 5.84 & 5.62 & 8.89 \\  & 7 m & 4.85 & 4.01 & 6.12 & 5.32 & 4.81 & 4.43 & 5.28 & 7.13 \\  & 8 m & 3.48 & 3. Table 3 shows the maximum errors induced with sequences of different lengths when using the proposed method and three other methods on various evaluation data. To satisfy the main requirement of vehicle positioning--guiding the use of vacant parking spaces--the maximum positioning error needed to be approximately 5 m [38], which is approximately twice the width of a parking space.