A device posture recognition method based on geomagnetic sensor
By employing a collaborative architecture combining deep learning feature extraction, density clustering, and particle swarm optimization algorithms, the system dynamically adapts to the magnetic field environment, solving the problems of low attitude recognition accuracy and poor stability of geomagnetic sensors under magnetic field interference, and achieving high-precision and highly robust attitude recognition.
Patent Information
- Application Number
- CN202610588323.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-30
- Publication Date
- 2026-08-25
AI Technical Summary
Existing geomagnetic sensor attitude recognition technology suffers from low accuracy and poor stability under magnetic field interference, lacks adaptive strategies, cannot effectively distinguish between reliable and distorted data, and lacks deep learning feature extraction and closed-loop self-learning capabilities.
Employing a full-link linkage architecture that integrates deep learning feature extraction, density clustering quality partitioning, particle swarm optimization algorithm, and closed-loop model update, this system achieves high-precision attitude recognition of geomagnetic data and dynamically adapts to changes in the magnetic field environment through wavelet preprocessing, multi-scale deep feature extraction, DBSCAN clustering, and particle swarm optimization algorithm.
It achieves high-precision and robust device attitude recognition in complex magnetic field environments, improves the system's adaptability and robustness in the face of magnetic field interference, and solves the problem that fixed models in traditional methods cannot cope with magnetic field distortion.
Smart Images

Figure CN122634424A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of geomagnetic sensor attitude recognition technology, and more specifically to a device attitude recognition method based on a geomagnetic sensor. Background Technology
[0002] Geomagnetic sensor-based device attitude recognition is widely used in smart terminals, robot control, wearable devices, and other fields. Its core function is to calculate the device's pitch, roll, and yaw angles using geomagnetic vectors. Current mainstream technologies fall into two categories: Firstly, the traditional pure algorithm approach: after performing Kalman filtering / complementary filtering to denoise the raw geomagnetic data, the attitude angle is directly calculated through vector operations. This approach assumes that the local geomagnetic field is uniform and stable, and cannot distinguish between reliable data and distorted data. Under magnetic field interference, the attitude accuracy and stability drop sharply, and there is no data quality assessment capability.
[0003] Secondly, the integrated navigation clustering scheme: such as the existing publicly available underwater inertial / geomagnetic integrated navigation method, which only processes the filtering information terms through density clustering to adjust the Kalman filter noise matrix; this scheme relies on the fusion positioning of inertial measurement unit and geomagnetic sensor, and has no pure geomagnetic attitude calculation capability, no deep learning feature extraction, no magnetic field spatial quality partitioning, and clustering is only used for filtering parameter adjustment, which is not linked with attitude calculation and cannot be adapted to attitude recognition scenarios with a single geomagnetic sensor.
[0004] In summary, the existing technology has the following core defects: 1. It relies on manual features and fixed solution models, and cannot extract deep spatiotemporal features of the geomagnetic field; 2. It lacks spatial quality grading of geomagnetic data and cannot adaptively isolate magnetic field distortion interference; 3. Attitude calculation and data quality are not linked, it lacks closed-loop self-learning ability, and has poor robustness. Summary of the Invention
[0005] This application is made in view of the above and other ideas.
[0006] One of the objectives of this application is to overcome the shortcomings of existing technologies and provide a device attitude recognition method based on geomagnetic sensors. This method is based on a full-link linkage architecture of deep learning feature extraction, density clustering quality partitioning, intelligent algorithm dynamic optimization, and closed-loop model update. It achieves anti-interference and high-precision attitude recognition using pure geomagnetic sensors, and solves the technical problems of fixed models, poor anti-interference, and lack of adaptive strategies in existing technologies.
[0007] The technical solution adopted to solve the technical problem of the present invention is to provide a device attitude recognition method based on a geomagnetic sensor, which includes five core steps: data preprocessing, multi-scale depth feature extraction, geomagnetic data quality spatial partitioning, adaptive attitude estimation strategy generation, attitude calculation and closed-loop model update. The algorithm and technology feature linkage logic is as follows: wavelet preprocessing achieves basic noise reduction of geomagnetic data, providing standardized input for deep learning; multi-branch CNN realizes the mapping of geomagnetic data from raw values to multi-dimensional deep features, replacing traditional manual features; DBSCAN clustering realizes fine-grained partitioning of geomagnetic quality based on feature space distribution, providing a reliable basis for attitude calculation; particle swarm optimization algorithm dynamically customizes attitude calculation rules with high-reliability data as constraints, realizing adaptive matching between the calculation model and the magnetic field environment; backpropagation and incremental learning use attitude output as feedback to continuously optimize feature extraction capabilities, forming a closed-loop linkage of "data processing - feature mining - quality grading - dynamic calculation - model iteration".
[0008] As a further improvement of the present invention, the specific steps are as follows: S1 Data preprocessing: Real-time acquisition of raw triaxial data from the geomagnetic sensor of the device, followed by wavelet transform denoising, Z-score standardization, and time-series window segmentation to generate a preprocessed geomagnetic data sequence; S2 Multi-scale depth feature extraction: Constructing a multi-branch convolutional neural network, inputting the preprocessed geomagnetic data sequence into the network, extracting three types of multi-scale features: geomagnetic intensity distribution, geomagnetic gradient change, and geomagnetic direction consistency, and fusing them to generate a gridded geomagnetic feature map; S3 Geomagnetic data quality spatial partitioning: Using the DBSCAN density clustering algorithm to perform cluster analysis on the geomagnetic feature map, dividing high-stability geomagnetic regions and low-stability geomagnetic regions based on feature variance, identifying isolated points and marking them as geomagnetic anomalies; S4 Adaptive attitude estimation strategy generation: Using the high-stability geomagnetic regions as the search space of the particle swarm optimization algorithm, iteratively optimizing to generate the optimal attitude angle calculation rule; combining the low-stability geomagnetic regions and geomagnetic anomalies, configuring attitude correction actions including data resampling and smoothing filtering; S5 Attitude calculation and closed-loop model update: The attitude estimation strategy is executed to calculate the roll angle, pitch angle and yaw angle of the equipment, and output the equipment attitude parameters with confidence. The attitude parameters are used as supervision signals to optimize the weights of the convolutional neural network through the backpropagation algorithm, and incremental learning is performed to complete the adaptive update of the model.
[0009] As a further improvement of the present invention, step S1 is specifically as follows: S11 Select a symmetric wavelet basis function to perform multi-level wavelet decomposition on the original geomagnetic data, filter out high-frequency interference based on the energy threshold and reconstruct low-frequency coefficients to obtain smooth geomagnetic data; S12 Calculate the mean and variance of the smooth geomagnetic data and perform Z-score standardization processing; S13 Divide the standardized data into segments with a fixed time window to generate a preprocessed geomagnetic data sequence of equal length.
[0010] As a further improvement of the present invention, step S2 specifically involves: S21 constructing a multi-branch convolutional neural network, with each branch corresponding to a convolutional kernel of a different scale, to extract local detail features and global distribution features of geomagnetic data; S22 inputting the preprocessed geomagnetic data sequence into the multi-branch convolutional neural network, processing it through convolutional layers, pooling layers, and activation functions, and outputting multiple sets of feature maps; S23 fusing the multiple sets of feature maps to generate a comprehensive geomagnetic feature map that represents the spatial distribution of geomagnetic features in a grid format; setting a feature enhancement layer at the end of the multi-branch convolutional neural network, and using a piecewise linear activation function to perform a nonlinear transformation on the fused features to output a gridded geomagnetic feature map.
[0011] Preferably, step S3 specifically involves: S31 setting a neighborhood radius and density threshold, performing density clustering on all feature points in the geomagnetic feature map, and dividing the clusters according to the Euclidean distance between feature points and the density threshold; S32 calculating the geomagnetic feature variance of each cluster, with clusters having a variance lower than a preset threshold being high-stability geomagnetic regions and clusters having a variance higher than a preset threshold being low-stability geomagnetic regions; S33 marking isolated points without cluster affiliation as geomagnetic anomalies and recording their coordinates and feature values.
[0012] Preferably, in step S4, S41 uses a highly stable geomagnetic region as the search space for the particle swarm optimization algorithm, initializes the particle swarm, and each particle represents an attitude angle calculation rule; S42 uses a dynamic inertia weight adjustment strategy to optimize the particle swarm, constructs a fitness function based on geomagnetic feature consistency and attitude angle error, and calculates the fitness value of the particles; S43 iteratively updates the particle position and velocity, and selects the calculation rule corresponding to the particle with the highest fitness as the optimal attitude angle calculation rule; S44 combines the information of the low-stability geomagnetic region to configure attitude correction actions including data resampling and smoothing filtering.
[0013] Preferably, in step S5, S51, when calculating the attitude, feature data of the high-stability geomagnetic region is called first; S52, when a geomagnetic anomaly is detected, the attitude correction action is triggered, geomagnetic data is resampled, and the attitude angle is smoothed by Kalman filtering; S53, the final device attitude parameters containing attitude angle values and confidence index are output.
[0014] Preferably, in step S5, S51 executes an attitude estimation strategy to calculate the roll angle, pitch angle, and yaw angle of the equipment, and outputs the equipment attitude parameters with confidence; S52 uses the equipment attitude parameters as a supervision signal to calculate the loss function between the output of the convolutional neural network and the true attitude; S53 uses the backpropagation algorithm to adjust the weight parameters of the convolutional neural network and optimize the feature extraction channel corresponding to the geomagnetic anomaly point; S54 periodically collects new geomagnetic environment data, performs unsupervised incremental learning on the convolutional neural network, adapts to the dynamic geomagnetic environment, and completes the adaptive update of the model.
[0015] Compared with the prior art, the advantages of the technical solution of this application include at least the following: This invention constructs an attitude recognition scheme that integrates multi-dimensional feature deep learning, intelligent geomagnetic spatial stability classification, adaptive attitude calculation strategy generation, and closed-loop feedback iterative optimization. It effectively solves the technical problems of low attitude estimation accuracy, poor stability, and lack of self-learning ability in existing technologies under geomagnetic distortion environments, and achieves high-precision and high-robustness device attitude recognition in complex geomagnetic environments.
[0016] Unlike existing integrated navigation systems that use inertial navigation and geomagnetic fusion for positioning, this invention uses pure geomagnetic sensor attitude recognition without relying on inertial units. Unlike traditional filtering and vector calculation, it constructs a deep learning and intelligent optimization full-link architecture, filling the technical gap of geomagnetic attitude recognition without deep feature mining.
[0017] The present invention establishes a linkage mechanism of "feature extraction - quality partitioning - dynamic solution": CNN multi-scale features realize the fine expression of geomagnetic data, DBSCAN spatial partitioning accurately distinguishes the reliability of data, and particle swarm algorithm dynamically adapts to the solution rules, completely solving the problem that traditional fixed models cannot cope with magnetic field distortion.
[0018] Unlike traditional solutions where feature extraction and attitude calculation are unidirectional and fragmented processes, this invention establishes a closed-loop link of "perception-decision-feedback-optimization". Furthermore, as the device is used for a longer period of time, the CNN model's ability to identify geomagnetic anomaly patterns in specific scenarios is continuously enhanced, making the system increasingly adaptable and robust when facing new magnetic field interference. This is a core advantage that existing fixed-parameter models do not possess.
[0019] The embodiments of this application can achieve other advantageous technical effects not listed one by one. These other technical effects may be partially described below and can be expected and understood by those skilled in the art after reading this application. Attached Figure Description
[0020] The above-described features and advantages, as well as other features and advantages, and the ways in which they are implemented, of these embodiments will become more apparent and the embodiments of this application will be better understood by referring to the following description in conjunction with the accompanying drawings, in which: Figure 1 This is a schematic diagram illustrating the working principle of the device attitude recognition method based on a geomagnetic sensor described in this invention. Figure 2 A flowchart for preprocessing raw data from a geomagnetic sensor; Figure 3 This is a flowchart for multi-scale geomagnetic feature extraction; Figure 4 A visualization of the regional distribution of geomagnetic feature maps based on cluster analysis; Figure 5 Update the trend of the loss function for the convolutional neural network model. Detailed Implementation
[0021] The details of one or more embodiments of this application will be set forth in the following description of the accompanying drawings and specific embodiments. Other features, objects, and advantages of this application will become clear from these descriptions, drawings, and claims.
[0022] It should be understood that the illustrated and described embodiments are not limited in application to the details of the construction and arrangement of the components set forth in the following description or illustrated in the accompanying drawings. The illustrated embodiments may be other embodiments and can be implemented or performed in various ways. The examples are provided by way of explanation rather than limitation of the disclosed embodiments. In fact, it will be apparent to those skilled in the art that various modifications and variations can be made to the embodiments of this application without departing from the scope or spirit of this disclosure. For example, features illustrated or described as part of one embodiment may be used with another embodiment to still produce another embodiment. Therefore, this disclosure covers such modifications and variations that fall within the scope of the appended claims and their equivalents.
[0023] Similarly, it is understood that the phrases and terms used in this document are for descriptive purposes and should not be considered restrictive. The use of “including,” “contains,” or “has,” and their variations, in this document is intended to include, in an open-ended manner, the items listed thereafter, their equivalents, and any additional items.
[0024] The present application will now be described in more detail with reference to various embodiments and examples of several aspects thereof.
[0025] One of the objectives of the embodiments described below is to address the aforementioned deficiencies, as well as other problems.
[0026] Please see Figure 1This invention provides a device attitude recognition method based on a geomagnetic sensor. The method includes: real-time acquisition of raw geomagnetic sensor data from the device, followed by denoising and normalization of the raw geomagnetic sensor data to generate a preprocessed geomagnetic data sequence; multi-scale feature extraction of the preprocessed geomagnetic data sequence using a convolutional neural network to generate a geomagnetic feature map, wherein the geomagnetic feature map includes geomagnetic intensity distribution, geomagnetic gradient changes, and geomagnetic direction consistency features; cluster analysis of the geomagnetic feature map to divide it into high-stability geomagnetic regions and low-stability geomagnetic regions, and marking geomagnetic anomalies; generating an attitude estimation strategy based on the high-stability and low-stability geomagnetic regions, the attitude estimation strategy including attitude angle calculation rules and attitude correction actions; executing the attitude estimation strategy, outputting device attitude parameters, and updating the weight parameters of the convolutional neural network according to the device attitude parameters and geomagnetic anomaly information.
[0027] Example 1: See Figure 2 In specific implementation, the raw data from the geomagnetic sensor is denoised and normalized to generate a preprocessed geomagnetic data sequence. A wavelet transform algorithm is used to filter out noise from the raw data, removing high-frequency interference components to obtain smooth geomagnetic data. A symmetric wavelet basis function is selected for wavelet decomposition, and high-frequency noise components are removed according to a preset energy threshold. Low-frequency approximation coefficients are then reconstructed to obtain smooth geomagnetic data. The mean and variance of the smooth geomagnetic data are calculated, and Z-score standardization is performed to ensure the geomagnetic data distribution falls within a preset range. The formula for Z-score standardization is as follows:
[0028] in: These are standardized geomagnetic data values. These are smoothed geomagnetic data values. It is the mean of smoothed geomagnetic data. The standard deviation of the smoothed geomagnetic data is used to segment the standardized geomagnetic data into time series segments, generating a preprocessed geomagnetic data sequence. Each data segment contains geomagnetic readings within a fixed time window. In some embodiments, a preset energy threshold is set based on the spectral characteristics of the raw geomagnetic sensor data to distinguish between effective signal and noise components. The selection of symmetric wavelet basis functions includes the Daubechies wavelet, used for wavelet decomposition and reconstruction. Optionally, the length of the fixed time window is configured according to application requirements, for example, set to 100 milliseconds or 200 milliseconds, to capture the temporal characteristics of the geomagnetic data. Z-score normalization ensures that the geomagnetic data has zero mean and unit variance, facilitating subsequent convolutional neural network processing. It can be understood that the wavelet transform algorithm processes the raw geomagnetic sensor data through multi-level decomposition. High-frequency noise component removal is based on threshold processing of detail coefficients, and the reconstruction of low-frequency approximation coefficients preserves the main trends of the geomagnetic data. In specific implementations, the generation of the preprocessed geomagnetic data sequence includes an overlapping strategy for data segmentation to enhance the continuity and integrity of the sequence, and the calculation of smoothed geomagnetic data involves a sliding window averaging method to further reduce random fluctuations. The sliding window averaging method is applied to the generation process of preprocessed geomagnetic data sequences. By defining a fixed-length window that slides across the time series, the arithmetic mean of the geomagnetic readings within each window is calculated to further reduce random fluctuations in the data and enhance the smoothness of the sequence. The window length is set according to the sampling frequency of the geomagnetic sensor and the expected signal characteristics, for example, a window size of 100 milliseconds. The window sliding step is smaller than the window length to implement an overlapping strategy for data segmentation, ensuring partial data overlap between consecutive windows, thereby maintaining the temporal continuity and structural integrity of the sequence. In some embodiments, the normalization process also includes a data pruning step to limit geomagnetic data values exceeding a preset range to a reasonable interval, avoiding extreme values from affecting subsequent analysis. Optionally, the preset energy threshold in the wavelet transform algorithm is determined through experimental calibration to adapt to geomagnetic interference levels under different environments. The mean and variance of the Z-score normalization process are dynamically updated based on real-time data streams to improve processing adaptability. It is understood that the structured format of the preprocessed geomagnetic data sequence facilitates input into a multi-branch convolutional neural network, and the geomagnetic readings within the fixed time window include triaxial magnetometer data for a comprehensive characterization of geomagnetic field changes.
[0029] Example 2: See Figure 3In specific implementation, a convolutional neural network (CNN) is used to extract multi-scale features from the preprocessed geomagnetic data sequence to generate a geomagnetic feature map. A multi-branch CNN structure is constructed, with each branch corresponding to a convolutional kernel of a different scale, used to extract local and global features of the geomagnetic data. The preprocessed geomagnetic data sequence is input into the multi-branch CNN, and processed through convolutional layers, pooling layers, and activation functions to output multiple sets of feature maps. These multiple feature maps are fused to generate a comprehensive geomagnetic feature map. The geomagnetic feature map represents the spatial distribution of geomagnetic features in a grid format. The multi-branch CNN structure also includes a feature enhancement layer, which performs nonlinear transformations on the fused comprehensive geomagnetic feature map to improve feature discriminative power. The feature enhancement layer uses a piecewise linear activation function to process the feature maps. The piecewise linear activation function is defined as follows:
[0030] in: These are the input feature values. It is the slope parameter of the negative input region. It is the lower limit parameter of the linear region. It is the upper limit parameter of the linear region. This refers to the slope parameter of the positive input region. In some embodiments, the kernel size of the multi-branch convolutional neural network structure includes 1x1, 3x3, and 5x5 to capture different scale features of geomagnetic data. The pooling layer uses max pooling to reduce the feature map size, and the activation function uses the ReLU function to process the output of the convolutional layer. Optionally, the parameters of the feature enhancement layer... , , , The feature discrimination is optimized by adjusting the backpropagation algorithm during training. The generation of the comprehensive geomagnetic feature map includes channel stitching and convolutional fusion operations, merging the multi-branch outputs into a unified feature representation. It can be understood that multi-scale feature extraction, through parallel convolutional branches processing geomagnetic data, can simultaneously capture local details and global patterns, enhancing the richness of the geomagnetic feature map. In specific implementations, the preprocessed geomagnetic data sequence is used as input to the multi-branch convolutional neural network, with its data dimension matching the network input layer. The outputs of the convolutional and pooling layers undergo batch normalization to accelerate the training process, and the nonlinear transformation of the feature enhancement layer enhances the discriminative ability of the geomagnetic feature map. In some embodiments, the feature map fusion of the multi-branch convolutional neural network structure adopts a weighted summation method, with weights learned by the network. Each cell in the grid representation of the geomagnetic feature map corresponds to the spatial distribution value of the geomagnetic features. Optionally, the parameters of the piecewise linear activation function... and Set to a fixed value to control the linear range, parameter and The feature enhancement layer is dynamically initialized based on the training data, and its output is L2 regularized to prevent overfitting. It can be understood that the generation of the geomagnetic feature map relies on the collaborative work of a multi-branch structure: local feature branches focus on geomagnetic gradient changes, global feature branches capture geomagnetic intensity distribution, and the combined feature map provides input for subsequent clustering analysis.
[0031] Example 3: In specific implementation, cluster analysis is performed on the geomagnetic feature map to divide it into high-stability and low-stability geomagnetic regions and to mark geomagnetic anomalies. The DBSCAN clustering algorithm is applied to perform density clustering on the feature points in the geomagnetic feature map. Clusters are divided according to the Euclidean distance between feature points and a density threshold. The geomagnetic feature variance of each cluster is calculated, and clusters with variances below a preset threshold are marked as high-stability geomagnetic regions, while those with variances above the preset threshold are marked as low-stability geomagnetic regions. Isolated points that do not belong to any cluster are identified and marked as geomagnetic anomalies. The coordinates and feature values of the geomagnetic anomalies are recorded. The formula for calculating the geomagnetic feature variance is expressed as:
[0032] in: It is the variance of the geomagnetic characteristics of the cluster. It is the number of feature points in the cluster. It is the eigenvalue of the j-th feature point. This is the mean of the cluster feature values. In some embodiments, the Euclidean distance calculation of the DBSCAN clustering algorithm is based on the position of feature points in the feature space. The density threshold includes a minimum number of points parameter and a neighborhood radius parameter to define core points and boundary points. The division between high-stability and low-stability geomagnetic regions is dynamically adjusted based on a preset variance threshold. Optionally, the recording of geomagnetic anomalies includes the storage of feature vectors and the establishment of spatial indexes for reference in subsequent attitude estimation strategies. The parameters of the DBSCAN clustering algorithm are optimized through a grid search method to improve the clustering effect and the accuracy of region division. It can be understood that the DBSCAN clustering algorithm can automatically identify noise points as geomagnetic anomalies without pre-specifying the number of clusters, adapting to the complex distribution patterns of geomagnetic feature maps. In specific implementations, the variance calculation of clusters is based on the dispersion of feature values. The preset threshold is set according to statistical analysis of historical geomagnetic data. High-stability geomagnetic regions correspond to regions with gentle geomagnetic field changes, while low-stability geomagnetic regions correspond to regions with large geomagnetic field fluctuations. In some embodiments, feature points of the geomagnetic feature map are extracted from grid cells of the comprehensive geomagnetic feature map. Each feature point contains geomagnetic intensity, gradient, and orientation consistency feature values. The calculation of Euclidean distance involves vector differences in multidimensional space. Optionally, the neighborhood radius parameter in the density clustering process is adaptively adjusted according to the feature point distribution density, and the minimum number of points parameter is set to a fixed value to control the clustering granularity. The labeling of geomagnetic anomalies includes the detection of isolated points and the calculation of anomaly scores. It can be understood that the evaluation of geomagnetic feature variance provides a quantitative indicator of regional stability. Variance below a preset threshold indicates high feature value concentration and good regional stability, while variance above a preset threshold indicates high feature value dispersion and poor regional stability.
[0033] See Figure 4 This figure presents the results of cluster analysis on geomagnetic feature maps. A two-dimensional feature space is constructed using feature dimension 1 and feature dimension 2. Three types of regions are distinguished by three markers: solid black dots represent high-stability geomagnetic regions, where feature points are highly clustered, geomagnetic feature variance is low, and the geomagnetic field is less susceptible to interference and has good stability, making them a core and reliable data source for attitude estimation; gray dots represent low-stability geomagnetic regions, where feature points are relatively dispersed, geomagnetic feature variance is high, and the corresponding geomagnetic field exhibits some fluctuations or is in an interference transition zone; hollow white dots represent geomagnetic anomalies, where the geomagnetic field is severely distorted and is considered invalid data that needs to be removed in attitude calculations. This figure visually demonstrates the distribution pattern of geomagnetic data in the feature space, clearly distinguishing geomagnetic regions of different stabilities from anomalies. This provides a crucial basis for subsequent attitude estimation strategies based on regional differences, enabling the system to accurately calculate attitude using data from high-stability regions, perform data resampling and smoothing filtering corrections on low-stability regions, and eliminate interference from geomagnetic anomalies, ultimately improving the accuracy and robustness of device attitude recognition in complex environments.
[0034] Example 4: In specific implementation, an attitude estimation strategy is generated based on high-stability and low-stability geomagnetic regions. The high-stability geomagnetic region is used as the search space for the particle swarm optimization algorithm, and the particle swarm is initialized. Each particle represents an attitude angle calculation rule. A fitness function is defined to calculate the particle's fitness value based on geomagnetic feature consistency and attitude angle error. The particle's position and velocity are iteratively updated to find the particle with the highest fitness value and generate the optimal attitude angle calculation rule. In conjunction with the information from the low-stability geomagnetic region, attitude correction actions are designed, including geomagnetic data resampling and attitude angle smoothing filtering. When iteratively updating the particle's position and velocity, a dynamic inertia weight adjustment strategy is adopted to adaptively adjust the inertia weight value according to the convergence state of the particle swarm to balance global search and local search capabilities. The formula for dynamic inertia weight adjustment is expressed as:
[0035] in: It is the inertia weight value of the nth iteration. This is the initial value of the inertia weight. It is the final value of the inertia weight. It is the current iteration number. This represents the maximum number of iterations. In some embodiments, the search space of the particle swarm optimization algorithm is defined by the coordinates of feature points in a highly stable geomagnetic region. The position vector of each particle encodes the parameters of the attitude angle calculation rule. The geomagnetic feature consistency of the fitness function is calculated based on the variance of the geomagnetic direction features. The attitude angle error is obtained by comparing the estimated attitude with the reference value. Optionally, a dynamic inertia weight adjustment strategy adjusts the inertia weight value according to the average fitness change rate of the particle swarm. When the average fitness change rate is lower than a threshold, the inertia weight is reduced to enhance the local search; conversely, the inertia weight is increased to promote global exploration. Geomagnetic data resampling in the attitude correction action involves adding sampling points in low-stability geomagnetic regions to improve data reliability. It can be understood that the particle swarm optimization algorithm searches for the optimal attitude angle calculation rule through swarm intelligence. The design of the fitness function directly affects the search efficiency and result quality. Dynamic inertia weight adjustment helps to avoid premature convergence and improve optimization accuracy. In specific implementation, particle swarm initialization includes randomly generating particle position and velocity vectors. The dimension of the position vector is consistent with the number of parameters in the attitude angle calculation rule, and the velocity vector is limited within a preset range to prevent overflow. The fitness value calculation involves a weighted sum of geomagnetic feature consistency and attitude angle error, with weight coefficients set according to application requirements. In some embodiments, the attitude angle calculation rule includes a conversion formula from geomagnetic vector to Euler angles. The particle position vector contains coefficients and bias terms from the conversion formula. The optimal attitude angle calculation rule is generated by iteratively updating particle position and velocity. Position and velocity updates use the standard particle swarm optimization formula combined with dynamic inertial weights. Optionally, the geomagnetic data resampling strategy dynamically adjusts the sampling frequency based on the variance distribution of the low-stability geomagnetic region. The attitude angle smoothing filter uses moving average or low-pass filtering methods to reduce fluctuations. The parameter settings of the particle swarm optimization algorithm are shown in the table below. It can be understood that the dynamic inertial weight adjustment strategy balances exploration and utilization through linear decreasing. The selection of the initial and final values of the inertial weight affects the convergence speed, and the particle swarm size is determined according to the complexity of the search space.
[0036] Table 1: Dynamic Inertia Weight Parameter Table
[0037] In its implementation, the iterative process of the particle swarm optimization algorithm includes calculating the fitness value of each particle and updating its individual and global optimal positions. The position and velocity update formulas are combined with dynamic inertia weights. The geomagnetic feature consistency in the fitness function is calculated using the feature values of highly stable geomagnetic regions. Attitude angle error is derived based on sensor fusion data or a reference trajectory. Optionally, the attitude correction action is designed considering the spatiotemporal distribution of low-stability geomagnetic regions. Geomagnetic data resampling is triggered when a sudden increase in variance is detected. Kalman filtering is used for attitude angle smoothing. In practical implementation, the Kalman filter method applied to attitude angle smoothing involves establishing a state-space model of the attitude angles. The state vector consists of the equipment's roll, pitch, and yaw angles and their angular velocity components. The process model describes the dynamic characteristics of the attitude angles evolving over time based on the equipment's kinematic equations. The measurement model uses the attitude angles calculated from geomagnetic direction features extracted from geomagnetic feature maps as observed values. When a low-stability geomagnetic region or geomagnetic anomaly is detected, the Kalman filter's prediction and update steps are triggered. The influence of process noise and measurement noise is minimized by recursively calculating the state estimate and covariance matrix, achieving a smooth output of the attitude angles. The Kalman filter's gain matrix is dynamically adjusted based on the real-time estimated noise covariance to optimize the weight distribution between predicted and measured values, ensuring the stability and continuity of the attitude angle sequence in the presence of geomagnetic interference. The smoothed attitude angles and confidence indices are used together as part of the final equipment attitude parameters. It is understandable that the convergence conditions of the particle swarm optimization algorithm include fitness value changes less than a threshold or reaching the maximum number of iterations. The optimal attitude angle calculation rule is applied to real-time geomagnetic data analysis, and dynamic inertia weight adjustment ensures that the algorithm focuses on global exploration in the early stage of the search and on local fine search in the later stage.
[0038] Example 5: In specific implementation, the attitude estimation strategy is executed to output the equipment attitude parameters, and the weight parameters of the convolutional neural network are updated according to the equipment attitude parameters and geomagnetic anomaly information. Geomagnetic direction features are extracted from the geomagnetic feature map according to the optimal attitude angle calculation rule, and the roll angle, pitch angle, and yaw angle of the equipment are calculated. When a geomagnetic anomaly is detected, an attitude correction action is triggered to resample the geomagnetic data and apply Kalman filtering to smooth the attitude angles. The final equipment attitude parameters are output, including attitude angle values and confidence indices. The equipment attitude parameters are used as a supervision signal to calculate the loss function between the output of the convolutional neural network and the true attitude. The backpropagation algorithm is used to adjust the weight parameters of the convolutional neural network and to focus on optimizing the feature extraction channel corresponding to the geomagnetic anomaly. New geomagnetic sensor data is periodically used to incrementally learn the convolutional neural network to maintain the model's adaptability. The formula for calculating the loss function is expressed as:
[0039] in: It is the value of the loss function. It is the number of training samples. These are the predicted pose parameters output by the convolutional neural network. These are the actual attitude parameters. In some embodiments, attitude angle calculation is based on the transformation relationship between geomagnetic direction features and the reference coordinate system. Roll, pitch, and yaw angles are calculated using direction cosine matrices. Kalman filtering smoothing involves state prediction and measurement update steps to reduce attitude angle fluctuations. Optionally, a confidence index is calculated based on geomagnetic feature consistency and attitude angle error variance to evaluate the reliability of the output attitude parameters. Geomagnetic data resampling increases the sampling frequency or switches the sampling location to obtain more stable data when geomagnetic anomalies are detected. It can be understood that Kalman filtering effectively reduces the impact of noise on attitude angle calculation by fusing geomagnetic data and motion model predictions through a state-space model. The backpropagation algorithm adjusts the weights of the convolutional neural network according to the gradient of the loss function to minimize prediction errors. In specific implementations, the device attitude parameter output includes a real-time attitude angle sequence and corresponding confidence values. The triggering condition for attitude correction actions is based on the spatial density and temporal persistence of geomagnetic anomalies. The incremental learning process uses an online learning algorithm to update the weights of the convolutional neural network to adapt to environmental changes. In some embodiments, the loss function calculation involves a mean squared error or mean absolute error metric, the true pose parameters are derived from high-precision reference sensors or manually labeled data, and the adjustment of convolutional neural network weights includes learning rate scheduling and gradient pruning to prevent training instability. Optionally, feature extraction channel optimization corresponding to geomagnetic anomalies is achieved by increasing loss weights or dedicated regularization terms to improve the model's robustness to anomaly regions. Data management for incremental learning employs a sliding window or priority sampling strategy to retain the latest geomagnetic sensor data. It is understood that the update of convolutional neural network weight parameters is performed through stochastic gradient descent or adaptive optimization algorithms. Focusing on optimizing geomagnetic anomaly channel helps improve the model's pose recognition accuracy in disturbed environments, and periodic incremental learning ensures that the convolutional neural network continuously adapts to changes in the geomagnetic field and device dynamics.
[0040] See Figure 5This graph visually illustrates the trends of training and validation losses in a convolutional neural network (CNN) during the model update phase, showing how these losses change with the number of training epochs. The horizontal axis represents the number of training epochs, and the vertical axis represents the loss function value. The two broken lines represent the training loss and validation loss, respectively. As the graph shows, both losses decrease significantly with increasing training epochs. The initial loss value is high, then decreases rapidly and gradually stabilizes. This graph was generated based on using device pose parameters as supervisory signals, calculating the loss function between the CNN output and the actual pose, and adjusting the weight parameters using the backpropagation algorithm. The continuous decrease in the loss function indicates that the model is constantly learning and optimizing, especially focusing on optimizing the feature extraction channels corresponding to magnetic anomalies, and maintaining adaptability through incremental learning. This allows the model's loss value to approach zero after 50 training epochs, verifying the effectiveness of the mechanism of updating the CNN weights based on device pose parameters and geomagnetic anomaly information. This demonstrates the improved accuracy and enhanced generalization ability of the model in pose recognition tasks.
[0041] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.
Claims
1. A device attitude recognition method based on a geomagnetic sensor, characterized in that: Includes the following steps: S1 Data Preprocessing: The raw triaxial data from the geomagnetic sensor of the real-time acquisition device are sequentially subjected to wavelet transform denoising, Z-score normalization, and time-series window segmentation to generate a preprocessed geomagnetic data sequence; S2 Multi-scale Deep Feature Extraction: Construct a multi-branch convolutional neural network, input the pre-processed geomagnetic data sequence into the network, extract three types of multi-scale features: geomagnetic intensity distribution, geomagnetic gradient change, and geomagnetic direction consistency, and fuse them to generate a gridded geomagnetic feature map. S3 Geomagnetic Data Quality Spatial Partitioning: The DBSCAN density clustering algorithm is used to perform cluster analysis on the geomagnetic feature map. Based on the feature variance, high-stability geomagnetic regions and low-stability geomagnetic regions are divided, and isolated points are identified and marked as geomagnetic anomalies. S4 Adaptive Attitude Estimation Strategy Generation: Using a highly stable geomagnetic region as the search space for the particle swarm optimization algorithm, the optimal attitude angle calculation rule is generated through iterative optimization; combining a low-stability geomagnetic region and geomagnetic anomaly points, attitude correction actions including data resampling and smoothing filtering are configured. S5 Attitude Calculation and Closed-Loop Model Update: Executes attitude estimation strategy to calculate equipment roll angle, pitch angle, and yaw angle, and outputs equipment attitude parameters with confidence; uses attitude parameters as supervision signals, optimizes convolutional neural network weights through backpropagation algorithm, and performs incremental learning to complete model adaptive update.
2. The device attitude recognition method based on a geomagnetic sensor according to claim 1, characterized in that: Step S1 is as follows: S11 Selects symmetric wavelet basis functions to perform multi-level wavelet decomposition on the original geomagnetic data, filters out high-frequency interference based on energy threshold and reconstructs low-frequency coefficients to obtain smooth geomagnetic data; S12 calculates the mean and variance of the smoothed geomagnetic data and performs Z-score standardization. S12 segments the standardized data using a fixed time window to generate preprocessed geomagnetic data sequences of equal length.
3. The device attitude recognition method based on a geomagnetic sensor according to claim 1, characterized in that: Step S2 is as follows: S21 constructs a multi-branch convolutional neural network, with each branch corresponding to a convolutional kernel of different scales, to extract local detail features and global distribution features of geomagnetic data; S22 The preprocessed geomagnetic data sequence is input into a multi-branch convolutional neural network, and processed through convolutional layers, pooling layers and activation functions to output multiple sets of feature maps; S23. The multiple feature maps are fused to generate a comprehensive geomagnetic feature map that represents the spatial distribution of geomagnetic features in a grid format; A feature enhancement layer is set at the end of the multi-branch convolutional neural network, and a piecewise linear activation function is used to perform nonlinear transformation on the fused features to output a gridded geomagnetic feature map.
4. The device attitude recognition method based on a geomagnetic sensor according to claim 1, characterized in that: Step S3 is as follows: S31 sets the neighborhood radius and density threshold, performs density clustering on all feature points in the geomagnetic feature map, and divides the clusters according to the Euclidean distance between feature points and the density threshold. S32 calculates the variance of geomagnetic characteristics for each cluster. Clusters with variances below a preset threshold are considered high-stability geomagnetic regions, while clusters with variances above a preset threshold are considered low-stability geomagnetic regions. S33 marks isolated points without cluster affiliation as geomagnetic anomalies and records their coordinates and eigenvalues.
5. The device attitude recognition method based on a geomagnetic sensor according to claim 1, characterized in that: Step S4 is as follows: S41 uses a highly stable geomagnetic region as the search space for the particle swarm optimization algorithm, initializes the particle swarm, and each particle represents a kind of attitude angle calculation rule; S42 employs a dynamic inertia weight adjustment strategy to optimize the particle swarm, constructs a fitness function based on geomagnetic feature consistency and attitude angle error, and calculates the fitness value of the particles. S43 Iteratively updates the particle position and velocity, and selects the calculation rule corresponding to the particle with the highest fitness as the optimal attitude angle calculation rule; S44 incorporates information from unstable geomagnetic regions and configures attitude correction actions that include data resampling and smoothing filtering.
6. The device attitude recognition method based on a geomagnetic sensor according to claim 1, characterized in that: Step S5 is as follows: S51 attitude calculation prioritizes the use of feature data from highly stable geomagnetic regions; When S52 detects a geomagnetic anomaly, it triggers an attitude correction action, performs geomagnetic data resampling, and uses Kalman filtering to smooth the attitude angles. The S53 output contains the final device attitude parameters, including attitude angle values and confidence indices.
7. The device attitude recognition method based on a geomagnetic sensor according to claim 6, characterized in that: Step S5 is as follows: S51 executes attitude estimation strategies to calculate the equipment's roll angle, pitch angle, and yaw angle, and outputs the equipment attitude parameters with confidence. S52 uses the device attitude parameters as a supervision signal to calculate the loss function between the output of the convolutional neural network and the actual attitude. S53 uses the backpropagation algorithm to adjust the weight parameters of the convolutional neural network and optimize the feature extraction channels corresponding to geomagnetic anomaly points. S54 periodically collects new geomagnetic environment data, performs unsupervised incremental learning on the convolutional neural network, adapts to the dynamic geomagnetic environment, and completes adaptive model updates.