# Magnetic Localization Method for Vehicles Based on Transformer
## 4 Experiments and Discussions
### Generalization Analysis  
Many factors may affect the robustness of the positioning methods, including changes of the surroundings and the size of the positioning area. In this section, we conducted several additional experiments under different testing conditions to evaluate the influence of these factors on our method. The information concerning every validation dataset is shown in Table 6.  
First, we estimated the impact of different surroundings. The validation data 1 were collected on a weekday morning, when the parking garage was full of cars, while the validation data 2 were collected on a weekend night, when almost no vehicles were in the parking garage, as shown in Figure 13a. The track is the same as the 7 th evaluation data in Section 4.2.  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Evaluation Data** & **Surroundings** & **The Size of Area** \\ \hline
1 & Full of cars & A small area as shown in Figure 10 \\ \hline
2 & Nearly no cars & \\ \hline
3 & / & A large area \\ \hline \hline \end{tabular}
\end{table}
Table 6: Information concerning the three evaluation data.  
Figure 13: (**a**) Different surroundings; (**b**) measured magnetic fields in different surroundings.  
The mean and maximum errors of our method with 7-m-long sequences are shown in Table 7. Compared to the results for the same track and sequences of the same length, the mean and maximum errors are very close to those in Tables 2 and 3. In other words, the positioning results were almost unaffected by environmental changes.  
This may be attributed to two reasons. On the one hand, the data we used during the training process were collected in different surroundings, so the network is suitable for different surroundings. On the other hand, as seen from the plots in Figure 13b, although the measured magnetic fields are slightly different at the same position in different surroundings, the shapes of the magnetic field signal sequences are very similar for the same driving route, which has less impact on the sequence-based magnetic field positioning.  
Second, we tested the ability of our method in a larger area. In validation data 3, the magnetic fields were collected in a large ground parking garage in urban canyon areas with dense buildings at the Beijing New Technology Base of the Chinese Academy of Sciences, which has an area of approximately 170 \(\times\) 310 m\({}^{2}\), as shown in Figure 14a. The red lines in Figure 14b are the driving routes in this area.  
The mean and maximum errors of our method for sequences of different lengths are shown in Table 8. Compared to a small area, a longer distance was needed to distinguish the shape of the magnetic field sequence at different locations in a larger area. In addition, we also compared our method with other methods shown in Section 4.2., except for the method in [12] because the network did not converge during the training phase. As shown in Table 8, the positioning errors and required sequence length were both less than those of the other two methods.  
Figure 15 represents the positioning results of three methods with 35-m-long sequences in a large area. Although the above methods all have incorrect positioning points, our method has the least number of errors.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline \multirow{2}{*}{**Method**} & \multirow{2}{*}{**Type of Error**} & \multicolumn{2}{c}{**Evaluation Data**} \\ \cline{3-4}  & & **1** & **2** \\ \hline \multirow{2}{*}{Proposed method} & mean & 1.31 & 1.51 \\ \cline{2-4}  & max & 4.02 & 4.98 \\ \hline \hline \end{tabular}
\end{table}
Table 7: The mean and maximum errors (m) in different surroundings.  
Figure 14: (**a**) A large ground parking garage in an urban canyon area with dense buildings; (**b**) driving routes.