A method and system for behavior scenario recognition to assist in enhancing indoor positioning

CN122590872APending Publication Date: 2026-08-18WUHAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610677841.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-18
Publication Date
2026-08-18

AI Technical Summary

Technical Problem

问题一:传统PDR误差随时间无界累积

Benefits of technology

[0041]综上所述,本发明具有如下创新点:

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122590872A_ABST
    Figure CN122590872A_ABST
Patent Text Reader

Abstract

The application discloses a kind of behavior scene identification auxiliary enhancement indoor positioning method and system.The method first utilizes the multi-source sensor built-in in smart phone to collect inertia, environment and wireless signal data, and constructs "environment-scene-action" layered labeling sample according to fixed time window slice;Second, a kind of layered identification model driven by data model is proposed, the time view feature of Transformer and mask perception statistical view feature are extracted in parallel for each sensor stream, cross-sensor information is aggregated using graph attention network after adaptive fusion, and context probability is output by decoding according to "environment→scene→action" three-level cascade;On this basis, build two-way line positioning enhancement framework: route one uses identification event section and confidence threshold to trigger passageway heading soft constraint and landmark backtracking type smoothing alignment, and enhance traditional Pedestrian Dead Reckoning;Route two freezes the backbone of RoNIN inertial odometer, and introduces a light fusion head to input the action probability as context to realize gated correction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of indoor positioning and navigation technology, specifically relating to a method and system for enhancing indoor positioning with the assistance of behavioral scene recognition for smartphones. Background Technology

[0002] Indoor navigation and location services are essential capabilities for smart cities, smart factories, public safety, and emergency rescue. Unlike outdoor environments, indoor spaces are characterized by multipath propagation and obstruction, the coexistence of structured passages and vertical transportation, and dynamic signal changes due to dense crowds. This makes it difficult for single-source positioning methods to balance cost, continuity, and robustness.

[0003] The mainstream indoor positioning technologies include: (1) Wireless signal-based methods, such as Wi-Fi / BLE fingerprint matching or ranging positioning, which require the pre-collection of a large number of fingerprint databases or the deployment of dedicated base stations and are easily affected by dynamic environmental changes; (2) Vision- or laser-based methods, such as visual SLAM and lidar SLAM, which have high accuracy but high hardware requirements and large computational overhead, making it difficult to run in real time on ordinary smartphones; (3) Pedestrian dead reckoning (PDR) based on inertial sensors, which uses accelerometer step detection, step length model distance estimation, gyroscope or magnetometer to provide heading, and achieves continuous trajectory output through step-by-step recursion, without the need for additional infrastructure, and is one of the most promising basic solutions for indoor navigation in smartphones; (4) Inertial odometry methods based on deep learning, such as IONet, RoNIN, TLIO, RIDI, MEIO, etc., which directly regress velocity or displacement from the original IMU sequence through neural networks, which alleviates the drift problem of traditional inertial integration to a certain extent.

[0004] Despite the advantages of each of the above methods, the following prominent problems still exist in long-term continuous indoor navigation tasks in complex public buildings: Problem 1: Traditional PDR errors accumulate unbounded over time. Low-cost MEMS inertial sensors inevitably contain biases and noise, and the systematic errors in the step size model and heading estimation are continuously amplified through double integration. Especially in long corridor scenarios, small heading biases can translate into continuous lateral drift; in vertical transportation scenarios (elevators, stairs), abrupt changes in motion patterns can render the statistical assumptions of traditional step size models invalid; at indoor-outdoor transition points, prior accumulated errors will become concentrated, leading to overall trajectory deviation.

[0005] Question 2: Learning-based inertial odometry lacks perception and adaptation to changes in carrying motion. Smartphones are carried in various ways during actual use. Different carrying motions significantly alter the amplitude distribution, gait peak shape, and attitude observation stability of the IMU signal. Existing learning-based methods typically process all motion patterns with a uniform feature representation, which easily leads to velocity estimation shifts and implicit heading errors when the motion distribution changes, accumulating into trajectory drift after continuous integration.

[0006] Question 3: Scene / action recognition and localization are independent of each other, lacking a systematic transformation mechanism. Most existing solutions treat action recognition as an independent classification task. Even those that introduce event detection are usually limited to a single scene type or a single constraint form, lacking a systematic framework that can uniformly transform multi-dimensional contextual priors into localization constraints.

[0007] Question 4: Lack of a unified recognition model for smartphone navigation that can simultaneously output probabilities of environment, scene, and action at three levels of context. Existing human activity recognition methods are mostly designed for single classification tasks and do not consider the conditional associations and semantic constraints between "environment-scene-action," resulting in a lack of guarantee of the physical rationality of the output labels (for example, the contradictory combination of "outdoor" and "elevator" may be predicted at the same time). Summary of the Invention

[0008] To address the aforementioned issues, this invention proposes a method for enhancing indoor positioning through behavior scene recognition for smartphones. This method first utilizes the smartphone's built-in multi-source sensors to collect inertial, environmental, and wireless signal data, slicing it into fixed time windows and constructing hierarchical labeled samples of "environment—scene—action." Second, it proposes a hierarchical recognition model jointly driven by data models, extracting Transformer time view features and mask-aware statistical view features in parallel for each sensor stream. After adaptive fusion, it uses a graph attention network (GAT) to aggregate cross-sensor information, and outputs context probabilities through a three-level cascaded decoding of "environment → scene → action." Based on this, a dual-route positioning enhancement framework is constructed: Route 1 utilizes recognition event segments and confidence gating to trigger soft constraints on aisle headings and landmark backtracking smooth alignment, enhancing traditional pedestrian dead reckoning (PDR); Route 2 freezes the RoNIN inertial odometry backbone and introduces a lightweight fusion head to use action probabilities as context input for gating correction. Experiments show that the overall accuracy of the recognition model reaches 93.19%. In multi-scene switching routes, PDR enhancement achieves an absolute trajectory error of 2.699m, and in multi-action switching routes, RoNIN fusion enhancement achieves an absolute trajectory error of 3.411m, both significantly better than pure PDR and various learned odometry baselines. The specific steps include the following: Multi-source sensor data acquisition and preprocessing; A hierarchical context recognition model is constructed, extracting temporal view features and statistical view features for each sensor stream. After adaptive fusion, cross-sensor information is aggregated through a graph attention network. Finally, the context probability and label are output by three-level cascaded decoding according to environment → scene → action. The context event segment extraction is aligned with the timeline. Continuous recognition outputs are merged into event segments based on label consistency. The comprehensive confidence score is calculated, and an interval query relationship is established with the PDR step event timeline. A dual-route positioning enhancement module is constructed. Route 1 is a recognition-driven traditional PDR enhancement, and Route 2 is a recognition-enhanced learning-based inertial odometry correction. The two routes complement and cooperate to jointly suppress the cumulative drift from different sources and obtain the final trajectory.

[0009] Furthermore, during preprocessing, a hierarchical context labeling system of environment-scene-action is adopted. The environment layer is divided into three categories: indoor, semi-open, and outdoor. The scene layer is defined based on the environment layer: the indoor environment is subdivided into four categories: corridor, stairs, elevator, and escalator; the semi-open environment is subdivided into two categories: walking and stationary; the outdoor environment is no longer subdivided into scenes, is marked as no scene, and scene loss is ignored during training. The action layer describes the user's way of carrying the device, including five categories: holding, making or receiving calls, hanging down, swinging the arm, and putting the device in the pocket.

[0010] Furthermore, the extraction method for time view features is as follows: Let S be the set of sensors, Indicates one of the sensors; for those containing For a batch of data segments, for any one data sample, the input sequence of sensor s is represented as: ,in This represents the maximum length of the padded sequence. For the original feature dimension, Boolean mask Used to indicate the valid time step that is not filled; The time view branch first projects the original sequence through a linear projection matrix. Mapped to a shared hidden dimension d, and then fed into a Transformer encoder after overlaying positional encoding:

[0011] in For sensors The corresponding Transformer encoder, This indicates a position encoding operation. For sensors The linear projection matrix, The encoded hidden representation sequence; The encoded output is compressed in time dimension using global average pooling to obtain a fixed-length temporal feature embedding. That is, time view features, with dimensions of ; The methods for extracting features from statistical views are as follows: To characterize the amplitude distribution and global stability of complementary time coding, the effective time step set... Calculate the statistics for mask sensing; for each feature channel Calculate the mean and standard deviation:

[0012]

[0013] in, Indicates time window Sampling time within, Represents time step At the time The values ​​that can be taken on each feature This represents the total number of time steps contained within the time window. Further statistical analysis was conducted on the maximum, minimum, root mean square, and mean absolute deviation. Additionally, to characterize the short-term trend of the sequence, the mean absolute rate of change was introduced.

[0014] in ; The above seven types of statistics are concatenated into a vector along the channel dimension. And obtain statistical feature embeddings through linear mapping. That is, statistical view features.

[0015] Furthermore, the method for aggregating cross-sensor information using graph attention networks is as follows: In acquiring the independent embedding of all sensors Subsequently, cross-sensor dependencies are modeled using the Graph Attention Network (GAT), where independent embeddings... It is obtained by weighting time view features and statistical view features; each sensor is treated as a node, and a directed fully connected graph containing self-loops is constructed. ,in Let be the set of nodes in the graph. For the set of all edges, graph nodes The neighborhood is defined as ,in The difference operation represents the set operation, and the node represents the subtraction operation. The neighborhood of a node is the set of all nodes. Remove its own node Composition; the GAT layer first calculates the nodes and Attention coefficient between:

[0016] in For nodes For nodes Attention weights For a shared linear transformation matrix, For attention parameter vectors, This represents vector concatenation. It is a modified linear activation function with leakage; Based on this, the updated node representation is obtained by aggregating neighborhood information:

[0017] in It is a non-linear activation function; After multi-layer aggregation, global mean pooling is used to obtain the segment-level fusion representation. As a global behavioral representation of the entire multi-sensor data segment, it is used for subsequent layered decoding, where This represents the feature dimension size of the global behavior representation vector. This represents the batch size.

[0018] Furthermore, the specific implementation of the three-level cascaded decoding output of context probability and label according to environment → scene → action is as follows: First, the environmental prediction head is based on a global representation. Output environment probability:

[0019] in A fully connected mapping for the environment classification head. The original predicted scores are normalized into a probability distribution; Secondly, the scene prediction head is only activated in indoor and semi-open environments; indoor branch prediction predicts four categories {elevator, escalator, corridor, stairs}, and semi-open branch prediction predicts two categories {walking, stationary}; for outdoor environments, the scene label is recorded as no scene and the scene loss term is ignored during training. Finally, the action prediction head will provide a global representation. The probability vectors of the environment and the corresponding scene are concatenated as conditional inputs to achieve lower-level action discrimination under the semantic constraints of the upper layer. To ensure semantic consistency, an action feasibility rule base is introduced. Where e and c represent the environment and scene categories, respectively. This represents the set of action category indices allowed under the combination of environment e and scene c; the original prediction score of action category k is masked.

[0020] in It is a constant. Indicates the category of action The original prediction score before masking; This indicates the action category after masking. The corresponding updated predicted score; the updated predicted score is... After normalizing the function, the action prediction probability vector is obtained.

[0021] Furthermore, the specific processing steps for extracting context event segments and aligning them with the timeline are as follows: The raw sensor logs are sorted by time window length. Slice the data using non-overlapping windows and record the start time for each slice. and end time For the i-th time window, the hierarchical context recognition model outputs three probability vectors. , , and discrete labels ,in, , and They represent the first The output of each time window includes an environment probability vector, a scene probability vector, and an action probability vector. , and They respectively represent the first probability vector determined by the above probability vector. Discrete labels for environment prediction, scene prediction, and action prediction within a time window; To measure prediction reliability and serve subsequent constraint gating, a comprehensive confidence level is defined:

[0022] in Indicates the first The overall confidence level for each time window is conservatively estimated by taking the minimum of the three maximum probabilities. This is to cover the special case of outdoor scenes without defined scene categories, and a modified scene confidence score is introduced. When the environment is determined to be outdoor and the scene is without scene, ,otherwise To reduce the impact of single-window prediction jitter on event triggering, adjacent windows are merged based on label continuity and consistency, targeting the scene label sequence. Define group numbering:

[0023] in, Indicates the first The group number to which each time window is divided; This is an indicator function; it takes the value 1 when the condition inside the parentheses is true, and 0 otherwise. Group windows within the same group into candidate event segments. Only retain lengths of at least The event block for each window is used for subsequent constraint triggering; During stepwise integration in PDR, the timestamp corresponding to each step peak is... Perform a range query in the state sequence. This allows us to obtain the context label and its confidence level corresponding to the current step, achieving timeline alignment between the identified segment and the PDR step event. Further, the specific processing steps for Route 1 are as follows: The initial trajectory is obtained based on traditional PDR: Let the triaxial acceleration be... , , First, calculate the magnitude of the resultant acceleration:

[0024] right Second-order low-pass Butterworth filtering is performed to obtain Then, peak detection and extraction of the peak time are performed. Valid gait events satisfy the amplitude threshold and minimum step interval constraints:

[0025] in, The set peak acceleration threshold is used to filter out minor fluctuations caused by non-stepping. The minimum step interval is set to prevent the same step from being detected repeatedly; for each step peak, a local window of a certain time is set to its left and right. Internal calculation of acceleration range Step length Estimated using the Weinberg model:

[0026] Where K is an empirical coefficient; the heading is determined by the AHRS yaw angle sequence. Interpolation to peak time yields Mapped to the direction angle in a Cartesian coordinate system ,in, This represents a function that converts angle values ​​to radians; the trajectory is recursively calculated as follows:

[0027] in, and These represent the pedestrians at the 1st and 2nd positions, respectively. The x and y coordinates of the two-dimensional planar position at each step; and These represent the pedestrians at the 1st and 2nd positions, respectively. The updated two-dimensional plane x and y coordinates after each step; The conditions for setting trigger constraints based on confidence gating and security mechanisms are as follows: In order to avoid introducing incorrect constraints due to identification noise, the activation of all constraints is jointly controlled by the following conditions: (1) Comprehensive confidence Not lower than the threshold (2) For an event segment, n consecutive window labels are consistent and the confidence level is met; (3) The distance between the current location and the landmark does not exceed the neighborhood radius r; The constraint can be triggered only when all the above conditions are met. The initial trajectory is corrected based on the scene type identified by the hierarchical context recognition model and the event segments after timeline alignment.

[0028] Furthermore, the initial trajectory is corrected by including: Aisle Main Heading Soft Correction: When the hierarchical context recognition model determines that the current step is in an indoor environment and the confidence level exceeds a threshold, a main heading magnetic soft constraint is introduced for the heading; a predefined set of main directions is used. For each step of the original heading Calculate the signed angle difference between it and each principal direction. Normalized to the interval [-180, 180], where, For a predefined set of principal directions Any candidate principal direction angle; take the nearest principal direction:

[0029] like , If the tolerance angle is used, a progressive magnetic attraction method is employed for correction.

[0030] in The magnetic attraction coefficient; make During trajectory recursion, replace ; Backtracking smooth landmark alignment: When the identified event segment corresponds to a clear landmark, backtracking smoothing is used to achieve anchor point alignment that triggers identification and naturally attracts the landmark; during online integration, a trajectory buffer segment that has not yet solidified since the last anchor point correction is maintained. After triggering, define the end-point drift:

[0031] in For the target landmark coordinates, For the current end estimate; for any point within the buffer segment Smoothing correction is performed using linear time weights:

[0032]

[0033] because , After correction, it meets the requirements. and This achieves the effect of aligning the end with the landmark, maintaining continuity at the beginning, and linearly distributing the error in the middle section, satisfying only the current position. And it is enabled when the event segment determination is stable. The neighborhood radius; Special handling for elevator events: Brief pauses and small-scale displacements during the elevator waiting and entering phases can cause misalignment of a standard PDR near the doorway; special handling is required for the identified elevator event segments. Enable constraints within the lead / lag window:

[0034] Current position satisfies At that time, a backtracking smooth alignment is performed on the buffer segment before the trigger to the doorway landmark, wherein, Indicates the first The position coordinates of the step, As a landmark at the elevator entrance, The neighborhood threshold; To depict the short-term pattern of waiting → entering, the most recent time before triggering is... The historical trajectory of seconds is rewritten; let the waiting point be... The points inside the car are For any point in the backtracking window: record Let the elevator event constraint trigger time be set. If time difference Then the linear interpolation is:

[0035] Otherwise, set as a waiting point. After backtracking is complete, the current position will be constrained to [location] during the duration of the elevator event. Within a certain range, to avoid random drift caused by zero speed / short step within the elevator; Staircase event step length scaling: Significant changes in human and mobile phone posture occur when ascending or descending stairs, causing step length statistics to deviate from those observed on flat ground; for the identified staircase event segments... And consider entering the advance window. ,when Step scaling compensation is introduced at this time:

[0036] in This is the scaling factor for the staircase step length. Replace the recursive formula in the trajectory By combining the backtracking smoothing of the stairwell landmarks, the alignment of key transfer points is achieved.

[0037] Furthermore, the specific processing procedure for Route 2 is as follows: The frozen RoNIN backbone network is used as a learned inertial odometry system, with the attitude-aligned IMU sequence in the global coordinate system as input, to regress the global plane velocity. The baseline coordinate trajectory is obtained by time integration:

[0038] Freeze all parameters of the RoNIN backbone network without changing its structure and weights, and only extract the intermediate representation vector before its output layer. This serves as the input for the subsequent fusion head; The fusion head receives two inputs: RoNIN intermediate representation. The action probability vector output after time axis alignment ; The fusion head adopts a contextual attention + gating correction structure, with the attention module using... To query the Weighted enhancement is performed, followed by a correction of the predicted position by the modified branch. The gating value is given by the gating branch. The final corrected trajectory is represented as follows:

[0039] in The RoNIN baseline trajectory; Training and Inference: During the training phase, only the parameters of the fusion head are updated, while the RoNIN backbone parameters remain frozen. The positional error between the reference trajectory and the RoNIN baseline trajectory is used as the supervision signal. Optimization during training phase and The mean square error between them; and at the same time for A lightweight regularization term is added to suppress the correction amplitude; during the inference phase, the velocity is first output by RoNIN and integrated to obtain the baseline trajectory. Then, the fusion head predicts the correction amount and gating value based on the real-time action probability, performs time-domain smoothing and interpolation on the correction amount sequence to align it with the complete time axis, and finally obtains the corrected trajectory. .

[0040] The present invention also provides a system for behavior scene recognition-assisted enhanced indoor positioning, including a processor and a memory. The memory is used to store program instructions, and the processor is used to call the program instructions in the memory to execute a method for behavior scene recognition-assisted enhanced indoor positioning as described in the above technical solution.

[0041] In summary, the present invention has the following innovative features: Innovation Point 1: This paper proposes a multi-sensor fusion behavior scene recognition method driven by a joint data model. The method extracts Transformer temporal view embeddings and mask-aware statistical view embeddings in parallel for each sensor data stream. It then weights and merges these two types of features through an adaptive fusion mechanism, models cross-sensor correlations using a Graph Attention Network (GAT), and finally performs cascaded decoding according to the semantic hierarchy of "environment → scene → action". The prediction results of the upper layer serve as the conditional input for the prediction of the lower layer, and a semantic feasibility rule mask is introduced to ensure the consistency of the output labels in terms of physical constraints.

[0042] Innovation Point Two: A traditional PDR enhancement method based on event segment recognition and confidence gating is proposed. The time-indexed state sequence output by the recognition model is aligned with the step event timeline of the PDR. In corridor scenarios, a "magnetic" heading soft constraint is introduced in the main direction to progressively suppress lateral drift. Landmark-triggered backtracking smooth alignment is introduced at key locations such as elevators, staircases, and indoor / outdoor entrances. Linear time weights are used to continuously distribute the terminal error across the historical trajectory within the backtracking window, completing anchor point correction without causing hard jumps. All constraints are subject to comprehensive confidence thresholds and continuous consistency discrimination gating to avoid erroneous corrections due to single misjudgments.

[0043] Innovation Point 3: A gating correction method is proposed that freezes the RoNIN backbone and introduces a lightweight context fusion head. This method extracts intermediate representation vectors from the RoNIN output module, uses the action probability vector output by the recognition model as context input, and after attention enhancement, the correction branch predicts the position correction amount, while the gating branch provides the confidence weight. The final trajectory is represented as the baseline trajectory plus the gating correction amount. When the context is unreliable, the gating value approaches zero, causing the model to naturally degenerate into the baseline RoNIN, thus ensuring safety.

[0044] This invention systematically transforms the results of multi-dimensional contextual behavior scene recognition into constraint and compensation signals in the positioning process, effectively suppressing the cumulative drift of traditional PDR and learning inertial odometry in complex indoor environments, and significantly improving positioning accuracy while maintaining trajectory continuity and topological consistency. Attached Figure Description

[0045] Figure 1 Overall architecture diagram of indoor positioning for enhanced behavior scene recognition.

[0046] Figure 2 A framework diagram of a behavior scene recognition model jointly driven by data models.

[0047] Figure 3 A complete flowchart for enhanced dual-route positioning.

[0048] Figure 4 The figure shows the experimental results of the model classification test.

[0049] Figure 5 This is a comparison chart of the results of indoor positioning test experiments. Detailed Implementation

[0050] The technical solution of the present invention will be further described below with reference to the accompanying drawings and embodiments.

[0051] To better understand the content of this invention, the relevant symbols are explained below:

[0052] Figure 1 The overall system architecture of this invention is demonstrated, comprising an upper "data model-driven high-precision recognition of multimodal behavioral scenes" module and a lower "behavioral scene recognition-assisted positioning enhancement method" module. This invention provides a method for enhancing indoor positioning with behavioral scene recognition assistance for smartphones, and its overall technical approach includes the following core components: (1) Multi-source sensor data acquisition and preprocessing: Using the accelerometer, gyroscope, magnetometer, barometer and GNSS, light, Wi-Fi and Bluetooth sensors built into the smartphone, multi-modal data streams are acquired with a unified clock and sliced, aligned and standardized according to a fixed time window (5 seconds, non-overlapping) to form a sample format that can be used for model input.

[0053] (2) Hierarchical context recognition model: extract time view features and statistical view features for each sensor stream, and then aggregate cross-sensor information through graph attention network after adaptive fusion. Finally, the context probability and label are output by three-level cascade decoding of "environment → scene → action".

[0054] (3) Context event segment extraction and time alignment: The continuous identification outputs are merged into event segments according to the label consistency, the comprehensive confidence is calculated, and an interval query relationship is established with the PDR step event time axis.

[0055] (4) Dual-route localization enhancement: Route 1 is recognition-driven traditional PDR enhancement (scene constraints), and Route 2 is recognition-enhanced learning-based inertial odometry correction (motion compensation). The two routes complement each other and work together to suppress cumulative drift from different sources.

[0056] The specific processing procedure is as follows: (1) Multi-sensor data acquisition and preprocessing: Data acquisition relies on a custom-developed Android acquisition application to uniformly record timestamps and data streams from multiple sensor sources. The acquired information sources cover inertial, environmental, and wireless signal modes, mainly including: accelerometers, gyroscopes, magnetometers, barometers, gravity / linear acceleration, attitude (rotation vector), GNSS (outdoor / semi-open), illumination, Wi-Fi and Bluetooth scan results, etc. Inertial sensors record at the highest frequency mode allowed by the device (usually in the range of 50-200Hz), while other sensors record according to the system update cycle. All data streams are timestamped with a unified millisecond-level clock and aligned according to time windows during the offline phase.

[0057] The preprocessing stage divides continuous data into fixed-length windows. This invention uses windows with a length of... Non-overlapping time windows are used to slice each sensor sequence. Data segments shorter than a complete window are discarded. The original sampling density is preserved within the window. Zero-padding is performed on variable-length sequences during batch processing, and a Boolean effective mask is constructed from the actual length. This is used for mask-aware calculations in subsequent statistical branches, thus avoiding contamination of the feature distribution by padding values. Data cleaning includes handling NaN / Inf outliers, normalization / standardization by sensor channel, and removal of extreme noise segments.

[0058] This invention employs a hierarchical contextual annotation system of "environment-scene-action". The environment layer is divided into three categories: indoor, semi-open (such as entrance / exit transition areas, corridors, etc.), and outdoor. The scene layer is conditionally defined based on the environment layer: indoor environments are further subdivided into four categories: corridors, stairs, elevators, and escalators; semi-open environments are subdivided into two categories: walking and stationary; outdoor environments are not further subdivided into scenes and are marked as no scene (N / A), and scene loss is ignored during training. The action layer describes the user's carrying method, including five categories: holding, making / receiving calls, hanging down, swinging, and putting in pocket. This hierarchical design maintains semantic consistency with the cascaded decoding strategy of subsequent models, aligning the annotation space with the prediction space, thereby reducing unreasonable label combinations.

[0059] (2) Hierarchical context recognition model, Figure 2The internal structure of the hierarchical recognition model is shown in detail, including single-sensor dual-view feature extraction, GAT cross-sensor aggregation network, and hierarchical cascaded output head.

[0060] (2.1) Single Sensor Feature Extraction – Time View Branch: Let S be the set of sensors, This refers to one specific sensor. For those containing... A batch of data segments, the input sequence of sensor s is represented as: ,in This represents the maximum length of the padded sequence. Original feature dimension. Boolean mask. Used to indicate the valid time step that is not filled.

[0061] The time view branch first projects the original sequence through a linear projection matrix. Mapped to the shared hidden dimension d, and then fed into the Transformer encoder after overlaying positional encoding (PE):

[0062] in For sensors The corresponding Transformer encoder, This indicates a position encoding operation. For sensors The linear projection matrix, This is the encoded hidden representation sequence.

[0063] The encoded output is compressed in time dimension using global average pooling to obtain a fixed-length temporal feature embedding. This design unifies and aligns heterogeneous sensor sequences of different dimensions to a single dimension. The shared representation space facilitates subsequent cross-sensor fusion.

[0064] (2.2) Single sensor feature extraction – masked sensing statistical view branch: for complementary time coding to characterize amplitude distribution and global stability, the model at the effective time step set Calculate the statistics for mask sensing. For each feature channel... Calculate the mean and standard deviation:

[0065]

[0066] in, Indicates time window Sampling time within, Represents time step At the time The values ​​that can be taken on each feature This represents the total number of time steps contained within the time window.

[0067] Further statistical analysis was performed on the maximum, minimum, root mean square, and mean absolute deviation (MAD). Additionally, to characterize the short-term trend of the series, the mean absolute rate of change (MAC) was introduced.

[0068] in .

[0069] The above seven types of statistics are concatenated into a vector along the channel dimension. And obtain statistical feature embeddings through linear mapping. Because statistical branches explicitly exclude padding values ​​through a masking mechanism, they can still provide robust distribution summaries even when sequence quality varies.

[0070] (2.3) Adaptive Dual-View Fusion: To address the varying degrees of dependence on temporal and statistical features across different sensors and behavioral patterns, the model employs an adaptive fusion mechanism. The two types of embeddings are concatenated into a single image. And a normalized weight distribution is generated through a multilayer perceptron (MLP):

[0071] in For sensors The corresponding multilayer perceptron, ensure and The sum of them is .

[0072] The weighted fusion of a single sensor is represented as follows:

[0073] in This mechanism allows the model to make soft selections and adaptive trade-offs between the two types of view information based on the current sensor reliability and fragment dynamics, rather than relying on a fixed fusion ratio.

[0074] (2.4) Graph Attention Network Cross-Sensor Aggregation: In acquiring independent embeddings of all sensors Subsequently, the model models cross-sensor dependencies using a Graph Attention Network (GAT). Each sensor is treated as a node, and a directed fully connected graph containing self-loops is constructed. ,in Let be the set of nodes in the graph. For the set of all edges, graph nodes The neighborhood is defined as ,in The difference operation represents the set operation, and the node represents the subtraction operation. The neighborhood of a node is the set of all nodes. Remove its own node Composition. The GAT layer first calculates the nodes. and Attention coefficient between:

[0075] in For sensor nodes For nodes Attention weights For a shared linear transformation matrix, For attention parameter vectors, This represents vector concatenation. This is a modified linear activation function with leakage.

[0076] Based on this, the updated node representation is obtained by aggregating neighborhood information:

[0077] in It is a non-linear activation function.

[0078] After multi-layer aggregation, global mean pooling is used to obtain the segment-level fused representation. As a global behavioral representation of the entire multi-sensor data segment, it is used for subsequent layered decoding, where This indicates the feature dimension size of the global behavior representation vector. This represents the batch size.

[0079] (2.5) Cascaded hierarchical decoding strategy: Predictive decoding follows the hierarchical constraints of "environment → scene → action" for cascaded prediction.

[0080] First, the environmental prediction head is based on a global representation. Output environment probability:

[0081] in A fully connected mapping for the environment classification head. The original predicted scores of the model are normalized into a probability distribution.

[0082] Secondly, the scene prediction head only activates in indoor and semi-open environments. Indoor branches predict four categories: {elevator, escalator, corridor, stairs}, while semi-open branches predict two categories: {walking, stationary}. For outdoor environments, the scene label is recorded as no scene, and the scene loss term is ignored during training.

[0083] Finally, the action prediction head will provide a global representation. The probability vectors of the environment and the corresponding scene are concatenated as conditional inputs to achieve "lower-level action discrimination under upper-level semantic constraints". To ensure semantic consistency, an action feasibility rule base is introduced. Here, e and c represent the environment and scene categories, respectively, and A(e,c) represents the set of action category indices allowed under the combination of environment e and scene c. The original predicted score of action category k is then masked.

[0084] in It is a relatively large constant. Indicates the category of action The original prediction score before masking; This indicates the action category after masking. The corresponding updated predicted score; the updated predicted score is... After function normalization, the action prediction probability vector is obtained. This rule mask filters out action categories that do not conform to semantic constraints before softmax normalization, ensuring that the final output remains logically consistent across the three dimensions of environment, scene, and action.

[0085] (2.6) Multi-task joint loss function: The model training uses a multi-task joint loss function for optimization:

[0086] in and Used to balance the weights of auxiliary tasks. The right side of the equals sign... , and These represent the losses for environment classification, scene classification, and action classification tasks, respectively. Regarding the calculation methods for these three losses: considering the potential imbalance in the distribution of class samples, the loss for environment classification is calculated as follows: Loss related to action classification tasks All calculations use the weighted cross-entropy loss function; since outdoor environments do not contain scene labels, the scene classification task loss... When using the cross-entropy loss function, -1 is used as the ignore index to ignore outdoor sample segments that do not contain scene labels. The optimizer uses AdamW, and the learning rate scheduler adopts a learning rate decay strategy based on the evaluation metric stagnation (ReduceLROnPlateau). The training process supports automatic mixing of precision and gradient clipping to improve training stability.

[0087] (3) Context event segment extraction and time alignment: In order to transform the inference output of the recognition model into a state sequence that can be queried by PDR, the original sensor logs are aligned according to the time window length. Slice the data using non-overlapping windows and record the start time for each slice. and end time For the i-th time window, the recognition model outputs three probability vectors. , , and discrete labels ,in, , and They represent the first The output of each time window includes an environment probability vector, a scene probability vector, and an action probability vector. , and They respectively represent the first probability vector determined by the above probability vector. Discrete labels for environment prediction, scene prediction, and action prediction within a time window.

[0088] To measure prediction reliability and serve subsequent constraint gating, a comprehensive confidence level is defined:

[0089] in Indicates the first The overall confidence level of each time window is conservatively estimated by taking the minimum value among the three maximum probabilities. This is to cover the special case of outdoor scenes without defined scene categories, and a modified scene confidence score is introduced. When the environment is determined to be outdoor and the scene is without scene, ,otherwise This processing avoids the passive decay of confidence caused by "no outdoor scene".

[0090] To reduce the impact of single-window prediction jitter on event triggering, adjacent windows are merged based on label continuity and consistency. This is done using the scene label sequence. For example, define the group number:

[0091] in, Indicates the first The group number to which each time window is divided; This is an indicator function; it takes the value 1 when the condition within the parentheses is true, and 0 otherwise.

[0092] Group windows within the same group into candidate event segments. Only retain lengths of at least [amount missing]. The event segments of each window are used as valid elevator events, valid stair events, or valid outdoor events for subsequent constraint triggering.

[0093] During stepwise integration in PDR, the timestamp corresponding to each step peak is... Perform a range query in the state sequence. This allows us to obtain the context label and its confidence level corresponding to the current step, thereby achieving timeline alignment of "identified fragment - PDR step event".

[0094] (4) Figure 3 The complete process of dual-route localization enhancement is shown, including behavior scene recognition prior generation (corresponding to (3) context event segment extraction and time alignment), PDR constraint triggering and adaptive correction route (corresponding to (4.1) enhancement route one), and RoNIN-based recognition enhancement fusion network route (corresponding to (4.2) enhancement route two: recognition enhancement learning inertial odometry correction).

[0095] (4.1) Enhancement Route 1: Recognition-driven traditional PDR enhancement. Its input includes two parts: the first part is real-time three-axis acceleration data used for step peak detection, step size estimation, and heading recursion, as well as the yaw angle sequence calculated by AHRS (Attitude and Heading Reference System); the second part is the context state sequence and its confidence after time axis alignment. The context state sequence includes at least environment labels and scene labels. Its output is: the corrected two-dimensional trajectory sequence calculated under recognition prior and confidence gating trigger, after main direction "magnetic attraction" heading compensation, landmark-triggered backtracking smooth alignment, and step size adaptive adjustment.

[0096] (4.1.1) Obtaining the initial trajectory based on traditional PDR: This invention uses the classic step-event-based PDR as the baseline algorithm for the enhanced framework. Let the triaxial acceleration be... , , First, calculate the magnitude of the resultant acceleration:

[0097] right Second-order low-pass Butterworth filtering (zero-phase forward-backward processing) is performed to obtain Then, peak detection and extraction of the peak time are performed. Valid gait events must satisfy amplitude threshold and minimum step interval constraints:

[0098] in, The set peak acceleration threshold is used to filter out minor fluctuations caused by non-stepping. The minimum step interval is set to prevent the same step from being detected repeatedly. For each step peak, a local window of 0.5 seconds is set to the left and right of it. Internal calculation of acceleration range Step length Estimated using the Weinberg model:

[0099] Where K is an empirical coefficient. The heading is determined by the AHRS yaw angle sequence. Interpolation to peak time yields Mapped to the direction angle in a Cartesian coordinate system in, This represents a function that converts angle values ​​to radians. The trajectory is recursively calculated as follows:

[0100] in, and These represent the pedestrians at the 1st and 2nd positions, respectively. The x and y coordinates of the two-dimensional planar position at each step; and These represent the pedestrians at the 1st and 2nd positions, respectively. The two-dimensional plane x and y coordinates after the position is updated at each step.

[0101] (4.1.2) Conditions for setting trigger constraints based on confidence gating and security mechanisms: In order to avoid introducing incorrect constraints due to identification noise, the activation of all constraints is jointly controlled by the following conditions: (1) Comprehensive confidence Not lower than the threshold (2) For an event segment, the labels of n consecutive windows must be consistent and the confidence level must be met (consistency consistency judgment); (3) The distance between the current location and the landmark must not exceed the neighborhood radius r. Constraints can be triggered only when all the above conditions are met, so as to control the impact of misidentification on the trajectory to a minimum.

[0102] (4.1.3) Correct the initial trajectory based on the scene type identified by the recognition model and the event segments after time axis alignment; (4.1.3.1) Soft Correction for Main Course of the Corridor: When the recognition model determines that the current step is in an indoor environment and the confidence level exceeds a threshold, a "magnetic" soft constraint is introduced on the main course. A predefined set of main courses is used. For each step of the original heading Calculate the signed angle difference between it and each principal direction. (Normalized to the interval [-180, 180]), where, For a predefined set of principal directions Any candidate principal direction angle in the range.

[0103] Take the nearest main direction:

[0104] like ( (where the tolerance angle is), then a gradual magnetic attraction method is used for correction:

[0105] in is the magnetic attraction coefficient.

[0106] make During trajectory recursion, Replace (4.1.1) in The update iterates step by step to gradually approach the main direction, suppressing lateral drift in passageways while preserving natural transitions at turns.

[0107] (4.1.3.2) Backtracking Smoothing Landmark Alignment: When the identified event segment corresponds to a clear landmark (such as a stairwell entrance, exit, or elevator door), backtracking smoothing is used to achieve "identification trigger - natural adsorption" anchor point alignment. During online integration, a trajectory buffer segment that has not yet solidified since the last anchor point correction is maintained. After triggering, define the end-drift:

[0108] in For the target landmark coordinates, For the current end estimate. For any point within the buffer segment. Smoothing correction is performed using linear time weights:

[0109]

[0110] because , After correction, it meets the requirements. and This achieves the effects of aligning the end with the landmark, maintaining continuity at the beginning, and linearly distributing errors in the middle section. It only satisfies the requirements at the current position. ( Enabled when the neighborhood radius is (and the event segment determination is stable).

[0111] (4.1.3.3) Special Handling of Elevator Events: Brief pauses and small-scale displacements during the elevator waiting and entering phases can cause misalignment of the standard PDR near the doorway. For the identified elevator event segments... Enable constraints within the lead / lag window:

[0112] Current position satisfies At that time, the buffer segment before the trigger is first smoothly aligned back to the doorway landmark, where, Indicates the first The position coordinates of the step, As a landmark at the elevator entrance, This is the neighborhood threshold.

[0113] Furthermore, to characterize the short-term "waiting → entering" pattern, the most recent time before triggering is... The historical trajectory of seconds is rewritten by backtracking. Let the waiting point be... The points inside the car are For any point in the backtracking window: record Let the elevator event constraint trigger time be set. If time difference Then the linear interpolation is:

[0114] Otherwise, set as a waiting point. After backtracking is complete, the current position will be constrained to [location] during the duration of the elevator event. To avoid random drift caused by zero speed / short steps inside the elevator.

[0115] (4.1.3.4) Staircase Event Step Length Scaling: When ascending or descending stairs, the posture of the human body and mobile phone changes significantly, and the step length statistical characteristics deviate from walking on flat ground. For the identified staircase event segments... And consider entering the advance window. ,when Step scaling compensation is introduced at this time:

[0116] in The scaling factor for stair step length ( (Because the stride length on stairs is usually shorter than that on flat ground). Replace the recursive formula for the trajectory in (4.1.1) By combining the backtracking smoothing of the stairwell landmarks, the alignment of key transfer points is achieved.

[0117] (4.2) Enhancement Route Two: Identify and enhance the learning inertial odometry (i.e., freeze RoNIN backbone) correction. Its input also includes two parts. The first part is: the attitude-aligned global coordinate system IMU sequence (three-axis acceleration and angular velocity) as the input of the basic learning inertial odometry (i.e., the frozen RoNIN backbone network), which is used to output baseline velocity estimation and integral calculation of baseline trajectory. And extract intermediate representation vectors The second part consists of the motion probability vectors for five types of handheld actions (holding, answering a phone call, hanging down, swinging the arm, and putting the phone in a pocket), output after timeline alignment. Its output is the final corrected sequence of position coordinates, which is generated by the fusion head based on the intermediate representation vector. The position correction amount is predicted in conjunction with the action probability. and gate value Then compared with the baseline trajectory The final trajectory is obtained by merging, smoothing and interpolating in the time domain.

[0118] (4.2.1) Freezing the RoNIN backbone: RoNIN is a learning-based inertial odometry system based on a 1D residual convolutional network. It takes the attitude-aligned IMU sequence in the global coordinate system as input and regresses the global plane velocity. Integrating it over time yields the baseline coordinate trajectory:

[0119] This invention freezes all backbone network parameters of RoNIN without altering its structure and weights, only extracting intermediate representation vectors before its output layer. This serves as the input for the subsequent fusion head.

[0120] (4.2.2) Lightweight Context Fusion Header: The fusion head receives two inputs: RoNIN intermediate representation and action probability vector (The posterior probability of the five types of carrying actions: holding, answering the phone, hanging down, swinging the arm, and putting the device in the pocket).

[0121] The fusion head adopts a "contextual attention + gating correction" structure. The attention module uses... To query the Weighted enhancement is performed, followed by a correction of the predicted position by the modified branch. The gating value is given by the gating branch. The final corrected trajectory is represented as follows:

[0122] in This is the RoNIN baseline trajectory. The gating mechanism allows the model to pass through when the context is unreliable or out of distribution. It naturally degrades to the baseline RoNIN output, thus avoiding the risks of over-correction.

[0123] (4.2.3) Training and Inference: During the training phase, only the parameters of the fusion head are updated; the RoNIN backbone parameters remain frozen. The positional error between the reference trajectory (LiDAR SLAM) and the RoNIN baseline trajectory is used as the supervision signal. Optimization during training phase and The mean square error between them. At the same time, for A lightweight regularization term is added to suppress the correction magnitude, encouraging the model to maintain conservative corrections when there is no clear error signal.

[0124] In the inference phase, RoNIN first outputs the velocity and integrates it to obtain the baseline trajectory. Then, the fusion head predicts the correction amount and gating value based on the real-time action probability, performs time-domain smoothing and interpolation on the correction amount sequence to align it with the complete time axis, and finally obtains the corrected trajectory. .

[0125] Figure 4 The hierarchical recognition model is shown to perform classification on independent test sets, including overall accuracy for each task, environment classification confusion matrix, scene classification confusion matrix, and action classification confusion matrix.

[0126] Figure 5 The comparison of positioning accuracy between the two verification routes is shown, including bar charts of ATE / RTE indicators for each method and comparison of the superimposed trajectories of multiple methods on the indoor floor plan.

[0127] This demonstrates that the present invention has the following beneficial effects: (1) Recognition model performance: On the self-built multi-source sensor data independent test set, the overall classification accuracy of the hierarchical recognition model reached 93.19%, of which the environmental classification accuracy was 96.16%, the scene classification accuracy was 94.14%, and the action classification accuracy was 98.62%. The high recognition accuracy provides a reliable contextual prior for subsequent localization enhancement.

[0128] (2) Route 1 Evaluation: This route maintains the same carrying action but undergoes frequent scene changes (covering indoor and outdoor crossings, elevators, stairs, and other level changes), using the LiDAR SLAM trajectory as the true benchmark. The PDR enhancement method of this invention achieves the best results with ATE=2.699m and RTE@10m=3.765m, which reduces the absolute trajectory error by 84.8% compared to pure PDR (ATE=17.705m) and by 27.6% compared to RoNIN (ATE=3.727m). It is also significantly better than learning baselines such as MEIO (5.537m), RIDI (7.280m), and TLIO (8.666m).

[0129] (3) Route 2 evaluation: This route incorporates various handheld posture changes (holding, answering the phone, swinging the arm, putting in the pocket, etc.) throughout the long corridor to evaluate the impact of action changes on positioning. The RoNIN fusion enhancement method of this invention achieves the best results with ATE=3.411m and RTE@10m=1.707m, which reduces the absolute trajectory error by 50.6% compared to pure RoNIN (ATE=6.902m) and by 81.8% compared to pure PDR (ATE=18.760m). It is also significantly better than the comparative methods such as RIDI (4.557m), MEIO (10.391m) and TLIO (12.729m).

[0130] On the other hand, embodiments of the present invention also provide a system for behavior scene recognition-assisted enhanced indoor positioning, including a processor and a memory. The memory is used to store program instructions, and the processor is used to call the program instructions in the memory to execute a method for behavior scene recognition-assisted enhanced indoor positioning as described in the above technical solution.

[0131] The specific embodiments described herein are merely illustrative of the spirit of the invention. Those skilled in the art to which this invention pertains may make various modifications or additions to the described specific embodiments or use similar methods to substitute them, without departing from the spirit of the invention or exceeding the scope defined by the appended claims.

Claims

1. A method for enhancing indoor positioning with behavior scene recognition assistance, characterized in that, include: Multi-source sensor data acquisition and preprocessing; A hierarchical context recognition model is constructed, extracting temporal view features and statistical view features for each sensor stream. After adaptive fusion, cross-sensor information is aggregated through a graph attention network. Finally, the context probability and label are output by three-level cascaded decoding according to environment → scene → action. The context event segment extraction is aligned with the timeline. Continuous recognition outputs are merged into event segments based on label consistency. The comprehensive confidence score is calculated, and an interval query relationship is established with the PDR step event timeline. A dual-route positioning enhancement module is constructed. Route 1 is a recognition-driven traditional PDR enhancement, and Route 2 is a recognition-enhanced learning-based inertial odometry correction. The two routes complement and cooperate to jointly suppress the cumulative drift from different sources and obtain the final trajectory.

2. The method for enhancing indoor positioning with behavior scene recognition as described in claim 1, characterized in that: During preprocessing, a hierarchical context annotation system of environment-scene-action is adopted; The environment layer is divided into three categories: indoor, semi-open, and outdoor. The scene layer is defined based on the environment layer: the indoor environment is subdivided into four categories: corridor, stairs, elevator, and escalator; the semi-open environment is subdivided into two categories: walking and stationary; the outdoor environment is no longer subdivided into scenes, is marked as no scene, and scene loss is ignored during training. The action layer describes the user's way of carrying the device, including five categories: holding, making or receiving calls, hanging down, swinging the arm, and putting it in the pocket.

3. The method for enhancing indoor positioning with behavior scene recognition as described in claim 1, characterized in that: The extraction method for time view features is as follows: Let S be the set of sensors, Indicates one of the sensors; for those containing For a batch of data segments, for any one data sample, the input sequence of sensor s is represented as: ,in This represents the maximum length of the padded sequence. For the original feature dimension, Boolean mask Used to indicate the valid time step that is not filled; The time view branch first projects the original sequence through a linear projection matrix. Mapped to a shared hidden dimension d, and then fed into a Transformer encoder after overlaying positional encoding: in For sensors The corresponding Transformer encoder, This indicates a position encoding operation. For sensors The linear projection matrix, The encoded hidden representation sequence; The encoded output is compressed in time dimension using global average pooling to obtain a fixed-length temporal feature embedding. That is, time view features, with dimensions of ; The methods for extracting features from statistical views are as follows: To characterize the amplitude distribution and global stability of complementary time coding, the effective time step set... Calculate the statistics for mask sensing; for each feature channel Calculate the mean and standard deviation: in, Indicates time window Sampling time within, Represents time step At the time The values ​​that can be taken on each feature This represents the total number of time steps contained within the time window. Further statistical analysis was conducted on the maximum, minimum, root mean square, and mean absolute deviation. Additionally, to characterize the short-term trend of the sequence, the mean absolute rate of change was introduced. in ; The above seven types of statistics are concatenated into a vector along the channel dimension. And obtain statistical feature embeddings through linear mapping. That is, statistical view features.

4. The method for enhancing indoor positioning with behavior scene recognition as described in claim 1, characterized in that: The following is how cross-sensor information is aggregated using a graph attention network: In acquiring the independent embedding of all sensors Subsequently, cross-sensor dependencies are modeled using the Graph Attention Network (GAT), where independent embeddings... Obtained by weighting time view features and statistical view features; Treat each sensor as a node and construct a directed fully connected graph containing self-loops. ,in Let be the set of nodes in the graph. For the set of all edges, graph nodes The neighborhood is defined as ,in The difference operation represents the set operation, and the node represents the subtraction operation. The neighborhood of a node is the set of all nodes. Remove its own node Composition; the GAT layer first calculates the nodes and Attention coefficient between: in For nodes For nodes Attention weights For a shared linear transformation matrix, For attention parameter vectors, This represents vector concatenation. It is a modified linear activation function with leakage; Based on this, the updated node representation is obtained by aggregating neighborhood information: in It is a non-linear activation function; After multi-layer aggregation, global mean pooling is used to obtain the segment-level fusion representation. As a global behavioral representation of the entire multi-sensor data segment, it is used for subsequent layered decoding, where This represents the feature dimension size of the global behavior representation vector. This represents the batch size.

5. The method for enhancing indoor positioning with behavior scene recognition as described in claim 1, characterized in that: The specific implementation of the three-level cascaded decoding of environment → scene → action to output context probability and label is as follows: First, the environmental prediction head is based on a global representation. Output environment probability: in A fully connected mapping for the environment classification head. The original predicted scores are normalized into a probability distribution; Secondly, the scene prediction head is only activated in indoor and semi-open environments; indoor branch prediction predicts four categories {elevator, escalator, corridor, stairs}, and semi-open branch prediction predicts two categories {walking, stationary}; for outdoor environments, the scene label is recorded as no scene and the scene loss term is ignored during training. Finally, the action prediction head will provide a global representation. The probability vectors of the environment and the corresponding scene are concatenated as conditional inputs to achieve lower-level action discrimination under the semantic constraints of the upper layer. To ensure semantic consistency, an action feasibility rule base is introduced. Where e and c represent the environment and scene categories, respectively. This represents the set of action category indices allowed under the combination of environment e and scene c; the original prediction score of action category k is masked. in It is a constant. Indicates the category of action The original prediction score before masking; This indicates the action category after masking. The corresponding updated predicted score; the updated predicted score is... After normalizing the function, the action prediction probability vector is obtained.

6. The method for enhancing indoor positioning with behavior scene recognition as described in claim 1, characterized in that: The specific process for extracting context event segments and aligning them with the timeline is as follows: The raw sensor logs are sorted by time window length. Slice the data using non-overlapping windows and record the start time for each slice. and end time For the i-th time window, the hierarchical context recognition model outputs three probability vectors. , , and discrete labels ,in, , and They represent the first The output of each time window includes an environment probability vector, a scene probability vector, and an action probability vector. , and They respectively represent the first probability vector determined by the above probability vector. Discrete labels for environment prediction, scene prediction, and action prediction within a time window; To measure prediction reliability and serve subsequent constraint gating, a comprehensive confidence level is defined: in Indicates the first The overall confidence level for each time window is conservatively estimated by taking the minimum of the three maximum probabilities. This is to cover the special case of outdoor scenes without defined scene categories, and a modified scene confidence score is introduced. When the environment is determined to be outdoor and the scene is without scene, ,otherwise To reduce the impact of single-window prediction jitter on event triggering, adjacent windows are merged based on label continuity and consistency, targeting the scene label sequence. Define group numbering: in, Indicates the first The group number to which each time window is divided; This is an indicator function; it takes the value 1 when the condition inside the parentheses is true, and 0 otherwise. Group windows within the same group into candidate event segments. Only retain lengths of at least The event block for each window is used for subsequent constraint triggering; During stepwise integration in PDR, the timestamp corresponding to each step peak is... Perform a range query in the state sequence. This allows us to obtain the context label and its confidence level corresponding to the current step, thereby achieving timeline alignment of the recognition segment-PDR step event.

7. The method for enhancing indoor positioning with behavior scene recognition as described in claim 1, characterized in that: The specific processing procedure for Route 1 is as follows: The initial trajectory is obtained based on traditional PDR: Let the triaxial acceleration be... , , First, calculate the magnitude of the resultant acceleration: right Second-order low-pass Butterworth filtering is performed to obtain Then, peak detection and extraction of the peak time are performed. Valid gait events satisfy the amplitude threshold and minimum step interval constraints: in, The set peak acceleration threshold is used to filter out minor fluctuations caused by non-stepping. The minimum step interval is set to prevent the same step from being detected repeatedly; for each step peak, a local window of a certain time is set to its left and right. Internal calculation of acceleration range Step length Estimated using the Weinberg model: Where K is an empirical coefficient; the heading is determined by the AHRS yaw angle sequence. Interpolation to peak time yields Mapped to the direction angle in a Cartesian coordinate system ,in, This represents a function that converts angle values ​​to radians; the trajectory is recursively calculated as follows: in, and These represent the pedestrians at the 1st and 2nd positions, respectively. The x and y coordinates of the two-dimensional planar position at each step; and These represent the pedestrians at the 1st and 2nd positions, respectively. The updated two-dimensional plane x and y coordinates after each step; The conditions for setting trigger constraints based on confidence gating and security mechanisms are as follows: In order to avoid introducing incorrect constraints due to identification noise, the activation of all constraints is jointly controlled by the following conditions: (1) Comprehensive confidence Not lower than the threshold (2) For an event segment, n consecutive window labels are consistent and the confidence level is met; (3) The distance between the current location and the landmark does not exceed the neighborhood radius r; The constraint can be triggered only when all the above conditions are met. The initial trajectory is corrected based on the scene type identified by the hierarchical context recognition model and the event segments after timeline alignment.

8. The method for enhancing indoor positioning with behavior scene recognition as described in claim 7, characterized in that: Correcting the initial trajectory includes: Aisle Main Heading Soft Correction: When the hierarchical context recognition model determines that the current step is in an indoor environment and the confidence level exceeds a threshold, a main heading magnetic soft constraint is introduced for the heading; a predefined set of main directions is used. For each step of the original heading Calculate the signed angle difference between it and each principal direction. Normalized to the interval [-180, 180], where, For a predefined set of principal directions Any candidate principal direction angle; take the nearest principal direction: like , If the tolerance angle is used, a progressive magnetic attraction method is employed for correction. in The magnetic attraction coefficient; make During trajectory recursion, replace ; Backtracking smooth landmark alignment: When the identified event segment corresponds to a clear landmark, backtracking smoothing is used to achieve anchor point alignment that triggers identification and naturally attracts the landmark; during online integration, a trajectory buffer segment that has not yet solidified since the last anchor point correction is maintained. After triggering, define the end-point drift: in For the target landmark coordinates, For the current end estimate; for any point within the buffer segment Smoothing correction is performed using linear time weights: because , After correction, it meets the requirements. and This achieves the effect of aligning the end with the landmark, maintaining continuity at the beginning, and linearly distributing the error in the middle section, satisfying only the current position. And it is enabled when the event segment determination is stable. The neighborhood radius; Special handling for elevator events: Brief pauses and small-scale displacements during the elevator waiting and entering phases can cause misalignment of a standard PDR near the doorway; special handling is required for the identified elevator event segments. Enable constraints within the lead / lag window: Current position satisfies At that time, a backtracking smooth alignment is performed on the buffer segment before the trigger to the doorway landmark, wherein, Indicates the first The position coordinates of the step, As a landmark at the elevator entrance, The neighborhood threshold; To depict the short-term pattern of waiting → entering, the most recent time before triggering is... The historical trajectory of seconds is rewritten; let the waiting point be... The points inside the car are For any point in the backtracking window: record Let the elevator event constraint trigger time be set. If time difference Then the linear interpolation is: Otherwise, set as a waiting point. After backtracking is complete, the current position will be constrained to [location] during the duration of the elevator event. Within a certain range, to avoid random drift caused by zero speed / short step within the elevator; Staircase event step length scaling: Significant changes in human and mobile phone posture occur when ascending or descending stairs, causing step length statistics to deviate from those observed on flat ground; for the identified staircase event segments... And consider entering the advance window. ,when Step scaling compensation is introduced at this time: in This is the scaling factor for the staircase step length. Replace the recursive formula in the trajectory By combining the backtracking smoothing of the stairwell landmarks, the alignment of key transfer points is achieved.

9. The method for enhancing indoor positioning with behavior scene recognition as described in claim 1, characterized in that: The specific processing procedure for Route 2 is as follows: The frozen RoNIN backbone network is used as a learned inertial odometry system, with the attitude-aligned IMU sequence in the global coordinate system as input, to regress the global plane velocity. The baseline coordinate trajectory is obtained by time integration: Freeze all parameters of the RoNIN backbone network without changing its structure and weights, and only extract the intermediate representation vector before its output layer. This serves as the input for the subsequent fusion head; The fusion head receives two inputs: RoNIN intermediate representation. The action probability vector output after time axis alignment ; The fusion head adopts a contextual attention + gating correction structure, with the attention module using... To query the Weighted enhancement is performed, followed by a correction of the predicted position by the modified branch. The gating value is given by the gating branch. The final corrected trajectory is represented as follows: in The RoNIN baseline trajectory; Training and Inference: During the training phase, only the parameters of the fusion head are updated, while the RoNIN backbone parameters remain frozen. The positional error between the reference trajectory and the RoNIN baseline trajectory is used as the supervision signal. Optimization during training phase and The mean square error between them; and at the same time for A lightweight regularization term is added to suppress the correction amplitude; during the inference phase, the velocity is first output by RoNIN and integrated to obtain the baseline trajectory. Then, the fusion head predicts the correction amount and gating value based on the real-time action probability, performs time-domain smoothing and interpolation on the correction amount sequence to align it with the complete time axis, and finally obtains the corrected trajectory. .

10. A system for enhancing indoor positioning with behavior scene recognition assistance, characterized in that: It includes a processor and a memory, the memory being used to store program instructions, and the processor being used to call the program instructions in the memory to execute the behavior scene recognition-assisted enhanced indoor positioning method as described in any one of claims 1-9.