An Improved Indoor Positioning Method Based on Nearest Neighbor Interpolation

Nowadays, people’s demand for indoor location information is more and more, which continuously promotes the development of indoor positioning technology. In the field of indoor positioning, fingerprint based indoor positioning algorithm still accounts for a large proportion. However, the operation of this method in the offline stage is too cumbersome and time-consuming, which makes its disadvantages obvious, and requires a lot of manpower and time to sample and maintain. Therefore, in view of this phenomenon, an improved algorithm based on nearest neighbor interpolation is designed in this paper, which reduces the measurement of actual sampling points when establishing fingerprint map. At the same time, some simulation points are added to expand fingerprint map, so as to ensure that the positioning error will not become larger or even better. Experimental results show that this method can further improve the positioning accuracy while saving the sampling cost.


Ⅰ. Introduction
With the continuous development of science and technology, people's demand for various services is increasing, location-based service business is expanding, and more and more people pay attention to it. Outdoor positioning is basically achieved by relying on satellites. But positioning in indoor environment can not rely on satellite signals. This has led to the emergence of a large number of different solutions in the field of indoor positioning, each has its own advantages and disadvantages, and there is no perfect solution. Gradually, there are many indoor positioning technologies based on WiFi, RFID, UWB, sound signals, magnetic signals and inertial sensors (Ijaz, Yang, Ahmad, & Lee, 2013;Koyuncu & Yang, 2010;Farid, Nordin, & Ismail, 2013;H. Liu, Darabi, Banerjee, & J. Liu, 2007;Disha, 2013;Al-Ammar, Alhadhrami, Al-Salman, Alarifi, Al-Khalifa, Alnafessah, & Alsaleh, 2014;Vo & De, 2015). In order to meet the positioning requirements of a certain level of accuracy, most indoor positioning technologies need to deploy additional dedicated hardware facilities. The positioning cost is high, and the positioning accuracy and coverage are limited by hardware conditions, which is not conducive to application and promotion.
However, among these schemes, indoor positioning based on WiFi has become one of the more commonly used methods due to its advantages such as dense equipment layout and convenient signal acquisition (Le Dortz, Gain, & Zetterberg, 2012). And this method is mostly based on received signal strength (RSS) to estimate the position of objects to be located (Li, Meng, & Wang, 2014;Khalajmehrabadi, Gatsis, & Akopian, 2017;Li, Fu, Yang, & Shen, 2019). RSS has different values in each position. Therefore, we take these different RSSs as the features in these locations, also called "fingerprints". And determine the approximate position of the object to be located by comparing these fingerprints during positioning.
In this scheme, the most important is the establishment of fingerprint database, which determines the final positioning results. A good fingerprint database can make the positioning error become very small. At the same time, because WiFi signals are extremely vulnerable to interference, the fingerprint database will gradually deteriorate over time, and the positioning accuracy will also gradually deteriorate (Yan, Wang, & Zhao, 2020). Therefore, after spending a lot of manpower and time on sampling and establishing the database, it is still necessary to maintain and modify the fingerprint database every once in a while, which leads to very high cost and overhead.
In view of this situation, we learn from the VIRE algorithm, which is mainly based on RFID location algorithm, and introduce the concept of "virtual". In this paper, based on this idea, a new virtual insertion algorithm is proposed and used in WiFi location. On the premise of reducing the sampling workload, the positioning accuracy is further improved.

Fingerprint Location Technique
Fingerprint positioning technology mainly takes advantage of the spatial difference of wireless signals in different positions. The wireless signals are taken as the characteristics of physical positions, namely "fingerprints". The corresponding positioning method is called fingerprint positioning. This method uses the corresponding relationship between signal RSS value and physical address to realize location, which can be divided into two stages: offline stage and online stage (Janicka & Rapinski, 2016;Guan, Deng, Ge, & Yu, 2011). In the offline stage, reference points were selected and the RSS values of each reference point were collected to build the location fingerprint database. In the online stage, the newly collected RSS value is input into the algorithm model for matching and classification operation to obtain the coordinates of the position to be measured. Generally speaking, the commonly used classification algorithms include KNN algorithm, Naive Bayes algorithm, Support Vector Machine (SVM), etc (Cleophas & Zwinderman, 2013). Among them, KNN algorithm is easy to implement, does not need the training process, and is suitable for multi-classification problems, so we choose KNN classification algorithm model to achieve matching positioning, in order to get more accurate positioning results, we use WKNN algorithm on the basis of KNN algorithm, it considers the weight on the basis of KNN algorithm.
Specifically, in the offline phase, we get a set of sampled data D contains the coordinates of each sampling point and its corresponding RSS values. Then in the online phase, the new information of the object to be located is obtained and compared with the sampling data D, usually with similarity measure. Similarity measure methods including euclidean distance, pearson correlation coefficient and cosine similarity, etc. In this paper, we use Euclidean distance to calculate, which can be specifically expressed as:

= −
Where, n is the sampled WiFi Access Point (AP) signal, and and respectively represent the RSS signal value of the Mth AP of Point i and Point j.
On this basis, after introducing the weight, it can be expressed as: In the WKNN algorithm, the value of K is not fixed, and the value of K needs to be determined according to the actual situation. Generally, K is an integer no more than 20.

VIRE
The algorithm of VIRE (Zhao, Liu, & Ni, 2007) is modified by the LANDMARC algorithm (Ni & Liu, 2004), which uses the reference tag as the positioning reference to assist positioning, and expansion of reference tags density by means of linear interpolation, then eliminate impossible position. The uncertainty of the tags to be located is corrected by the weighted average of the remaining "adjacent tags", makes the algorithm in the process of positioning less affected by the external environment change, and has the high stability.
Specifically, the sampling area is divided according to the rectangular grid, so it is not necessary to measure the whole area intensively during sampling. After getting the sampling data of some points, the RSS signals on the virtual points that have not been sampled can be determined through these real sampling points. Each virtual point is surrounded by four real points, and then the four real points are used to predict the RSS value of the virtual point through linear interpolation. In this way, a relatively complete sampling map can be established with less work, which greatly saves the cost and improves the positioning accuracy.

Improved Virtual Interpolation Algorithm
In VIRE, the linear interpolation method is used to determine the RSS value on the virtual point, which needs to be laid in a regular rectangular grid. In this paper, this idea is used for reference, and some improvements are made to it, so that sampling is not required according to the regular rectangle.
Within the sampling area, we randomly sampled it without intensive sampling, so that we can get the RSS values of the real sampling points, which do not necessarily need to be regular. Then, we use the nearest neighbor interpolation method to interpolate the virtual points. Specifically, we treat the RSS value of the closest real point to the virtual point as the RSS value of the virtual point, because In theory, the closer the points are, the more similar the fingerprints are. As shown in Figure 1(a), the solid circle is the real point and the hollow circle is the virtual point, and the RSS value on the virtual point is determined by the nearest neighbor.
When a virtual point with multiple nearest neighbor real point, we will be the real point of nearest neighbor RSS value weighted average, and get the final virtual point, can be expressed as = (∑ ) . Among them, is the RSS value of the virtual point, is the RSS value of the nearest real point. As shown in Figure 1(b), when multiple nearest neighbors are present, the RSS value on the virtual point is determined jointly by these nearest neighbors. Through the above steps, we can not be limited to the regular sampling method, so as to get the RSS value on the virtual point, which makes the sampling method more flexible.

Experiment
The main environment of this experiment is a warehouse with a size of about 27m×20m, and 50 APs are placed in it. Two mobile phones (Huawei Nova4 and VIVO X20) are used to sample them, and 140 points are randomly sampled. The RSS value of each sampling point is sampled for 5 minutes, 30 times per minute, and the collected data is denoised by means of mean filtering. Then the 140 real points of the sampled map are expanded to 540 points by the above method, including 400 virtual points.
In order to verify the effectiveness and feasibility of the improved positioning method proposed in this paper, according to the above method and environment, the map obtained by the improved algorithm is compared with the original map. The comparison of the results obtained is shown in the following figure It can be seen that this method can greatly improve the positioning accuracy while reducing the sampling points. When the sampling area is larger and the virtual points are more dense, the positioning error will be smaller, and the effect of this method will be more obvious.

Conclusions
Aiming at the problem that the establishment of fingerprint map in fingerprint positioning requires a large amount of work, this paper proposes an improved method based on the VIRE algorithm, which not only reduces the sampling points, but also ensures the improvement of positioning accuracy and controls the positioning error within a small range, making the algorithm more robust and flexible.