Indoor positioning method and device based on kalman filtering fusion deep learning algorithm
By integrating the CLAHDE model, which combines CNN, LSTM, Attention, and AdaBoost algorithms, and using a Kalman filter to process gyroscope data, the constant drift and heading error problems of gyroscope data in indoor positioning are solved, achieving high-precision indoor positioning.
Patent Information
- Application Number
- CN202411990674.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2044-12-31
AI Technical Summary
In the existing technology, indoor positioning methods based on mobile phone gyroscopes have the problem of low positioning accuracy, especially when processing gyroscope data, constant value drift and heading error are large, resulting in inaccurate positioning.
The CLAHDE algorithm, which integrates convolutional neural networks (CNN), long short-term memory networks (LSTM), attention mechanisms, and adaptive boosting (AdaBoost), is used in conjunction with a Kalman filter to perform high-precision prediction and heading angle correction of gyroscope data. The rotation matrix is calculated using the quaternion method, and the pedestrian path is determined by using an angle threshold and then filtered in the Kalman filter.
It significantly improves the indoor positioning accuracy of smartphone built-in gyroscopes, reduces heading errors, and enhances the accuracy and stability of positioning. In particular, it reduces error correction under complex path and straight-line walking conditions, and improves the overall performance of the positioning algorithm.
Smart Images

Figure CN119935140B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of navigation technology, more particularly, to an indoor positioning method and device based on Kalman filtering fusion deep learning algorithm. BACKGROUND
[0002] With the progress of science and technology and the vigorous development of smart cities, it is of great practical significance and broad application prospects to study a pedestrian heading correction algorithm based on a mobile phone gyroscope. Inertial sensor technology plays a crucial role in indoor positioning. This algorithm mainly uses the inertial sensors built into the mobile phone to accurately measure the direction of pedestrian walking and improve the accuracy and reliability of navigation and positioning. As the core of this technology, the Pedestrian Dead Reckoning (PDR) algorithm calculates the current position of the pedestrian by processing the data collected by the inertial sensors. Compared with traditional inertial sensor positioning methods, the PDR algorithm has relatively loose requirements for the accuracy of the sensors, which makes it more suitable for indoor positioning tasks in a smartphone environment. The core steps of the PDR algorithm include gait detection, step length estimation, and heading angle calculation, which are used for step counting, 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 indoor positioning efficiency lies in 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. However, the process of establishing the model is complex and the prediction accuracy is not high enough. SUMMARY
[0004] To solve the problems in the prior art, the present application proposes a new indoor positioning model CLAHDE (CNN-LSTM-Attention-AdaBoost AHDE) that fuses convolutional neural networks (CNN), LSTM, attention mechanisms (Attention), adaptive boosting (AdaBoost), and AHDE algorithms. To suppress the constant drift contained in the mobile phone gyroscope data, parameter-optimized LSTM is used. Through the CNN-LSTM-Attention-AdaBoost fusion algorithm, high-precision prediction of gyroscope data is performed. The processed gyroscope data is processed through the AHDE algorithm, finally 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 Kalman filtering fusion deep learning algorithm, comprising:
[0006] Collecting and preprocessing three-axis gyroscope data;
[0007] The deep learning model is constructed, and the model comprises a CNN network module, an LSTM network module, an attention module, and an AdaBoost integrated module. The CNN network module is used for convolution processing of the preprocessed three-axis gyroscope data. The LSTM network module is used for learning 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 for weighting the output of the LSTM by using an attention mechanism to highlight key information. The AdaBoost integrated module is used for integrating multiple weak learners, combining the prediction results obtained by each weak learner based on the data output by the attention mechanism, and outputting the final gyroscope data.
[0008] The rotation matrix is calculated by using the quaternion method to solve the final gyroscope prediction data, and the current heading angle is obtained.
[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, and when the current heading angle is not available, the deviation value is input as a key observation to introduce a Kalman filter for filtering processing. The optimal estimation deviation of the heading angle is obtained by filtering, and the current heading angle is corrected by using the optimal estimation deviation. Finally, the position information of the current position is obtained by using the corrected heading angle and the step information estimated by the preset step estimation model.
[0010] In an embodiment, the three-axis gyroscope data is preprocessed, including:
[0011] The sliding average filtering technology is used for denoising processing of the three-axis gyroscope data.
[0012] In an embodiment, the attention module is used for weighting the output of the LSTM by using an attention mechanism to highlight key information, including:
[0013] The output of the LSTM is taken as input;
[0014] The attention scores are calculated and weighted summed;
[0015] The attention scores after the weighted sum are normalized to obtain the three-axis gyroscope data processed by the attention.
[0016] In an embodiment, according to the deviation between the current heading angle and the preset dominant direction, it is judged whether the current heading angle is available, including:
[0017] According to the formula, it is judged whether the current heading angle is available:
[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 previous two steps, th Ψ is the deviation threshold value, th Ψ is the deviation between the current heading angle and the preset dominant direction, m is an indication of the route state, when Ψ is the deviation between the current heading angle and the preset dominant direction, m is an indication of the route state, when
[0020] In an embodiment, if the current heading angle is available, dead reckoning is performed using the current heading angle and the step length information estimated by the preset step length estimation model to obtain the current position information.
[0021] In an embodiment, when the current heading angle is not available, the deviation value is input as a key observation into a Kalman filter for filtering processing to obtain an optimal estimation deviation of the heading angle, including:
[0022] Initializing the parameters of the Kalman filter;
[0023] Inputting the optimal estimation value at the previous time into the prediction equation to obtain the predicted value at the current time;
[0024] Calculating the observation value at the current time by the observation equation and calculating the error variance matrix of the prediction at the current time by the error equation;
[0025] Calculating the Kalman gain according to the error variance matrix of the prediction at the current time;
[0026] Calculating the optimal estimation value at the current time according to the predicted value at the current time, the observation value at the current time, and the Kalman gain to obtain the optimal estimation deviation of the heading angle.
[0027] In an embodiment, the preset step length estimation model adopts a nonlinear step length estimation model to obtain the average pedestrian step length.
[0028] Based on the same inventive concept, the second aspect of the present application provides an indoor positioning device based on Kalman filtering fusion deep learning algorithm, comprising:
[0029] A data acquisition and processing module for acquiring and preprocessing three-axis gyroscope data;
[0030] The deep learning model construction module is configured to construct a deep learning model, which comprises a CNN network module, an LSTM network module, an attention module and an AdaBoost integrated module.
[0031] The quaternion solution module is configured to calculate a rotation matrix for the final gyroscope prediction data by using a quaternion method to obtain a current heading angle.
[0032] The positioning module is configured to determine whether the current heading angle is available according to a deviation between the current heading angle and a preset dominant direction, and to input the deviation value as a key observation into a Kalman filter for filtering when the current heading angle is not available, to obtain an optimal estimation deviation of the heading angle by filtering, and to correct the current heading angle by using the optimal estimation deviation.
[0033] Based on the same inventive concept, the third aspect of the present application provides a computer readable storage medium having a computer program stored thereon, the program being executed by a processor to implement the indoor positioning method based on the Kalman filtering fusion deep learning algorithm according to the first aspect.
[0034] Based on the same inventive concept, the fourth aspect of the present application provides a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor executing the program to implement the indoor positioning method based on the Kalman filtering fusion deep learning algorithm according to the first aspect.
[0035] Compared with the prior art, the present application has the following advantages and beneficial technical effects:
[0036] The application provides an indoor positioning method based on Kalman filtering fusion of a deep learning algorithm, first, three-axis gyroscope data is collected and preprocessed, then a CNN neural network model is used for convolution processing of inputted three-axis gyroscope data of a smartphone, the change rule in the gyroscope data signal is amplified, and irrelevant data is inhibited, a long short-term memory neural network model is used for learning the nonlinear rule 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 output of the LSTM is weighted by an attention mechanism, and key information is highlighted, finally, AdaBoost integrates multiple weak learners, combines the prediction results of the weak learners, and outputs the final prediction result of the gyroscope data. The peak value detection method is used for step frequency detection, and the pedestrian step frequency is obtained. The mean value is obtained by a nonlinear step length estimation model, and the pedestrian step length is obtained. In order to ensure full attitude calculation, a quaternion method is used to calculate a rotation matrix to calculate the predicted data of the gyroscope. An angle threshold judgment mechanism is introduced, which can effectively distinguish whether the pedestrian walks along a dominant straight line 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 input as a key observation into the Kalman filter for filtering, and the optimal estimated deviation of the heading angle is obtained by filtering, so as to calculate the corrected heading angle. On the basis of obtaining the accelerometer and gyroscope data, combined with the heading angle data optimized by the algorithm, the dead reckoning process is performed, and finally the accurate position information is obtained. BRIEF DESCRIPTION OF DRAWINGS
[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, below will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor.
[0038] Figure 1 The overall flowchart of the indoor positioning method based on Kalman filtering fusion of a deep learning algorithm in the embodiments of the present application is shown in the figure.
[0039] Figure 2 The detailed flowchart of the indoor positioning method based on Kalman filtering fusion of a deep learning algorithm in the embodiments of the present application is shown in the figure.
[0040] Figure 3 The flowchart of the model in the embodiments of the present application is shown in the figure.
[0041] Figure 4 The main direction division schematic diagram in the embodiments of the present application is shown in the figure.
[0042] Figure 5This is a flow chart of walking path recognition in an embodiment of the present invention;
[0043] Figure 6 This 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] Figure 9 Schematic diagram of step number calculation results in an embodiment of the present invention;
[0047] Figure 10 Schematic diagram of positioning accuracy results of different algorithms in an embodiment of the present invention. DETAILED DESCRIPTION
[0048] To overcome the low positioning accuracy problem in existing technologies, the present invention uses a convolutional neural network (CNN) to perform pattern recognition and prediction on angular velocity time series data collected by a gyroscope. The Long Short-Term Memory (LSTM) neural network, a variant of the recurrent neural network (RNN), is widely used in processing long-term time series data because of its consistent memory cells. The attention mechanism dynamically focuses on the importance of different parts of the sequence, which can better understand the key information in the sequence and improve the model's prediction accuracy. Adaptive Boosting (AdaBoost) is an ensemble learning method that combines multiple simple models (weak learners) into a powerful model. During training, AdaBoost adjusts the weights of samples based on the performance of each weak learner, allowing subsequent models to focus more on samples where the previous model had errors. This method can improve the model's stability and predictive ability and reduce the risk of overfitting. In the experiment, the CNN-LSTM-Attention-AdaBoost algorithm suppressed the constant drift problem in gyroscope data and achieved high-precision prediction of gyroscope data.
[0049] Another step to improve the indoor positioning accuracy is to improve the efficiency of heading information calculation. To reduce the heading error, scholars propose to use heuristic correction algorithm as a solution: this kind of algorithm makes full use of environmental information and human motion characteristics to correct the calculated heading in real time. Heuristic drift elimination algorithm (HDE) shows obvious heading correction effect in simple path environment along a single dominant direction. However, when facing complex paths, the algorithm has difficulty in properly adjusting the amplitude of heading angle correction, and sometimes it may lead to incorrect heading correction, which may weaken the overall performance of the positioning algorithm. Improved HDE (iHDE) directly corrects the heading angle error in real time, which 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 facing straight walking paths along non-dominant directions, the algorithm may still have inappropriate heading correction due to limited path recognition ability. On this basis, the more advanced version of AHDE (Advanced HDE, AHDE) is derived, which temporarily stops the heading correction during non-linear walking to avoid unnecessary error accumulation. Independent EKF models are established for walking along the dominant direction and straight walking along the non-dominant direction to accurately correct the heading error. This design effectively reduces the probability of incorrect correction, especially in the context of walking along the dominant direction and straight walking along the non-dominant direction, AHDE algorithm can more accurately correct the heading.
[0050] Based on this, the application proposes a new indoor positioning model CLAHDE (CNN-LSTM-Attention-AdaBoost AHDE) which fuses convolutional neural network (CNN), LSTM, attention mechanism (Attention), adaptive boosting (AdaBoost) and AHDE algorithm. For the constant drift contained in the mobile phone gyroscope data, parameter optimized LSTM is used for suppression. Through the high-precision prediction of the gyroscope data by the CNN-LSTM-Attention-AdaBoost fusion algorithm, the processed gyroscope data is processed by the AHDE algorithm, finally improving the positioning accuracy of the built-in accelerometer and gyroscope of the smartphone indoors. The specific process is as follows:
[0051] A CNN neural network model performs convolution processing on the input three-axis gyroscope data from a smartphone, amplifying the variations in the gyroscope data signal and suppressing irrelevant data. A long short-term memory neural network model learns the nonlinear patterns in the gyroscope data output from the convolutional neural network based on its temporal variation and spatial distribution. An attention mechanism weights the LSTM output to highlight key information. Finally, AdaBoost integrates multiple weak learners and combines their predictions to output the final gyroscope data prediction. Cadence is detected using peak detection to determine the pedestrian's cadence. A nonlinear step length estimation model calculates the mean to determine the pedestrian's step length. To ensure full pose resolution, the quaternion method is used to calculate the rotation matrix used to resolve the gyroscope prediction data. An angle threshold judgment mechanism is introduced to effectively determine whether the pedestrian is walking along a dominant straight path. When the system determines that the pedestrian is walking in a straight line, the algorithm calculates and analyzes the deviation between the current heading angle and the preset dominant direction. This deviation is then used as a key observation input for filtering in a Kalman filter. This filtering yields the optimal heading angle deviation estimate, which is then used to calculate the corrected heading angle. Dead reckoning is performed based on the accelerometer and gyroscope data, combined with the algorithmically optimized heading angle data. This process involves integrating the coordinates of the previous position with the heading angle and step length of the current step to calculate the current precise position coordinates.
[0052] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only 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 making creative efforts shall fall within the scope of protection of the present invention.
[0053] Example 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 preprocess it;
[0056] S2: Construct a deep learning model, the model includes a CNN network module, an LSTM network module, an attention module and an AdaBoost integrated module, wherein the CNN network module is used for convolution processing on the preprocessed three-axis gyroscope data, the LSTM network module is used for learning 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 for weighting the output of the LSTM by using the attention mechanism to highlight the key information, and the AdaBoost integrated module is used for integrating multiple weak learners, combining the prediction results obtained by each weak learner based on the data output by the attention mechanism, and outputting the final gyroscope data.
[0057] S3: The rotation matrix is calculated by using the quaternion method to solve the final gyroscope prediction data, and the current heading angle is obtained.
[0058] S4: According to the deviation between the current heading angle and the preset dominant direction, it is judged whether the current heading angle is available, and when the current heading angle is not available, the deviation value is taken as a key observation input, and a Kalman filter is introduced for filtering processing, and the optimal estimation deviation of the heading angle is obtained by filtering, and the current heading angle is corrected by 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.
[0059] Specifically, the several key technologies involved in the application are described as follows:
[0060] CNN convolutional neural network: Convolutional Neural Network (CNN) is a kind of deep learning model, which performs well in image and video recognition, classification and segmentation, etc. The design of CNN is inspired by the human visual system, which 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 address the gradient vanishing and exploding problems that traditional RNNs face when dealing with long sequence data. LSTM effectively captures long-term dependencies by designing a carefully gated mechanism and memory cells, making it perform well in sequence modeling tasks. The core of the LSTM network is the LSTM unit, which contains a memory cell and three control gates: the forget gate, the input gate, and the output gate. The forget gate determines what information to discard from the memory cell at the previous time step; the input gate determines what new information to obtain from the current input and the previous state, and updates the memory cell state; the output gate determines what state to output from the memory cell as the current time step's output. Through the interaction of these gating mechanisms and memory cells, LSTM can selectively retain and forget information, better capturing long-term dependencies. LSTM has been widely applied in natural language processing, speech recognition, time series prediction, and other fields, demonstrating excellent performance.
[0062] Attention Mechanism: Also known as 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 parts of the information while ignoring less important information when processing information. This mechanism is particularly important in natural language processing (NLP) and computer vision, as it can improve the model's sensitivity to key features, thereby improving performance.
[0063] AdaBoost: AdaBoost is an ensemble learning algorithm that iteratively optimizes a series of weak learners and combines them into a strong learner.
[0064] Quaternion Method: The quaternion method, also known as the four-parameter method, is a method that uses four elements to form a number:
[0065]
[0066] where q0 is the real part of the quaternion, q1, q2, and q3 are coefficients multiplied by the imaginary unit, is the imaginary unit of the quaternion, is the imaginary part of the quaternion.
[0067] To solve the quaternion differential equation, we need to solve four equations:
[0068]
[0069] where 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 estimation through iterative update. It is a recursive process, only using the current input measurement and the previously calculated state and its uncertainty matrix to run, without additional past information.
[0071] See Figure 2 , the detailed flowchart of the indoor positioning method based on Kalman filter fusion deep learning algorithm in the embodiment of the present application, the main steps involved will be described below. Figure 2
[0072] I. Data collection and preprocessing
[0073] In the specific implementation process, the present application involves smartphone accelerometer and gyroscope data. Smartphone accelerometer data is used for step detection and step length estimation. Smartphone gyroscope data is used to calculate 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) Moving average filtering: In these captured data, both 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. The present embodiment adopts moving average filtering technology to denoise the accelerometer data.
[0078] 2) Step frequency detection: The present embodiment selects peak detection method to determine the number of steps. In order to improve the accuracy of peak detection, the present embodiment adopts three-axis synthetic acceleration data, and introduces the following two constraint conditions:
[0079] First, the peak value of acceleration should exceed the preset threshold value, in order to reduce the false detection caused by body micro-motion;
[0080] Second, the time interval between two consecutive peaks should exceed the set threshold value, in order to exclude multiple peaks in 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 considers the nonlinear relationship between step length and acceleration, especially suitable for walking situations with complex acceleration changes. Weinberg's model 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 equation (3).
[0082]
[0083] where A max , A min are the maximum and minimum values of acceleration in a step, respectively, and k is an empirical constant (k in equation (1)) is the imaginary unit of quaternion), which is determined by actual test.
[0084] II. CNN-LSTM-Attention-AdaBoost prediction model establishment
[0085] (1) LSTM neural network
[0086] LSTM is a variant of RNN that has evolved and developed on the basis of RNN, and has good universality in long-time data processing. It can handle the dependence on long-term information through memory cells, and overcome some shortcomings and deficiencies in recurrent neural networks. In the LSTM model designed in the present application, three gating operations are included, namely input gate, forget gate and output gate, which regulate the transmission of information flow between cells through gating operation.
[0087] The gyroscope data information stored and involved in the memory cell of the LSTM neural network can be added with key information and deleted with useless information through the gating switch, and the operation of the gating switch can be realized through the Sigmoid function. Sigmoid is a monotonic bounded function, all values of which are between 0 and 1. 0 means that the door is closed and does not allow gyroscope data information to pass through, and 1 means that the door is open and allows all input gyroscope data information to pass through. As shown in the figure, the architecture of the LSTM neural network model for predicting gyroscope data includes three gates to control the gyroscope data information involved in model learning. The LSTM neural network structure designed in the present application mainly includes the following five steps:
[0088] First step: data normalization;
[0089] Second step: through the forget gate in the LSTM structure, also known as the forget gate, discard the useless gyroscope data residual information through the Sigmoid function, according to the state vector in the hidden layer and the input gyroscope data information, through the operation of the door, output a vector between 0 and 1, 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] Third step: decide which information to add to the cell by updating the gate, which is divided into two steps, first, use the hidden state vector h t-1 and x t , through the operation of the output gate to decide which information to update, the update gate is represented by i t , the update parameter is calculated as follows:
[0092] i t = σ(W i · [h t-1 , x t ] + b i ) (5)
[0093] Second, use the hidden state vector ht-1 in the model and the gyroscope data input information x t , through the operation of the tanh layer, get the candidate cell vector According to the following formula:
[0094]
[0095] Fourth step: perform update operation on the old cell information c t-1 contained in the cell state, and consider the updated cell information as the new cell state information C t , the specific update rule is to control the information stored in the candidate cell state C t according to the forget gate, and add new key information to the new candidate cell information C t through the input gate.
[0096]
[0097] Fifth step: after updating the cell state, the output information needs to be determined according to the output hidden layer state vector h t-1 and input information x t .
[0098] o t = v(W0· [h t-1 , x t ] + b0) (8)
[0099] h t = o t · tanh(c t ) (9)
[0100]
[0101] where o t is the output gate, σ is the activation function, W, b are input data, h t is the state vector, is the output vector, softmax is an activation function,
[0102] (2) Convolutional Neural Networks (CNN)
[0103] CNN (Convolution Layer) is a deep learning model suitable for image recognition, computer vision, and time series regression tasks. The classic CNN structure includes convolution layers, pooling layers, fully connected layers, and activation functions. CNN models can also be optimized and expanded by adjusting convolution kernel size, step, padding, and stacking multiple convolution layers and pooling layers. In addition, pre-trained convolutional neural network models such as VGG, ResNet, and Inception can be used for transfer learning to handle more complex tasks and datasets in real-world 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 parts while ignoring less important information when processing information. This mechanism is particularly important in natural language processing (NLP) and computer vision, as it can improve 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 attention scores;
[0108] Step 3: Weighted sum;
[0109] Step 4: Normalize attention scores.
[0110] (4) AdaBoost Model
[0111] AdaBoost (Adaptive Boosting) algorithm is an ensemble learning algorithm whose core idea is to optimize a series of weak learners iteratively 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] Third step: update sample weight;
[0115] Fourth step: build strong learner;
[0116] The overall model flow of CNN-LSTM-Attention-AdaBoost is shown in Figure 3 .
[0117] III. Walking path recognition
[0118] A pedestrian heading correction algorithm based on main direction is constructed. The algorithm assumes that the moving direction of pedestrians in indoor walking mainly follows eight preset main directions, forming a "m" type optional path network, as shown in Figure 4 .
[0119] In the scenario of pedestrians walking along a straight line or an approximately straight line path, the heading angle of consecutive steps changes slightly. Conversely, when the pedestrian turns, the heading angle of the current step will show a significant difference compared with the heading angle of the previous step. By using this feature, the turning behavior of the pedestrian can be recognized by monitoring the change of the heading angle between consecutive steps.
[0120] In order to improve the accuracy of turning detection, a detection mechanism based on the change of heading angle of three consecutive steps is adopted. Specifically, a calculation formula is defined, which is as follows:
[0121]
[0122] The 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 step two steps ago Ψ k-2 , and introduces a deviation threshold value Ψ th to determine whether a turn occurs between steps. In this embodiment, 10° is usually taken as the threshold angle for determining a turn. Through this formula, the turning action of pedestrians during walking can be effectively detected, where m is an indication of the route state, 1 represents straight walking, and 0 represents turning action. The overall flow is shown in Figure 5 .
[0123] IV. Kalman filter correction of heading angle
[0124] (1) Heading error estimation
[0125] When it is determined that the pedestrian walks straight, the difference between the current heading angle and the current main direction is calculated, and the difference is taken as the observation quantity for Kalman filtering. The prediction equation is:
[0126] X(i|i-1) = X(i-1|i-1) + W(i) (12)
[0127] Compute the error covariance matrix:
[0128] P(i|i-1) = P(i-1|i-1) + Q (13)
[0129] The observation equation is:
[0130]
[0131] Compute the Kalman gain:
[0132]
[0133] Compute the optimal estimate at time i:
[0134] X(i|i) = X(i|i-1) + Kt(i)(Z(i) - X(i|i-1)) (16)
[0135] Update the error covariance matrix for X(i|i) at time i:
[0136] P(i|i) = (1 - Kt(i))P(i|i-1) (17)
[0137] Where the characters have the following meanings:
[0138] X(i|i-1): the predicted value at time i;
[0139] X(i-1|i-1): the optimal estimate at time i-1;
[0140] W(i): the state equation noise;
[0141] P(i|i-1): the error covariance matrix predicted at time i;
[0142] P(i-1|i-1): the error covariance matrix at time i-1;
[0143] Q: the variance matrix of the state equation noise;
[0144] Z(i): the observation value at time i;
[0145] The observation function in the observation equation;
[0146] V(i): the observation equation noise;
[0147] Kt(i): the Kalman gain;
[0148] R(i): the 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 i moment.
[0151] The Kalman filtering process is shown in Fig. 6. In the figure, X1 is X(i-1|i-1), X2 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 X2 is formula (12); substituting P into the function to calculate the Kalman gain K is formula (15); and substituting X2, Z and K into the function to obtain X2 is formula (16). The final output of the Kalman filter is the optimal estimation bias of the heading angle.
[0152] (2) Correcting the heading
[0153] After obtaining the optimal estimation bias of the heading angle by the Kalman filter, 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) is X2 in formula (16), i.e., the optimal estimation bias of the heading angle. Figure 6
[0156] The method of the application will be described below by using specific experimental data.
[0157] Programming language: MATLAB, target area: indoor and outdoor multi-occlusion area, and prepared data: pedestrian smartphone built-in accelerometer and gyroscope data.
[0158] I. Raw data collection
[0159] In order to collect data for walking experiments, the experimenter held the smartphone flat in front of his chest and walked straight on a 100-meter track in the playground. An "AndroSensor" application was installed on the smartphone to collect data at a frequency of 50 Hz.
[0160] Table 2 Accelerometer and gyroscope raw data
[0161]
[0162]
[0163] II. Data preprocessing
[0164] In the process of monitoring pedestrian motion, the data captured by the inertial sensors integrated in the smartphone mainly includes three parts:
[0165] (1) Human motion information: related to the static, walking and running motion states of the human body, which is crucial for PDR;
[0166] (2) Jitter data: Due to the vibration caused by human motion, the sensor will also record these jitter information, which belongs to the interference of non-motion state;
[0167] (3) Measurement error of sensor: Because the sensor in the smart phone is non-professional hardware, its measurement accuracy is relatively limited, so the collected data will be affected by the structure limitation of the sensor itself.
[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 by preprocessing step before calculation. This embodiment adopts sliding average filtering technology to denoise the accelerometer data, and the processed combined acceleration data is determined by peak detection method. The results are shown in the following figure.
[0169] Figure 7 and Figure 8 respectively show the acceleration raw data and the acceleration data obtained by sliding average filtering. Through the comparison of the two figures, it can be seen that the sliding average filtering effectively eliminates the noise information, weakens the influence of noise on experimental data, and improves the accuracy of step count result. The step count result of the walking route of the experiment is calculated by the filtered acceleration data, and the result is shown in Figure 9 , in which the red dots represent the detected wave peaks, and the total number of dots is the calculated step count.
[0170] III. Verification experiment
[0171] To verify the performance of the optimization algorithm, this embodiment designs the experiment, as shown in Figure 10 , the walking distance of this experiment is set to 100m, and the expected time is 70s. In the experiment, the detailed accuracy analysis of the processed data of two different algorithms is summarized in the corresponding table, and the accuracy analysis is shown in Table 3.
[0172] Table 3 Accuracy analysis of straight line walking experiment
[0173]
[0174] Through the comprehensive analysis of the figure and table data, the following conclusions can be drawn:
[0175] (1) In the 100-meter straight line experiment, the heading error of the original PDR algorithm gradually accumulates over time, affecting the accuracy of positioning. The introduction of the optimization algorithm, especially the optimization of the CLAHDE model, effectively reduces the error. The closure error of CLAHDE is 2.38m, compared with PDR's 10.70m and AHDE's 4.97m, the accuracy is improved by 77.8% and 52.1% respectively, which shows the significant effect of CLAHDE algorithm in reducing the closure error.
[0176] (2) In the 100-meter straight line experiment, as shown in the red circle in the figure, there is a mutation interval in the heading angle error of CLAHDE. This interval corresponds to the change of the CLAHDE model for the direction of the path, which changes from deviating from the ideal trajectory to approaching the ideal trajectory, resulting in a larger heading angle deviation of CLAHDE.
[0177] The application discloses a kind of based on mobile phone gyroscope heading correction optimization method, belong to indoor positioning technical field.The method mainly carries out data acquisition, acceleration data preprocessing, CNN-LSTM-Attention-AdaBoost prediction model establishment, pedestrian path recognition and Kalman filter correction heading angle work.Accelerometer and gyroscope data are as object, construct pedestrian path recognition algorithm, after high-precision prediction output is carried out to gyroscope data by prediction model, the method that processed gyroscope data is carried out Kalman filter and is corrected to heading, more in line with the demand of pedestrian indoor positioning application, can be carried out pedestrian indoor positioning navigation on continuous time.
[0178] The key points protected by the application include four aspects:
[0179] (1) The innovative method of integrating CNN (Convolutional Neural Network), LSTM (Long Short-Term Memory), Attention (Attention Mechanism), and AdaBoost (Adaptive Boosting) into one model. This integration leverages the strengths of CNN in local feature extraction, the ability of LSTM to handle sequential data and long-term dependencies, the role of Attention mechanism in focusing on key information, and the characteristics of AdaBoost in improving model robustness and reducing overfitting.
[0180] (2) The performance improvement achieved by using the CNN-LSTM-Attention-AdaBoost integrated algorithm for gyroscope data prediction. Specifically, this algorithm adaptively adjusts sample weights and model weights, paying special attention to data points that are misclassified or mispredicted, thereby improving prediction accuracy. This method can significantly improve the prediction accuracy of gyroscope data, reduce errors, enhance the generalization ability of the model, reduce the constant bias 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, including the introduction of a deviation threshold for judging turning. In the scenario where a pedestrian walks along a straight or approximately straight path, the change in the heading angle of consecutive steps is small. Conversely, when a pedestrian turns, the heading angle of the current step will exhibit a significant difference compared to the heading angle of the previous step. By utilizing this feature, the turning behavior of the pedestrian can be recognized by monitoring the change in the heading angle between consecutive steps.
[0182] (4) Heading correction technology through Kalman filtering. The present invention relates to a heading correction method through Kalman filtering, which calculates and analyzes the deviation between the current heading angle and the preset dominant direction. This deviation value is then input as a key observation into the Kalman filter for filtering processing. Through this data processing technology, a more accurate estimate 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 the algorithm-optimized heading angle data, the dead reckoning process is executed. 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 accurate current position coordinates.
[0183] Embodiment Two
[0184] Based on the same inventive concept, the present embodiment discloses an indoor positioning device based on Kalman filtering fusion deep learning algorithm, comprising:
[0185] a data acquisition and processing module for acquiring and preprocessing three-axis gyroscope data;
[0186] a deep learning model construction module for constructing a deep learning model, the model including a CNN network module, an LSTM network module, an attention module, and an AdaBoost integrated module, wherein 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 rules 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, and the AdaBoost integrated module is used to integrate multiple weak learners, combine the prediction results obtained from the data output by each weak learner based on the attention mechanism, and output the final gyroscope data;
[0187] a quaternion solution module for calculating a 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 for judging whether the current heading angle is available according to a deviation between the current heading angle and the preset dominant direction, and inputting the deviation value as a key observation into a Kalman filter for filtering processing when the current heading angle is not available, filtering to obtain an optimal estimated deviation of the heading angle, and correcting the current heading angle by using the optimal estimated deviation; and finally performing a dead reckoning by using the corrected heading angle and step length information estimated by the preset step length estimation model to obtain current position information.
[0189] Since the device introduced in the embodiment two of the present application is the device used for implementing the indoor positioning method based on the Kalman filter fusion deep learning algorithm in the embodiment one of the present application, the specific structure and deformation of the device can be understood by those skilled in the art based on the method introduced in the embodiment one of the present application, and thus will not be described here again. Any device used in the method in the embodiment one of the present application belongs to the scope of the present application.
[0190] Embodiment three
[0191] Based on the same inventive concept, the present application further provides a computer readable storage medium having a computer program stored thereon, the program being executed by a processor to implement the method in the embodiment one.
[0192] Since the computer readable storage medium introduced in the embodiment three of the present application is the computer readable storage medium used for implementing the indoor positioning method based on the Kalman filter fusion deep learning algorithm in the embodiment one of the present application, the specific structure and deformation of the computer readable storage medium can be understood by those skilled in the art based on the method introduced in the embodiment one of the present application, and thus will not be described here again. Any computer readable storage medium used in the method in the embodiment one of the present application belongs to the scope of the present application.
[0193] Embodiment four
[0194] The present application further provides a computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor implementing the method in the embodiment one when executing the program.
[0195] Since the computer device introduced in the embodiment four of the present application is the computer device used for implementing the indoor positioning method based on the Kalman filter fusion deep learning algorithm in the embodiment one of the present application, the specific structure and deformation of the computer device can be understood by those skilled in the art based on the method introduced in the embodiment one of the present application, and thus will not be described here again. Any computer device used in the method in the embodiment one of the present application belongs to the scope of the present application.
[0196] Those skilled in the art will appreciate that embodiments of the present application can be devised for a variety of other systems which are currently developed or later developed. Therefore, the present application is not intended to be limited to the embodiments described herein which can be considered merely as examples, presents, or applications of the application. It is therefore contemplated that other variations and modifications can be affected which, without departing from the spirit and scope of the application. Accordingly, the application is intended to embrace all such alterations, modifications, and variations that fall within the scope and spirit of the application. Although exemplary embodiments of the present application have been described in detail, those skilled in the art will understand that various modifications can be made to the embodiments without departing from the spirit and scope of the application. Therefore, it is not intended that the application be limited to the specific embodiments disclosed herein, but rather that the scope of the present application be determined by the appended claims and their equivalents. Accordingly, the application is intended to embrace all alternatives, modifications and variations which fall within the scope of the present application. Various aspects and embodiments of the application are presented in terms of methods, systems, computer program products, and / or computer- implemented methods. These and other aspects, embodiments, and / or variations of the application are described in
[0197] The present application is described in terms of exemplary embodiments, devices (systems), and computer program products in flowcharts and / or block diagrams. It will be understood that each block of the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processing system, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowcharts and / or block diagrams block or blocks. Figure 1 The flowcharts and / or block diagrams have been simplified for ease of discussion, and so should not be construed as requiring a particular order of implementation in accordance with any aspect, embodiment, or variation thereof. Figure 1 The flowcharts and / or block diagrams have been simplified for ease of discussion, and so should not be construed as requiring a particular order of implementation in accordance with any aspect, embodiment, or variation thereof.
[0198] While the preferred embodiments of the application have been described, additional variations and modifications can be made to the embodiments described and shown, which will fall within the scope of the application. Therefore, it is intended that the application not be limited to the particular embodiments disclosed, but that the application should be construed in accordance with the limitations and appropriate scope thereof, and that modifications and alterations are intended which fall within the scope and spirit of the application.
Claims
1. An indoor positioning method based on Kalman filtering and 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 output of the convolutional neural network based on the temporal 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 and combine the prediction results obtained by each weak learner based on the data output by the attention mechanism to 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; Based on the deviation between the current heading angle and the preset dominant direction, it is determined whether the current heading angle is available. If 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 filtering obtains the optimal estimated deviation of the heading angle, and the optimal estimated deviation is used to correct the current heading angle. 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 according to claim 1, characterized in that: Preprocess the three-axis gyroscope data, including: The sliding average filtering technology is used to denoise the three-axis gyroscope data.
3. The indoor positioning method based on Kalman filtering and deep learning algorithm according to 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 sum; 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 according to claim 1, characterized in that: Based on 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 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 according to 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 according to claim 1, characterized in that: When the current heading angle is unavailable, the deviation value is used as the key observation input and introduced into the Kalman filter for filtering. The filtering obtains the optimal estimated deviation of the heading angle, including: Initialize the parameters of the Kalman filter; Input the optimal estimated value at the previous moment and obtain the predicted value at 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 current moment prediction is calculated through the error equation; Calculate the Kalman gain based on the error variance matrix predicted at the current moment; The optimal estimated 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, which is used as the optimal estimated deviation of the heading angle.
7. The indoor positioning method based on Kalman filtering and deep learning algorithm according to claim 1, characterized in that: The preset step length estimation model uses a nonlinear step length estimation model to calculate the mean and obtain the pedestrian step length.
8. An indoor positioning device based on Kalman filtering and 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 construction 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 laws in the gyroscope data from the data output by the convolutional neural network based on 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 and combine the prediction results obtained by each weak learner based on the data output by the attention mechanism to 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. If 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 filtering obtains the optimal estimated deviation of the heading angle and uses the optimal estimated deviation to correct the current heading angle. 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.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the indoor positioning method based on the Kalman filter fusion deep learning algorithm as described in any one of claims 1 to 7 is implemented.
10. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: 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
Positioning method for optimizing LSTM neural network based on particle swarm optimization
CN117848342A