1 Introduction

Mobile devices are playing more and more important roles in our daily life with the advent of location based service (LBS). In general, LBS greatly hinges on the localization accuracy to provide various services, such as convenient smart city services and ubiquitous Internet-of-Things implementation [13]. After years of research and development, wireless local area networks (WLANs) are widely deployed in the indoor environment. Pervasiveness of WLAN provides good opportunity to estimate the mobile device position for indoor LBS. The common WLAN indoor localization approach makes use of access points (APs) based on the received signal strength (RSS) [4]. The main reason to use RSS for position estimation is not only because the availability of APs in indoor environment but also because the capability of mobile devices to measure and report the RSS from the detected APs.

Generally, fingerprint is the most popular method for WLAN indoor localization system, which was first proposed in [5]. Benefiting from high positioning accuracy in indoor multi-path environment, it has subsequently attracted lots of researcher attentions. Typically, fingerprint method works in two phases: offline phase and online phase [5]. In the offline phase, RSS values are sampled in the WLAN indoor environment, and then a radio map is built by labeling these RSS values with their sampling locations. In particular, each position for recording RSS values is called a reference point (RP). Hence, radio map has lots of fingerprints, which are composed of RP locations and associated RSS values. In the online phase, query RSS value is reported and then used to estimate the sampling location within all RPs in radio map by comparing query RSS value with RSS values in the radio map [6, 7]. Therefore, radio map is the key part of WLAN localization system, which effectively builds the bridge between the signal and the location.

In order to obtain high localization accuracy, it is common practice to enrich the radio map with a large number of RPs. However, recording RSS value at lots of RPs is obviously labor-intensive and time-consuming. Thus, obtaining good positioning accuracy while reducing the RSS value sampling workload is no doubt a challenging task in the offline phase. Over the last decade, many algorithms have been proposed for enriching the radio map when only several RPs are available, such as graph-based semi-supervised learning (G-SSL) [8] and compressive sensing (CS) [9]. But these approaches still require at least some effort for RSS value sampling. In recent years, the crowdsourcing approach has attracted wide attentions for almost zero-effort to construct radio map [1012]. In this approach, radio map is constructed in the background when mobile devices are roaming in the indoor WLAN environment. It automatically collects the crowdsourcing data from each participating mobile device without interfering the normal usage of mobile devices. The availability of crowdsourcing data for both signal and location greatly reduces the burden for radio map building in the offline phase and makes the WLAN indoor localization system more practical.

Usually, crowdsourcing data are collected from participating individuals while they take their mobile devices to engage daily activities. The mobile device collects two kinds of data for radio map building in background. For signal space, RSS value can be directly recorded by the WLAN adapters. For location space, inertial sensors, such as accelerometer, gyroscope, and magnetometer, are the most popular devices to record the RP location. Accelerometer is used to determine the individual step, whose location can be considered as the RP position. When each step is determined, we can further calculate the total displacement distance by multiplying average stride length with step count. Gyroscope and magnetometer are able to find the individual moving direction. Usually, movement direction changing is supposed to occur only at the step location, which means the trajectory between any two adjacent steps will be considered as a straight line and the entire trajectory is composed of polylines. With the help of these inertial sensors, an individual trajectory in the indoor environment can be easily determined based on the pedestrian dead reckoning (PDR) method [13, 14]. However, due to lack of benchmark, each step in the trajectory is a relative location with respect to the trajectory beginning or ending. Their real positions in the floor plan are still unknown. Then, the trajectory should be carefully matched with the floor plan to transfer the step relative locations into real locations [15]. When all step real locations are determined, we can label them with the associated RSS values to build the radio map in a crowdsourcing way [16]. When more and more mobile devices provide their crowdsourcing data both in signal space and location space, radio map will become too huge to practice. Hence, the indoor environment is divided into small grids, and all the RPs within the same grid will be merged. The RP location is set as the grid center locations, and the RP RSS values will be an averaged one. The grid size is decided by both the localization accuracy requirement and the radio map storage limitation.

Above all, RP location and RSS value are so important that will affect the radio map performance for localization. Unfortunately, in the way of radio map crowdsourcing building, there are still several problems to be concerned. First, PDR method suffers seriously step determination error because mobile device will be frequently switched between different usage modes, such as holding in hand, putting in pocket and so on. Few literature concerns how to determine the step when mobile device is switching the usage mode. Actually, the acceleration in usage mode switching is very different from the one when mobile device is staying in a certain usage mode. If usage mode switching is not detected, false step determination will occur and lead to poor trajectory estimation. It will no doubt seriously affect the step location transferring accuracy from the relative one into the real one, which in turn degrades the radio map in location space. Second, each crowdsourcing mobile device may be diverse in the hardware design so that they will have different RSS value even sampled in the same place. If the WLAN adapters do not have the same benchmark for the RSS space, the RSS value samplings will introduce serious noise to the radio map in the offline phase. Meanwhile, it will make the RSS values incomparable between online phase and offline phase. Fortunately, this problem has been solved in our previous work [17, 18]. Third, each RSS value may be only one sampling at each step. It cannot well describe the normal signal environment on account of individual different using habit and signal propagation in the indoor multi-path environment. The latter two problems will inevitably degrade the RSS space of the radio map.

Therefore, in this paper, our main goal is to provide the method to improve the quality of crowdsourcing data both in location space and signal space. Theoretically, radio map is a matrix with element values obtained from the crowdsourcing data. All the adverse factors can be considered as noise resources making the radio map inaccurate for fingerprint localization. So we propose corresponding methods to reduce the noise coming from the three aforementioned problems occurring in the way of radio map crowdsourcing building.

The main contributions of this paper are as follows:

  1. 1

    Detect the usage mode switching to improve the step determination accuracy. We propose to utilize the short-term Fourier transform (STFT) to accurately find the occurrence of usage mode switching both in time and frequency domain, which is able to well describe the step when mobile device is switching one usage mode to another one. Then the dynamic threshold calculated by the previous peak-valley difference is employed to achieve better step determination, which further reduces the noise in the location space of the radio map.

  2. 2

    Smoothen the RSS value to well describe the RSS value in a real indoor environment. We propose to utilize the multi-dimensional scaling (MDS) method to infer an optimal RSS value at each step location by exploiting the correlation of RSS values at nearby locations. Comparing with the conventional methods, we succeed in requiring fewer RSS value samplings for crowdsourcing radio map building, which further reduces the noise in the signal space of radio map.

The rest of the paper is organized as follows. The related works are discussed in Section 2. In Section 3, we address the problem of WLAN indoor localization. The step determination method for radio map location space and radio map smoothing method in signal space are analyzed in Section 4. The simulation and experiment results and discussions are presented in Section 5. Finally, Section 6 draws the conclusion on this paper.

2 Background and related works

In order to reduce the collection workload in the offline phase, various methods have been proposed to realize the rapid deployment of the WLAN indoor localization system in the last decade. In recent years, due to the pervasive application of inertial sensors on mobile devices, motion-assisted WLAN localization system has received extensive attention and made quick progress. Recently, using the sensor data collected by accelerometers, gyroscopes, and magnetometers, the walking direction, distance, and gesture information can be captured [19]. Accelerometers measure the 3D linear acceleration (m/s2) or g-force (gravity or g) of the device. Gyroscopes give the angular velocity (rad/s) and measure the direction in principle of angular momentum. Magnetometers provide the strength and direction of magnetic fields [20].

For the pedestrian localization, pedometer is a common method to calculate the user’s movement distance. In order to accurately calculate the movement distance, a number of step counting algorithms have been proposed by researchers. Peak detection or zero crossing of acceleration readings are the simple and effective algorithms [21]. In advanced methods, more accurate step counting results can be obtained by further mining pattern information [22, 23]. Through walk detection and step counting, the mobile device can measure the walking distance by multiplying the stride length with the step counts. The stride length depends on the step frequency, user height, and other factors. Lots of methods like [2426] have been proposed to find the relationship between step length and the step frequency, user height, and other factors.

With the motion-assisted technology, crowdsourcing-based rapid deployment technology is widely applied in indoor WLAN location system [27]. During the offline phase, when the user is walking, RSS values and sensor data are collected simultaneously. Then the distance between two RSS records can be calculated through the sensor data. The novelty is that even when the user is working with routine business and walking in the office, the site survey can be conducted transparently [28, 29]. Hence, there is no need to conduct dense fingerprinting by professional surveyors. In [30], an automatic construction method of radio map by crowdsourcing PDR traces is proposed, the PDR traces are used to generate indoor road paths and the radio map can be constructed combined with the WiFi fingerprints. Zou et al. proposed an adversarial learning-enabled automatic WiFi indoor radio map construction and adaptation with mobile robot, the LiDAR SLAM (Simultaneous Localization and Mapping) and Generative Adversarial Networks (GAN) is used to constructs the spatial map and radio map simultaneously [31]. In [32], a graph-based SLAM is used to provide the dead reckoning data from multiple users, then the user’s trajectories can be aligned and a crowdsourcing WiFi-based radio map can be established for the WLAN indoor localization service.

The major concern about offline survey reduction is how to balance between localization accuracy and survey cost. RSS measurements collected by the users moving in the environment are potentially more erroneous than those collected by the experts at the exact location of reference points. Therefore, in order to filter the noise or errors, post-processing methods after sampling like Sliding Correlation Time Window (SCTW) [33], Particle Filter [34], and path-loss model are proposed [35]. Due to the low-rank characteristics of radio map, a variety of low-rank matrix completion methods are proposed to reduce the noise of radio map. In [36], the Inexact Augmented Lagrange Multiplier (IALM) algorithm is proposed to precisely recover the missing RSS in the radio map in the offline phase. By solving the nuclear norm minimization, the IALM algorithm could not only recover the missing received signal strength, but also reduce the noise effectively. In [37], a radio map noise reduction method by using Hankel matrix is proposed to separate the noise from the signal. An empirical model of RSSI is proposed in [38] to reconstruct radio map in both geometric space and the signal space. In [39], a sparse representation and low rank matrix recovery-based radio map update method is proposed to handle the fingerprint missing and sparse noise, as a result, the radio map can be updated quickly and accurately.

3 Problem formulation

3.1 Step determination problem

When building a radio map, we need to get the user’s real-time location information firstly. Using the PDR algorithm and the data of smart phone built-in sensors, we can estimate the user’s walking steps, step size, and movement direction, so as to calculate the user’s real-time position, and the user’s steps are mainly calculated by using the acceleration data. The acceleration of human walking is nearly sinusoidal, that is, there is a peak acceleration and a valley acceleration in each step. In addition, the user’s backward or side step situation is generally not considered in the step counting model, The current research usually divides the mobile phone use mode into four types: Pocketing (P), Swing (S), Texting (T), and Calling (C). Figure 1 shows the three-axis acceleration curves corresponding to the four usage modes when simulating the user’s walking.

Fig. 1
figure 1

Triaxial acceleration curves of different mobile phone usage modes

As can be seen from Fig. 1, the characteristics of three-axis acceleration are also different corresponding to different mobile phone placement modes. Therefore, some researchers train the characteristics of acceleration samples to judge the placement mode of mobile phones for direction estimation. However, considering the diversity of people and mobile phone placement patterns, this pattern recognition using a large number of samples does not have a wide range of applications. Because the acceleration of three axes contains walking information, the modulus of acceleration of three axes is usually used for step counting calculation

$$ s[n]=\sqrt{a_{x}^{2}(n)+a_{y}^{2}(n)+a_{z}^{2}(n)}. $$
(1)

At present, the commonly used step detection methods are based on the characteristics of human walking acceleration, such as peak valley detection, zero crossing detection, and autocorrelation detection. Take valley detection as an example, the blue circle in Fig. 2 is the step counting result corresponding to a certain acceleration sampling value. As can be seen from Fig. 2, the collected acceleration data fluctuates violently due to noise, which will cause the wrong step detection. In order to eliminate the interference caused by noise, researchers often add new detection elements, such as time interval, peak valley difference, acceleration slope, and so on. The red box in Fig. 2 shows the step counting result after adding more detection elements. However, considering that the user may switch the mobile placement mode during walking, and the change of peak valley difference before and after the switching process may cause the missing detection of the number of steps. Therefore, a step counting algorithm based on usage mode switching state is proposed in this paper.

Fig. 2
figure 2

False detection and missed detection in different step counting algorithms

3.2 RSS fluctuation problem

For the typical WLAN indoor positioning system, a particular mobile device with WLAN adapter is used to record the RSS values. In the offline phase, radio map is first constructed. Suppose there are m APs and n RPs, and we have n fingerprints in the radio map. For the i-th fingerprint (Si,Ri), the RP location is Si=(xi,yi), and the RSS value \(\mathbf {R}_{i}\in \mathbb {R}^{1\times m}\) is an average value for several RSS value samplings. The signal space \(\mathbf {RSS} \in \mathbb {R}^{n\times m} \) of the radio map can be tabulated into a matrix form as,

$$ \mathbf{RSS} =\left(\begin{array}{c} \mathbf{R}_{1}\\ \mathbf{R}_{2}\\ \vdots \\ \mathbf{R}_{n} \end{array} \right)= \left(\begin{array}{cccc} r_{11} & r_{12} & \ldots & r_{1m}\\ r_{21} & r_{22} & \ldots & r_{2m}\\ \vdots & \vdots & \ddots & \vdots\\ r_{n1} & r_{n2} & \ldots & r_{nm} \end{array} \right), $$
(2)

where each element rij is the RSS recorded at the i-th RP from the j-th AP.

In the online phase, the mobile device collects an RSS value Rj at an unknown position Sj. Then, Rj will be compared with each row of RSS in Eq. (2). The most several similar Ri are found out, and their associated locations Si are obtained. The unknown position Sj will be finally decided as the average location of these Si.

For the crowdsourcing WLAN indoor positioning system, one of the problems is that numerous of mobile devices, but not a particular one, participate in both offline phase for radio map building and online phase for localization. Due to different hardware design, the RSS values collected by the diverse mobile devices are subject to the difference of the WLAN adapter. As a result, different data collection devices may have different signal sensing capacities and yield different RSS distribution characteristic. Numerous studies show that the RSS differences for different devices will exceed more than 25 dB due to the hardware differences [40, 41]. Therefore, the localization accuracy is degraded significantly by the RSS variations across different devices. Fortunately, the device diversity problem is solved by the linear regression (LR) method we proposed in [17, 18] and the uniformed RSS values are obtained in both the offline training phase and the online phase.

Another problem is that the RSS values collected by a mobile device in indoor environment are subject to multiple sources of noise, such as path loss, multi-path, and shadowing. Moreover, the mobile devices may not be able to scan the whole spectrum to capture the RSS values of all available APs. As a result, the RSS values for radio map building may contain environmental noise and measurement error. For instance, we collect 100 RSS value samplings from a single AP at a location in our lab, which is located at Harbin Institute of Technology, 2A Building. All these samplings are plotted in the histogram as shown in Fig. 3. We suppose −110 dBm corresponds to the occasion when mobile device is unable to receive any signal strength from an AP. It can be seen the recorded RSS value distributes in a large range from −70 to −50 dBm. The distribution of the average RSS readings—with the anomalous −110 dBm values excluded—on the 12th floor of the 2A building is shown in Fig. 4. We can see that although the average signal distribution is somewhat consistent with the signal propagation model, the distribution of RSS values fluctuates sharply. Inclusion of such fluctuation may result in erroneous location estimates.

Fig. 3
figure 3

RSS values collected in the same place at different time

Fig. 4
figure 4

Signal distribution in corridor of 12th Floor of 2A Building at Harbin Institute of Technology

As described above, one of the key challenges is how to process the measured RSS values collected by crowdsourcing to make them closer to the nominal value. In this paper, we apply the multidimensional scaling (MDS) method to reduce the fluctuation of RSS values and smooth out the radio map.

We define \(\mathbf {D}\in \mathbb {R}^{n\times m} \) to be the matrix of relative distances between AP and RP as

$$ \mathbf{D} = \left[d(\mathbf{S}_{i},AP_{1}), d(\mathbf{S}_{i},AP_{2}), \hdots, d(\mathbf{S}_{i},AP_{m}) \right], $$
(3)

where d(Si,APk) is the Euclidean distance vector between the reference point Si and the access point APk as,

$$ d(\mathbf{S}_{i},AP_{k}) = \|\mathbf{S}_{i}-{\mathbf S}_{APk}\|_{2}, $$
(4)

where SAPk is the position of the k-th AP.

We also define \(\mathbf {R} \in \mathbb {R}^{n\times n}\) to be the similarity matrix between the RSS readings of corresponding reference points.

$$ \mathbf{R} = \left[ r(\mathbf{R}_{i},\mathbf{R}_{j}) \right]. $$
(5)

It is worth to note that the relative RSS value between two RPs of Si and Sj is related to the Euclidean distance as

$$ r(S_{i},S_{j}) \approx \mathcal{F}(d(S_{i},AP_{k})), $$
(6)

where \(\mathcal {F}(.)\) is a function that models the WLAN signal propagating in the indoor environment.

4 Methods

4.1 Step determination algorithm

4.1.1 Usage mode switching detection

Usually, there are four kinds of usage mode when a user takes the mobile device roaming in the indoor environment for crowdsourcing data collection, which are pocketing (P), swing (S), texting (T), and calling (C). During the period when user switches the usage mode, the mobile device is actually staying in another mode, which we define as the usage mode switching (M). Since user stepping on the ground will feedback a drastic change in acceleration, different acceleration value thresholds can be set to determine the step when the mobile device is staying in a usage mode. However, it is not easy to distinguish different usage modes in a traditional way.

Taking the four usage modes in a walk as an example, the acceleration data in time domain is in Fig. 5. We can see it is hard to use a constant threshold for step determination. So it is not reliable to make a judgement on the usage mode switching only by the acceleration amplitude in time domain. We need a dynamic threshold for each usage mode and mode switching to determine the step.

Fig. 5
figure 5

Acceleration in time domain

Now, we introduce our method to detect the usage mode switching, which will further help to separate different usage modes to determine the step based on the dynamic acceleration threshold. It is well known that the walking step frequency is about 2Hz, so that there will be more energy generated around this frequency. In order to make the acceleration data more intuitive and easy to handle, we propose to employ the short-time Fourier transform (STFT) method to transform the frequency domain in the following ways:

$$ {\mathbf{STFT}}\{ x[n]\} (m,\omega) = \sum\limits_{n = 0}^{N} {x[n]\omega [n - m]{e^{- j\omega n}}}. $$
(7)

We make STFT transformation on the above data and plot the result in Fig. 6. It can be seen from the frequency domain that when the user is walking, the energy is concentrated near the walking frequency. When the user changes the mobile phone usage mode, a larger value will occurs in the frequency band below the walking frequency. Cross comparing with Figs. 5 and 6, there are more acceleration information that can be extracted from both in time and frequency domain.

Fig. 6
figure 6

Acceleration in frequency domain

Therefore, based on the energy distribution characteristics in the frequency domain, the mode switching can be detected. The detail detection steps are as follows:

  • Step 1: Calculate the average amplitude of the spectrum at each moment and compare it with the threshold to determine if the user is walking. According to the practice, we set the threshold 3m/s2.

  • Step 2: Calculate the mean value of peak spectral energy at the moment of walking, and use two-thirds of it as the threshold for mode switching detection.

  • Step 3: Select 1–2Hz spectrum, calculate the length of the frequency band greater than the threshold in Step 2, then we get the range of greater energy in the frequency band below the walking frequency

  • Step 4: Compare the frequency range in Step 3 with the threshold in Step 2. If it is greater than the threshold, it is determined that the user is switching the usage mode.

According to the above steps, the result of usage mode switching is shown in Fig. 7. We can clearly determine there are 3 times usage mode switching occurring, which is more obvious than Fig. 5. The reason for selecting 1–2Hz as the usage mode switching detection range in step 4 is as follows. The frequency of human walking is generally higher than 2Hz, which means the spectrum energy of walking is more than 2Hz. So the high frequency spectrum energy below 2Hz can be regarded as the occurrence of usage mode switching.

Fig. 7
figure 7

Results for usage mode switching detection

According to the above detection algorithm, four people are selected for the experiment, and the various mode switching in multiple walks are detected and counted. The results are shown in Table 1. It can be seen from Table 1 that the detection algorithm based on frequency domain has large false detection error. The main reason for missing detection is that when the user produces continuous and fast mode switching, the algorithm can only judge multiple switching as one. The main reason for false detection is that different users have different walking habits, and the larger swing amplitude of the walking part leads to higher energy in 1–2Hz frequency band, resulting in false detection. Although the probability of false detection is high, it can meet the requirements of step counting algorithm.

Table 1 Performance of mode switching detection algorithm

4.1.2 Dynamic threshold setting

As the usage mode switching in the acceleration is got, we can make dynamic threshold in each mode. Due to the sinusoidal characteristic of human walking, we choose valley detection for step determination. In order to obtain accurate valley detection, we integrate extremum interval judgement, mode switching detection and dynamic threshold calculated by previous peak differences to correct the step determination result. The extremum interval judgement is used to eliminate the false step determination caused by jitter. The dynamic threshold refers to use the previous peak valley difference as the current threshold for different usage mode. The step determination method is expressed as follows:

  • Step 1: Take an acceleration value in time domain and compare it with 3 values before and after this value to determine whether it is a local extremum. If so, go to Step 2; otherwise, return to Step 1.

  • Step 2: Determine the current extremum as peak or valley. Subtract the current extremum from the previous neighbor extremum to get the peak-valley difference adiff(n). If current extremum is a valley, go to Step 3; otherwise, return to Step 1.

  • Step 3: If adiff(n) is greater than the dynamic threshold (1m/s2 for initial value), and current valley can be separated from the previous valley by more than 0.3s, the valley is judged as usage mode or mode switching. If the minimum peak-valley difference and the valley interval are not satisfied, return to Step 1; otherwise, go to Step 4.

  • Step 4: Utilize the proposed usage mode switching detection method to label the valley with usage mode or mode switching. If the label is usage mode, go to Step 5; otherwise, go to Step 6.

  • Step 5: Determine whether the valley in one of the four usage modes is valid as a step or not. If adiff(n) satisfies with Equation (8), this valley is determined as a step and then go to Step 7, otherwise return to Step 1.

    $$ \frac{2}{3}{a_{\text{diff}}}(n - 1) < {a_{\text{diff}}}(n) < 3{a_{\text{diff}}}(n - 1), $$
    (8)
  • Step 6: Determine whether the valley in the mode switching is valid as a step or not. If adiff(n) satisfies with Eq. (9), this valley is determined as a step and then go to Step 7; otherwise, return to Step 1.

    $$ \frac{1}{3}{a_{\text{diff}}}(n - 1) < {a_{\text{diff}}}(n) < 4{a_{\text{diff}}}(n - 1), $$
    (9)
  • Step 7: Save current peak-valley difference adiff(n) of the valid step as the dynamic threshold. Return to Step 1 for the next judgement, until all the acceleration values are processed.

In order to avoid false step determination, both Eqs. (8) and (9) are used to reduce the noise from the acceleration values caused by jitter. Figure 8 shows the proposed step determination method comparing with the traditional method.

Fig. 8
figure 8

Comparison between the proposed method and traditional method

During this experiment, mode switching occurs for two times. As can be seen from Fig. 8, the proposed method outperforms the traditional method for more accurate step determination. The determination error for the traditional method mainly comes from the missing detection after the mode switching. This is because it cannot recognize the mode switching, and thus the acceleration after the switching is misjudged as a glitch and be filtered. But the proposed method can successfully avoid the above-mentioned problem because of the usage mode switching detection. Table 2 further shows the comparison of the step determination result of the two methods.

Table 2 Comparison of different algorithms

As can be seen from Table 2, the proposed method takes the usage mode switching into account and thus has better detection performance than the traditional method. The main advantage of the proposed method is that when the usage mode switching occurs, it will not filter the effective steps as glitches after switching, which means it has a smaller missed detection probability than the traditional method. So far, more accurate step determination is achieved. It can greatly help to improve the PDR trajectory location, and further enhance the performance of the location sapce of radio map building the in crowdsourcing way.

4.2 Multidimensional scaling-based RSS smoothing method

4.2.1 Classical multidimensional scaling algorithm

As noted earlier, in crowdsourcing the signal strengths are measured by a simple walk through the environment. The resulting RSS radio map is a noisy measurement of the signal strengths. In this section, we use MDS to smoothen the RSS values based on the relative distance between collection points, the known AP locations and the signal propagation model.

When a radio map is constructed in offline training phase, the squared similarity distance r2(Si,Sj) (\(i,j=1,2,\dots,n\)) between all pairs of points in data space is calculated by

$$ \begin{aligned} r^{2}(S_{i},S_{j})&=\sum \limits_{k=1}^{m}{\|r_{ik}-r_{jk}\|}^{2}=\sum \limits_{k=1}^{m}\left(r^{2}_{ik}+r^{2}_{jk}-2r_{ik}r_{jk}\right) \end{aligned} $$
(10)

Then squared similarity matrix \( \mathbf {R}^{2}\in \mathbb {R}^{n\times n}\) in data space is obtained as

$$ \mathbf{R}^{2} = \left(\begin{array}{cccc} 0 & r^{2}(S_{1},S_{2}) & \ldots & r^{2}(S_{1},S_{n})\\ r^{2}(S_{2},S_{1}) & 0 & \ldots & r^{2}(S_{2},S_{n})\\ \vdots & \vdots & \ddots & \vdots\\ r^{2}(S_{n},S_{1}) & r^{2}(S_{n},S_{2}) & \ldots & 0 \end{array} \right) $$
(11)

In MDS algorithm, the relative points RSS is computed from R as follows:

First of all, the double centering is applied to the similarity matrix with

$$ \begin{aligned} \mathbf{B}=-\frac{1}{2}\mathbf{J}\mathbf{R}^{2}\mathbf{J} \end{aligned} $$
(12)

The definition of J is given by

$$ \begin{aligned} \mathbf{J}=\mathbf{I}-\frac{\mathbf{e*e}^{\mathrm{T}}}{n} \end{aligned} $$
(13)

where \(\mathbf {I} \in \mathbb {R}^{n\times n}\) is an identity matrix, and \(\mathbf {e} \in \mathbb {R}^{n\times 1}\) is column vector with e=(1,1,...,1)T.

Decompose B by using the singular value decomposition (SVD) as:

$$ \begin{aligned} \mathbf{B}=\mathbf{U}\mathbf{\Lambda}\mathbf{U}^{\mathrm{T}} \end{aligned} $$
(14)

where Λ=diag(λ1,λ2,...,λm) is a diagonal eigenvalue matrix of B with \(\lambda _{1}\geq \lambda _{2}\geq \dots \geq \lambda _{n}\geq 0\). U=[u1,u2,…,un] is an orthogonal matrix whose columns are the corresponding eigenvectors.

Suppose we want to get the m dimensions of the solution, we denote the matrix of largest m eigenvalue by Λm, and denote Um to be the first m columns of U. The coordinate matrix of classical scaling is:

$$ \begin{aligned} \mathbf{RSS}'=\mathbf{U}_{m}\mathbf{\Lambda}^{\frac{1}{2}}_{m} \end{aligned} $$
(15)

4.2.2 Estimation of r 2(S i,S j)

To smoothen the RSS values in radio map, the precise similarity distance matrix is needed. We use a signal propagation model to compute the similarity distance r(Si,Sj) when the RSS values collected in RP Si are noised. Consider the k-th (k=1,2,...,m) AP installed in the indoor area as shown in Fig. 9.

Fig. 9
figure 9

A typical Wi-Fi Network with one AP

The location of AP, cAP, can be estimated with good accuracy using the CS method in [42]; hence, we treat its location as known. We use the indoor signal propagation model in [43] to model the wave propagation in the environment. The RSS value received from AP k(k=1,2,...,m) at location Si can be calculated by

$$ r_{ik}=10\text{log}_{10}\frac{Ph_{ik}}{d_{ik}^{\alpha_{i}}}-10\text{log}_{10}(10^{-3}) $$
(16)

where dik denotes the distance between the kth AP and the location at which the measurement is done, P is the transmission power of the AP, αi is the propagation loss exponent in the environment, and hjk is the combined effect of path loss, fading, and shadowing.

Using this model, and using an approximation as in [43], we get

$$ r_{ik}-r_{jk} \approx 10\text{log}_{10}\frac{d^{\alpha_{j}}_{jk}}{d^{\alpha_{i}}_{ik}}. $$
(17)

Let us also define r(Si,Sj) to be the vector of RSS differences for all APs between the measurements at Si ad Sj. The k-th element of r(Si,Sj) is the difference of the RSS measurement from the k-th AP between Si ad Sj, which can be represented by

$$ r_{k}(S_{i},S_{j}) = r_{ik}-r_{jk} $$
(18)

The square Euclidean norm of r(Si,Sj) can be written as

$$ \begin{aligned} \| \mathbf{r}(S_{i},S_{j}) \|^{2} &=\sum \limits_{k=1}^{m}{|r_{ik}-r_{jk}|}^{2} =100\sum \limits_{k=1}^{m} \left(\text{log}_{10}\frac{d^{\alpha_{j}}_{jk}}{d^{\alpha_{i}}_{ik}} \right)^{2} \end{aligned} $$
(19)

By alternate the unprecise similarity distance r2(Si,Sj) in \(\mathbf {R}^{2}_{n\times n}\) with ∥r(Si,Sj)∥2, a more accurate similarity matrix can be obtained which is used to smooth the RSS values in the radio map.

4.2.3 The application of MDS algorithm

As described above, RSS values are collected from m APs at n RPs in the indoor area and a radio map is constructed by the n×m matrix of RSS values. Since the noised RSS values are unknown in the RSS matrix RSS, we assume the RSS values ri in RP Si are noised, then it can be smoothed by using MDS method based on coordinates matrix C and the RSS except ri and the RSS values in other RPs can be smoothed one by one until the RSS values in all RPs are smoothed. The radio map can be smoothed by the following steps:

  • Step1: Compute the similarity distance in data space between RP Si and other RPs using formula (19). The rest of similarity distances are computed by RSS values and the distance matrix for MDS is constructed by combining these two parts of similarity distances.

  • Step2: Apply MDS to the distance matrix, retaining the first m largest eigenvalues and eigenvectors to construct a m dimensional relative RSS matrix.

  • Step3: Transform relative RSS matrix to absolute RSS matrix based on RSS except ri by using linear transform, which may include scaling, rotation, and reflection.

5 Results and discussion

This section provides details on the experimental evaluation of the proposed MDS method using both simulations and implementations. The experimental environment is located in the 12th floor of Building 2A at Harbin Institute of Technology. As shown in Fig. 10, the localization area is the corridor with 49.4 m in length and 14.1 m in width, which is illustrated with yellow color. In the offline phase, we deployed 27 access points (Linksys WRT54G) with IEEE 802.11b/g mode. The radio map was constructed using a step-counter-assisted RSS measurement method. In the localization area, we set 5 walking routes and collect RSS values and sensor data during walking. Figure 11 shows the walking track of the staff and the location of RP points in the radio map when creating the radio map. A fingerprint is synthesized by using RSS values and the corresponding coordinate calculated by the sensor data, and then the radio map is built. Using this system, we only need a few hours to build a radio map with 823 fingerprints. However, since the resultant radio map only has a few RSS values at each RP, the influence of outlier values and signal fluctuation are more pronounced than for traditionally generated radio maps, which have hundreds of RSS values at each RP (Fig. 11).

Fig. 10
figure 10

Floor plan for indoor localization, where the area colored in yellow is used for testing

Fig. 11
figure 11

Illustration of reference points distribution in the interesting area for localization

In contrast, we use the traditional methods to collect 100 RSS values at each RP and take the average value to build the radio map. The signal distribution of AP7 in the radio map is displayed in Fig. 12. It can be seen from the figure that the signal distribution of radio map established by the traditional method is very smooth and the fluctuation is very small. Therefore, it is foreseeable that the user can be precisely positioned using this radio map.

Fig. 12
figure 12

Signal distribution of radio map built by traditional method

The signal distribution of radio map built by step-counter-assisted RSS measurement method is showed in Fig. 13. As shown in Fig. 13, although the signal distribution of RSS values from a single AP in the radio map built by step-counter-assisted method is generally consistent with the signal propagation model, lots of noises and measurement errors are embedded in the original radio map which lead to the wild fluctuation at some RPs. Figure 14 illustrates the difference between the radio map built by the traditional method and step-counter-assisted method. From the Fig. 14, we can draw two conclusions that the error range is very large (from −35 to 10dB) and the error at each RP fluctuates greatly. If this radio map is used to estimate the user’s location, it will generate a large number of positioning errors.

Fig. 13
figure 13

Signal distribution of radio map built by step-counter-assisted method

Fig. 14
figure 14

Error of radio map built by step-counter-assisted method

In order to improve the positioning accuracy, the proposed MDS algorithm is applied to smooth the received RSS values in offline training phase. Figure 15 presents the smoothed signal distribution of the radio map and we can see that the MDS algorithm has removed lots of noises and measurements errors from the original radio map, resulting in better adherence to the signal propagation model. Figure 16 presents the difference between the smoothed radio map and the traditional radio map. Compared with Figs. 13 and 14, the smoothed radio map is more similar to the radio map created by the traditional method, and the RSS fluctuations at each reference point are smaller.

Fig. 15
figure 15

Signal distribution of smoothed radio map

Fig. 16
figure 16

Error of smoothed radio map

The CDF curve of the positioning error for the MDS algorithm is given in Fig. 17. As comparisons, the sliding correlation time window filter (SCTW) method in [33] and original data are also simulated in this paper. The SCTW method only uses a small number of the RSS values in the radio map and most of the information in the radio map is abandoned, therefore it cannot achieve the optimal radio map. Because the proposed MDS algorithm derives out a more precise radio map, the MDS algorithm has a higher the positioning accuracy than other methods. Notably, the maximum localization error has been reduced from 10m to 6m, and when the positioning error is 2m, the positioning accuracy is increased by more than 30%.

Fig. 17
figure 17

Cumulative distribution function of Positioning error

6 Conclusion

In this paper, the noise reduction method for radio map in crowdsourcing indoor positioning system is proposed. In order to precisely count the steps, mode switching based step counting algorithm and dynamic threshold detection method are used in our step-counting-assisted RSS measurement method. Although step-counting-assisted method can obtain radio maps quickly, RSS data in radio map contains lots of errors and fluctuates violently. Therefore, the accuracy of the radio map cannot meet our requirements. In order to increase the accuracy of radio map and reduce RSS fluctuations and errors, the MDS method are proposed to smooth the radio map. The intuition behind this technique is that the RSS values between different RPs have an intrinsic relationship due to the fixed positions of RPs. According to the MDS algorithm, noisy RSS values can be well corrected and an smoother radio map is obtained. We tested the proposed method in a typical office environment at Harbin Institute of Technology, and the experimental results demonstrate that the proposed method leads to significantly improvements on localization accuracy.