# Regional Double-Layer, High-Precision Indoor Positioning System Based on iBeacon Network

Authors: Xiaona Zhang; Shufang Zhang; Chao Wang; Shujing Sun
Journal: Mathematical Problems in Engineering
 (2022)

---

## Abstract

With the development of modern society, the demand for indoor positioning technology is higher and higher. The existing indoor positioning technology is difficult to really solve the problem of accuracy and achieve high-performance indoor positioning system design. Based on iBeacon equipment, this paper proposes a method to optimize received signal strength indication indoor positioning algorithm by using the Gaussian filtering method so as to reduce the adverse impact of multipath fading in indoor environment. In order to further improve the accuracy of indoor positioning algorithm, the stack automatic encoder in the deep neural network algorithm is introduced. Through the deep learning method, the high-dimensional information of the fingerprint database collected by the system can be extracted and the adverse impact of data noise on the database is also reduced. Through the simulation test of the system, it can be seen that the error of received signal strength indication indoor positioning algorithm based on extended Gaussian filter is small. Compared with the traditional iBeacon algorithm, the improved algorithm can achieve better data classification. The maximum error of the whole system is 1.02 M. Comprehensive analysis shows that the proposed indoor positioning system has a certain practical value and can be applied to the indoor positioning needs in a certain range of environment.


---

## Body

## 1. Introduction

With the continuous development of modern city, the internal environment of Hongda building has become more complex, whether it is GPS or BeiDou system, it is difficult to meet people’s demand for indoor positioning. In terms of indoor environment, due to the low signal strength of satellite navigation, it is difficult to penetrate the obstacles of buildings and play a role in indoor environment (Liu et al.) [1]. Compared with the outdoor environment, the indoor environment will be affected by the complexity of time and environment. At present, it is difficult to have mature technology to achieve high-precision indoor positioning technology (Yazıcı et al.) [2]. The application of indoor navigation system will be very extensive, such as indoor logistics sorting system, library book inquiry and book management, underground parking lot parking space search and car demand, mine safety tracking, and so on. At present, almost all positioning technologies are affected by the environment; for example, the change of cloudy and rainy days and cloud thickness will change the positioning accuracy, and the occlusion of high-rise buildings on satellite signals will also reduce the positioning accuracy (Xie et al.) [3]. In the indoor environment, changes in the environment may make the positioning system fail. In the past, Wi-Fi signal was used to achieve positioning, which would fluctuate violently due to changes in the environment (Zhang et al.) [4]. As far as the positioning accuracy is concerned, the outdoor positioning accuracy can meet the use demand within tens of meters, but in the indoor positioning service, this accuracy is far from enough, and higher-accuracy indoor positioning needs to be realized (Bernardini et al.) [5].Based on iBeacon equipment, this paper proposes a method to optimize RSSI indoor location algorithm by using Gaussian filtering method to reduce the adverse impact of multipath fading on indoor environment. An indoor positioning system based on iBeacon is designed, which can meet the requirements of indoor positioning accuracy and data processing.The innovations of this study are as follows: (1) RSSI technology is used to optimize the signal strength data received by iBeacon equipment, which reduces the impact of indoor environment on positioning algorithm. (2) The deep neural network algorithm is used to train the fingerprint database, which reduces the data noise and improves the indoor positioning accuracy. (3) An indoor location system based on improved RSSI location algorithm optimized by neural network is designed. The system has the characteristics of small error and high efficiency. Through the combination with Android mobile phone, the scalability of the system is improved.


## 2. Related Work

With the continuous development of modern communication technology and the continuous improvement of the construction of ground base station, high-precision positioning service has covered all aspects of work and life. Sun et al. proposed a high-precision lbs architecture based on GNSS CORS network. Combined with the daily requirements of HNCORS network, the “SoBDS” platform is established. The decimeter-level example experiment shows that the platform can support 1 million users and has good compatibility and scalability (Sun et al.) [6]. Zhang et al. proposed using big data processing technology to optimize network information transmission, completed the construction of online social network connection prediction model, which can greatly improve the efficiency of data transmission [7]. Kwangjae et al. proposed SKPF algorithm. The algorithm improves the positioning accuracy by fusing the uncertain location data obtained from DR and fingerprint. SKPF algorithm has better positioning accuracy than KF and UKF algorithm; the performance is equivalent to PF algorithm and has higher computational efficiency than PF algorithm [8]. Wu et al. proposed a method of indoor automatic positioning through modern smart phone mobile terminal, which detects the change process of Bluetooth signal through smart phone and takes Bluetooth as signal source. This method can achieve a stable signal source and achieve high-precision positioning [9]. Zuo et al. pointed out that indoor positioning is a very difficult thing. They proposed an interpolation positioning method based on fingerprint matching method. In the research, they constructed an effective fingerprint image and realized high-precision indoor positioning [10]. Chen et al. proposed UILoc, an unsupervised indoor positioning scheme, which uses the combination of smart phone sensors, iBeacon, and Wi-Fi fingerprints to achieve reliable and accurate indoor positioning at zero labor cost [11].Wang et al. designed a local coordinate system to support the identification of parking and beacon positions. The system can solve the parking problems in underground parking lot and help users to find parking and vehicles more convenient [12]. Lamoureux and Chelouah put forward a kind of indoor precise positioning system based on Bluetooth technology. The system has the characteristics of easy installation, low power consumption, and high efficiency. Because GPS signal is difficult to penetrate the wall and cannot realize indoor positioning, Bluetooth technology is a high-applicability indoor high-precision positioning method [13]. According to the positioning requirements of modern intelligent library, Fei et al. put forward a micro message platform system that is applied to book positioning and bookcase navigation. The system can reduce the time users find books and also help the library managers balance between the number of books and book search (Fei et al.) [14]. Rezazadeh et al. make a comprehensive analysis and experiment on the importance of iBeacon layout and the factors affecting beacon signal quality. A customized application for Android is developed to record and analyze iBeacon signals. The layout strategy proposed in this study is 21.7% more accurate than the existing ordinary iBeacon layout [15]. In the process of goods picking up and counting in indoor warehouse, automatic goods sorting can be realized by dynamic location information of products. Zhao et al. propose a distributed serial tracking method based on iBecon technology to seamlessly combine the warehouse workflow and realize the indoor precise navigation of vehicles [16]. óscar et al. proposed a heuristic drift cancellation algorithm to modify the indoor navigation algorithm. This method can reduce the error of the heading by using the building leading direction and judge the pedestrian movement according to the comprehensive evaluation results [17].Indoor positioning service technology has great economic potential and social demand. When receiving indoor signals, it will produce large errors due to the increase of ranging. Deng et al. designed a location algorithm of occlusion compensation error, which is based on Bluetooth location technology and can improve the accuracy and robustness of indoor location [18]. Zhang and Mao proposed a WKNN indoor positioning method based on the spatial characteristics of the target. This method can be combined with Wi-Fi fingerprint database to solve the problem of simultaneous analysis of multiple targets in a unified area and the problem of large span of calculation results and inaccurate positioning [19]. Cao et al. introduced a new two-way ranging method for indoor accurate positioning. In order to deal with the harsh indoor environment, a good return based on Gaussian process was proposed to improve the effect of data processing. The model can determine the ground point position coordinates according to the known access point position [20]. Yang et al. proposed a vision-based indoor positioning technology. Compared with Bluetooth and Wi-Fi based positioning technology, this technology can complete indoor positioning without additional hardware deployment. However, the pixel coordinates may be distorted due to the location scene, so the pixel threshold constraint is introduced. The algorithm can be improved to improve the positioning accuracy [21].Although there are many related researches on integrated indoor relative positioning technology, they are mostly implemented in the way of small-range positioning accuracy or small data processing, which is difficult to achieve good results for real multistorey buildings. At present, there is a real need for an indoor positioning method with low cost, high positioning accuracy, strong applicability, and other comprehensive performance. Combined with the existing research, this paper selects Android smart phones and iBeacon devices to achieve high-precision indoor positioning and introduces RSSI positioning algorithm and improved optimization of deep neural network to achieve better parameter setting and data positioning.


## 3. Optimization Design of Received Signal Strength Indication Location Algorithm

Wireless sensor networks have been widely used because of their self-organization, distribution, low power consumption, and low cost. In recent years, the hot research is to use wireless signals to locate. Location information has a very important application. For example, in military affairs, sensor networks can be used to detect the action route of enemy forces; in civil use, location information can be used to detect the flow of people in shopping malls. This is a concept of content awareness. Now some map applications have embedded this concept into their applications, such as Baidu Maps and Google Maps, which can not only track the determined geographical location in real time, but also give relevant information such as surrounding catering and accommodation.


### 3.1. Received Signal Strength Indication Ranging

In this paper, the RSSI (received signal strength indicator) value is selected to design the indoor positioning algorithm. The basic principle of this method is to judge the distance between the target and the base station according to the strength of the wireless signal received by the target to be tested. The closer the distance is, the higher the RSSI value will be, and vice versa (Huang et al.) [22]. According to the conventional setting, the signal receiving distance of 1 m is taken as the environment scalar of signal strength, and the signal strength within 1 m is considered as the signal strength under stable and ideal environment; thus, a reference RSSI value is obtained. The distance relationship model between mobile terminal and signal base station can be constructed by using the reference RSSI value. According to the theoretical model of wireless signal transmission, the calculation formula of the actual RSSI value can be deduced.Set the reference distance asd0 (the value of d0 is 1 m), the reference RSSI value as RSSI0, the actual measured distance between the target and the base station as dt, the corresponding measured RSSI value as RSSI1, and the attenuation factor of the wireless signal as n.(1)RSSI1=RSSI0+10nlogd1/d0+ε.In equation (1), a is ε Gaussian random parameter with a value of 0.When measuring the location distance, the transmission of wireless signal will be affected by obstacles, multipath decay, climate change, and other environmental factors. Therefore, in order to reduce the impact of environmental factors on positioning error, it is necessary to measure the unique environmental parameters.RSSI values are spread in disorder in the system, and they cannot be defined and classified in advance. Therefore, Gaussian filtering can be extended to cluster the data of each group, thus reducing the impact of environmental factors on RSSI values and obtaining more accurate positioning results.


### 3.2. Improvement and Optimization of Received Signal Strength Indication Value Based on Gaussian Filter

The RSSI of the same node may produce some unreasonable measurement values due to environmental interference, even if it is a small probability event, but once it occurs, it will seriously affect the accuracy of RSSI values. The idea of using Gaussian filter to improve and optimize the RSSI value is to select the effective value from the high-probability region of RSSI value and calculate the average value of output to improve the ranging accuracy.Let a total ofn RSSI values obey Gaussian distribution, the mean value of RSSI value is μ, the variance of RSSI value is σ2, and the probability density function of RSSI value is fx, so(2)fx=1σ2πexp−x−μ22σ2.The calculation formula of RSSI value meanB is as follows. The calculation formula of mean value μ of RSSI value is(3)μ=1n∑i=1nRSSIi.The calculation formula ofσ2 is(4)σ2=1n−1∑i=1nRSSI−μ2.According to the calculated value of (2), if the RSSI value is in the range of μ−σ,μ+σ, then the RSSI to is regarded as the high-probability confidence interval.The average RSSI value calculated by Gaussian filter can reduce the influence of environment interference, but the accuracy of test paper needs to be further improved, so it is necessary to optimize RSSI value by using extended Gaussian filter.The idea of extended Gaussian filter to optimize the RSSI value is to decompose the observed RSSI value into several combinations of Gaussian probability density functions, which are satisfied with the normal distribution curve. Let the number of groups of Gaussian probability density function beK, the component distribution function in this combination be Nμk,σk2, the number, mean value, and variance of RSSI values of the third group be Nk, μk, σk2, and e, respectively, the number of RSSI values be N, and the relatively stable value in RSSI value be μk, then the probability density function of RSSI value can be obtained.(5)Px=∑k=1KwkNμk,σk2.In (5), wk is the weighting factor. Among these signals, the direct signal group is the ideal signal group, and the component of group K−1 is the multipath fading signal.Using Gaussian filter to represent RSSI observations, it can be divided into two categories. Take the ideal RSSI mean map after clustering by extended Gaussian filter in Figure1 as an example, where the signal strength of −50 dbm dotted line is the RSSI mean after Gaussian filtering on the left, the RSSI mean after extended Gaussian filtering on the right, and the ideal signal group clustering on the right. This set of RSSI means can significantly reduce the interference of multipath fading signal on the test value and tend to the ideal value.Figure 1
Ideal RSSI mean graph after Gaussian filter clustering.The process of clustering RSSI means by extended Gaussian filter is to use iterative method to calculate the maximum likelihood estimation of parameters.When groupbk=0 is not selected, group k is selected; when group bk=1 is selected, then bk. When e is selected, the expression is as follows.Suppose that the probability of groupk being selected in RSSI value is wk, and each component of the K dimensional random variable b is represented by bk, and the value of bk is 0 or 1. p⋅ is expressed as a probability function.(6)wk=pbk=1.Among them,bk∈0,1,∑k=1kbk=1, in this group, except group k, the rest of the components are 0, which meet the conditions of probability normalization. Assuming that the components are independent distribution, the joint probability distribution can be calculated:(7)pb=pb1pb2⋯pb3=∏k=1Kwkbk.Given the probability ofb, the probability of x under the condition of b is(8)px=∑bpbpx|b.After finishing formulas (7) and (8), it can be calculated that(9):px=∑k=1KwkNx;μk,σk2.After introducingK-dimensional implicit variable b, x represents the probability calculation formula of group k.(10)pbk=1|x=px|bk=1pbk=1px=wkNx;μk,σk2∑i=1KwiNx;μi,σi2.The collected RSSI values are divided into three groupsK=1,2,3. If it is a normal Gaussian filter, then K=1. The sum of probabilities of all RSSI measurements is a fixed N value. After updating the weight of part k, it is expressed as(11)wk=∑i=1NpkRSSIi.Then, the corresponding mean and variance are updated:(12)μk=∑i=1NpkRSSIiRSSIi∑i=1NpkRSSIi,σk2=∑i=1NpkRSSIiRSSIi−μk2∑i=1NpkRSSIi.The above iterative process is repeated until it meets the set threshold.


## 3.1. Received Signal Strength Indication Ranging

In this paper, the RSSI (received signal strength indicator) value is selected to design the indoor positioning algorithm. The basic principle of this method is to judge the distance between the target and the base station according to the strength of the wireless signal received by the target to be tested. The closer the distance is, the higher the RSSI value will be, and vice versa (Huang et al.) [22]. According to the conventional setting, the signal receiving distance of 1 m is taken as the environment scalar of signal strength, and the signal strength within 1 m is considered as the signal strength under stable and ideal environment; thus, a reference RSSI value is obtained. The distance relationship model between mobile terminal and signal base station can be constructed by using the reference RSSI value. According to the theoretical model of wireless signal transmission, the calculation formula of the actual RSSI value can be deduced.Set the reference distance asd0 (the value of d0 is 1 m), the reference RSSI value as RSSI0, the actual measured distance between the target and the base station as dt, the corresponding measured RSSI value as RSSI1, and the attenuation factor of the wireless signal as n.(1)RSSI1=RSSI0+10nlogd1/d0+ε.In equation (1), a is ε Gaussian random parameter with a value of 0.When measuring the location distance, the transmission of wireless signal will be affected by obstacles, multipath decay, climate change, and other environmental factors. Therefore, in order to reduce the impact of environmental factors on positioning error, it is necessary to measure the unique environmental parameters.RSSI values are spread in disorder in the system, and they cannot be defined and classified in advance. Therefore, Gaussian filtering can be extended to cluster the data of each group, thus reducing the impact of environmental factors on RSSI values and obtaining more accurate positioning results.


## 3.2. Improvement and Optimization of Received Signal Strength Indication Value Based on Gaussian Filter

The RSSI of the same node may produce some unreasonable measurement values due to environmental interference, even if it is a small probability event, but once it occurs, it will seriously affect the accuracy of RSSI values. The idea of using Gaussian filter to improve and optimize the RSSI value is to select the effective value from the high-probability region of RSSI value and calculate the average value of output to improve the ranging accuracy.Let a total ofn RSSI values obey Gaussian distribution, the mean value of RSSI value is μ, the variance of RSSI value is σ2, and the probability density function of RSSI value is fx, so(2)fx=1σ2πexp−x−μ22σ2.The calculation formula of RSSI value meanB is as follows. The calculation formula of mean value μ of RSSI value is(3)μ=1n∑i=1nRSSIi.The calculation formula ofσ2 is(4)σ2=1n−1∑i=1nRSSI−μ2.According to the calculated value of (2), if the RSSI value is in the range of μ−σ,μ+σ, then the RSSI to is regarded as the high-probability confidence interval.The average RSSI value calculated by Gaussian filter can reduce the influence of environment interference, but the accuracy of test paper needs to be further improved, so it is necessary to optimize RSSI value by using extended Gaussian filter.The idea of extended Gaussian filter to optimize the RSSI value is to decompose the observed RSSI value into several combinations of Gaussian probability density functions, which are satisfied with the normal distribution curve. Let the number of groups of Gaussian probability density function beK, the component distribution function in this combination be Nμk,σk2, the number, mean value, and variance of RSSI values of the third group be Nk, μk, σk2, and e, respectively, the number of RSSI values be N, and the relatively stable value in RSSI value be μk, then the probability density function of RSSI value can be obtained.(5)Px=∑k=1KwkNμk,σk2.In (5), wk is the weighting factor. Among these signals, the direct signal group is the ideal signal group, and the component of group K−1 is the multipath fading signal.Using Gaussian filter to represent RSSI observations, it can be divided into two categories. Take the ideal RSSI mean map after clustering by extended Gaussian filter in Figure1 as an example, where the signal strength of −50 dbm dotted line is the RSSI mean after Gaussian filtering on the left, the RSSI mean after extended Gaussian filtering on the right, and the ideal signal group clustering on the right. This set of RSSI means can significantly reduce the interference of multipath fading signal on the test value and tend to the ideal value.Figure 1
Ideal RSSI mean graph after Gaussian filter clustering.The process of clustering RSSI means by extended Gaussian filter is to use iterative method to calculate the maximum likelihood estimation of parameters.When groupbk=0 is not selected, group k is selected; when group bk=1 is selected, then bk. When e is selected, the expression is as follows.Suppose that the probability of groupk being selected in RSSI value is wk, and each component of the K dimensional random variable b is represented by bk, and the value of bk is 0 or 1. p⋅ is expressed as a probability function.(6)wk=pbk=1.Among them,bk∈0,1,∑k=1kbk=1, in this group, except group k, the rest of the components are 0, which meet the conditions of probability normalization. Assuming that the components are independent distribution, the joint probability distribution can be calculated:(7)pb=pb1pb2⋯pb3=∏k=1Kwkbk.Given the probability ofb, the probability of x under the condition of b is(8)px=∑bpbpx|b.After finishing formulas (7) and (8), it can be calculated that(9):px=∑k=1KwkNx;μk,σk2.After introducingK-dimensional implicit variable b, x represents the probability calculation formula of group k.(10)pbk=1|x=px|bk=1pbk=1px=wkNx;μk,σk2∑i=1KwiNx;μi,σi2.The collected RSSI values are divided into three groupsK=1,2,3. If it is a normal Gaussian filter, then K=1. The sum of probabilities of all RSSI measurements is a fixed N value. After updating the weight of part k, it is expressed as(11)wk=∑i=1NpkRSSIi.Then, the corresponding mean and variance are updated:(12)μk=∑i=1NpkRSSIiRSSIi∑i=1NpkRSSIi,σk2=∑i=1NpkRSSIiRSSIi−μk2∑i=1NpkRSSIi.The above iterative process is repeated until it meets the set threshold.


## 4. Research on Optimization and Improvement of Location Algorithm Based on Deep Learning

Using location fingerprint algorithm to locate location coordinates has two stages. The first stage is the offline stage, which needs to initialize the iBeacon device, reset the parameters in the device and distinguish the devices, and arrange the devices in the indoor positioning scene and record the corresponding positions. The core task in the offline phase is to successfully build a location fingerprint map, divide the map into many small areas through the grid map, collect the signal in each area, and record the corresponding signal strength value, which is the fingerprint characteristics of the corresponding area (Yan et al.) [23]. After recording and storing the collected fingerprint characteristics database, the corresponding database can be formed, and the first stage is completed. The second stage is the online positioning stage. In this stage, the fingerprint information needs to be sent to the database. The server will use the matching algorithm to match the fingerprint in the data, find the most similar fingerprint, and send the corresponding predicted positioning coordinates to the user to realize the positioning.


### 4.1. Location Principle of Fingerprint Matching Algorithm

The grid coordinates of the area divided in the offline phase are regarded as the output results, the RSSI value is regarded as the input information, and the processing process of the data by fingerprint matching algorithm is the training of given data and output. With the training of fingerprint matching function, the function can predict the new input value and the corresponding output until the most suitable parameters are found [24]. The process of location calculation by using fingerprint matching algorithm is a process in which the classification of discrete fingerprint data will be regressed. The basic principle is shown in Figure 2.Figure 2
Flowchart of fingerprint matching algorithm location calculation.The key of using fingerprint matching method for indoor positioning is to match the received data with the data in the database, obtain the data with the highest matching degree, and get the final positioning result after weighted average processing. The key of this process is to find the global optimal solution in the system database at the beginning, which requires more base stations to be arranged as much as possible and more fingerprint database data to be obtained at the beginning. However, if you traverse a high-dimensional database every time, there will be a very high delay and the requirement of calculation will be very high.The manual fingerprint classification method is mainly to make user-defined area labels for different building floor numbers, building numbers, and so on, and grid according to different area labels. Using machine learning algorithm to learn and train fingerprint database, a good classification function can better achieve the local optimal solution of the data, so we need to take a good classification design method. As one of the deep learning algorithms, KNN algorithm is also calledk-nearest neighbor algorithm. When using KNN algorithm to calculate the location, we should first use RSSI information and data information in fingerprint database to calculate the Euclidean distance between two points. At present, the commonly used classification methods include support vector machine and KNN algorithm, which need to be optimized in the follow-up research. Based on the above, we can get the positioning flowchart based on fingerprint database, as shown in Figure 3.Figure 3
Hierarchical structure of fingerprint matching algorithm.


### 4.2.k-Nearest Neighbor Classification Algorithm

KNN (k-nearest neighbor classification) algorithm is also called K-neighbor algorithm. When using KNN algorithm to calculate location, we must first use RSSI information and data information in fingerprint database to calculate Euclidean distance between two points. The difference between the algorithm and RSSI is that the coordinate of KNN is the average of K fingerprint point closest to the target point, and the K value will be greater than 1. Set the near point coordinate of the target point as xi,yi point as and the calculation formula of its positioning coordinate is(13)x,y=1K∑i=1Kxi,yi.In formula (13), a value is K superparameter, which needs to be measured based on the actual environment in the field.In the actual test environment, in general, the distance from the target point determines the accuracy of information measurement. The closer the information is, the more accurate the information is. When using KNN algorithm to calculate, for the point closer to the target point, higher weights can be given to improve the accuracy of the prediction results. In general, the reciprocal of the distance can be used as the weight of the fingerprint point, and the weight of thei point is set as wi. after adding the normalization parameter to it, the calculation formula of the positioning coordinates can be obtained.(14)x,y=∑i=1Kwixi,yi.


### 4.3. Improved Location Algorithm Based on Deep Neural Network

Because the location algorithm system needs a large number of data samples, the location algorithm needs to be able to process a large number of data and has a good processing ability for the database with high dimension. This paper selects the stack automatic encoder in the deep neural network to supervise the training of data and adjust the parameters. The encoder can reduce the dimension of high-dimensional database to facilitate the classification of fingerprint database.Every stack automatic encoder can be regarded as a backpropagation neural network, and the output target of the encoder is equivalent to the input. The encoder can be divided into two parts: the encoding refers to the process of transforming high-dimensional output data into low-dimensional data, and the decoding refers to decoding the encoded data to get the same dimension data as the input data. Through the process of encoding and decoding, the data error is compared and analyzed. The error of backpropagation can be used to adjust the algorithm parameters. Through repeated iterations, the information lost in the system can be expressed in a low dimension within a controllable range. The decoding and encoding process of stack automatic encoder based on deep neural network is shown in Figure4.Figure 4
Encoding and decoding process of the stack autoencoder.Suppose that the input data ofm fingerprint is m×n matrix of n, and the number of base stations is kk<m. The encoder encodes the input data to obtain d-dimensional data and then decodes the data through the decoder to calculate the output data in the reserved information for error comparison so as to achieve high-dimensional data dimensionality reduction. When a single encoder completes the training, the whole model will discard the decoder part and take the encoded data as the input data of the next automatic encoder. After layer-by-layer training of the neural network model, the parameters of the whole neural network model will be updated gradually. The softmax function is selected again to classify the final output. The algorithm flow of the whole model is shown in Figure 5.Figure 5
Flowchart of deep neural network algorithm.


## 4.1. Location Principle of Fingerprint Matching Algorithm

The grid coordinates of the area divided in the offline phase are regarded as the output results, the RSSI value is regarded as the input information, and the processing process of the data by fingerprint matching algorithm is the training of given data and output. With the training of fingerprint matching function, the function can predict the new input value and the corresponding output until the most suitable parameters are found [24]. The process of location calculation by using fingerprint matching algorithm is a process in which the classification of discrete fingerprint data will be regressed. The basic principle is shown in Figure 2.Figure 2
Flowchart of fingerprint matching algorithm location calculation.The key of using fingerprint matching method for indoor positioning is to match the received data with the data in the database, obtain the data with the highest matching degree, and get the final positioning result after weighted average processing. The key of this process is to find the global optimal solution in the system database at the beginning, which requires more base stations to be arranged as much as possible and more fingerprint database data to be obtained at the beginning. However, if you traverse a high-dimensional database every time, there will be a very high delay and the requirement of calculation will be very high.The manual fingerprint classification method is mainly to make user-defined area labels for different building floor numbers, building numbers, and so on, and grid according to different area labels. Using machine learning algorithm to learn and train fingerprint database, a good classification function can better achieve the local optimal solution of the data, so we need to take a good classification design method. As one of the deep learning algorithms, KNN algorithm is also calledk-nearest neighbor algorithm. When using KNN algorithm to calculate the location, we should first use RSSI information and data information in fingerprint database to calculate the Euclidean distance between two points. At present, the commonly used classification methods include support vector machine and KNN algorithm, which need to be optimized in the follow-up research. Based on the above, we can get the positioning flowchart based on fingerprint database, as shown in Figure 3.Figure 3
Hierarchical structure of fingerprint matching algorithm.


## 4.2.k-Nearest Neighbor Classification Algorithm

KNN (k-nearest neighbor classification) algorithm is also called K-neighbor algorithm. When using KNN algorithm to calculate location, we must first use RSSI information and data information in fingerprint database to calculate Euclidean distance between two points. The difference between the algorithm and RSSI is that the coordinate of KNN is the average of K fingerprint point closest to the target point, and the K value will be greater than 1. Set the near point coordinate of the target point as xi,yi point as and the calculation formula of its positioning coordinate is(13)x,y=1K∑i=1Kxi,yi.In formula (13), a value is K superparameter, which needs to be measured based on the actual environment in the field.In the actual test environment, in general, the distance from the target point determines the accuracy of information measurement. The closer the information is, the more accurate the information is. When using KNN algorithm to calculate, for the point closer to the target point, higher weights can be given to improve the accuracy of the prediction results. In general, the reciprocal of the distance can be used as the weight of the fingerprint point, and the weight of thei point is set as wi. after adding the normalization parameter to it, the calculation formula of the positioning coordinates can be obtained.(14)x,y=∑i=1Kwixi,yi.


## 4.3. Improved Location Algorithm Based on Deep Neural Network

Because the location algorithm system needs a large number of data samples, the location algorithm needs to be able to process a large number of data and has a good processing ability for the database with high dimension. This paper selects the stack automatic encoder in the deep neural network to supervise the training of data and adjust the parameters. The encoder can reduce the dimension of high-dimensional database to facilitate the classification of fingerprint database.Every stack automatic encoder can be regarded as a backpropagation neural network, and the output target of the encoder is equivalent to the input. The encoder can be divided into two parts: the encoding refers to the process of transforming high-dimensional output data into low-dimensional data, and the decoding refers to decoding the encoded data to get the same dimension data as the input data. Through the process of encoding and decoding, the data error is compared and analyzed. The error of backpropagation can be used to adjust the algorithm parameters. Through repeated iterations, the information lost in the system can be expressed in a low dimension within a controllable range. The decoding and encoding process of stack automatic encoder based on deep neural network is shown in Figure4.Figure 4
Encoding and decoding process of the stack autoencoder.Suppose that the input data ofm fingerprint is m×n matrix of n, and the number of base stations is kk<m. The encoder encodes the input data to obtain d-dimensional data and then decodes the data through the decoder to calculate the output data in the reserved information for error comparison so as to achieve high-dimensional data dimensionality reduction. When a single encoder completes the training, the whole model will discard the decoder part and take the encoded data as the input data of the next automatic encoder. After layer-by-layer training of the neural network model, the parameters of the whole neural network model will be updated gradually. The softmax function is selected again to classify the final output. The algorithm flow of the whole model is shown in Figure 5.Figure 5
Flowchart of deep neural network algorithm.


## 5. Design of the iBeacon Positioning System in Building Interior

Since the initial UUID numbers of different devices are different, the main number and subnumber need to be set according to the actual situation to keep the broadcast power of the device consistent. Since most mobile phone users are Android system, Android platform is selected for software design. The mobile client mainly includes database operation module, reality positioning module, and equipment monitoring module. The server mainly includes database processing, corresponding client requests, and returning algorithm results to the client.


### 5.1. Overall System Frame

The overall framework design of the iBeacon positioning system is shown in Figure6. The whole system mainly includes the hardware configuration and software design. The hardware configuration is mainly for the iBeacon device.Figure 6
Overall framework design of the indoor positioning system based on iBeacon.When users want to achieve indoor positioning function, they use the mobile phone client to start the scanning of Bluetooth device through software. After scanning the iBeacon device, they receive the signal strength value at a certain location, package it, and finally realize the transmission of information. The server will use the improved stack of deep neural network to classify the fingerprint information after dimensionality reduction. Finally, KNN algorithm is used to display the location result, and the result is returned to the client. Users need to repeat this process repeatedly if they want to achieve continuous positioning function and achieve the effect of navigation.


### 5.2. Database Design

Before the experiment, this paper first expounds the database. As the self-owned database of Android system, SQLite database has the characteristics of fast speed and less resource occupation, so it is especially suitable for mobile devices. In addition, SQLite databases can index standard SQL syntax, which can be easily extended on subsequent large databases. Therefore, in order to achieve fingerprint matching and location, this paper uses the improved algorithm to establish the location fingerprint database.To build a system database based on SQLite database, we should build a database help class according to the user’s needs. This is an abstract class, and we need to rewrite its onupgrade and oncreate methods. We can get the database objects through the help class object getwritabledatabase() method to realize the operation on the database. Each time you write the corresponding SQL query in execsql(), you can add, change, and delete. In order to complete the interaction between the database and the system, an FP is created_ Dbopenhelper ordinary class, in which the static inner class innovates the database and table, and updates the function. FP_ Dbopenhelper general class contains private variables such as indication and database name, which is convenient for data search, insertion, and other functions.The table in the database contains base station table, user table, and so on; the base station table stores the coordinate information related to the base station in the system, and the user table stores the user information for user registration, login, and other functions. In the fingerprint database, the most important table is the location fingerprint table, which includes the fingerprint number (FPID), time stamp (current date), fingerprint point coordinates, and the signal receiving strength (RSSI1, RSSI2, RSSI3, and RSSI4). The design of the fingerprint information table is shown in Table1.Table 1
Design of the fingerprint information table in system database.
NameLengthData typeIs null allowedDefault valuePrimary keyCurrentDate32TimestampNoNoNoFRID128IntegerNoSelf-increasingYesRSSI18IntegerNoNoNoRSSI28IntegerNoNoNoRSSI38IntegerNoNoNoRSSI48IntegerNoNoNoCoordinate_x16RealNoNoNoCoordinate_y16RealNoNoNoAfter each table in the database is established, the JavaBean class needs to be established in the program. Different attributes correspond to different fields. In order to prevent the attributes from being tampered with, each attribute responds to the settings. If there is no JavaBean class, users will need to write SQL statements every time they operate, making the program more complex, and the efficiency of the system will be greatly reduced. It can also be seen from Table1 that the ID attribute of the database fingerprint table belongs to the self-increasing mode, so it will be added and subtracted automatically after each database operation.


### 5.3. Implementation of iBeacon Function

The system design is based on Android mobile phone system. The mobile phone system must have Bluetooth 4.0 protocol to meet the support of indoor positioning software for Bluetooth protocol, and iBeacon device can be detected. In Android system, Bluetooth manager object needs to be acquired to realize Bluetooth operation. Bluetooth adapter in mobile phone system is obtained by getadapter() function. After Bluetooth scan, the Bluetooth adapter object startlescan() function returns three parameters through the onlescan callback function. Bluetooth packet format varies according to the number of bytes, as shown in Table2.Table 2
Bluetooth packet format.
Packet formatLengthNumber of bytesiBeacon device prefix90–8UUID169–24Major225–26Minor227–28Txpower129Bluetooth packets are mainly composed of major, minor, UUID, and txpower. The UUID is a 128-bit identifier, which is also the unique flag of iBeacon device. All iBeacon devices are encapsulated in the dynamic array ArrayList, and the notifydatasetchanged() method is used to refresh the Bluetooth device list dynamically.After scanning the iBeacon device, the received signal strength of the device can be obtained. If you need to add fingerprint points, you need to determine the location coordinates of fingerprint points, transform the ArrayList data into fingerprint class fingerprintbean information data, and add it as a parameter to the database. Through the data search function, you can get all the fingerprint points dynamic array FPS, and the final parameter positioning coordinate function is KNN_ Locate. At KNN_ In the locate function, the length of FPS will also change dynamically when the function is running, so it is necessary to save the length value.KNN_ The locate function converts the formal parameter to the actual parameter and defines two double variables, which are the sum of the coordinates nearest to the fingerprint. Let there ben quantity in RSSI value, and the Euclidean distance between two coordinate points is calculated as follows:(15)D=1n∑j=1nRSSI1j−RSSI2j2.In the database, the fingerprint closest to the current fingerprint is stored in the fingerprintbean class array. Only when the value ofk is less than the total number of nodes, can the KNN algorithm be satisfied, and the final positioning coordinates are calculated each time.(16)x,y=1k∑i=1kxi,∑i=1kyi.In (16), xi,yi respectively represent the x,y coordinates of the fingerprint point i close to the target point.


## 5.1. Overall System Frame

The overall framework design of the iBeacon positioning system is shown in Figure6. The whole system mainly includes the hardware configuration and software design. The hardware configuration is mainly for the iBeacon device.Figure 6
Overall framework design of the indoor positioning system based on iBeacon.When users want to achieve indoor positioning function, they use the mobile phone client to start the scanning of Bluetooth device through software. After scanning the iBeacon device, they receive the signal strength value at a certain location, package it, and finally realize the transmission of information. The server will use the improved stack of deep neural network to classify the fingerprint information after dimensionality reduction. Finally, KNN algorithm is used to display the location result, and the result is returned to the client. Users need to repeat this process repeatedly if they want to achieve continuous positioning function and achieve the effect of navigation.


## 5.2. Database Design

Before the experiment, this paper first expounds the database. As the self-owned database of Android system, SQLite database has the characteristics of fast speed and less resource occupation, so it is especially suitable for mobile devices. In addition, SQLite databases can index standard SQL syntax, which can be easily extended on subsequent large databases. Therefore, in order to achieve fingerprint matching and location, this paper uses the improved algorithm to establish the location fingerprint database.To build a system database based on SQLite database, we should build a database help class according to the user’s needs. This is an abstract class, and we need to rewrite its onupgrade and oncreate methods. We can get the database objects through the help class object getwritabledatabase() method to realize the operation on the database. Each time you write the corresponding SQL query in execsql(), you can add, change, and delete. In order to complete the interaction between the database and the system, an FP is created_ Dbopenhelper ordinary class, in which the static inner class innovates the database and table, and updates the function. FP_ Dbopenhelper general class contains private variables such as indication and database name, which is convenient for data search, insertion, and other functions.The table in the database contains base station table, user table, and so on; the base station table stores the coordinate information related to the base station in the system, and the user table stores the user information for user registration, login, and other functions. In the fingerprint database, the most important table is the location fingerprint table, which includes the fingerprint number (FPID), time stamp (current date), fingerprint point coordinates, and the signal receiving strength (RSSI1, RSSI2, RSSI3, and RSSI4). The design of the fingerprint information table is shown in Table1.Table 1
Design of the fingerprint information table in system database.
NameLengthData typeIs null allowedDefault valuePrimary keyCurrentDate32TimestampNoNoNoFRID128IntegerNoSelf-increasingYesRSSI18IntegerNoNoNoRSSI28IntegerNoNoNoRSSI38IntegerNoNoNoRSSI48IntegerNoNoNoCoordinate_x16RealNoNoNoCoordinate_y16RealNoNoNoAfter each table in the database is established, the JavaBean class needs to be established in the program. Different attributes correspond to different fields. In order to prevent the attributes from being tampered with, each attribute responds to the settings. If there is no JavaBean class, users will need to write SQL statements every time they operate, making the program more complex, and the efficiency of the system will be greatly reduced. It can also be seen from Table1 that the ID attribute of the database fingerprint table belongs to the self-increasing mode, so it will be added and subtracted automatically after each database operation.


## 5.3. Implementation of iBeacon Function

The system design is based on Android mobile phone system. The mobile phone system must have Bluetooth 4.0 protocol to meet the support of indoor positioning software for Bluetooth protocol, and iBeacon device can be detected. In Android system, Bluetooth manager object needs to be acquired to realize Bluetooth operation. Bluetooth adapter in mobile phone system is obtained by getadapter() function. After Bluetooth scan, the Bluetooth adapter object startlescan() function returns three parameters through the onlescan callback function. Bluetooth packet format varies according to the number of bytes, as shown in Table2.Table 2
Bluetooth packet format.
Packet formatLengthNumber of bytesiBeacon device prefix90–8UUID169–24Major225–26Minor227–28Txpower129Bluetooth packets are mainly composed of major, minor, UUID, and txpower. The UUID is a 128-bit identifier, which is also the unique flag of iBeacon device. All iBeacon devices are encapsulated in the dynamic array ArrayList, and the notifydatasetchanged() method is used to refresh the Bluetooth device list dynamically.After scanning the iBeacon device, the received signal strength of the device can be obtained. If you need to add fingerprint points, you need to determine the location coordinates of fingerprint points, transform the ArrayList data into fingerprint class fingerprintbean information data, and add it as a parameter to the database. Through the data search function, you can get all the fingerprint points dynamic array FPS, and the final parameter positioning coordinate function is KNN_ Locate. At KNN_ In the locate function, the length of FPS will also change dynamically when the function is running, so it is necessary to save the length value.KNN_ The locate function converts the formal parameter to the actual parameter and defines two double variables, which are the sum of the coordinates nearest to the fingerprint. Let there ben quantity in RSSI value, and the Euclidean distance between two coordinate points is calculated as follows:(15)D=1n∑j=1nRSSI1j−RSSI2j2.In the database, the fingerprint closest to the current fingerprint is stored in the fingerprintbean class array. Only when the value ofk is less than the total number of nodes, can the KNN algorithm be satisfied, and the final positioning coordinates are calculated each time.(16)x,y=1k∑i=1kxi,∑i=1kyi.In (16), xi,yi respectively represent the x,y coordinates of the fingerprint point i close to the target point.


## 6. Simulation Test

In order to test the change of RSSI value and conversion function under different distances, the shadow model is used to simulate and analyze the performance of RSSI algorithm.


### 6.1. Simulation Analysis of Received Signal Strength Indication Algorithm

(17)RSSI1=RSSI0+10nlogd1+ε.In (17), the value of RSSI0,n is fixed, and (17) can be further transformed as follows:(18)RSSI=Alnd+B.Through parametersAandB, the RSSI values at different distances can be measured, and the collected environmental data can be fitted to determine the environmental parameters. In order to verify the performance of the proposed improved and optimized RSSI algorithm, the data within 3 M are selected to carry out the ranging model parameter experiment of RSSI value. The relevant parameters needed for simulation are as follows: base station distance is 5 cm, 10 measurements are recorded at each sampling point, broadcast transmission power is 0 dm, and broadcast interval is 100 ms. The fitting curve of signal strength and distance data received by iBeacon equipment is shown in Figure 7.Figure 7
RSSI mean fitting curve.The fitting curve after Gaussian filtering is shown in Figure8.Figure 8
Fitting curve of RSSI value after Gaussian filtering.The fitting curve after extended Gaussian filtering is shown in Figure9.Figure 9
RSSI value fitting curve processed by extended Gaussian function.It can be seen from the fitting curve and error comparison diagram in Figures7–9 that within the range of 0.5 m, the overall prediction effect is good due to the high signal strength, but with the increase of distance, the prediction effect of the fitting curve is disturbed by the abnormal value, causing the error value to fluctuate.As a linear smoothing filter, Gaussian filter is obtained by discretizing two-dimensional Gaussian function. Due to the high signal strength of Gaussian template, the overall prediction effect is better, and the filtered result is better than the mean filter.The most important parameter of Gaussian filter is the standard deviation of Gaussian distribution. The standard deviation and Gaussian filter have great smoothing ability. The larger the value, the wider the frequency band of Gaussian filter and the better the smoothness of image. The extended Gaussian filter proposed in this paper can filter most outliers with minimum error.


### 6.2. Simulation Test of Classification Results of Location Algorithm

Indoor data set is selected for test, and the input data of the experiment is the first 520 attributes. In the data set, +100 means that the base station signal cannot be received, but in the actual test process, +100 means that the infinite distance is not suitable, so before the experiment, the “+100” in the data set is replaced by “−110.” The building attribute in the data set represents the building, and the floor attribute represents the floor. These two attribute data start from 0 and are independent of each other. In the actual test, the improved localization algorithm proposed in this paper is compared with the traditional iBeacon localization algorithm to verify the classification effect of the improved localization algorithm.Considering the convenience of Python language, this experiment is carried out in Python language, and the results are shown in Table3.Table 3
Comparative analysis of classification results of location algorithms.
Algorithm typeOutput resultsTraining set accuracyVerification set accuracyiBeacon traditional location algorithmBuilding0.914570.99546Building + floor0.902830.97648The positioning algorithm proposed in this studyBuilding0.994311.00000Building + floor0.989180.99479Traditional beacon ranging calculates the distance according to the model of RF field strength attenuation with distance. Because the RF signal propagation itself is greatly unstable due to environmental interference, the ranging based on this principle will not be accurate. It can be seen from Table3 that the proposed optimization algorithm is more accurate than the traditional training set of iBeacon. In order to test the influence of neural network on the location algorithm, the average results after many tests are shown in Table 4 for 2, 3, and 4 hidden layers, respectively.Table 4
Classification results of improved location algorithm based on deep neural network.
Number of hidden layersDimensionTraining set accuracyVerification set accuracy2520, 256, 1280.992480.921433520, 256, 128, 640.994230.935714520, 256, 128, 640.997800.91472Through the analysis of the results, it can be seen that the accuracy of the improved localization algorithm in the training and verification set can ensure more than 99% accuracy, which shows that it has high accuracy in the classification of fingerprint database. It has a good effect on the positioning judgment of building or floor. After using the deep neural network to optimize the algorithm, the classification accuracy has been significantly improved.In order to further verify the operation efficiency of the improved algorithm proposed in this paper, it is compared with the traditional positioning algorithm for simulation analysis, and 200 data pieces are selected for operation. With the increase of operation data, the time required for both is shown in Figure10.Figure 10
The time-consuming comparison between the improved algorithm and the traditional location algorithm is analyzed in this paper.As can be seen from Figure10, with the gradual increase of data to be simulated and tested, the time-consuming of both algorithms is gradually increasing. With the increase of the amount of data, the time-consuming increase is also gradually increasing. Further analysis shows that the improved localization algorithm in this paper takes relatively less time, and although the test data increases, the difference in efficiency is more significant. It can be seen that the improved algorithm has a significant efficiency improvement.


### 6.3. System Positioning Accuracy Test

The positioning accuracy of the system is tested in a set building and a 15 m × 25 m room for positioning accuracy test. In order to reduce the impact of obstacles on wireless signals, when deploying iBeacon devices, try to avoid doors, windows, or obstacles. A total of 20 points are selected to test the accuracy of the system. The traditional iBeacon positioning system and the improved iBeacon positioning system based on neural network are compared and analyzed and compared with the actual database values. The accuracy of the error is judged by the size of the error value. The results of system positioning test are shown in Figure11.Figure 11
Comparison chart of system positioning error analysis.As can be seen from Figure11, except that the error of the improved iBeacon positioning system in test point 3 is slightly higher than that of the traditional iBeacon positioning system, the error values of other points are smaller. The maximum error of the improved positioning system is test point 13, and the error is 1.02 M. From the overall analysis, it can be found that the positioning error of the point closer to the iBeacon device is smaller, and the farther the distance is, the larger the error is, which has a certain relationship with the strength and stability of the signal.


### 6.4. Discussion

At present, there are many researches on indoor positioning technology, and a large number of algorithms’ optimization and system designs have been carried out, but it is always difficult to form a mature positioning system with good universality and high performance. To sum up, there are two main reasons: first, it is difficult to solve the accuracy problem by traditional algorithms. One of the requirements of indoor positioning technology is to have high accuracy. This problem must be solved for indoor positioning; otherwise indoor positioning is difficult to meet the needs of practical functions. The second is the cost problem. Because indoor positioning is difficult to achieve low cost and high precision like GPS (Global Positioning System), the equipment and schemes that can be used indoors have the problem of high cost and are difficult to popularize. If iBeacon equipment is used, its bluetooth function can be used to realize high-precision positioning function through mobile phone.The key problem to be solved is to find a suitable location algorithm. The calculation of RSSI value can well realize high-precision distance calculation. In order to meet the positioning requirements in complex environment, the anti-interference performance against noise can be improved through Gaussian filtering. Combined with KNN algorithm, the classification calculation of data can be realized, and the deeper data classification can be realized under the calculation of deep learning algorithm. According to the simulation analysis, it can be seen that the maximum error of indoor positioning simulation is 1.02 M, which can meet most indoor positioning requirements and has good practical effect.


## 6.1. Simulation Analysis of Received Signal Strength Indication Algorithm

(17)RSSI1=RSSI0+10nlogd1+ε.In (17), the value of RSSI0,n is fixed, and (17) can be further transformed as follows:(18)RSSI=Alnd+B.Through parametersAandB, the RSSI values at different distances can be measured, and the collected environmental data can be fitted to determine the environmental parameters. In order to verify the performance of the proposed improved and optimized RSSI algorithm, the data within 3 M are selected to carry out the ranging model parameter experiment of RSSI value. The relevant parameters needed for simulation are as follows: base station distance is 5 cm, 10 measurements are recorded at each sampling point, broadcast transmission power is 0 dm, and broadcast interval is 100 ms. The fitting curve of signal strength and distance data received by iBeacon equipment is shown in Figure 7.Figure 7
RSSI mean fitting curve.The fitting curve after Gaussian filtering is shown in Figure8.Figure 8
Fitting curve of RSSI value after Gaussian filtering.The fitting curve after extended Gaussian filtering is shown in Figure9.Figure 9
RSSI value fitting curve processed by extended Gaussian function.It can be seen from the fitting curve and error comparison diagram in Figures7–9 that within the range of 0.5 m, the overall prediction effect is good due to the high signal strength, but with the increase of distance, the prediction effect of the fitting curve is disturbed by the abnormal value, causing the error value to fluctuate.As a linear smoothing filter, Gaussian filter is obtained by discretizing two-dimensional Gaussian function. Due to the high signal strength of Gaussian template, the overall prediction effect is better, and the filtered result is better than the mean filter.The most important parameter of Gaussian filter is the standard deviation of Gaussian distribution. The standard deviation and Gaussian filter have great smoothing ability. The larger the value, the wider the frequency band of Gaussian filter and the better the smoothness of image. The extended Gaussian filter proposed in this paper can filter most outliers with minimum error.


## 6.2. Simulation Test of Classification Results of Location Algorithm

Indoor data set is selected for test, and the input data of the experiment is the first 520 attributes. In the data set, +100 means that the base station signal cannot be received, but in the actual test process, +100 means that the infinite distance is not suitable, so before the experiment, the “+100” in the data set is replaced by “−110.” The building attribute in the data set represents the building, and the floor attribute represents the floor. These two attribute data start from 0 and are independent of each other. In the actual test, the improved localization algorithm proposed in this paper is compared with the traditional iBeacon localization algorithm to verify the classification effect of the improved localization algorithm.Considering the convenience of Python language, this experiment is carried out in Python language, and the results are shown in Table3.Table 3
Comparative analysis of classification results of location algorithms.
Algorithm typeOutput resultsTraining set accuracyVerification set accuracyiBeacon traditional location algorithmBuilding0.914570.99546Building + floor0.902830.97648The positioning algorithm proposed in this studyBuilding0.994311.00000Building + floor0.989180.99479Traditional beacon ranging calculates the distance according to the model of RF field strength attenuation with distance. Because the RF signal propagation itself is greatly unstable due to environmental interference, the ranging based on this principle will not be accurate. It can be seen from Table3 that the proposed optimization algorithm is more accurate than the traditional training set of iBeacon. In order to test the influence of neural network on the location algorithm, the average results after many tests are shown in Table 4 for 2, 3, and 4 hidden layers, respectively.Table 4
Classification results of improved location algorithm based on deep neural network.
Number of hidden layersDimensionTraining set accuracyVerification set accuracy2520, 256, 1280.992480.921433520, 256, 128, 640.994230.935714520, 256, 128, 640.997800.91472Through the analysis of the results, it can be seen that the accuracy of the improved localization algorithm in the training and verification set can ensure more than 99% accuracy, which shows that it has high accuracy in the classification of fingerprint database. It has a good effect on the positioning judgment of building or floor. After using the deep neural network to optimize the algorithm, the classification accuracy has been significantly improved.In order to further verify the operation efficiency of the improved algorithm proposed in this paper, it is compared with the traditional positioning algorithm for simulation analysis, and 200 data pieces are selected for operation. With the increase of operation data, the time required for both is shown in Figure10.Figure 10
The time-consuming comparison between the improved algorithm and the traditional location algorithm is analyzed in this paper.As can be seen from Figure10, with the gradual increase of data to be simulated and tested, the time-consuming of both algorithms is gradually increasing. With the increase of the amount of data, the time-consuming increase is also gradually increasing. Further analysis shows that the improved localization algorithm in this paper takes relatively less time, and although the test data increases, the difference in efficiency is more significant. It can be seen that the improved algorithm has a significant efficiency improvement.


## 6.3. System Positioning Accuracy Test

The positioning accuracy of the system is tested in a set building and a 15 m × 25 m room for positioning accuracy test. In order to reduce the impact of obstacles on wireless signals, when deploying iBeacon devices, try to avoid doors, windows, or obstacles. A total of 20 points are selected to test the accuracy of the system. The traditional iBeacon positioning system and the improved iBeacon positioning system based on neural network are compared and analyzed and compared with the actual database values. The accuracy of the error is judged by the size of the error value. The results of system positioning test are shown in Figure11.Figure 11
Comparison chart of system positioning error analysis.As can be seen from Figure11, except that the error of the improved iBeacon positioning system in test point 3 is slightly higher than that of the traditional iBeacon positioning system, the error values of other points are smaller. The maximum error of the improved positioning system is test point 13, and the error is 1.02 M. From the overall analysis, it can be found that the positioning error of the point closer to the iBeacon device is smaller, and the farther the distance is, the larger the error is, which has a certain relationship with the strength and stability of the signal.


## 6.4. Discussion

At present, there are many researches on indoor positioning technology, and a large number of algorithms’ optimization and system designs have been carried out, but it is always difficult to form a mature positioning system with good universality and high performance. To sum up, there are two main reasons: first, it is difficult to solve the accuracy problem by traditional algorithms. One of the requirements of indoor positioning technology is to have high accuracy. This problem must be solved for indoor positioning; otherwise indoor positioning is difficult to meet the needs of practical functions. The second is the cost problem. Because indoor positioning is difficult to achieve low cost and high precision like GPS (Global Positioning System), the equipment and schemes that can be used indoors have the problem of high cost and are difficult to popularize. If iBeacon equipment is used, its bluetooth function can be used to realize high-precision positioning function through mobile phone.The key problem to be solved is to find a suitable location algorithm. The calculation of RSSI value can well realize high-precision distance calculation. In order to meet the positioning requirements in complex environment, the anti-interference performance against noise can be improved through Gaussian filtering. Combined with KNN algorithm, the classification calculation of data can be realized, and the deeper data classification can be realized under the calculation of deep learning algorithm. According to the simulation analysis, it can be seen that the maximum error of indoor positioning simulation is 1.02 M, which can meet most indoor positioning requirements and has good practical effect.


## 7. Conclusion

The indoor ranging positioning algorithm introduced in this paper uses the extended Gaussian filtering method to delete and filter significant abnormal data values so as to reduce the impact of multipath fading on positioning results. The simulation analysis also verifies the performance of the algorithm after using single RSSI algorithm, ordinary Gaussian filter processing, and extended Gaussian filter processing, and the error after extended Gaussian filter processing is the smallest. In order to meet the needs of nonranging indoor positioning algorithm, an improved fingerprint matching algorithm based on stack automatic encoder is proposed. Based on the optimization of deep neural network algorithm, the positioning algorithm has better classification effect. Compared with the traditional iBeacon positioning algorithm, it has better judgment effect for building or floor positioning, And the overall accuracy can guarantee more than 99%. Through the test of 15 m × compared with the traditional iBeacon positioning system, the error is smaller, which can meet most of the indoor positioning requirements. At present, there are many Android smart phones in China. Whether the indoor positioning system designed in this paper can be applied to these mobile phone systems needs further verification. However, the location algorithm studied in this paper still needs to refer to the actual application for judgment in data processing. Therefore, in the future research, this paper also needs to make a more in-depth research on building location.



---

*Source: 8673083-2022-03-27.xml*