Next Article in Journal
A Trajectory Compensation Method Considering the Car-Following Behavior for Data Missing of Millimeter-Wave Radar in Roadside Detection Applications
Next Article in Special Issue
MA-RTI: Design and Evaluation of a Real-World Multipath-Assisted Device-Free Localization System
Previous Article in Journal
Prehensile and Non-Prehensile Robotic Pick-and-Place of Objects in Clutter Using Deep Reinforcement Learning
Previous Article in Special Issue
Majorization-Minimization Method for Elliptic Localization in the Absence of Transmitter Position
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Magnetic-Field-Based Indoor Positioning Using Temporal Convolutional Networks

Laboratoire Pluridisciplinaire de Recherche en Ingénierie des Systèmes, Mécanique et Energétique, Université d’Orléans, 12 Rue de Blois, 45067 Orleans, France
*
Author to whom correspondence should be addressed.
Sensors 2023, 23(3), 1514; https://doi.org/10.3390/s23031514
Submission received: 24 December 2022 / Revised: 20 January 2023 / Accepted: 25 January 2023 / Published: 30 January 2023
(This article belongs to the Special Issue Indoor and Outdoor Sensor Networks for Positioning and Localization)

Abstract

:
Traditional magnetic-field positioning methods collect magnetic-field information from each spatial point to construct a magnetic-field fingerprint database. During the positioning phase, real-time magnetic-field measurements are matched to a magnetic-field map to predict the user’s location. However, this approach requires a significant amount of time to traverse the entire magnetic-field fingerprint database and does not effectively leverage the magnetic-field sequence’s unique patterns to improve the accuracy and robustness of the positioning system. In recent years, the application of deep learning for the indoor positioning of magnetic fields has grown rapidly, especially by using the magnetic-field sequence as a time series and a trained long short-term memory (LSTM) model to predict the position, directly avoiding the time-consuming matching process. However, the training of LSTM is time-consuming, and the degradation problem occurs as the stack of layers increases. This article proposes a temporal convolutional network (TCN)-based magnetic-field positioning system that extracts magnetic-field sequence features by preprocessing them with coordinate transformation, smoothing filtering, and first-order differencing. The proposed method is seamlessly applicable to heterogeneous smartphones. The trained TCN models are compared with the LSTM and gated recurrent unit (GRU) models, showing the high accuracy and robustness of the proposed algorithm.

1. Introduction

In recent years, the rising demand for accurate and timely location-based services (LBSs) has attracted considerable interest from academics and the industry. Advanced positioning technology can provide better services such as indoor navigation and tracking, entertainment, location-based information retrieval, and emergency and safety applications [1,2].
Infrastructural approaches include Wi-Fi, radio frequency identification (RFID), ultrawide-band (UWB), and Bluetooth (BLE), and they require a customized infrastructure such as Wi-Fi access points (APs), beacons, sensors, and tags to sense the environment. Pedestrian dead reckoning (PDR) and magnetic-field-based location systems employ environmental signals and do not require an infrastructure [3,4,5,6].
Wi-Fi [7] has an average accuracy of 5 to 15 m. It has the advantage of widely distributed Wi-Fi APs, low access requirements, and high flexibility. However, it also has limitations such as noise and multipath distortion, radio mismatch issues, fluctuations in Wi-Fi signals, vulnerability to changes in APs, and the heterogeneity of Wi-Fi devices, and the positioning performance is severely degraded in dynamic environments. In addition, in recent times, Android has restricted the frequent scanning of Wi-Fi APs (Wi-Fi scan throttling), limiting the widespread use of Wi-Fi location methods [8].
BLE [9] has been the focus of attention for indoor positioning technologies, with an accuracy of typically 1 to 5 m. It has the advantage of a low reception range and low energy consumption. However, BLE is expensive as it requires the intensive deployment of BLE beacons to improve positioning accuracy. It also has inherent limitations in radio signal propagation, such as shadowing, signal absorption, and multipath.
UWB [10] has the advantages of high accuracy (10∼30 cm), high multipath resolution, large bandwidth, low latency, high penetration, and freedom from interference. The constraints of UWB include high infrastructural requirements, energy consumption, and user costs.
Inertial navigation [11] is advantageous due to its low cost and ease of deployment; its disadvantage is that it is restricted by the accuracy of inertial sensors, and the accumulation of drift and deviation errors.
Magnetic-field-based indoor positioning is an attractive candidate for indoor positioning solutions due to the prevalence of magnetic fields. The advantages of magnetic fields are that they are infrastructure-free, they have temporal stability, and are tolerant to moving objects. There are also some disadvantages, such as low discernibility (i.e., identical magnetic-field measurements can be found elsewhere), the heterogeneity of devices (i.e., heterogeneous smartphones have different magnetic-field measurements at the same location), and the susceptibility to interference from the presence of ferromagnetic materials in the surrounding environment [12].
The contributions of this study are summarized as follows.
  • A magnetic-field-based indoor positioning system was designed. Six heterogenous smartphones, namely, iPhone 12 Mini, iPhone Xs Max, Redmi Note 7, Samsung Galaxy S20, Samsung Galaxy S9, and Oneplus 7T Pro, were used to collect magnetic-field trajectories to construct an extensive database of magnetic-field trajectories.
  • Compared to traditional machine learning and the dynamic time warping (DTW) method, the proposed method does not require the traversal of the entire magnetic-field database.
  • Compared to recurrent neural network (RNN) methods (e.g., long- short-term memory (LSTM) and the gated recurrent unit (GRU)), the proposed method avoids the degradation problem as the number of stack layers increases. Conventional RNNs such as LSTM/GRU are nonparallel learning systems that must complete the previous hidden state’s computation before the subsequent hidden state’s computation, whereas the temporal convolutional network (TCN) is a parallel system that requires much less training time [13].
  • Magnetic-field measurements are preprocessed using magnetic-field coordinate system transformation, moving average, and first-order difference methods.
  • The trained model was used to classify the magnetic-field sequences from the test set, achieving 99.80% accuracy for the three trained smartphones. For the untrained heterogeneous smartphones (Samsung Galaxy S20, Samsung Galaxy S9, and OnePlus 7T Pro), accuracies of 95.20%, 88.23%, and 84.27% were achieved, respectively. The proposed method, thus, functions well for heterogeneous devices.
The rest of the article is organized as follows: Section 2 provides a brief review of previous work on indoor positioning using magnetic fields. Section 3 and Section 4 present a preliminary analysis of magnetic-field data and a background overview of TCNs, respectively. Then, the proposed architecture, experimental setup and results, and analysis are explained in Section 5. Lastly, Section 6 concludes our work.

2. Related Work

Due to its simplicity and effectiveness, the fingerprinting method is widely used for indoor positioning on the basis of magnetic fields. The fingerprinting approach consists of two phases, online and offline, starting with an online phase when data from ground-truth locations are collected to create a database, followed by an offline phase when the data from the smartphone are used for positioning.
Magnetic fields are mainly used in narrow one-dimensional spaces such as corridors [14,15]. There are difficulties in using magnetic fields in wide environments [16], and it is challenging to achieve positioning using magnetic fields in old buildings with almost no metal structures [17].
The fingerprinting positioning problem can often be seen as a classification problem, and many machine-learning methods, such as k-nearest neighbors (k-NN) [18], support vector machines (SVMs) [19,20], decision trees [21], and neural networks [22,23], can be used to predict the location by classifying the fingerprinting signal. Montoliu et al. [24] proposed a bag-of-words (BoW)-based method for describing fingerprints on the basis of magnetic fields. The authors gathered 21 points in a corridor and evaluated the classification using k-NN, SVM, random forest, and other algorithms, demonstrating good positioning performance.
Typically, fingerprinting methods require traversing the entire magnetic-field database, which is often time-consuming. Most conventional methods treat successive sequences of magnetic fields as independent observations of each other, and positioning is achieved with point-to-point matching. However, measurements from two points at different spatial locations may show similarity in a wide environment, leading to positioning errors. Complex indoor environments often have various constraints, and as some walking trajectories are relatively fixed, it becomes feasible to use historical information about the trajectory to enhance the location estimation method [25].
In [26,27], the authors used dynamic time warping (DTW), which treats the magnetic-field trajectory as a time series. The magnetic-field trajectories’ unique pattern can overcome the low-discernibility problem of the magnetic field, but it is also very time-consuming and can cause time delays. Although magnetic-field anomalies can be used to locate users moving through narrow corridors, it remains challenging to locate users in expansive areas. Perez-Navarro et al. [27] created eight ’virtual corridors’ to simulate users’ movement upon entering this building. Using the DTW method, they obtained a dataset of 64 paths (8 paths × 2 directions × 4 smartphones) and achieved corridor-level positioning.
The works in [28,29,30] used sensor fusion methods to increase positioning accuracy, such as the fusion of pedestrian dead reckoning (PDR) with the magnetic field using Kalman filters, particle filters, or hidden Markov models. However, these methods improve positioning performance by increasing the information, and do not improve positioning methods that use only the magnetic field. Furthermore, filter-based sensor fusion requires sufficient experience to tune parameters such as the covariance matrix [26].
The use of deep-learning algorithms in indoor positioning has grown rapidly in recent years. In [31,32,33], the authors highlighted the problem of heterogeneous devices for magnetic-field-based positioning, and attempted to solve this problem using a deep-learning approach.
Magnetic-field positioning can be divided into point-to-point matching and trajectory matching schemes. Recent works have attempted to implement point-to-point matching using deep-learning methods to classify magnetic-field measurements (magnetic landmarks) that had prominent features in indoor environments. Three LSTM-based DRNNs were proposed to classify magnetic-field landmarks by Bhattarai et al. in [34]. Magnetic landmarks were collected at 25 points in the corridor and 17 points in the laboratory, and the experimental results showed that this achieved 97.20% accuracy. Ashraf et al. [32] enabled three heterogeneous smartphones to collect various magnetic-field landmarks along indoor paths, transforming magnetic-field data into terms (words) and documents to mitigate the effects of smartphone heterogeneity. The extracted term frequency vectors were used to train LSTM and GRU networks, and their predictions were voted on to estimate the user’s current location.
Research into the classification of magnetic-field trajectories through deep learning has also been developed. In [28], the authors extracted recurrence-plot (RP), trend, sequence-length, and peak features from magnetic-field sequences. The extracted image features were then analyzed with a convolutional neural network (CNN), and magnetic landmarks were classified with a multilayer perceptron (MLP). The corridor and atrium had accuracies of 0.8 and 2.3 m, respectively. Zhang et al. [35] proposed an LSTM-based magnetic-field positioning algorithm and extended the magnetic-field dimension with a double sliding-window-based scheme, which expanded the feature dimension of the LSTM model to achieve higher positioning accuracy.
To solve the above problem, this paper proposes a novel magnetic positioning algorithm based on TCNs to avoid the RNN (LSTM and GRU) vanishing gradient problem. Magnetic-field sequences are used to represent each corridor [13]. A vast database of magnetic fields was collected through heterogeneous smartphones. We also designed a preprocessing system for the magnetic-field measurements to overcome the nature of heterogeneous devices, and improve algorithmic performance with the following consecutively stacked procedures: coordinate system transformation, moving average filtering, and first-order differencing.

3. Magnetic-Field Preliminaries

Magnetic-field measurements from heterogeneous devices are not the same [32,36], and the positioning accuracy can vary significantly when applying a positioning method to data from heterogeneous devices.
However, the magnetic-field measurements of heterogeneous devices on the same path show the same pattern [26], which is a good characteristic for magnetic indoor positioning.
It is labor- and time-intensive to create fine magnetic-field point maps. As the magnetic field varies between 25 and 65 μ T, almost identical magnetic-field measurements may be repeated at different indoor locations, leading to low-magnetic-field-discernibility problems [37].
The magnetic trajectory model methodology is more reliable than point-based methods for magnetic-field positioning. It connects magnetic points in space to form a spatial sequence, inside which unique patterns can help in identifying specific areas and narrowing the positioning range.
Figure 1 shows the m x , m y , and m z axes, and intensity components of the magnetic-field measurement of three heterogeneous smartphones. Figure 1a,c,e indicate trajectories in the forward direction along the corridor. Figure 1b,d,f indicate trajectories in the backward direction along the corridor, which are the inverse of Figure 1a,c,e. The magnetic trajectories of heterogeneous smartphones clearly exhibit similar patterns in the same corridor for all components. Symmetrical patterns can also be found between the forward and backward figures (e.g., Figure 1a,b).
Take Figure 1a,b as an example. The m x (red) and m y (blue) components of the magnetic field are direction-dependent, i.e., the magnetic declination equals arctan m y m x . It is difficult to see whether the correspondences of m x and m y were in opposite directions (forward and backward).
The value of m z is much larger than that of m x and m y , contributing 90% of the intensity m a g . Intuitively, m z and intensity m a g show an axisymmetric relationship. We also used the information from m x and m y to improve the model’s robustness.
The magnetic-field trajectory’s spatial and temporal stability could help in finding the area where the user is located, such as the initial position of the PDR. The user walks with the smartphone with an arbitrary gesture and in an arbitrary direction, so it is essential to transform the raw magnetic-field measurement into a direction-independent coordinate.
The coordinate system of a smartphone, with the X axis pointing east, the Y axis pointing north, and the Z axis pointing to the sky, constitutes a right-handed coordinate system (ENU) [37]. The magnetic-field measurement is directional, mainly on the X and Y axes, while the Z axis reading is direction-independent. The calibrated magnetic-field intensity is constant at the same position [12].
The three-dimensional magnetic field can be decomposed into two horizontal and vertical components using the gravity vector, where the vertical component is parallel to the direction of gravity, and the horizontal component is orthogonal to gravity [38].
Figure 2 shows the transformation of the magnetic field into horizontal and vertical components. Figure 2a,c,e indicate transformed trajectories in the forward direction along the corridor. Figure 2b,d,f represents transformed trajectories in the backward direction along the corridor.
It was mentioned earlier that the m x and m y components are direction-dependent, while the m z and m a g components are relatively stable. We, therefore, transformed the magnetic-field measurements into horizon vertical coordinates. Take Figure 2b as examples: the vertical component (blue) m v and the magnetic-field intensity m a g (black) are centrosymmetric in the forward and backward directions, and since the horizontal component m h (red) is equal to m h = m a g 2 m v 2 . We infer that m h is also centrosymmetric in the forward and backward directions.

4. Temporal Convolutional Networks

The temporal convolutional network is a class of neural network architecture with two distinctive characteristics: first, the convolution in the architecture is causal, meaning that future information does not influence previous information, and second, the input and output sequences have the same length [13].

4.1. Sequence Modeling

Suppose we have an input magnetic-field sequence X = x 1 , x 2 x T x i R m and wish to predict some corresponding outputs Y = y 1 , y 2 y T (e.g., the labels of the corridor). We predict y t using only previously observed inputs: X = x 1 , x 2 x t x i R m . A magnetic-field sequence modeling network can be expressed as a function f : X t + 1 Y t + 1 , namely:
y ^ 0 , , y ^ t = f x 0 , , x t .
The restriction on y t is dependent only on x 1 , x 2 x t , and not on any "future" input x t + 1 , x t + 2 x T . Our goal is to find a network f that minimizes the expected loss between actual and predicted values, L y 0 , , y T , f x 0 , , x T .

4.2. Causal Convolutions

RNNs are often used for sequence modeling, such as processing video, audio, and sensor signals along the time direction, and CNNs are often used for image processing. However, CNNs are significantly underestimated for sequential modeling and build more concise models than RNNs do.
p ( x ) = t = 1 T p x t x 1 , , x t 1
Conventional 2D CNN models are not designed for dealing directly with sequence data, but 1D causal convolutions can perform sequence modeling, mainly abstracting to predict y t on the basis of x 1 , x 2 x t and y 1 , y 2 y t 1 , making y t close to the actual value.
Causal convolution requires many layers or large filters to increase the receptive fields of the convolution. As shown in Figure 3, an output corresponds to more inputs when many hidden layers exist between the output and input layers. The more the hidden layers between the input and output layers, the farther apart they are, and the higher the convolutional computation is, which can bring problems such as gradient vanishing, high training complexity, and poor fitting.

4.3. Dilated Causal Convolutions

Dilated convolution can be applied to regions larger than the length of the filter by skipping some of the input, and it is equivalent to generating a larger filter from the original filter by adding zeros.
Suppose that a network has N convolutional layers, the dilated factor of the n-th convolutional layer is 2 ( n 1 ) , the span is 1, and the filter size is f s i z e ; then, the receptive field size of the network can be computed as R = ( f s i z e 1 ) 2 N 1 + 1 . Figure 4 shows the dilated causal convolutions of 1, 2, 4, and 8.
The size of the receptive field and the number of learnable parameters can be adjusted by changing the filter’s size and the number of layers. Dilated convolution allows for a model to have a very large receptive field with a small number of layers, which can solve the problems associated with causal convolution [13,39,40].

4.4. Residual Block

A deep neural network can be viewed as mapping between the input and output spaces. It is composed of multiple stacked layers. Each layer is a subfunction regarding its underlying mapping.
Deep neural networks face the problem of degradation, and researchers have found that, as the depth of the network increases, the accuracy becomes saturated and degrades rapidly.
He et al. [41] proposed deep residual learning to solve this degradation problem. Figure 5a depicts the residual learning block. Assume that H ( x ) is an underlying mapping composed of multiple stacked layers, with x representing the input of the initial layer. The residual mapping is represented as F ( x ) = H ( x ) x
It is challenging to approximate identity mapping by directly using multiple nonlinear layers. If the identity mapping is optimal, residual learning reconstruction approximates the identity mapping by reducing the weights of multiple nonlinear layers to zero.
Since the receptive field of a TCN is determined via network depth n, filter size k, and dilation factor d, Bai et al. [13] designed a generic TCN model that solved the recession problem for deeper and larger TCNs by replacing the convolutional layers with a generic residual module.
Figure 5b depicts the residual blocks of a generic TCN architecture, including two sets of dilated causal convolution layers with the same dilation factor, weight normalization, rectified linear unit (ReLU) activation function, and spatial dropout.
Figure 5c The TCN network combines the input and output of each block, and when the input dimension does not equal the output dimension, an additional 1 × 1 convolution is performed on the input to ensure dimensional matching.

4.5. Advantages and Disadvantages

There are several advantages and disadvantages to TCN sequence modeling [13]. Its advantages are listed as follows.
  • Parallelism: RNNs process time sequences sequentially and must wait for the completion of the preceding sequence before performing predictions for the subsequent sequence. Since convolution enables the use of the same filter at each layer, TCN allows for the input sequence to be treated as a whole.
  • Flexible receptive field size: To modify the size of receptive fields, TCNs can stack more dilation (causal) convolutional layers, employ larger dilation factors, or increase the size of the filters.
  • Stable gradients: Since the backpropagation path of TCN is different from the temporal direction of the sequence, it avoids the explosion/gradient disappearance problem of RNNs (LSTM, GRU).
  • Low memory requirement for training: Training requires less memory for TCNs. In TCNs, cell gates are shared within a layer, and the backpropagation path depends exclusively on network depth. LSTM and GRU typically require a substantial amount of memory to store the partial outcomes of their numerous cell gates.
  • Arbitrary length input: TCNs obtain sequences of arbitrary length by sliding one-dimensional convolutional kernels, while RNNs simulate input sequences of different lengths by recursion.
TCN also has a distinct disadvantage.
  • Insufficient flexibility in transfer learning: TCN may not be as transferable because the amount of historical information necessary for model prediction may vary across domains. As a result, the performance of TCNs may be poor when transferring a model from a problem that requires less memory information to a problem that requires more memory, as their receptive field is insufficiently large.

5. Experiments

In this section, we outline a framework we designed for a magnetic-field indoor positioning system on the basis of TCNs. Numerous magnetic-field trajectories were collected in an indoor corridor using a heterogeneous smartphone, and the magnetic-field data were preprocessed via coordinate transformation, moving average, and first-order differencing. Trained and untrained smartphones were used to evaluate the algorithm.

5.1. System Architecture

Figure 6 depicts the framework of the proposed TCN-based magnetic trajectory classification system. The system comprises two phases: offline training and online test. A smartphone equipped with a magnetometer was used to classify magnetic trajectories as follows:
  • The magnetic-field database was collected from the building’s corridors.
  • Coordinate system transformation, smoothing filtering, and first-order differencing were implemented to obtain magnetic-field features.
  • The preprocessed magnetic-field measurements were combined to build a training set of magnetic fingerprinting for each corridor with the corridor number as the label.
  • The collected database of magnetic-field trajectories was used to train the TCN model.
  • The test dataset was used to evaluate the trained prediction model.

5.2. Data Collection

To evaluate the performance of the proposed algorithm, we selected eight corridors on the first, second, and third floors of the building of Polytech Galilée, shown in Figure 7; several heterogeneous smartphones (iPhone Xs Max, iPhone 12 Mini, Redmi Note 7, Samsung Galaxy S20) were used to collect the data.
Table 1 describes the system version, sensor vendor, magnetometer model, and magnetometer characteristics of the smartphones used in the experiment. Samsung Galaxy S20, Samsung Galaxy S9, and Redmi Note 7 all use magnetometer models from Asahi Kasei Microdevices (AKM), OnePlus 7T Pro uses a magnetometer model from MEMSIC, while iPhone uses Apple’s own magnetometer, and the information is not available through the API.
The chosen corridors were all between 10 and 20 m in length, the MATLAB Mobile application was used for data collection, and the sampling frequency was set to 100 Hz. The smartphones were held horizontally, and data were collected 10 times in the forward direction and 10 times in the backward direction, so that there were 20 trajectories per corridor; the training dataset of 3 heterogeneous smartphones (iPhone Xs Max, iPhone 12 Mini, and Redmi Note 7) contained a total of 3 × 10 × 2 × 8 = 480 trajectories. We then collected two more round trips in each corridor (two forward and two backward) as a test dataset, giving a total of 4 × 8 × 3 = 96 test trajectories. The training dataset had 739,700 magnetic-field measurement samples, while the test dataset contained 148,600 samples.
We also took two round-trip paths of Samsung Galaxy S20, Samsung Galaxy S9, and OnePlus 7T Pro to test whether the algorithm could be seamlessly applied to heterogeneous smartphones, even if we had not used the neural network to train them.

5.3. Magnetic Features Preprocessing

The magnetic-field sequence underwent three preprocessing steps: coordinate system transformation, smoothing filtering, and first-order differentiation.
  • Coordinate transformation: The original magnetic-field signal needed to be transformed from a body coordinate system into a world coordinate system.
    m t n = R t n b m t b
    where m t b = ( m x , t b , m y , t b , m z , t b ) R 3 × 1 is the magnetic-field measurement in the body coordinate system at time t, and m t n = ( 0 , m h , t n , m v , t n ) R 3 × 1 is the magnetic-field measurement in the world coordinate system at time t, R t n b R 3 × 3 is the rotation matrix that transforms the magnetic-field measurement from the body coordinate system b to the world coordinate system n.
    After the coordinate transformation, we used the magnetic-field horizontal component, vertical component, and the magnetic-field intensity as features: m = ( m h , m v , m h 2 + m v 2 ) .
  • Smoothing filter: As the collected magnetic-field sequence contained Gaussian white noise and burrs, we employed the moving average approach with a window size of 100 to smooth the signal.
  • First order difference: After transforming the coordinate system and smoothing filter, we calculated the difference between adjacent elements of the magnetic-field sequence as features.

5.4. Experimental Settings

Table 2 describes the parameter settings of the algorithm. We defined a TCN network with six residual blocks in sequence, beginning with a dilation factor of 1 and each subsequent residual block with a dilation factor twice that of the previous layer. For the residual block’s one-dimensional convolutional layer, 128 filters of size 5 were provided, and a dropout factor of 5 × 10 3 was specified for the dropout layer. The optimizer was set to ‘Adam’, epochs were set to 120, the minibatch size was set to 4, and the learning rate was set to 1 × 10 4 .
Table 2 also shows the working environment of the experiment. The experiments in this article were conducted on a MacBook Pro with a 2.6 GHz 6-Core Intel Core i7 processor running macOS Monterey 12.6. All models were implemented on MATLAB 2022a.

5.5. Classification Results

We first tested our prediction model using the three trained smartphones. The test dataset for the experiment consisted of forward and backward trajectories from the three trained smartphones. Figure 8 depicts the ground truth and predictions of the test set, with most of the red lines overlapping the blue (predictions were consistent with the ground truth). The shown red line represents an incorrect prediction.
Figure 9a shows the confusion matrix result of the three trained smartphones (iPhone Xs Max, iPhone 12 Mini, and Redmi Note 7). The blue diagonal areas represent correctly predicted points, while the nondiagonal parts represent wrongly predicted points. The majority of the 148,600 total points corresponded to correct predictions. Classification accuracy can be evaluated by comparing predictions with ground truth and calculated with Equation (4); the accuracy of the TCN-based magnetic-field trajectory classification method was 99.80%.
Accuracy = # correctly classified points # total points .
To evaluate the applicability of our trained model to an untrained smartphone, we utilized a Samsung Galaxy S20, Samsung Galaxy S9, and OnePlus 7T Pro to collect three test datasets (two round-trip walks in eight corridors for each smartphone). The newly collected data were fed into the previously trained model (Figure 9b–d) and achieved accuracies of 95.20%, 88.23%, and 84.27%, respectively. This demonstrates that the trained model could also be applied to untrained smartphones.
We implemented the GRU and bidirectional LSTM (BiLSTM) to the same training and test sets. Table 3 compares the classification accuracy of BiLSTM, GRU, and TCNs in the same dataset. The results show that the TCN models outperformed the two RNN models.

6. Conclusions

In this article, we proposed a novel TCN-based indoor magnetic positioning algorithm for smartphones that exploits the predictive power of TCNs to solve the indoor magnetic positioning problem and avoids the time-consuming fingerprint matching process compared to the DTW-based magnetic-field sequence matching method. Compared with traditional RNN methods such as LSTM and GRU, our training was faster and more accurate, and avoided the gradient explosion problem.
We analyzed the characteristics of magnetic-field trajectories, and preprocessed the magnetic-field sequence using coordinate transformation, smoothing filters, and first-order differencing. Large-scale magnetic-field trajectory data were used to train the prediction model, and different test sets were used to evaluate our algorithm. An accuracy of 99.8% for the three trained smartphones was achieved. Accuracies of 95.20%, 88.23%, and 84.27% were achieved for the three untrained heterogenous smartphones. In addition, the TCN algorithm was significantly more efficient than models from GRU and BiLSTM.

Author Contributions

Conceptualization, G.O., K.A.-M. and Z.O.; methodology, G.O., K.A.-M. and Z.O.; software, G.O. and Z.O.; validation, G.O., K.A.-M. and Z.O.; formal analysis, G.O., K.A.-M. and Z.O.; investigation, G.O., K.A.-M. and Z.O.; resources, G.O.; data curation, G.O.; writing—original draft preparation, G.O.; writing—review and editing, G.O., K.A.-M. and Z.O.; visualization, G.O.; supervision, K.A.-M.; and project administration, G.O. and K.A.-M. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Not applicable.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Schiller, J.; Voisard, A. Location-Based Services; Elsevier: Amsterdam, The Netherlands, 2004. [Google Scholar]
  2. Basiri, A.; Lohan, E.S.; Moore, T.; Winstanley, A.; Peltola, P.; Hill, C.; Amirian, P.; e Silva, P.F. Indoor location based services challenges, requirements and usability of current solutions. Comput. Sci. Rev. 2017, 24, 1–12. [Google Scholar] [CrossRef] [Green Version]
  3. Ali, M.U.; Hur, S.; Park, S.; Park, Y. Harvesting indoor positioning accuracy by exploring multiple features from received signal strength vector. IEEE Access 2019, 7, 52110–52121. [Google Scholar] [CrossRef]
  4. Alarifi, A.; Al-Salman, A.; Alsaleh, M.; Alnafessah, A.; Al-Hadhrami, S.; Al-Ammar, M.A.; Al-Khalifa, H.S. Ultra wideband indoor positioning technologies: Analysis and recent advances. Sensors 2016, 16, 707. [Google Scholar] [CrossRef] [Green Version]
  5. Yao, C.Y.; Hsia, W.C. An indoor positioning system based on the dual-channel passive RFID technology. IEEE Sens. J. 2018, 18, 4654–4663. [Google Scholar] [CrossRef]
  6. Cantón Paterna, V.; Calveras Auge, A.; Paradells Aspas, J.; Perez Bullones, M.A. A bluetooth low energy indoor positioning system with channel diversity, weighted trilateration and kalman filtering. Sensors 2017, 17, 2927. [Google Scholar] [CrossRef] [Green Version]
  7. Liu, F.; Liu, J.; Yin, Y.; Wang, W.; Hu, D.; Chen, P.; Niu, Q. Survey on WiFi-based indoor positioning techniques. IET Commun. 2020, 14, 1372–1383. [Google Scholar] [CrossRef]
  8. Android Developers: Wi-Fi Scanning Overview. Available online: https://developer.android.com/guide/topics/connectivity/wifi-scan#wifi-scan-throttling (accessed on 6 October 2022).
  9. Mainetti, L.; Patrono, L.; Sergi, I. A survey on indoor positioning systems. In Proceedings of the 2014 22nd International Conference on Software, Telecommunications and Computer Networks (SoftCOM), Split, Croatia, 17–19 September 2014; pp. 111–120. [Google Scholar]
  10. Mazhar, F.; Khan, M.G.; Sällberg, B. Precise indoor positioning using UWB: A review of methods, algorithms and implementations. Wirel. Pers. Commun. 2017, 97, 4467–4491. [Google Scholar] [CrossRef]
  11. Wu, Y.; Zhu, H.B.; Du, Q.X.; Tang, S.M. A survey of the research status of pedestrian dead reckoning systems based on inertial sensors. Int. J. Autom. Comput. 2019, 16, 65–83. [Google Scholar] [CrossRef]
  12. Ouyang, G.; Abed-Meraim, K. Analysis of Magnetic Field Measurements for Indoor Positioning. Sensors 2022, 22, 4014. [Google Scholar] [CrossRef]
  13. Bai, S.; Kolter, J.Z.; Koltun, V. An empirical evaluation of generic convolutional and recurrent networks for sequence modeling. arXiv 2018, arXiv:1803.01271. [Google Scholar]
  14. Galván-Tejada, C.E.; García-Vázquez, J.P.; Brena, R.F. Magnetic field feature extraction and selection for indoor location estimation. Sensors 2014, 14, 11001–11015. [Google Scholar] [CrossRef]
  15. Haverinen, J.; Kemppainen, A. A global self-localization technique utilizing local anomalies of the ambient magnetic field. In Proceedings of the 2009 IEEE International Conference on Robotics and Automation, Kobe, Japan, 12–17 May 2009; pp. 3142–3147. [Google Scholar]
  16. Li, K.; Bigham, J.; Bodanese, E.L.; Tokarchuk, L. Location estimation in large indoor multi-floor buildings using hybrid networks. In Proceedings of the 2013 IEEE Wireless Communications and Networking Conference (WCNC), Shanghai, China, 7–10 April 2013; pp. 2137–2142. [Google Scholar]
  17. Gozick, B.; Subbu, K.P.; Dantu, R.; Maeshiro, T. Magnetic maps for indoor navigation. IEEE Trans. Instrum. Meas. 2011, 60, 3883–3891. [Google Scholar] [CrossRef]
  18. Li, D.; Zhang, B.; Li, C. A feature-scaling-based k-nearest neighbor algorithm for indoor positioning systems. IEEE Internet Things J. 2015, 3, 590–597. [Google Scholar] [CrossRef]
  19. Abdou, A.S.; Aziem, M.A.; Aboshosha, A. An efficient indoor localization system based on Affinity Propagation and Support Vector Regression. In Proceedings of the 2016 Sixth International Conference on Digital Information Processing and Communications (ICDIPC), Beirut, Lebanon, 21–23 April 2016; pp. 1–7. [Google Scholar]
  20. Chriki, A.; Touati, H.; Snoussi, H. SVM-based indoor localization in wireless sensor networks. In Proceedings of the 2017 13th International Wireless Communications and Mobile Computing Conference (IWCMC), Valencia, Spain, 26–30 June 2017; pp. 1144–1149. [Google Scholar]
  21. Yim, J. Introducing a decision tree-based indoor positioning technique. Expert Syst. Appl. 2008, 34, 1296–1302. [Google Scholar] [CrossRef]
  22. Zhang, W.; Liu, K.; Zhang, W.; Zhang, Y.; Gu, J. Deep neural networks for wireless localization in indoor and outdoor environments. Neurocomputing 2016, 194, 279–287. [Google Scholar] [CrossRef]
  23. Wang, X.; Gao, L.; Mao, S. CSI phase fingerprinting for indoor localization with a deep learning approach. IEEE Internet Things J. 2016, 3, 1113–1123. [Google Scholar] [CrossRef]
  24. Montoliu, R.; Torres-Sospedra, J.; Belmonte, O. Magnetic field based Indoor positioning using the Bag of Words paradigm. In Proceedings of the 2016 International Conference on Indoor Positioning and Indoor Navigation (IPIN), Sapporo, Japan, 18–21 September 2016; pp. 1–7. [Google Scholar]
  25. Bai, S.; Yan, M.; Wan, Q.; He, L.; Wang, X.; Li, J. DL-RNN: An accurate indoor localization method via double RNNs. IEEE Sens. J. 2019, 20, 286–295. [Google Scholar] [CrossRef]
  26. Subbu, K.P.; Gozick, B.; Dantu, R. LocateMe: Magnetic-fields-based indoor localization using smartphones. ACM Trans. Intell. Syst. Technol. (TIST) 2013, 4, 1–27. [Google Scholar] [CrossRef]
  27. Perez-Navarro, A.; Montoliu, R.; Torres-Sospedra, J.; Conesa, J. Magnetic field as a characterization of wide and narrow spaces in a real challenging scenario using dynamic time warping. In Proceedings of the 2018 International Conference on Indoor Positioning and Indoor Navigation (IPIN), Nantes, France, 24–27 September 2018; pp. 1–8. [Google Scholar]
  28. Lee, N.; Ahn, S.; Han, D. AMID: Accurate magnetic indoor localization using deep learning. Sensors 2018, 18, 1598. [Google Scholar] [CrossRef] [Green Version]
  29. Wang, G.; Wang, X.; Nie, J.; Lin, L. Magnetic-based indoor localization using smartphone via a fusion algorithm. IEEE Sens. J. 2019, 19, 6477–6485. [Google Scholar] [CrossRef]
  30. Shu, Y.; Bo, C.; Shen, G.; Zhao, C.; Li, L.; Zhao, F. Magicol: Indoor localization using pervasive magnetic field and opportunistic WiFi sensing. IEEE J. Sel. Areas Commun. 2015, 33, 1443–1457. [Google Scholar] [CrossRef]
  31. Ashraf, I.; Hur, S.; Park, S.; Park, Y. DeepLocate: Smartphone based indoor localization with a deep neural network ensemble classifier. Sensors 2019, 20, 133. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  32. Ashraf, I.; Zikria, Y.B.; Hur, S.; Bashir, A.K.; Alhussain, T.; Park, Y. Localizing pedestrians in indoor environments using magnetic field data with term frequency paradigm and deep neural networks. Int. J. Mach. Learn. Cybern. 2021, 12, 3203–3219. [Google Scholar] [CrossRef]
  33. Fernandes, L.; Santos, S.; Barandas, M.; Folgado, D.; Leonardo, R.; Santos, R.; Carreiro, A.; Gamboa, H. An infrastructure-free magnetic-based indoor positioning system with deep learning. Sensors 2020, 20, 6664. [Google Scholar] [CrossRef]
  34. Bhattarai, B.; Yadav, R.K.; Gang, H.S.; Pyun, J.Y. Geomagnetic field based indoor landmark classification using deep learning. IEEE Access 2019, 7, 33943–33956. [Google Scholar] [CrossRef]
  35. Zhang, M.; Jia, J.; Chen, J.; Yang, L.; Guo, L.; Wang, X. Real-time indoor localization using smartphone magnetic with LSTM networks. Neural Comput. Appl. 2021, 33, 10093–10110. [Google Scholar] [CrossRef]
  36. Ashraf, I.; Zikria, Y.B.; Hur, S.; Park, Y. A Comprehensive Analysis of Magnetic Field Based Indoor Positioning With Smartphones: Opportunities, Challenges and Practical Limitations. IEEE Access 2020, 8, 228548–228571. [Google Scholar] [CrossRef]
  37. Ouyang, G.; Abed-Meraim, K. A Survey of Magnetic-Field-Based Indoor Localization. Electronics 2022, 11, 864. [Google Scholar] [CrossRef]
  38. Shahidi, S.; Valaee, S. GIPSy: Geomagnetic indoor positioning system for smartphones. In Proceedings of the 2015 International Conference on Indoor Positioning and Indoor Navigation (IPIN), Sapporo, Japan, 18–21 September 2015; pp. 1–7. [Google Scholar]
  39. van den Oord, A.; Dieleman, S.; Zen, H.; Simonyan, K.; Vinyals, O.; Graves, A.; Kalchbrenner, N.; Senior, A.; Kavukcuoglu, K. Wavenet: A generative model for raw audio. arXiv 2016, arXiv:1609.03499. [Google Scholar]
  40. Sequence-to-Sequence Classification Using 1-D Convolutions. Available online: https://fr.mathworks.com/help/deeplearning/ug/sequence-to-sequence-classification-using-1-d-convolutions.html (accessed on 28 September 2022).
  41. He, K.; Zhang, X.; Ren, S.; Sun, J. Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Las Vegas, NV, USA, 26 June–1 July 2016; pp. 770–778. [Google Scholar]
Figure 1. Magnetic field measurements of heterogeneous smartphones in the same corridor. (a) iPhone 12 Mini forward; (b) iPhone 12 Mini backward; (c) iPhone Xs Max forward; (d) iPhone Xs Max backward; (e) Redmi Note 7 forward; (f) Redmi Note 7 backward.
Figure 1. Magnetic field measurements of heterogeneous smartphones in the same corridor. (a) iPhone 12 Mini forward; (b) iPhone 12 Mini backward; (c) iPhone Xs Max forward; (d) iPhone Xs Max backward; (e) Redmi Note 7 forward; (f) Redmi Note 7 backward.
Sensors 23 01514 g001aSensors 23 01514 g001b
Figure 2. Magnetic field measurement with coordinate transformation in the same corridor. (a) iPhone 12 Mini transformed data forward; (b) iPhone 12 Mini transformed data backward; (c) iPhone Xs Max transformed data forward; (d) iPhone Xs Max transformed data backward; (e) Redmi Note 7 transformed forward; (f) Redmi Note 7 transformed data backward.
Figure 2. Magnetic field measurement with coordinate transformation in the same corridor. (a) iPhone 12 Mini transformed data forward; (b) iPhone 12 Mini transformed data backward; (c) iPhone Xs Max transformed data forward; (d) iPhone Xs Max transformed data backward; (e) Redmi Note 7 transformed forward; (f) Redmi Note 7 transformed data backward.
Sensors 23 01514 g002aSensors 23 01514 g002b
Figure 3. Visualization of a stack of causal convolutional layers.
Figure 3. Visualization of a stack of causal convolutional layers.
Sensors 23 01514 g003
Figure 4. Visualization of a stack of dilated causal convolutional layers.
Figure 4. Visualization of a stack of dilated causal convolutional layers.
Sensors 23 01514 g004
Figure 5. Structure of proposed temporal convolutional networks. (a) Residual learning block; (b) TCN residual block; (c) example of residual connection in a TCN.
Figure 5. Structure of proposed temporal convolutional networks. (a) Residual learning block; (b) TCN residual block; (c) example of residual connection in a TCN.
Sensors 23 01514 g005
Figure 6. Scheme of the indoor magnetic trajectory classification based on a temporal convolutional network.
Figure 6. Scheme of the indoor magnetic trajectory classification based on a temporal convolutional network.
Sensors 23 01514 g006
Figure 7. Designed corridors in Polytech Galilee.
Figure 7. Designed corridors in Polytech Galilee.
Sensors 23 01514 g007
Figure 8. Test trajectory predictions.
Figure 8. Test trajectory predictions.
Sensors 23 01514 g008
Figure 9. Confusion matrix trained and untrained smartphone. (a) Aggregation of three trained smartphones (accuracy: 99.80%); (b) Samsung Galaxy S20 (accuracy: 95.20%); (c) Samsung Galaxy S9 (accuracy: 88.23%); (d) OnePlus 7T Pro (accuracy: 84.27%).
Figure 9. Confusion matrix trained and untrained smartphone. (a) Aggregation of three trained smartphones (accuracy: 99.80%); (b) Samsung Galaxy S20 (accuracy: 95.20%); (c) Samsung Galaxy S9 (accuracy: 88.23%); (d) OnePlus 7T Pro (accuracy: 84.27%).
Sensors 23 01514 g009
Table 1. Magnetometer information and operating systems for heterogeneous smartphones.
Table 1. Magnetometer information and operating systems for heterogeneous smartphones.
SmartphoneOperating
System
MagnetometerSensor
Vendor
Description
Samsung Galaxy S20Android 11AK09918CAKM3-axis, 16-bit;
Sensitivity: 0.15 μ T/LSB
Samsung Galaxy 9Android 9.0AK09916CAKM3-axis, 16-bit;
Sensitivity: 0.15 μ T/LSB
OnePlus 7T ProAndroid 11MMC5603XMEMSIC3-axis, 16-bit;
Sensitivity: 0.15 μ T/LSB
Redmi Note 7Android 10AK09918AKM3-axis, 16-bit;
Sensitivity: 0.15 μ T/LSB
iPhone Xs MaxiOS 15.61
iPhone 12 MiniiOS 16.0.2
Table 2. TCN parameterization and experimental environment.
Table 2. TCN parameterization and experimental environment.
Parameter
Number of filters128
Filter size5
Dropout factor 5 × 10 3
Number of blocks6
OptimizerAdam
Epochs120
Minibatch size4
Learning rate 1 × 10 4
Operating systemmacOS Monterey 12.6
CPU2.6 GHz 6-Core Intel Core i7
PlatformMATLAB 2022a
Table 3. Prediction accuracy with the trained and untrained smartphones.
Table 3. Prediction accuracy with the trained and untrained smartphones.
ModelsTrained SmartphonesGalaxy S20Galaxy S9OnePlus 7T Pro
BiLSTM85.51%36.36%60.53%62.23%
GRU76.97%34.34%43.36%43.61%
TCN99.80%95.20%88.23%84.27%
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Ouyang, G.; Abed-Meraim, K.; Ouyang, Z. Magnetic-Field-Based Indoor Positioning Using Temporal Convolutional Networks. Sensors 2023, 23, 1514. https://doi.org/10.3390/s23031514

AMA Style

Ouyang G, Abed-Meraim K, Ouyang Z. Magnetic-Field-Based Indoor Positioning Using Temporal Convolutional Networks. Sensors. 2023; 23(3):1514. https://doi.org/10.3390/s23031514

Chicago/Turabian Style

Ouyang, Guanglie, Karim Abed-Meraim, and Zuokun Ouyang. 2023. "Magnetic-Field-Based Indoor Positioning Using Temporal Convolutional Networks" Sensors 23, no. 3: 1514. https://doi.org/10.3390/s23031514

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop