FLOOR IDENTIFICATION WITH COMMERCIAL SMARTPHONES IN WIFI-BASED INDOOR LOCALIZATION SYSTEM

In this paper, we utilize novel sensors built-in commercial smart devices to propose a schema which can identify floors with high accuracy and efficiency. This schema can be divided into two modules: floor identifying and floor change detection. Floor identifying module starts at initial phase of positioning, and responsible for determining which floor the positioning start. We have estimated two methods to identify initial floor based on K-Nearest Neighbors (KNN) and BP Neural Network, respectively. In order to improve performance of KNN algorithm, we proposed a novel method based on weighting signal strength, which can identify floors robust and quickly. Floor change detection module turns on after entering into continues positioning procedure. In this module, sensors (such as accelerometer and barometer) of smart devices are used to determine whether the user is going up and down stairs or taking an elevator. This method has fused different kinds of sensor data and can adapt various motion pattern of users. We conduct our experiment with mobile client on Android Phone (Nexus 5) at a four-floors building with an open area between the second and third floor. The results demonstrate that our scheme can achieve an accuracy of 99% to identify floor and 97% to detecting floor changes as a whole.


INTRODUCTION
Location is essential to Location Based Service (LBS) in Ubiquitous computing.Outdoor positioning technology like GPS has been widely used in our daily life.However, when it comes to indoor, there are still no pervasive solutions.Last two decades has witnessed a great effort on indoor positioning.From all of the methods have been proposed, WiFi-based indoor localization is the most popular one due to its wide deployment in indoor environment.In particular, WiFi fingerprints-based technique has been frequently mentioned by researchers recently for its efficiency and robustness (He, et al., 2015).
WiFi fingerprinting is usually divided into two phases: offline and online.In offline stage, WiFi received signal strength (RSS) from different access points (APs) at different reference points will be collected to build the fingerprint database.In online stage, a user can sample RSS value at his or her location and compare it to the value in database, the location corresponding to the most similar one is regarded as a location result.
Although WiFi fingerprints-based localization does not require line-of-sight measurement of APs and can achieve high performance in most cases, the site survey is time-consuming and labor-intensive.Nowadays, commercial smartphones are often equipped with plenty of sensors that can be used to reduce cost of traditional solutions.Inertial sensors including accelerometer, gyroscope and magnetometer can give us mobility information which can benefit indoor localization in many ways since there is a close relation between mobility and location (Yang, et al., 2015).Combining with WiFi and sensors built-in smart devices, there are a lot of works about indoor localization technologies or * Corresponding author systems without human intervention, such as LiFS (Yang, et al., 2012), UnLoc (Wang, et al., 2012), WILL (Wu, et al., 2013) and Zee (Rai, et al., 2012).
These works have reduced the requiring of strenuous efforts by surveyors, but failed to discuss the error caused by similarity of fingerprints in different floors.Due to random propagation of WiFi signal and multipath effects, characteristics of WiFi signal in different floor may be similar, which leads to higher positioning error.Besides, searching a fingerprint in whole database is not efficient in online stage.If the floor of user stay is determined at first, we can narrow the searching space into smaller one.
There are plenty of researches on floor identification in indoor localization systems.These methods can be divided into two categories: one is need infrastructure such as GSM, Wi-Fi or GPS, another is infrastructure-free.(Varshavsky, et al., 2007) proposed a method based on GSM fingerprints, but the result of their system shows a low accuracy (73%) to identify different floors.FTrack system (Ye, et al., 2012) relies on accelerometer built-in smartphones to capture user's state of up and down stairs or taking an elevator.It can achieve an accuracy of 90% by learning two hours using Grouping-Merging algorithm without any prior knowledge of a building.However, this method relies on people's encounter to learn, which decrease its performance in condition of a few people in the building.
In this paper, we designed a floor identification method for indoor localization system, which includes floor identifying and change detection.The floor identifying module started at the beginning of localization to determine which floor the user stays.The change detection module will be invoked after entering continues localization procedure, and it will determine whether the user is up or down stairs or taking an elevator by combining accelerometer and barometer data.If floor change is detected, floor identifying module will be invoked again.
The rest of the paper is organized as follows: Section 2 gives an overview of our system.Section 3 describes the fundamentals and detailed design of the system.Section 4 demonstrates the experiments, and we conclude our work in Section 5.

SYSTEM OVERVIEW
We have mentioned before that WiFi fingerprints-based localization system usually include two stages: offline training stage and online localization stage.After adding floor identification function in traditional solution, the overview of this system can be presented as    (Duda, et al., 2012).

FUNDAMENTS AND EXPERIMENTS
In order to improve the performance of KNN algorithm, some improvements have been proposed, such as distance-weighted KNN algorithm, which weighting the sample's neighbors by their distance, and making nearer neighbors to get higher weights.In indoor environments, due to the barrier of walls and glass, as well as distance loss, signal strength of APs will have significant differences on different floors.So we can quick distinguish floors using KNN algorithm.
This paper introduce a KNN algorithm based on weighting signal strength.We first define a collection for every floor like this, , ( = 1,2, … , ) (1) Since the RSS value is negative, the smaller the signal strength is, the lower the weight is.And we take floor id of the highest score as the result.

BP Neural Network-Based Floor Identification：The
BP neural network used in this paper take Wi-Fi signal from all reference points as samples.By pre-processing, put the extracted signal features into a training network of Neural Network.The input matrix S and output matrix T is represented as follows.
Where   is the strength of Wi-Fi signal, i represents the i th AP, j is the j th reference point, and   is the result of floor determination.l, m and n represent number of floors, APs and reference points, respectively.We make  = 2,  = 301,  = 51, then the input neurons are 51 and the output are 2. Less hidden nodes will lead to network's poor ability to learn information.On the contrary, more hidden nodes will lead to a lack of ability to remember main information, and mixed with much subordinate information.The number of hidden nodes need to be determined together with many kinds of information such as number of training samples and noises (Sedighi, et al., 2011).Thus, the number of hidden layer neurons is usually computed by empirical formula like this, Where p represents the number of hidden layer neurons, a is a correctness.In our work, we set p as 10.After training, we'll get a range of weights.When determining a floor, we can get the result by putting the real-time WiFi signal strength to the Neural Network have been trained.

Floor Change Detection Module
As have mentioned above, floor identifying module only works on initial stage or when floor change have been detected.Thus, detecting floor change correctly is very important.We will discuss three kinds of method for floor change detection: 1) sensitive area based method, 2) barometer-based method and 3) fusion-based method.

Sensitive Area based method:
In this method, we first divided sensitive area of a floor by APs distribution and building's spatial information.It usually around staircases or elevators.When locating results indicate in sensitive area, which means floor change has been detected.Then we start floor identifying module to determine in which floor the new location is.Whereas, if the results indicate not in these area, floor identifying won't be start.
The performance of this method is dependent on the positioning results.Floor changes will fail to be detected if there is a large deviation in positioning.Moreover, this method is limited to staircases since the characteristics of fingerprints in elevators are not remarkable.Even if defined the area around elevator as sensitive one, wrong detection may happen as well.

3.2.2
Barometer-Based Method ： The barometer built-in smartphone can measure the pressure of atmosphere.Although it will be mainly affected by air density, temperature and altitude, we still can use the data of barometer to perceive the location change in vertical orientation.How to select appropriate time interval τ and upper value ℎ  and lower value ℎ  of pressure difference will impact the detecting results directly.
In elevator scenario, the threshold and the length of sliding window is easy to find due to the moving pattern is simple, velocity is stable and elevator moves faster than human.In situation of Figure 3, make τ = 2.5s , ℎ  = 7 , ℎ  = 3, the detecting accuracy can achieve to 100%.
In staircase scenario, user's movement is more complicated.To evaluate the change patterns of pressure in different velocity, we can divide it into three situations, high speed, moderate speed and low speed.We find it is difficult to determine the parameters.To solve this problem, we consider to combine moving pattern and pressure observation to detect floor change, and we call it fusionbased method.

3.2.3
Fusion-Based Method：The total acceleration of threeaxis can be calculated by three-axis accelerometer like this, Then we can detect the user's step pattern to determine whether it is stationary or moving, and count its steps at the same time (Li, et al., 2012).Afterwards, use the barometer to detect pressure changes, and then detect the floor change according to the pressure difference in certain steps.Similar to the method of based on barometer, it is just the sliding windows not focus on pressure changes in fixed time any more.
Fusing barometer and accelerometer can solve the floor change detecting problem in different velocity for the observations are not the pressure change in a period of time any more.It is the change in certain steps.We set N = 5, then it is just related to how many steps the user moved, not the velocity of moving.
According to the thresholds setting in former section, the upper value is 7 Pa, and the lower one is 3 Pa.In that case, floor change can't be detected with lower velocity to go up stair.However, a barometer and accelerometer fusion based method can detect floor changes in the whole process.

EXPERIENCE AND ANALYSIS
We implemented our method in a building which has 4 floors and with a patio area between second and third floor.There are 51 APs installed in this building, and 29 of them are installed in second and third floor.We set up 301 references with an interval of 2 m.The experiment is implemented on Nexus 5 phone.Wi-Fi signals are sampled with a frequency of 2 Hz, and barometer and accelerometer are 100 Hz.We evaluate the performance of proposed system from three parts: a) accuracy of identifying initial floor; b) accuracy of detecting floor when it changed; c) accuracy of identifying floor when it doesn't change.
The method mentioned in this paper increases the accuracy of identifying floor significantly when it did not change.For it guarantees there is no floor change have be detected, the wrong identification almost won't happen.It means a lot for those area that easy to be wrongly identified.In this table, the accuracy of identification around elevator is obviously lower than around staircase.Mainly due to the APs in third floor are not separated by walls and arrive to the second floor.At the same time, the density of APs in the third floor is higher than the second floor, make the area in second floor easy to be regarded as third floor.However, there is no switching over for wrong judgement when user step into this area after utilizing our method.In the scenario of floor changed, since the accuracy of our floor change detection method is 100% in elevator situation, and around 97% in staircase situation, when failing to detect floor change, the accuracy of floor identification will decrease.But for the area maybe changed is smaller than that won't change, it will not affect too much for identification accuracy.In addition, the incorrectness of distinction has been decreased under the no floor change situation, so that the accuracy of the whole three methods has been promoted 1.645%, 1.56%, 0.17%.

CONCLUSIONS
We have presented a method to identify floor via commercial smartphone.On the basis of Wi-Fi fingerprints localization system, our method utilize the data from barometer and accelerometer to decrease misidentifying significantly.The accuracy of detecting floor change can achieve to 97% or above.
Combined with floor identifying method based on KNN and BP Neural Network, the accuracy of identifying floor in our system can achieve 99%.
for character segmentation and recognition in license plate images.Expert Systems with Applications,38(11)

Fig. 1 .
It still contains offline stage and online stage.While the offline stage not only need to build the fingerprints database, but also need to train the model of floor identifying.Before the process of localization, we use K-Nearest Neighbors algorithm or Neural Network algorithm to determine initial floor quickly, and then load the related data of floor fingerprints according to the initial information.Floor change detection module is not invoked at beginning.When localization starts, the system enters in a continuous localization mode.The data of barometer and accelerometer will be collected, and we can use it to infer user's moving patter.When the motion of taking elevator or going up and down stairs has been detected, it suggests the floor has changed.Then the floor identifying module will keep enable until floor changes can't be detected.In this system, floor identifying and change detection are two main tasks.Floor identifying is important in initial stage and when floor change has happened.While floor change detection need to analyze users' moving pattern correctly.It only starts at the situation of floor change is likely to happen.

Figure 2 .
Figure 2. Sensitive area based floor change detection method.
Fig.3.shows the change of pressure and height of Nexus 5 and Xiao MI 2. We found that the measurements are different due to different sensor quality of different devices.But height and pressure have an approximate linear relationship.The absolute height by these two kinds of device have a big difference.The relative value change are 35.1 m and 32.6 m, respectively.The average changes of pressure are 10.8 pa/m and 11.9 pa/m.According to this, we proposed a method to detect floor change based pressure difference.Defining a sliding window's pressure difference as ∆  = |  −  − |, where τ is observation time.The state of floor change at time t is ∆  , where ∆  = 0 means there is no change.The upper value and lower value of pressure difference are ℎ  and ℎ  .The rule to detect floor changes are as follow:When ∆  < ℎ  , ∆  = 0.When ℎ  < ∆  < ℎ  , ∆  = ∆ −1 .When ∆  > ℎ  , ∆  = 1.

Figure 3 .
Figure 3.The pressure changes of different devices during taking elevator

3.1 Floor Identifying Module 3.1.1 KNN-Based Floor Identification:
Let  = { 1 , … ,   }, and the classification of every sample   is known.For test point , if the nearest point in set   is  ′ , the Nearest Neighbor Rule (NNR) will consider  and  ′ as same classification.An extension of NNR is K-Nearest Neighbor Rule, which classifies x as the category that occurring most frequently in the k nearest neighbors where n is the amount of floors,   is the floor's id, and   is amount of APs on   floor.If we sort the former k signal strength in descending order like this, ( 1 ,  2 , … ,   ), then it will correspond to k APs ( 1 ,  2 , … ,   ) and l (l ≤ k) floors.Considering it will closer to some APs if the signal is stronger, we can use the ratio of signal strength and the maximum signal strength of each AP as a weight.

Table 1 .
Table1shows the method's effectiveness at staircase and elevator in second floor.Comparison of elevator and staircase in second floor.