# Magnetic Localization Method for Vehicles Based on Transformer
## 4 Experiments and Discussions
### Positioning Performance
Therefore, we focused on the shortest sequence length needed to obtain the maximum error, which was less than 5 m. Our method, with a sequence length of 7 m, maintained its maximum errors under 5 m for all the evaluation data, while the traditional MAGCOM method with a 7-m-long sequence had maximum errors exceeding at least 62 m. When the length of the sequence increased, the maximum errors of the traditional method gradually decreased, and most data with 12-m-long sequences were qualified for the traditional method, yielding equal precision to that of our method with 7-m-long sequences. However, for evaluation data 2 and 7, until the sequence length increased to 15 m, the maximum errors were greater than 5 m. For the method in [12], the maximum errors in most cases were greater than 5 m, which results in a poor experience for users. In the method in [27], the maximum errors can be reduced to less than 5 m with 8-m-long sequences, which is slightly longer than that of our method. It can be concluded that a 7-m sequence length is sufficient for performing localization using our method, representing a reduction relative to other methods. We selected 7-m-long sequences from two evaluation data to illustrate the effect of our method, whose positioning results are shown in Figure 11. The results suggest that in comparison with the traditional MAD-based matching method and the method in [12],  
\begin{table}
\begin{tabular}{c 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{4}{*}{Proposed method} & 5 m & 37.91 & 57.29 & 18.05 & 30.95 & 44.33 & 91.94 & 33.27 & 19.74 \\  & 6 m & 5.00 & 6.53 & 2.10 & 8.72 & 6.51 & 6.29 & 9.09 & 2.16 \\  & 7 m & 2.69 & 4.20 & 1.84 & 3.50 & 3.28 & 3.22 & 4.63 & 1.82 \\ \hline \multirow{4}{*}{Traditional MAGCOM method using the MAD metric} & 5 m & 91.07 & 81.57 & 91.00 & 90.67 & 90.39 & 91.17 & 86.08 & 91.04 \\  & 6 m & 91.17 & 62.92 & 91.00 & 90.36 & 90.53 & 91.17 & 73.36 & 91.14 \\  & 7 m & 91.17 & 62.40 & 90.70 & 90.02 & 90.53 & 90.86 & 73.92 & 90.83 \\  & 8 m & 72.91 & 45.75 & 72.67 & 74.04 & 89.88 & 72.85 & 64.61 & 90.49 \\  & 9 m & 76.94 & 44.72 & 72.82 & 71.93 & 83.71 & 72.77 & 64.61 & 72.97 \\  & 10 m & 15.37 & 43.35 & 15.49 & 52.45 & 83.86 & 51.97 & 62.36 & 15.41 \\  & 11 m & 15.37 & 26.34 & 15.01 & 52.89 & 14.62 & 3.06 & 62.36 & 15.37 \\  & 12 m & 2.66 & 26.34 & 2.33 & 2.67 & 2.54 & 2.96 & 15.69 & 2.84 \\  & 13 m & 2.66 & 26.34 & 2.33 & 2.60 & 2.54 & 2.99 & 15.24 & 2.84 \\  & 14 m & 2.46 & 7.18 & 2.33 & 2.60 & 2.54 & 2.83 & 15.24 & 2 whose matching results were chaotic and disorganized, the method in [27] and our method significantly reduced the degree of mismatching, producing results that closely fit the true positions. Figure 11: Comparison of the positioning results obtained with (**a**) the proposed method, (**b**) the traditional MAGCOM method using the MAD metric, (**c**) the method in [12], and (**d**) the method in [27] when using a 7-m-long sequence for various tracks. Finally, we calculated the testing time of our method and compared it to that of other methods with a 7-m-long sequence. As shown in Table 4, the traditional method was superior to the learning-based methods in terms of time complexity, and our method took the longest calculation time due to the large size of the network. Considering that the speed of vehicles in the garage is usually less than 20 km/h, the average calculation time of 52.63 ms almost meets real-time positioning needs.