Academic Journal of Science and Technology ISSN: 2771-3032 | Vol. 11, No. 3, 2024 97 Research on Indoor Localization Method based on Deep Learning and Wireless Sensing Yong Deng, Chuanhao Li School of Mechatronic Engineering, Southwest Petroleum University, Chengdu 610500, China Abstract: Aiming at the problems of indoor localization accuracy due to scale difference and noise interference in wireless sensing, a deep learning indoor localization architecture for wireless sensing is proposed. Firstly, iBeacon devices are arranged in the localization area to collect location fingerprints, and then stacked autoencoder (SAE) is introduced to effectively capture the depth features of the data to improve the robustness of the subsequent localization model. To further enhance the global temporal sensing capability of the model, a bidirectional long short-term memory network (BiLSTM) is introduced for location prediction. The experimental results show that the algorithm achieves higher positioning accuracy and better generalization performance than the traditional indoor localization methods. Keywords: Indoor Localization; Wireless Sensing; SAE; BiLSTM. 1. Introduction Positioning service is a technology that provides users with personalized services and real-time information, and the demand for indoor positioning such as location-based wireless advertisement push, information retrieval, and pedestrian navigation is growing rapidly [1]. In outdoor environments, Global Navigation Satellite System (GNSS) services can provide users with highly accurate global position estimation and convenient positioning services [2]. However, GNSS performs poorly in indoor positioning because satellite signals are easily blocked by buildings and the complex indoor environment increases signal interference. With the development of iBeacon, a low-power Bluetooth device, and the fact that Received Signal Strength Index (RSSI) is the most commonly used source of information in sensing strategies, RSSI has become the main way of location prediction [3]. A common approach to address the irregularity of signal power attenuation with respect to location is to form a location database by obtaining RSSIs of multiple APs from a grid of reference points, and location derivation is accomplished by comparing the similarity or distance between the new signals and the previous reference points. However, the variation of RSSI due to the fluctuating nature of wireless signals is a major problem that affects precise location. Therefore, extracting reliable features from large- scale reference points and finding effective mapping functions become the key to wireless localization. Traditional machine learning methods are essentially shallow learning architectures [4], which have limited modeling and representation capabilities when dealing with such large and noisy data, and in order to extract and construct potential representations from rich data, deep learning architectures with multiple layers of nonlinear processing capabilities are required. The main contributions of this paper are as follows: (1) Better indoor localization performance: The method proposed in this paper makes full use of RSSI temporal information. Considering the spatio-temporal correlation of RSSI, it achieves better performance than existing methods. (2) Reducing data noise: The method in this paper is relatively less dependent on the amount of data, which reduces the impact of noise on localization. (3) Estimation and validation: In order to estimate and validate the performance and effectiveness of the method proposed in this paper, we have conducted a large number of experiments. 2. Related Work Methods based on RSSI location fingerprint localization are summarized in the following three categories: probabilistic methods, deterministic methods and neural network methods. In probabilistic methods, it is assumed that the probability density function of RSSI has a certain distribution of empirical parameters, such as the Gaussian distribution, for now its matching with the target signal measurements for localization. In deterministic methods, RSSI is usually used as a feature parameter combined with a deterministic matching algorithm for location estimation. Compared to these algorithms, deep learning methods provide more stable and accurate localization [5]. Literature [6] introduced the extracted information into a shallow neural network for nonlinear estimation of node location coordinates. Literature [7] calibrates the localization results by adjusting the loss function and weights in the CNN model. The authors proposed a WiFi fingerprint localization method based on traditional dnn and experimentally demonstrated that the proposed 4-layer network containing a Hidden Markov Model can effectively extract RSSI signal features and generate initial localization estimates. In order to solve the existing problems in the current indoor localization methods, this paper proposes an indoor localization method based on SAE-BiLSTM utilizing time series RSSI by doing the following: (1) Collect and establish a time series dataset. (2) Considering the time-series information of RSSI, the effect of time-series length on the localization performance is investigated. (3) Apply the model to the time series task domain for indoor localization. 98 3. Methodological Overview 3.1. SAE Feature Extraction Method In this paper, we propose a time-series RSSI-based indoor localization method SAE-BiLSTM, which has a smaller average Euclidean distance and more stable performance. Modeling and analysis using logarithmic distance path loss propagation modeling.    0 0 10 lgL L d P d P d n d           (1) where  LP d is the RSSI value received when the distance from the positioning terminal to the beacon base station is d , and  0LP d is the RSSI value when the positioning terminal is 0d from the beacon base station. n is the environmental attenuation factor and X is the Gaussian random variable. In practical applications of indoor localization, it is common to set  LP d RSSI ,  0 0LP d P , Equation (1) can be simplified as:  10 lgRSSI A n d  (2) where 0A P X  . Different indoor environments and the values of and are different, in order to obtain better indoor localization effect, this paper selects an indoor space of 8m×8m to arrange the iBeacon beacon device in a symmetric way and set the RP to collect RSSI to establish the location fingerprint library. The smartphone records the RSSI value from the first AP collected at the first reference point, and constructs the fingerprint sequence as shown in Equation (3). ,1 ,2 ,, , ,i i i i jRSSI rssi rssi rssi    (3) Due to the tedious and time-consuming construction of offline location fingerprint library, this paper divides the localization area into a 0.8m×0.8m grid. The localization area is divided into a grid of 0.8m×0.8m, and 9 iBeacon devices are set as APs and 15 reference points. The mobile device is a smartphone, and the collection client is realized by using WeChat applet, because WeChat applet is a lightweight application across devices and operating systems. Localization fingerprints are collected through the static collection method of the WeChat applet client by using the mobile device to collect 1000 sets of data as training samples at each reference point and 500 sets of data as verification samples at another 10 random locations. Due to electromagnetic interference, multipath effect, etc., the AP nodes scanned at different reference points will have missing RSSI values, and it is necessary to set the missing value to - 110dBm to indicate the unavailable APs when constructing the location fingerprint library to ensure the distribution range of RSSI values. After completing the acquisition and filtering of all reference points, the offline location fingerprint library is constructed as shown in Fig. as shown in Eq. (4).   1,1 1,2 1, 1 1 1 2,1 2,2 2, 2 2 2 1 2 ,1 ,2 , , , , j T j i i i i j i i i rssi rssi rssi x y timestamp rssi rssi rssi x y timestamp F RSSI RSSI RSSI rssi rssi rssi x y timestamp                          (4) Fig 1. RSSI Fingerprint Localization Auto Encoder (AE) is an unsupervised learning method, which is designed to be able to automatically learn from a large amount of unlabeled data to capture valid features in the data, and the output target is restored to the input as much as possible. AE is mainly composed of Encoder and Decoder, the encoding process is a high-dimensional output data through the process of encoding into a higher level of low- dimensional representation; decoder will be encoded data decoding and input data dimensionality of the same data, and compared with the input data to get the reconstruction error, will be reconstructed to the back propagation of the reconstruction error to the entire process of adjusting the parameters, through the continuous iterative tuning parameters. Through continuous iteration of the parameter adjustment process to finally get the loss of information within the control range of the original high-dimensional data 99 of the low-dimensional representation. The training process is represented by the formula Equation (5). to Equation (7).    1 1y x f W x b  (5)    2 2x y g W y b   (6)      , ,AEJ L x x L x g f x  (7) SAE is a deep neural network structure containing multiple hidden layers deeply extended by multiple AEs, which has more powerful feature expression ability, and makes the training of the network more stable by layer-by-layer training, avoiding problems such as gradient vanishing and gradient explosion. The original positional fingerprint data are normalized using Equation (8) prior to SAE training to obtain normalized data with unbiased low variance of the distribution, and the direct use of the original data may lead to difficulty in convergence of the model during the training process. , min , max min i j i j rssi rssi rssi rssi rssi    (8) The SAE feature learning model in this paper consists of three AEs stacked together, and the encoder and decoder are symmetric structures. The number of neurons in the output layer of the encoder with the best localization effect is 256, 128 and 64 respectively, the training period is 150, the batch size is 32, the activation function adopts Sigmoid, the loss function is MSE, and the optimizer chooses Adam. The SAE model in this paper adopts the layer-by-layer greedy training strategy, and after the training, the SAE model can finally extract 64 robustness features, which will be transmitted to the location prediction model for location prediction. Fig 2. SAE Feature Extraction Model Recurrent Neural Network (RNN) is a neural network structure specialized in processing sequential data [8]. The chain-connected memory units of an RNN enable it to recursively pass historical information in the evolutionary direction of the sequence in an internal loop. Although RNNs have certain historical information storage and prediction capabilities, they often cause gradient vanishing and gradient explosion problems for processing longer sequences, which greatly limits their ability to learn long-term temporal correlations. Long Short-Term Memory (LSTM), as an improvement of RNN network, effectively overcomes the problem of dealing with long sequence data [9]. Although LSTM can solve the problem of long sequence prediction, it can only learn the forward information of the sequence and ignore the backward information of the sequence. Bidirectional Long Short-Term Memory (BiLSTM) is able to learn both forward and backward information of sequences, and the hidden layers used for forward and backward are independent of each other, which makes BiLSTM better able to mine the temporal characteristics of data. 3.2. BiLSTM Location Prediction Model Fig 3. LSTM Model BiLSTM consists of two LSTMs dealing with forward and backward sequences. In forward LSTM, the input data enters in chronological order and the output of each time step is used as input for the next time step. In backward LSTM, the input data enters in the reverse order of the time sequence and the output of each time step is similarly used as the input of the next time step. There is no interaction between the forward- propagating hidden layer and the backward-propagating hidden layer, forming two networks that are independent of each other and have opposite data flow directions, enabling the model to integrate forward and backward information and improve its ability to learn the hidden information of sequence data. Fig 4. BiLSTM Position Prediction Model The location prediction model model contains two bi- directional LSTM layers, each bi-directional LSTM layer contains 100 neurons, ReLU is used as the activation function, MSE is used as the loss function, and the output is the location coordinates. In order to improve the model training speed while ensuring the model performance, the Adam optimization algorithm is used in the network training process. This algorithm is an improved version of Stochastic Gradient Descent (SGD), which uses only one value of the learning rate for updating the network parameters during the training of the model and keeps the value of the learning rate unchanged until the completion of the training, which tends to cause the network to fall into the local optimum during the training process, and at the same time slows down the training speed of the network[10]. This tends to cause the network to fall into 100 local optima during the training process, and also slows down the network training speed. However, the Adam optimization algorithm can dynamically adjust the learning rate of different parameters according to the first-order moment estimation and second-order moment estimation of the gradient, which makes the parameter updating smoother and improves the generalization ability and robustness of the network. 3.3. Experimentation and Analysis In order to investigate the effect of different SAE structures as well as time series lengths on localization performance, different combinations of SAE structures as well as time series lengths were performed, with SAE structures including two or three layers and different numbers of neurons, and time series lengths incremented from 3 to 15. Training and validation are performed using the above normalized RSSI with evaluation metrics of mean Euclidean distance, RMSE, MAE, and R2 score. The experimental results show that the localization performance is better under most of the SAE structures with a time series length of 13 under this structure. It is experimentally proved that the localization performance is optimal when the SAE structure is 256-128-64 and the time series length is 13 with an average Euclidean distance of 0.77m. Fig 5. Performance Metrics for Optimal Models In addition to this, we also compare the method proposed in this paper with other methods, including some machine learning architectures and deep learning architectures, and compute the respective error cumulative distribution functions and visualize the comparisons. Table 1 shows the performance comparison of different methods. Table 1. Performance Comparison of Different Method Method Mean Euclidean Distance/m Random Forest 1.63 WKNN 1.23 LSTM 1.61 BiLSTM 1.10 DNN 1.26 CNN 2.08 SAE-CNN 0.83 SAE-BiLSTM 0.77 Fig 6. Mean Euclidean Distance, RMSE, MAE, R2 Scores for Different Models The experimental results show that machine learning methods such as Random Forest (RF) and WKNN perform poorly in the classification of buildings and floors compared to neural network methods. This gap mainly comes from the fact that traditional methods fail to obtain high-level feature representations when dealing with nonlinear relationships and complex spatial structures, and deep neural network-based localization methods achieve better results than machine learning methods in indoor localization. Note that the models after adding the SAE feature learning network structure all achieve better results than before, as evidenced by experimental results for both CNN and BiLSTM. Fig 7. Heat Maps of Indicators for Different Models 0.6 0.8 1 1.2 1.4 1.6 1.8 Effect of SAE structure and Timestep on mean Euclidean distance (256-128-64, ts=13) 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 0.95 Effects of SAE structure and Timestep on R2 scores (256-128-64, ts=13) 0.6 0.8 1 1.2 1.4 1.6 The influence of SAE structure and Timestep on RMSE (256-128-64, ts=13) 0.4 0.5 0.6 0.7 0.8 0.9 1 1.1 1.2 Effect of SAE structure and Timestep on MAE (256-128-64, ts=13) 101 Fig 8. CDF for Different Models From Fig. 8, it can be seen that the error distributions of the SAE-BiLSTM model are all concentrated in a small range, and the slope of the curve is relatively large, indicating that the range of error distribution is more concentrated, and the overall error is distributed under 2m, which achieves a better performance than the other models. 4. Summary Wireless-aware indoor localization architecture based on stacked self-encoder feature learning cascade BiLSTM network improves the localization performance of the localization model and has better performance on the validation set. Compared with traditional indoor localization methods, this method not only achieves higher localization accuracy, but also effectively mitigates the large-scale differences in RSSI, attenuates the small-scale differences caused by noise, and maintains good robustness of the model. Meanwhile, due to the low cost, low power consumption and scalability of iBeacon devices, the modeling of localization areas is cost-effective and easy to implement. Solving the regression task using deep learning to predict the user's final location and applying the proposed deep neural network architecture to predict the user's location in large-scale dynamically changing indoor environments are the next research directions. References [1] Zhuang C S, Zhang D Y. A Robust WiFi Localization Algorithm Using Data Augmentation and Stacked Denoising Autoencoder [C]. 2023 35th Chinese Control and Decision Conference (CCDC) (2023): 1445-1450. [2] Yong L, Sun, Wei X, et al. Voronoi Diagram and Crowdsourcing-Based Radio Map Interpolation for GRNN Fingerprinting Localization Using WLAN[J]. Sensors (Basel, Switzerland), 2018. [3] Alqahtani A A S, Choudhury N. Machine Learning for Location Prediction Using RSSI On Wi-Fi 2.4 GHz Frequency Band [C], 2021 IEEE 12th Annual Information Technology, Electronics and Mobile Communication Conference (IEMCON), 2021. [4] Aggarwal C C. Machine Learning with Shallow Neural Networks [M]. Neural Networks and Deep Learning: A Textbook. Cham; Springer International Publishing. 2018: 53- 104. [5] Qiao F, Wu J, Li J, et al. Trustworthy Edge Storage Orchestration in Intelligent Transportation Systems Using Reinforcement Learning[J]. IEEE Transactions on Intelligent Transportation Systems, 2021, 22(7): 4443-56. [6] He S, Chan S H G. Wi-Fi Fingerprint-Based Indoor Positioning: Recent Advances and Comparisons[J].IEEE Communications Surveys & Tutorials, 2017, 18(1):466-490. [7] Jiao J, Li F, Deng Z L, et al. A Smartphone Camera-Based Indoor Positioning Algorithm of Crowded Scenarios with the Assistance of Deep CNN[J]. 2017, 17. [8] Das S, Tariq A, Santos T, et al. Recurrent Neural Networks (RNNs): Architectures, Training Tricks, and Introduction to Influential Research[M], Machine Learning for Brain Disorders, 2023: 117-38. [9] Sherstinsky A. Fundamentals of Recurrent Neural Network (RNN) and Long Short-Term Memory (LSTM) network[J]. Physica D: Nonlinear Phenomena, 2020, 404: 132306. [10] Kingma D P, BA J J C. Adam: A Method for Stochastic Optimization[J]. 2014, abs/1412.6980.