Indoor Localization through Mobile Participatory Sensing and Magnetic Field †

: Development of indoor location systems that use smartphone sensors has been a topic of interest to industry and academia. In this paper, we describe an experiment that was performed to evaluate the feasibility of creating a mobile indoor localization model based on data from participatory sensing. To achieve it, seven smartphone users used their integrated magnetometers to collected magnetic ﬁeld information on a building. The data collected are utilized to train three machine learning algorithms: The k Nearest Neighbors (KNN), Decision Trees (J48), and Naïve Bayes algorithms. The performance of the algorithms was measured through the accuracy and kappa statistics. Our results indicate that it is possible to create an infrastructure-less indoor localization model at room level using data from participatory sensing. The model with the most signiﬁcant performance was obtained with the KNN, since it offers an accuracy of 97.12%, while the model with the most reduced performance was Naïve Bayes, since it offers an accuracy of 50.79%.


Introduction
The localization of a person has been of interest as context information for developers of context-aware systems and the Internet of Things [1]. This is because of the diversity of applications that can be developed [2]; for instance, navigation systems that help firefighters quickly withdraw from hazardous areas and systems that assist people to move inside a mall or an airport.
The design of indoor location systems based on the Global Positioning System (GPS) has remained a challenge because of several factors like multipath fading, distance attenuation, or interference from other wireless systems, which affect the accuracy of GPS in estimating the person's localization. However, the development of new and sophisticated sensors has allowed the proposal of novel solutions for indoor location. These solutions utilize devices or sensors, like Ultrawideband, Bluetooth, Wi-Fi, RFID, accelerometers, and magnetometers, to name just a few, as well as several techniques to estimate the location or positioning, such as triangulation and proximity and location fingerprinting [3,4], the latter being the most popular.
Obtaining the location fingerprint consists of two phases: Training and position calculation [5]. In the training phase, the information associated with a signal of interest is measured and collected until it surveys the area of interest (e.g., a building). This information is collected in a database, known as a radio map. To calculate the position of a person, the signal of interest is measured and compared with the radio map using a machine learning algorithm (e.g., k Nearest Neighbors).
The location fingerprinting technique allows us to generate indoor location models [6,7]. However, we face the following problems: (i) A training phase with significant cost and time. This is because training requires an expert to perform the exhaustive measurements in indoor environments. (ii) The dynamics of the environment affect the radio map; that is, any change in the infrastructure of the indoor environment requires that the training phase be carried out again, which limits its implementation.
In this paper, we propose an experiment to evaluate the feasibility of using participatory sensing as a training phase of the location fingerprinting technique. This is to solve the problems of the location fingerprinting technique.
The paper is organized as follows. Section 2 presents several research works that use mobile participatory sensing at indoor locations. The experiment carried out to know the viability of the participatory sensing to generate the radio map is described in Section 3. In Section 4, the results of the experiment are presented; and finally, the conclusions and future work are presented in Section 5.

Related Work
Participatory sensing is defined as a paradigm that empowers people to contribute to the accomplishment of a specific task [8]. In indoor locations, the people contribute with data detected or generated on their smartphones. Several projects demonstrate the success of this technique, such as google crowdsource, OpenStreetMap, and Wikimapia. In these projects, people provide information to enrich a map with notes or photos, which provide more information about the place.
Therefore, participatory sensing has been implemented as the training phase of the systems that facilitate the automatic construction of virtual layouts for indoor environments. These systems are characterized by collecting information regarding the movement of an individual in an indoor environment (e.g., distance, direction, and number of steps), as well as information from sensors or devices embedded in the environment (e.g., access points). The information collected is utilized to identify the common pathways that the people use when commuting inside indoor environments. This information allows the proposal of a virtual layout of the environment. Examples of such systems are: CrowdInside [9], Piloc [10], CIMLoc [11], WILL [12], and Groping [13].
Unlike previous work, in this paper, we propose the implementation of participatory sensing as a training phase of the location fingerprinting technique to create a radio map and a predictive model for estimating the indoor location of a person. The magnetic field was selected because it is available in all indoor environments and does not require additional infrastructure to generate it (e.g., access points or radio bases) [4].

Experimental Setting Description
The experimental setting was the Computer Systems building. It consists of halls and five classrooms labeled with the letters A, B, C, D, and E (see

Data Collection
To collect data from the magnetic field, a mobile application was developed for devices using Android 4.3 or higher. The application uses the magnetometer to measure and collect the intensity of the magnetic field in µ Teslas (See Figure 2). Additionally, the application also collects other data, like time, date, name of the room where the measurement was collected (e.g., classroom B), magnetometer model, and Android version. The information collected is gathered in a cloud service called Firebase. To carry out data collection, persons who possessed a mobile device with a magnetometer (e.g., smartphone or tablet) were invited to participate. The persons were instructed to handle our mobile application. The training consisted of three activities: (1) Launching of the application, (2) choosing the room in which they would collect the information, and (3) performing the measurement and collection of magnetic field information.
To perform the data collection, the person should move voluntarily in the indoor environment over 30 s. During the use of the mobile application, the person must handle their mobile device in the palm of their hand with the screen up. This process is replicated every time they collect information.

Data Processing
To ensure the quality of the collected data and achieve more considerable accuracy in the estimation of the location, the following activities were carried out: • Data format. The data used in Firebase was collected in a JSON document; then, it was converted into a table type format, in which the columns were separated by commas. This was to facilitate its manipulation in the tools for the analysis of information (e.g., RStudio). To perform this, the Opal Convert tool was utilized.

•
Normalization. To ensure that all attributes possessed the same importance, the data were normalized using zero-mean normalization. • Data Partition. The data collected were randomly divided into two subsets of data: Training (70%) and testing (30%).

Predictive Model for Indoor Localization
To generate the predictive model with the magnetic field intensity information collected through participatory sensing, the following machine learning algorithms were used: k Nearest Neighbors (KNN), Decision Trees (J48), and Naive Bayesian (Naïve Bayes).
The algorithms were implemented in Rstudio. To assess the performance of learning algorithms in this paper, we considered the confusion matrix, success rate, and error rate. The confusion matrix represents a tool that allows the visualization of the performance of an algorithm. Each column of the matrix represents the number of predictions of the class, while each row represents the instances in the actual class. The success rate refers to the percentage of instances classified correctly, while the error rate refers to the percentage of instances classified incorrectly. These were calculated from the following equations: In the Equations (1) and (2)

Training Phase
A total of 701,714 magnetic field strength measurements on three axes (x, y, z) were collected by seven subjects using five different smartphones and two tablets. A total of 70% of the data generated were used to train three machine learning algorithms (491,200 measurements). A total of four models were generated by employing the training data.

Test Phase
A total of 201,514 measurements were employed to evaluate the performance of the models in estimating the location of an individual inside a room. The results of each algorithm are presented in Table 1. Therein, it can be observed that two models were generated using kNN with different values of k.
The models with the best performance were obtained from the KNN and J48 algorithms, as they offer an accuracy of 97.12% and 93.55%, respectively, when placing an individual. The model with the lowest performance was obtained with the Naïve Bayesian algorithm, which offers an accuracy of 50.79% and a concordance level of 0.3834. The algorithm with the most considerable accuracy was implemented in a mobile application. The mobile application allows a person to collect magnetic field information used to classify their location in the indoor environment. In the application's interface, it indicates in which room the person is located (See Figure 3). However, it does not provide your physical position (latitude and longitude).

Discussion and Conclusions
The results show that it is possible to generate a radio map and a predictive indoor localization model with data from a magnetic field collected through participatory sensing. Unlike the location fingerprinting technique with participatory sensing, an exhaustive data collection of the entire interior environment is not required.
Four models were generated.The models of KNN offer the most considerable accuracy, since they offer accuracies of 97.12% and 97.03% with high levels of concordance, Kappa = 0.9627 and 0.9639, respectively.
The model obtained with Naïve Bayes offers the most reduced performance, since it offers an accuracy of 50.79% with a low level of concordance, Kappa = 0.3834. Therefore, the generated model is not useful for estimating the location of an individual in an interior environment.
As future work, we consider the extraction of time and frequency features from magnetic field signals. This is to generate a model that can be independent of the mobile device being used. In addition, the magnetic field could also be merged with information from another sensor or device to provide the position of the person.
Author Contributions: Conceptualization, methodology, writing-original draft preparation, writing-review and editing, and formal analysis, J.P.G.V.; software, validation, and testing, I.L.A.S. All authors have read and agreed to the published version of the manuscript.
Funding: This research was funded by CONACyT CVU: 692550