# Magnetic Localization Method for Vehicles Based on Transformer
## 2 Related Work
### Learning-Based Methods  
Over the past ten years, learning-based methods have become a new trend [19; 20], in which deep learning is superior to traditional machine learning and has already been applied to magnetic localization. Two aspects of deep learning-based methods compensate for the defects of traditional methods. On the one hand, a database is not used in a straightforward way but is instead used to generate training sets via random walking and data augmentation. In this way, the grid-like database used in traditional methods is replaced by a neural network, which emphasizes the relationships between magnetic sequences and locations and learns the noise distribution of measured data. On the other hand, benefiting from its data-driven design, a deep learning-based method can autonomously extract useful features for localization tasks due to its deep cascaded layers and strong fitting capabilities (rather than manually extracting features and designing matching criteria to implement positioning via traditional methods). Many types of network structures have been proposed by researchers in the field of magnetic positioning, such as Convolutional Neural Networks (CNNs), Long Short-Term Memory (LSTM), Recurrent Neural Networks (RNNs), and Transformer. The authors of [21] used a standard CNN to classify extracted features in the spatial domain and exceeded 80% accuracy in a two-dimensional environment. In [22], CNNs were used to extract deep features, and correlations were utilized to obtain classification results. The results of a numerical simulation indicated that the mean matching rate surpassed 98.6%. [PERSON] trained a CNN to transform a Recurrence Plot (RP) and a magnetic map into deep features. His method yielded location classification accuracy improvements of 3.05% and 3.64% [7] compared with another CNN-based system treating fingerprints relying on instantaneous magnetic field data [23]. In the same year, he proposed an  
Figure 2: Framework of the traditional methods. improved CNN-based magnetic indoor positioning system using an attention mechanism, which outperformed the initial RP-based CNN but resulted in a much higher level of prediction latency [24]. The authors of [25] used an RNN to model magnetic time series, for which the input was a 3-dimensional magnetic vector and the output was 2-dimensional coordinates of the target location. This method provided average localization accuracy improvements of 57.5% and 74.6% over the results of the basic RNN model for medium- and large-scale testbeds, respectively. [PERSON] introduced a LSTM-based recurrent RNN to handle localization problems with smartphones. The maximum location errors of this method are 8.2 m using the magnetic only [26]. Reference [27] attained improved accuracy by better modeling the magnetic relationships present in the time domain with a Bidirectional LSTM (Bi-LSTM) structure. This method achieved positioning errors that were 88.6% and 76% less than those of the DTW method on two datasets. [PERSON] leveraged different scales to segment magnetic data and extracted magnetic sequence features at the corresponding scales through Transformer [28]. Moreover, multiple scale features were fused for positioning. Compared to typical magnetic field positioning methods, 90% of the positioning errors of this approach decreased by 13.79-60.73%. Reference [29] built Generative Adversarial Networks (GANs) to augment their training set, unburdening the data collection process and leading to a mean localization accuracy improvement of 9.66% over the conventional semi-supervised localization algorithm. Although the accuracy of the positioning results has improved to a certain extent, most of the abovementioned neural networks were designed for pedestrian positioning. In general, training sets are generated by limited measured data to decrease the difficulty of human collection, which inevitably introduces errors and limits the performance of the network.