# Magnetic Localization Method for Vehicles Based on Transformer
## 1 Introduction  
Vehicle navigation services are essential for drivers, regardless of time, weather, or location conditions [1]. Currently, GNSS is spectacularly successful at generating accurate positioning solutions in most outdoor environments [2], whose standard horizontal positioning accuracy is 1.0-3.9 m [3]. However, this approach cannot satisfy the accuracy requirements of positioning tasks in GNSS-denied scenarios, due to the limited coverage ranges of networks and channel-fading issues. To solve this problem, various positioning systems [4], such as the Inertial Navigation System (INS), Wireless Fidelity (Wi-Fi), Bluetooth, and visual systems, have been studied. INS is capable of stand-alone positioning, but it can provide only relative results, and its accuracy decreases dramatically (tens of kilometers per hour at most [5]) as the operation time increases [6]. For Wi-Fi and Bluetooth, much effort is required to install and maintain a large amount of infrastructure, which makes the application of these technologies less attractive [7]. The accuracies that can typically be obtained with Wi-Fi and Bluetooth are 1-10 m and 2-15 m, respectively [8]. In recent years, visual positioning has become a popular approach due to its high precision (<5 m [9]). However, this method relies on complex image-matching algorithms, limiting its applicability to resource-constrained terminals, and it is easily affected by lighting conditions.  
Compared to the positioning methods mentioned above, methods based on magnetic fields have been researched for a long time because of the following advantages. First, magnetic field-based positioning does not require any infrastructure, making such systems highly cost effective [10] because a magnetic field can be obtained anywhere on Earth [11]. Second, magnetic field signals are quite stable in the time domain, as opposed to radio frequency signals or sound waves, which is very important for matching-based methods [12].  
Finally, magnetic fields offer all-weather availability in the sense that they are not affected by weather-related factors, such as light, rain, and snow.  
However, magnetic signals are less distinguishable than Wi-Fi and Bluetooth signals, i.e., different positions may have similar magnetic observations, leading to a high probability of mismatch [13]. To improve the accuracy of magnetic localization, this paper innovatively proposes a magnetic localization method based on Transformer. The following contributions are made in this research.  
* We propose a novel magnetic localization framework that is specifically designed for vehicles. On the one hand, assisted by mileage information, a magnetic sequence with equal distance intervals is used as the input. This solves the problem of inconsistent spatial scales due to speed and sampling frequency differences. On the other hand, we regard the magnetic positioning problem as a regression task in which a neural network serves as the regressor and directly outputs the desired position coordinates. This strategy is feasible for vehicles and ensures the accuracy of the positioning results because of the diversity of the input data.
* For the first time, we incorporate Transformer into the field of magnetic localization for vehicles. Transformer extracts magnetic features and explores the deep temporal position information of the input sequence, thus improving the positioning accuracy.  
The remainder of this paper is organized as follows. We review the related work in Section 2. Section 3 introduces the proposed method in detail. Section 4 reports and discusses the results of several localization experiments. Finally, in the last section, we provide the main conclusions of this study and suggestions for future work.