Indoor positioning method and device based on Kalman filtering fusion deep learning algorithm
By using the CNN-LSTM-Attention-AdaBoost algorithm to predict the gyroscope data in indoor positioning, and correcting the heading angle with Kalman filter, the problem of low positioning accuracy in indoor positioning is solved, and the indoor positioning with higher accuracy is achieved.
Patent Information
- Application Number
- CN202411990674.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2044-12-31
AI Technical Summary
The prior art has low positioning accuracy in indoor positioning, especially in high-precision prediction of gyroscope data.
The CNN-LSTM-Attention-AdaBoost algorithm is used to predict the three-axis gyroscope data with high accuracy, and the heading angle is corrected through the Kalman filter, which ultimately improves the positioning accuracy of the built-in accelerometer and gyroscope indoors of the smartphone.
It significantly improves the accuracy of indoor positioning, reduces heading errors, enhances the generalization ability of the model, and reduces the constant deviation of gyroscope data.
Smart Images

Figure CN119935140A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of navigation technology, and more specifically, to an indoor positioning method and device based on a Kalman filter fused with a deep learning algorithm. Background Art
[0002] With the advancement of science and technology and the booming development of smart cities, the study of pedestrian heading correction algorithms based on mobile phone gyroscopes has important practical significance and broad application prospects. Inertial sensor technology plays a vital role in the field of indoor positioning. This algorithm mainly uses the built-in inertial sensors of mobile phones to accurately measure the walking direction of pedestrians and improve the accuracy and reliability of navigation positioning. The pedestrian dead reckoning (PDR) algorithm is the core of this technology. It calculates the current position of pedestrians by processing the data collected by inertial sensors. Compared with traditional inertial sensor positioning methods, the PDR algorithm has relatively loose requirements on sensor accuracy, which makes it more suitable for indoor positioning tasks in smartphone environments. The core links of the PDR algorithm include gait detection, step length estimation and heading angle calculation, which are used for step count, step length measurement and direction determination respectively to achieve two-dimensional positioning. PDR provides an autonomous and continuous indoor positioning method without the need for external infrastructure support.
[0003] The key to improving the efficiency of indoor positioning lies in the high-precision prediction of gyroscope data. The academic community has introduced machine learning methods into indoor positioning, and researchers have proposed an indoor positioning algorithm based on a multi-level extreme learning machine, but the process of building the model is complicated and the prediction accuracy is not enough. Summary of the invention
[0004] In view of the problems existing in the prior art, the present invention proposes a new indoor positioning model CLAHDE (CNN-LSTM-Attention-AdaBoost AHDE) that integrates convolutional neural network (CNN), LSTM, attention mechanism (Attention), adaptive boost (AdaBoost), and AHDE algorithm. The constant drift contained in the mobile phone gyroscope data is suppressed by using parameter-optimized LSTM. The gyroscope data is predicted with high precision through the CNN-LSTM-Attention-AdaBoost fusion algorithm, and the processed gyroscope data is processed by the AHDE algorithm, ultimately improving the positioning accuracy of the built-in accelerometer and gyroscope of the smartphone indoors. The specific process is as follows:
[0005] The first aspect provides an indoor positioning method based on a Kalman filter fusion deep learning algorithm, comprising:
[0006] Collect three-axis gyroscope data and pre-process it;
[0007] Construct a deep learning model, which includes a CNN network module, an LSTM network module, an attention module, and an AdaBoost integration module. The CNN network module is used to perform convolution processing on the preprocessed three-axis gyroscope data. The LSTM network module is used to learn the nonlinear laws in the gyroscope data from the data output by the convolutional neural network according to the time variation and spatial distribution of the gyroscope data. The attention module is used to weight the output of the LSTM using the attention mechanism to highlight key information. The AdaBoost integration module is used to integrate multiple weak learners, combine the prediction results obtained by each weak learner based on the data output by the attention mechanism, and output the final gyroscope data.
[0008] The quaternion method is used to calculate the rotation matrix to solve the final gyroscope prediction data and obtain the current heading angle;
[0009] According to the deviation between the current heading angle and the preset dominant direction, it is judged whether the current heading angle is available. When the current heading angle is not available, the deviation value is used as the key observation input and introduced into the Kalman filter for filtering. The optimal estimation deviation of the heading angle is obtained by filtering, and the current heading angle is corrected using the optimal estimation deviation. Finally, the corrected heading angle and the step length information estimated by the preset step length estimation model are used to perform dead reckoning to obtain the current position information.
[0010] In one embodiment, preprocessing the three-axis gyroscope data includes:
[0011] The sliding average filtering technique is used to denoise the three-axis gyroscope data.
[0012] In one embodiment, the attention module is used to weight the output of the LSTM using an attention mechanism to highlight key information, including:
[0013] Take the output of LSTM as input;
[0014] Calculate the attention score and perform weighted summation;
[0015] The weighted summed attention scores are normalized to obtain the three-axis gyroscope data after attention processing.
[0016] In one implementation, judging whether the current heading angle is available according to the deviation between the current heading angle and the preset dominant direction includes:
[0017] Determine whether the current heading angle is available according to the formula:
[0018]
[0019] Ψ k is the heading angle of the current step, Ψ k-1 is the heading angle of the previous step, Ψ k-2 is the heading angle of the first two steps, Ψ th is the deviation threshold Ψ th , is the deviation between the current heading angle and the preset dominant direction, m is the indication of the route status, when When m=1, it means the current heading angle is available, indicating straight-line walking. Otherwise, the current heading angle is unavailable, indicating a turning action.
[0020] In one implementation, if the current heading angle is available, dead reckoning is performed using the current heading angle and step length information estimated by a preset step length estimation model to obtain current position information.
[0021] In one implementation, when the current heading angle is unavailable, the deviation value is used as a key observation input and introduced into a Kalman filter for filtering, and the optimal estimation deviation of the heading angle is obtained by filtering, including:
[0022] Initialize the parameters of the Kalman filter;
[0023] Input the optimal estimate value of the previous moment and obtain the predicted value of the current moment through the prediction equation;
[0024] The observation value at the current moment is calculated through the observation equation, and the error variance matrix of the prediction at the current moment is calculated through the error equation;
[0025] Calculate the Kalman gain based on the error variance matrix predicted at the current moment;
[0026] The optimal estimate value at the current moment is obtained according to the predicted value at the current moment, the observed value at the current moment, and the Kalman gain calculation, which is used as the optimal estimate deviation of the heading angle.
[0027] In one implementation, the preset step length estimation model uses a nonlinear step length estimation model to calculate the average value to obtain the pedestrian step length.
[0028] Based on the same inventive concept, the second aspect of the present invention provides an indoor positioning device based on Kalman filtering fusion deep learning algorithm, comprising:
[0029] Data acquisition and processing module, used to collect three-axis gyroscope data and perform preprocessing;
[0030] A deep learning model building module is used to build a deep learning model. The model includes a CNN network module, an LSTM network module, an attention module and an AdaBoost integration module. The CNN network module is used to perform convolution processing on the preprocessed three-axis gyroscope data. The LSTM network module is used to learn the nonlinear law in the gyroscope data from the data output by the convolutional neural network according to the time variation and spatial distribution of the gyroscope data. The attention module is used to weight the output of the LSTM using the attention mechanism to highlight key information. The AdaBoost integration module is used to integrate multiple weak learners, combine the prediction results obtained by each weak learner based on the data output by the attention mechanism, and output the final gyroscope data.
[0031] The quaternion solution module is used to calculate the rotation matrix using the quaternion method to solve the final gyroscope prediction data and obtain the current heading angle;
[0032] The positioning module is used to determine whether the current heading angle is available based on the deviation between the current heading angle and the preset dominant direction, and when the current heading angle is not available, the deviation value is used as the key observation input and introduced into the Kalman filter for filtering processing, the optimal estimation deviation of the heading angle is obtained by filtering, and the current heading angle is corrected using the optimal estimation deviation; finally, the corrected heading angle and the step length information estimated by the preset step length estimation model are used for dead reckoning to obtain the current position information.
[0033] Based on the same inventive concept, the third aspect of the present invention provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the indoor positioning method based on Kalman filtering fusion deep learning algorithm described in the first aspect is implemented.
[0034] Based on the same inventive concept, the fourth aspect of the present invention provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the indoor positioning method based on Kalman filter fusion deep learning algorithm described in the first aspect is implemented.
[0035] Compared with the prior art, the advantages and beneficial technical effects of the present invention are as follows:
[0036] The invention provides an indoor positioning method based on a Kalman filter fusion deep learning algorithm. First, three-axis gyroscope data is collected and preprocessed. Then, a CNN neural network model is used to perform convolution processing on the input three-axis gyroscope data of a smart phone, amplify the change law in the gyroscope data signal, and suppress irrelevant data. A long short-term memory neural network model is used to learn the nonlinear law in the gyroscope data from the data output by the convolution neural network according to the time change and spatial distribution of the gyroscope data. The attention mechanism weights the output of the LSTM to highlight the key information. Finally, AdaBoost integrates multiple weak learners, combines their prediction results, and outputs the final gyroscope data prediction result. The step frequency is detected by the peak detection method to obtain the pedestrian's step frequency. The pedestrian's step length is obtained by averaging the nonlinear step length estimation model. To ensure the full posture solution, the quaternion method is used to calculate the rotation matrix to solve the gyroscope prediction data. An angle threshold judgment mechanism is introduced, which can effectively distinguish whether the pedestrian walks along the dominant straight path. When the system determines that the pedestrian is in a straight walking state, the algorithm will calculate and analyze the deviation between the current heading angle and the preset dominant direction. This deviation value is then used as a key observation input and introduced into the Kalman filter for filtering. The optimal estimated deviation of the heading angle is obtained by filtering, and the corrected heading angle is calculated. Based on the accelerometer and gyroscope data, combined with the algorithm-optimized heading angle data, the dead reckoning process is performed to finally obtain accurate position information. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0038] Figure 1 This is an overall flow chart of an indoor positioning method based on a Kalman filter fused with a deep learning algorithm in an embodiment of the present invention;
[0039] Figure 2 It is a detailed flow chart of the indoor positioning method based on Kalman filtering fusion deep learning algorithm in an embodiment of the present invention;
[0040] Figure 3 is a flow chart of a model in an embodiment of the present invention;
[0041] Figure 4 This is a schematic diagram of main direction division in an embodiment of the present invention;
[0042] Figure 5This is a flow chart of walking path recognition in an embodiment of the present invention;
[0043] Figure 6 is a flow chart of Kalman filtering in an embodiment of the present invention;
[0044] Figure 7 This is a schematic diagram of raw acceleration data in an embodiment of the present invention;
[0045] Figure 8 Schematic diagram of acceleration data after processing in an embodiment of the present invention.
[0046] Fig. 9 This is a schematic diagram of the step number calculation result in an embodiment of the present invention;
[0047] Fig.10 Schematic diagram of positioning accuracy results of different algorithms in an embodiment of the present invention. DETAILED DESCRIPTION
[0048] In order to overcome the problem of low positioning accuracy in the prior art, the present invention realizes pattern recognition and prediction of angular velocity time series data collected by gyroscope through convolutional neural network (CNN); Long Short-Term Memory (LSTM) is a variant of recurrent neural network RNN. Due to its memory cells throughout, it can capture long-term dependencies and is widely used in long time series data processing; Attention mechanism (Attention) can better understand the key information in the sequence and improve the prediction accuracy of the model by dynamically focusing on the importance of different parts in the sequence; Adaptive boost (AdaBoost) is an integrated learning method that combines multiple simple models (weak learners) into a powerful model. During the training process, AdaBoost adjusts the weight of the sample according to the performance of each weak learner, so that the subsequent model is more focused on the sample with errors in the previous model. This method can improve the stability and prediction ability of the model and reduce the risk of overfitting. In the experiment, the CNN-LSTM-Attention-AdaBoost algorithm was used to suppress the constant drift problem in the gyroscope data and achieve high-precision prediction of the gyroscope data.
[0049] Another step to improve the accuracy of indoor positioning is to improve the efficiency of heading information solution. To reduce the heading error, scholars have proposed a heuristic correction algorithm as a solution: this type of algorithm makes full use of environmental information and human motion characteristics to correct the calculated heading in real time. The heuristic drift elimination algorithm (HDE) shows an obvious heading correction effect in a simple path environment walking along a single dominant direction. However, when faced with a complex path, the algorithm is difficult to properly adjust the amplitude of the heading angle correction, which sometimes leads to incorrect heading correction, which may weaken the overall performance of the positioning algorithm. The improved heuristic drift elimination algorithm (iHDE) directly corrects the heading angle error in real time. It regards the deviation between the heading angle and the expected dominant direction as an observation value and uses the extended Kalman filter (EKF) mechanism to improve the heading calculation. However, when faced with a straight walking path along a non-dominant direction, the algorithm may still make inappropriate heading corrections due to its limited path recognition ability. On this basis, a more advanced version of the enhanced and improved heuristic drift elimination algorithm (AdvancedHDE, AHDE) was derived. During non-straight walking, the AHDE algorithm temporarily stops the heading correction to avoid unnecessary error accumulation. For the situations of walking in the dominant direction and walking in a straight line in the non-dominant direction, independent EKF models are established to accurately correct the heading error. This design effectively reduces the probability of erroneous correction, especially in the situation of walking in the dominant direction and walking in a straight line in the non-dominant direction, the AHDE algorithm can perform heading correction more accurately.
[0050] Based on this, the present invention proposes a new indoor positioning model CLAHDE (CNN-LSTM-Attention-AdaBoost AHDE) that integrates convolutional neural network (CNN), LSTM, attention mechanism (Attention), adaptive boost (AdaBoost), and AHDE algorithm. The constant drift contained in the mobile phone gyroscope data is suppressed using parameter-optimized LSTM. The gyroscope data is predicted with high precision through the CNN-LSTM-Attention-AdaBoost fusion algorithm, and the processed gyroscope data is processed by the AHDE algorithm, ultimately improving the positioning accuracy of the built-in accelerometer and gyroscope of the smartphone indoors. The specific process is as follows:
[0051] The CNN neural network model is used to perform convolution processing on the input three-axis gyroscope data of the smartphone, amplify the change law in the gyroscope data signal, and suppress irrelevant data. The long short-term memory neural network model is used to learn the nonlinear law in the gyroscope data from the output data of the convolutional neural network according to the time change and spatial distribution of the gyroscope data. The attention mechanism weights the output of the LSTM to highlight the key information. Finally, AdaBoost integrates multiple weak learners and combines their prediction results to output the final gyroscope data prediction results. The peak detection method is used to detect the cadence and obtain the pedestrian's cadence. The nonlinear step length estimation model is used to calculate the average and obtain the pedestrian's step length. To ensure the full posture solution, the quaternion method is used to calculate the rotation matrix to solve the gyroscope prediction data. An angle threshold judgment mechanism is introduced, which can effectively distinguish whether the pedestrian is walking along the dominant straight path. When the system determines that the pedestrian is walking in a straight line, the algorithm will calculate and analyze the deviation between the current heading angle and the preset dominant direction. This deviation is then used as a key observation input and introduced into the Kalman filter for filtering. The optimal estimated deviation of the heading angle is filtered to calculate the corrected heading angle. Based on the accelerometer and gyroscope data, the dead reckoning process is performed in combination with the algorithm-optimized heading angle data. This process involves integrating the coordinates of the previous position with the heading angle and step length information of the current step to calculate the current precise position coordinates.
[0052] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0053] Embodiment 1
[0054] This embodiment discloses an indoor positioning method based on Kalman filtering and deep learning algorithm. Figure 1 ,include:
[0055] S1: collect three-axis gyroscope data and pre-process it;
[0056] S2: Construct a deep learning model, which includes a CNN network module, an LSTM network module, an attention module, and an AdaBoost integration module. The CNN network module is used to perform convolution processing on the preprocessed three-axis gyroscope data. The LSTM network module is used to learn the nonlinear laws in the gyroscope data from the data output by the convolutional neural network according to the time variation and spatial distribution of the gyroscope data. The attention module is used to weight the output of the LSTM using the attention mechanism to highlight key information. The AdaBoost integration module is used to integrate multiple weak learners, combine the prediction results obtained by each weak learner based on the data output by the attention mechanism, and output the final gyroscope data.
[0057] S3: Use the quaternion method to calculate the rotation matrix to solve the final gyroscope prediction data and obtain the current heading angle;
[0058] S4: According to the deviation between the current heading angle and the preset dominant direction, determine whether the current heading angle is available. When the current heading angle is not available, use the deviation value as the key observation input and introduce it into the Kalman filter for filtering. The optimal estimation deviation of the heading angle is obtained by filtering, and the current heading angle is corrected using the optimal estimation deviation. Finally, the corrected heading angle and the step length information estimated by the preset step length estimation model are used to perform dead reckoning to obtain the current position information.
[0059] Specifically, several key technologies involved in the present invention are described as follows:
[0060] CNN Convolutional Neural Network: Convolutional Neural Network (CNN) is a deep learning model that performs well in image and video recognition, classification, and segmentation. The design of CNN is inspired by the human visual system and can automatically and layer by layer extract high-level features from data.
[0061] LSTM neural network model: LSTM (Long Short-Term Memory) is a special recurrent neural network structure designed to solve the gradient vanishing and gradient exploding problems of traditional RNN when processing long sequence data. LSTM can effectively capture long-term dependencies through the design of carefully designed gating mechanisms and memory cells, and performs well in sequence modeling tasks. The core of the LSTM network is the LSTM unit, each of which contains a memory cell and three control gates: forget gate, input gate, and output gate. The forget gate determines what information is discarded from the memory cell at the previous moment; the input gate determines what new information is obtained from the current input and the previous state, and updates the memory cell state; the output gate determines what state is output from the memory cell as the output at the current moment. Through the interaction of these gating mechanisms and memory cells, LSTM can selectively retain and forget information, thereby better capturing long-term dependencies. LSTM has been widely used in natural language processing, speech recognition, time series prediction and other fields, showing excellent performance.
[0062] Attention mechanism: Also known as the attention mechanism, it is an algorithm that simulates human attention in deep learning models. It allows the model to dynamically focus on the most relevant part of the current information when processing information, while ignoring other less important information. This mechanism is particularly important in fields such as natural language processing (NLP) and computer vision because it can increase the model's sensitivity to key features, thereby improving performance.
[0063] AdaBoost: The AdaBoost algorithm is an ensemble learning algorithm. Its core idea is to optimize a series of weak learners in an iterative manner and finally combine them into a strong learner.
[0064] Quaternion method: Quaternion method is also called four-parameter method. As the name implies, quaternion is a number composed of four elements:
[0065]
[0066] Among them, q0 is the real part of the quaternion, q1, q2, q3 are the coefficients multiplied by the imaginary unit respectively, is the imaginary unit of the quaternion, is the imaginary part of the quaternion.
[0067] Solving quaternion differential equations requires solving four equations:
[0068]
[0069] in, These are the x-, y-, and z-axis gyroscope data respectively.
[0070] Kalman filter: Kalman filter is an efficient recursive filter that can estimate the state of a dynamic system from a series of incomplete and noisy measurements. The key idea of Kalman filter is data fusion and iterative update. By combining prior information and actual measurements, the system can better estimate the current state and gradually improve the accuracy of the estimate through iterative updates. It is a recursive process that only uses the current input measurement and the previously calculated state and its uncertainty matrix to run, without requiring additional past information.
[0071] See also Figure 2 , is a detailed flow chart of the indoor positioning method based on Kalman filtering fusion deep learning algorithm in an embodiment of the present invention. Figure 2 The main steps involved are described.
[0072] 1. Data Collection and Preprocessing
[0073] In a specific implementation process, the present invention involves smartphone accelerometer and gyroscope data. Smartphone accelerometer data is used for step counting detection and step length estimation. Smartphone gyroscope data is used for calculating the heading angle of the route. The collected data set and its related information are shown in Table 1.
[0074] Table 1 Data and related information
[0075] type Measuring dimensions Temporal resolution Accelerometer X, Y, Z three dimensions 0.05s Gyroscope X, Y, Z three dimensions 0.05s
[0076] Acceleration data preprocessing
[0077] 1) Sliding average filtering: In these captured data, jitter data and error data are regarded as noise. In order to improve the accuracy of data processing, these noises must be removed through preprocessing steps before calculation. This embodiment uses sliding average filtering technology to denoise the accelerometer data.
[0078] 2) Step frequency detection: This embodiment selects the peak detection method to determine the number of steps. In order to improve the accuracy of peak detection, this embodiment uses three-axis synthetic acceleration data and introduces the following two constraints:
[0079] First, the peak value of acceleration needs to exceed the preset threshold to reduce false detection caused by slight body movements;
[0080] Secondly, the time interval between two consecutive peaks should exceed the set threshold to exclude multiple peaks in a single step. Through these conditions, the accuracy of peak detection is significantly improved.
[0081] 3) Step length estimation: Compared with the linear model, the nonlinear model takes into account the nonlinear relationship between step length and acceleration, and is particularly suitable for walking situations with complex acceleration changes. The model proposed by Weinberg is a typical example, which uses the maximum and minimum values of acceleration and an empirical constant to calculate the step length, as shown in formula (3).
[0082]
[0083] In the formula, A max , A min are the maximum and minimum acceleration in one step, respectively, and k is an empirical constant (in formula (1) is the imaginary unit of the quaternion), determined through actual testing.
[0084] 2. Establishment of CNN-LSTM-Attention-AdaBoost prediction model
[0085] (1) LSTM Neural Network
[0086] LSTM is a variant developed from RNN. It has good universality in long-term data processing and can process the dependence on long-term information through memory cells, overcoming some shortcomings and deficiencies in recurrent neural networks. The LSTM model designed in this invention contains three gating operations, input gate, forget gate and output gate, which regulate the transmission of information flow between cells through gating operations.
[0087] The gyroscope data information stored and involved in the calculation in the memory cells of the LSTM neural network can add key information and delete useless information through the gate switch, and the operation of the gate switch can be achieved through the Sigmoid function. Among them, Sigmoid is a monotone bounded function, and all values are between 0 and 1. 0 means that the door is closed and the gyroscope data information is not allowed to pass through, and 1 means that the door is open and all input gyroscope data information is allowed to pass through. As shown in the figure, the architecture of the LSTM neural network model predicting gyroscope data contains three gates to control the gyroscope data information involved in model learning. The LSTM neural network structure designed in the present invention mainly includes the following five steps:
[0088] Step 1: Data normalization;
[0089] Step 2: The forget gate in the LSTM structure is also called the forget gate. The Sigmoid function is used to discard useless residual information of the gyroscope data. According to the state vector in the hidden layer and the input gyroscope data information, a vector between 0 and 1 is output through the operation of the gate. The operation of the forget gate is calculated according to the following formula:
[0090] f t=σ(W f ·[h t-1 ,x t ])+b f (4)
[0091] Step 3: Use the update gate to determine what information the cell adds. This step is divided into two steps. First, use the hidden layer state vector h t-1 and x t , which information is updated through the operation of the output gate, and the update gate uses i t Indicates that the update parameters are calculated according to the following formula:
[0092] i t =σ(W i ·[h t-1 ,x t ]+b i ) (5)
[0093] Secondly, using the hidden state vector ht-1 in the model and the gyroscope data input information x t Through the operation of the tanh layer, the candidate cell vector is obtained Calculate according to the following formula:
[0094]
[0095] Step 4: The old cell information c contained in the cell state t-1 Perform the update operation and regard the updated cell information as the new cell state information C t The specific update rule is to control the candidate cell state C according to the forget gate t The information stored in the input gate is used to add new key information to the new candidate cell information C t middle.
[0096]
[0097] Step 5: After updating the cell state, the output hidden layer state vector h t-1 and input information x t Determine the output information.
[0098] o t =v(W0·[h t-1 ,x t ]+b0) (8)
[0099] h t =o t ·tanh(c t ) (9)
[0100]
[0101] Among them, t is the output gate, σ is the activation function, W and b are the input data, and h t is the state vector, is the output vector, softmax is an activation function,
[0102] (2) Convolutional Neural Network
[0103] CNN (Convolution Layer) is a deep learning model suitable for tasks such as image recognition, computer vision, and time series regression. The classic CNN structure includes convolutional layers, pooling layers, fully connected layers, and activation functions. The CNN model can also be optimized and expanded by adjusting hyperparameters such as convolution kernel size, step size, padding, and stacking multiple convolutional layers and pooling layers. At the same time, pre-trained convolutional neural network models (such as VGG, ResNet, Inception, etc.) can also be used for transfer learning to cope with more complex tasks and data sets in actual scenarios.
[0104] (3) Attention Mechanism
[0105] Attention mechanism, also known as attention mechanism, is an algorithm that simulates human attention in deep learning models. It allows the model to dynamically focus on the most relevant part of the current information when processing information, while ignoring other less important information. This mechanism is particularly important in fields such as natural language processing (NLP) and computer vision, because it can increase the model's sensitivity to key features, thereby improving performance. The specific algorithm steps are as follows:
[0106] Step 1: Input representation;
[0107] Step 2: Calculate the attention score;
[0108] Step 3: weighted summation;
[0109] Step 4: Normalize the attention scores.
[0110] (4) AdaBoost model
[0111] The AdaBoost (Adaptive Boosting) algorithm is an ensemble learning algorithm. Its core idea is to optimize a series of weak learners in an iterative way and finally combine them into a strong learner. The specific algorithm steps are as follows:
[0112] Step 1: Initialize weights;
[0113] Step 2: Train weak learners;
[0114] Step 3: Update sample weights;
[0115] Step 4: Build a strong learner;
[0116] The overall model process of CNN-LSTM-Attention-AdaBoost is as follows Figure 3 shown.
[0117] 3. Walking Path Recognition
[0118] A pedestrian heading correction algorithm based on the main direction is constructed. The algorithm is based on the assumption that when pedestrians walk indoors, their movement direction mainly follows eight preset dominant directions, forming a "M"-shaped optional path network, such as Figure 4 shown.
[0119] When pedestrians walk along a straight or nearly straight path, the heading angle of consecutive steps changes slightly. In contrast, when pedestrians turn, the heading angle of the current step will show a significant difference compared to the heading angle of the previous step. Using this feature, the turning behavior of pedestrians can be identified by monitoring the changes in the heading angle between consecutive steps.
[0120] In order to improve the accuracy of turn detection, a detection mechanism based on the change of heading angle of three consecutive steps is adopted. Specifically, a calculation formula is defined as follows:
[0121]
[0122] This formula involves the heading angle Ψ of the current step k , the heading angle of the previous step Ψ k-1 and the heading angle Ψ of the first two steps k-2 , and introduces a deviation threshold Ψ th , used to determine whether a turn occurs between steps. In this embodiment, 10° is usually used as the threshold angle for determining a turn. This formula can effectively detect the turning action of pedestrians during walking, where m is used as an indication of the route state, 1 indicates straight walking, and 0 indicates a turning action. The overall process is as follows Figure 5 shown.
[0123] 4. Kalman filter correction heading angle
[0124] (1) Heading error estimation
[0125] When it is judged that the pedestrian is walking in a straight line, the difference between the current heading angle and the current main direction is calculated, and the difference is used as the observation value for Kalman filtering. The prediction equation is:
[0126] X(i|i-1)=X(i-1|i-1)+W(i) (12)
[0127] Compute the error variance matrix:
[0128] P(i|i-1)=P(i-1|i-1)+Q (13)
[0129] The observation equation is:
[0130]
[0131] Calculate the Kalman gain:
[0132]
[0133] Calculate the optimal valuation at time i:
[0134] X(i∣i)=X(i∣i-1)+Kt(i)(Z(i)-X(i∣i-1)) (16)
[0135] Update the variance matrix of X(i|i) at time i:
[0136] P(i∣i)=(1-Kt(i))P(i∣i-1) (17)
[0137] The characters have the following meanings:
[0138] X(i|i-1): predicted value at time i;
[0139] X(i-1|i-1): the optimal estimate at time i-1;
[0140] W(i): state equation noise;
[0141] P(i|i-1): the error variance matrix predicted at time i;
[0142] P(i-1|i-1): error variance matrix at time i-1;
[0143] Q: variance matrix of state equation noise;
[0144] Z(i): the observed value at time i;
[0145] The observation function in the observation equation;
[0146] V(i): observation equation noise;
[0147] Kt(i): Kalman gain;
[0148] R(i): variance matrix of the observation equation noise at time i;
[0149] X(i|i): the optimal estimate at time i;
[0150] P(i|i): Error variance matrix at time i.
[0151] The Kalman filter process is shown in Figure 6. In the figure, X1 is X(i-1|i-1), Xt2 is X(i|i-1), Z is Z(i), P is P(i|i-1), K is Kt(i), and X2 is X(i|i). Substituting X1 into the function to obtain Xt2 refers to formula (12); substituting P into the function to calculate the Kalman gain K refers to formula (15); substituting Xt2, Z and K into the function to obtain X2 refers to formula (16). The final output of the Kalman filter is the optimal estimated deviation of the heading angle.
[0152] (2) Correcting the course
[0153] After obtaining the optimal estimation deviation of the heading angle through Kalman filtering, the heading angle information can be obtained:
[0154]
[0155] In the formula, are the heading angles before and after correction, respectively, and X(i|i) refers to Figure 6 X2 in is the optimal estimated deviation of the heading angle.
[0156] The method of the present invention is described below by means of specific experimental data.
[0157] Programming language: MATLAB, Target area: Indoor and outdoor multi-occluded areas, Prepared data: Pedestrian smartphone built-in accelerometer and gyroscope data.
[0158] 1. Raw data collection
[0159] In order to collect data from the walking experiment, the experimenter held the mobile phone flat against the chest and walked in a straight line on the 100-meter track in the playground. The "AndroSensor" application was installed on the smartphone to collect data at a frequency of 50Hz.
[0160] Table 2 Accelerometer and gyroscope raw data
[0161]
[0162]
[0163] 2. Data Preprocessing
[0164] In the process of monitoring pedestrian movement, the data captured by the inertial sensor integrated in the smartphone mainly includes three parts:
[0165] (1) Human motion information: This data involves the static, walking, and running states of the human body. These data are crucial for PDR.
[0166] (2) Data generated by jitter: Due to the vibrations associated with human movement, the sensor will also record these jitter information. This type of data belongs to the interference of non-motion state;
[0167] (3) Sensor measurement error: Since the sensors in smartphones are non-professional-grade hardware, their measurement accuracy is relatively limited, so the collected data will be affected by the structural limitations of the sensors themselves.
[0168] In these captured data, jitter data and error data are considered as noise. In order to improve the accuracy of data processing, these noises must be removed through preprocessing steps before calculation. This implementation adopts sliding average filtering technology to denoise the accelerometer data. The processed combined acceleration data is used to determine the number of steps through the peak detection method. The results are shown in the figure below.
[0169] Figure 7 and Figure 8 The original acceleration data and the acceleration data obtained by sliding average filtering are shown respectively. By comparing the two figures, it can be seen that the sliding average filtering effectively eliminates the noise information, weakens the influence of noise on the experimental data, and improves the accuracy of the step count calculation results. The number of steps of the experimental walking route is calculated by using the filtered acceleration data. The results are as follows: Fig. 9 As shown in the figure, the red dots represent the detected peaks, and the total number of dots is the number of calculated steps.
[0170] 3. Verification Experiment
[0171] In order to verify the performance of the optimization algorithm, this embodiment designs the experiment, such as Fig.10 As shown in Figure 3, the walking distance of the experiment is set to 100m and the estimated time is 70 seconds. In the experiment, the detailed accuracy analysis after the two different algorithms are processed is summarized in the corresponding table. The accuracy analysis is shown in Table 3.
[0172] Table 3 Accuracy analysis of straight line walking experiment
[0173]
[0174] The following conclusions can be drawn from the comprehensive analysis of the data in the graphs and tables:
[0175] (1) In the 100-meter straight-line experiment, the heading error of the original PDR algorithm gradually accumulated over time, affecting the accuracy of positioning. The introduction of the optimization algorithm, especially the optimization of the CLAHDE model, effectively reduced the error. The closure error of the CLAHDE was 2.38m, which was 77.8% and 52.1% higher than the 10.70m of PDR and 4.97m of AHDE, respectively, showing the significant effect of the CLAHDE algorithm in reducing the closure error.
[0176] (2) In the 100-meter straight-line experiment, as shown by the red circle in the figure, the heading angle error of CLAHDE has a sudden change interval. This interval corresponds to the change in the path direction of the CLAHDE model, which changes from deviating from the ideal trajectory to approaching the ideal trajectory, resulting in a large deviation in the heading angle of CLAHDE.
[0177] The present invention discloses a method for optimizing heading correction based on a mobile phone gyroscope, and belongs to the field of indoor positioning technology. The method mainly carries out data collection, acceleration data preprocessing, CNN-LSTM-Attention-AdaBoost prediction model establishment, pedestrian path recognition, and Kalman filtering to correct heading angle. Taking accelerometer and gyroscope data as objects, a pedestrian path recognition algorithm is constructed. After the gyroscope data is predicted and output with high precision through the prediction model, the processed gyroscope data is subjected to Kalman filtering for heading correction. This method is more in line with the needs of pedestrian indoor positioning applications, and can perform pedestrian indoor positioning navigation in a continuous time.
[0178] The key points of protection of the present invention include four aspects:
[0179] (1) An innovative method that integrates four different machine learning technologies: CNN (convolutional neural network), LSTM (long short-term memory network), Attention (attention mechanism) and AdaBoost (adaptive boosting algorithm). This integration takes advantage of CNN's advantages in local feature extraction, LSTM's ability to process sequence data and long-term dependencies, the role of Attention mechanism in focusing on key information, and AdaBoost's characteristics in improving model robustness and reducing overfitting.
[0180] (2) The performance improvement obtained when predicting gyroscope data through the CNN-LSTM-Attention-AdaBoost integrated algorithm. Specifically, the algorithm improves the prediction accuracy by adaptively adjusting the sample weights and model weights, paying special attention to those data points that are misclassified or predicted. This method can significantly improve the prediction accuracy of gyroscope data, reduce errors, enhance the generalization ability of the model, reduce the constant deviation of gyroscope data, and achieve higher-precision indoor positioning.
[0181] (3) Pedestrian path recognition technology in indoor positioning. The present invention relates to an innovative pedestrian path method, which includes introducing a deviation threshold for judging turning. In a scenario where pedestrians walk along a straight line or a nearly straight line path, the heading angle of consecutive steps changes slightly. In contrast, when a pedestrian turns, the heading angle of the current step will show a significant difference compared to the heading angle of the previous step. Utilizing this feature, the turning behavior of pedestrians can be identified by monitoring the changes in the heading angle between consecutive steps.
[0182] (4) Heading correction technology through Kalman filtering. The present invention relates to a method for heading correction through Kalman filtering, which calculates and analyzes the deviation between the current heading angle and the preset dominant direction. This deviation value is then introduced into the Kalman filter as a key observation input for filtering. Through this data processing technology, a more accurate estimation of the heading angle deviation can be obtained, thereby achieving accurate correction of the heading angle. Based on the acquisition of accelerometer and gyroscope data, combined with algorithm-optimized heading angle data, a dead reckoning process is performed. This process involves integrating the coordinates of the previous position with the heading angle and step length information of the current step to calculate the current precise position coordinates.
[0183] Embodiment 2
[0184] Based on the same inventive concept, this embodiment discloses an indoor positioning device based on Kalman filtering fusion deep learning algorithm, including:
[0185] Data acquisition and processing module, used to collect three-axis gyroscope data and perform preprocessing;
[0186] A deep learning model building module is used to build a deep learning model. The model includes a CNN network module, an LSTM network module, an attention module and an AdaBoost integration module. The CNN network module is used to perform convolution processing on the preprocessed three-axis gyroscope data. The LSTM network module is used to learn the nonlinear law in the gyroscope data from the data output by the convolutional neural network according to the time variation and spatial distribution of the gyroscope data. The attention module is used to weight the output of the LSTM using the attention mechanism to highlight key information. The AdaBoost integration module is used to integrate multiple weak learners, combine the prediction results obtained by each weak learner based on the data output by the attention mechanism, and output the final gyroscope data.
[0187] The quaternion solution module is used to calculate the rotation matrix using the quaternion method to solve the final gyroscope prediction data and obtain the current heading angle;
[0188] The positioning module is used to determine whether the current heading angle is available based on the deviation between the current heading angle and the preset dominant direction, and when the current heading angle is not available, the deviation value is used as the key observation input and introduced into the Kalman filter for filtering processing, the optimal estimation deviation of the heading angle is obtained by filtering, and the current heading angle is corrected using the optimal estimation deviation; finally, the corrected heading angle and the step length information estimated by the preset step length estimation model are used for dead reckoning to obtain the current position information.
[0189] Since the device introduced in the second embodiment of the present invention is a device used to implement the indoor positioning method based on the Kalman filter fusion deep learning algorithm in the first embodiment of the present invention, based on the method introduced in the first embodiment of the present invention, the person skilled in the art can understand the specific structure and deformation of the device, so it is not repeated here. All devices used in the method in the first embodiment of the present invention belong to the scope of protection of the present invention.
[0190] Embodiment 3
[0191] Based on the same inventive concept, the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the method described in the first embodiment is implemented.
[0192] Since the computer-readable storage medium introduced in the third embodiment of the present invention is a computer-readable storage medium used to implement the indoor positioning method based on the Kalman filter fusion deep learning algorithm in the first embodiment of the present invention, based on the method introduced in the first embodiment of the present invention, the person skilled in the art can understand the specific structure and deformation of the computer-readable storage medium, so it is not repeated here. All computer-readable storage media used in the method of the first embodiment of the present invention belong to the scope of protection of the present invention.
[0193] Embodiment 4
[0194] The present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in Embodiment 1 when executing the program.
[0195] Since the computer device introduced in the fourth embodiment of the present invention is a computer device used to implement the indoor positioning method based on the Kalman filter fusion deep learning algorithm in the first embodiment of the present invention, based on the method introduced in the first embodiment of the present invention, the person skilled in the art can understand the specific structure and deformation of the computer device, so it is not repeated here. All computer devices used in the method of the first embodiment of the present invention belong to the scope of protection of the present invention.
[0196] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0197] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0198] Although preferred embodiments of the present invention have been described, additional changes and modifications may be made to these embodiments by those skilled in the art once the basic creative concepts are known. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention. Obviously, those skilled in the art may make various changes and modifications to the embodiments of the present invention without departing from the spirit and scope of the embodiments of the present invention. Thus, if these modifications and variations of the embodiments of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. An indoor positioning method based on Kalman filter fusion deep learning algorithm, characterized in that: include: Collect three-axis gyroscope data and pre-process it; Construct a deep learning model, which includes a CNN network module, an LSTM network module, an attention module, and an AdaBoost integration module. The CNN network module is used to perform convolution processing on the preprocessed three-axis gyroscope data. The LSTM network module is used to learn the nonlinear laws in the gyroscope data from the data output by the convolutional neural network according to the time variation and spatial distribution of the gyroscope data. The attention module is used to weight the output of the LSTM using the attention mechanism to highlight key information. The AdaBoost integration module is used to integrate multiple weak learners, combine the prediction results obtained by each weak learner based on the data output by the attention mechanism, and output the final gyroscope data. The quaternion method is used to calculate the rotation matrix to solve the final gyroscope prediction data and obtain the current heading angle; According to the deviation between the current heading angle and the preset dominant direction, it is judged whether the current heading angle is available. When the current heading angle is not available, the deviation value is used as the key observation input and introduced into the Kalman filter for filtering. The optimal estimation deviation of the heading angle is obtained by filtering, and the current heading angle is corrected using the optimal estimation deviation. Finally, the corrected heading angle and the step length information estimated by the preset step length estimation model are used to perform dead reckoning to obtain the current position information.
2. The indoor positioning method based on Kalman filtering and deep learning algorithm as claimed in claim 1, characterized in that: Preprocess the three-axis gyroscope data, including: The sliding average filtering technique is used to denoise the three-axis gyroscope data.
3. The indoor positioning method based on Kalman filter fusion deep learning algorithm as claimed in claim 1, characterized in that: The attention module is used to weight the output of LSTM using the attention mechanism to highlight key information, including: Take the output of LSTM as input; Calculate the attention score and perform weighted summation; The weighted summed attention scores are normalized to obtain the three-axis gyroscope data after attention processing.
4. The indoor positioning method based on Kalman filtering and deep learning algorithm as claimed in claim 1, characterized in that: According to the deviation between the current heading angle and the preset dominant direction, determine whether the current heading angle is available, including: Determine whether the current heading angle is available according to the formula: Ψ k is the heading angle of the current step, Ψ k-1 is the heading angle of the previous step, Ψ k-2 is the heading angle of the first two steps, Ψ th is the deviation threshold Ψ th , is the deviation between the current heading angle and the preset dominant direction, m is the indication of the route status, when When m=1, it means the current heading angle is available, indicating straight-line walking. Otherwise, the current heading angle is unavailable, indicating a turning action.
5. The indoor positioning method based on Kalman filtering and deep learning algorithm as claimed in claim 4, characterized in that: If the current heading angle is available, dead reckoning is performed using the current heading angle and step length information estimated by a preset step length estimation model to obtain the current position information.
6. The indoor positioning method based on Kalman filtering and deep learning algorithm as claimed in claim 1, characterized in that: When the current heading angle is not available, the deviation value is used as the key observation input and introduced into the Kalman filter for filtering. The optimal estimation deviation of the heading angle is obtained by filtering, including: Initialize the parameters of the Kalman filter; Input the optimal estimate value of the previous moment and obtain the predicted value of the current moment through the prediction equation; The observation value at the current moment is calculated through the observation equation, and the error variance matrix of the prediction at the current moment is calculated through the error equation; Calculate the Kalman gain based on the error variance matrix predicted at the current moment; The optimal estimate value at the current moment is obtained according to the predicted value at the current moment, the observed value at the current moment, and the Kalman gain calculation, which is used as the optimal estimate deviation of the heading angle.
7. The indoor positioning method based on Kalman filter fusion deep learning algorithm as claimed in claim 1, characterized in that: The preset step length estimation model uses a nonlinear step length estimation model to calculate the average and obtain the pedestrian step length.
8. An indoor positioning device based on Kalman filter fusion deep learning algorithm, characterized in that: include: Data acquisition and processing module, used to collect three-axis gyroscope data and perform preprocessing; A deep learning model building module is used to build a deep learning model. The model includes a CNN network module, an LSTM network module, an attention module and an AdaBoost integration module. The CNN network module is used to perform convolution processing on the preprocessed three-axis gyroscope data. The LSTM network module is used to learn the nonlinear law in the gyroscope data from the data output by the convolutional neural network according to the time variation and spatial distribution of the gyroscope data. The attention module is used to weight the output of the LSTM using the attention mechanism to highlight key information. The AdaBoost integration module is used to integrate multiple weak learners, combine the prediction results obtained by each weak learner based on the data output by the attention mechanism, and output the final gyroscope data. The quaternion solution module is used to calculate the rotation matrix using the quaternion method to solve the final gyroscope prediction data and obtain the current heading angle; The positioning module is used to determine whether the current heading angle is available based on the deviation between the current heading angle and the preset dominant direction, and when the current heading angle is not available, the deviation value is used as the key observation input and introduced into the Kalman filter for filtering processing, the optimal estimation deviation of the heading angle is obtained by filtering, and the current heading angle is corrected using the optimal estimation deviation; finally, the corrected heading angle and the step length information estimated by the preset step length estimation model are used for dead reckoning to obtain the current position information.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, an indoor positioning method based on a Kalman filter fused with a deep learning algorithm is implemented as described in any one of claims 1 to 7.
10. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the indoor positioning method based on Kalman filtering fusion deep learning algorithm as described in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Improved PDR indoor positioning method based on LSTM and attention mechanism
CN116465412A
Intelligent automobile motion multi-sensor data processing and fusion method
CN117685961A
Positioning method for optimizing LSTM neural network based on particle swarm optimization
CN117848342A
Indoor pedestrian positioning method based on improved PDR algorithm
CN118706126A
AL-NN neural network integrated navigation method based on attention mechanism
CN119043315A
Cited By
Vision-based human body key point detection mechanical palm synchronous control method and system
CN120663318A