A terminal device location determination system and method based on LSTM

Through the LSTM-based terminal device position discrimination method, combined with directional antenna, LSTM network and CNN network, the positioning range is dynamically expanded, and the COST-HATA model and weighted K nearest neighbor algorithm are used to solve the problem of large positioning errors of terminal devices in complex environments, and high-precision terminal device positioning is achieved.

CN120302237BActive Publication Date: 2025-08-19DONGGUAN LISHENG OF COMP TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510787063.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-13
Publication Date
2025-08-19
Estimated Expiration
2045-06-13

AI Technical Summary

Technical Problem

The existing terminal equipment position discrimination technology has large positioning errors when the environment changes, making it difficult to meet the stable positioning needs in dynamic and complex environments, especially in areas with weak signal coverage, which cannot obtain sufficient positioning information, resulting in positioning failure or excessive errors.

Method used

The terminal device position discrimination method based on LSTM is adopted, and signal characteristics are extracted by accessing directional antennas, dynamic time regularization preprocessing is performed, and LSTM network is constructed for indoor and outdoor position classification, spectrum map features are extracted, and position regression is used using a multi-layer perceptron, and position range is dynamically expanded when the signal strength is insufficient, and error correction is performed by combining the COST-HATA model and weighted K nearest neighbor algorithm.

Benefits of technology

It realizes high-precision terminal equipment positioning in complex environments, breaks through the limitations of fixed input dimensions of traditional models, improves the accuracy of signal feature extraction and the precision of position judgment, and ensures that high-precision positioning can still be achieved in scenarios with weak signal coverage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120302237B_ABST
    Figure CN120302237B_ABST
Patent Text Reader

Abstract

The present invention discloses a terminal device position discrimination system and method based on LSTM, belonging to the technical field of position discrimination. The present invention extracts signal features to obtain an RSSI sequence; constructs an LSTM network to perform indoor and outdoor position classification, obtains a spectrum graph and inputs it into a CNN network, extracts spectrum graph features, splices them with local time series features, inputs them into a multi-layer perceptron for final position regression, and outputs the terminal device position; when the RSSI signal strength is lower than a preset threshold, dynamically expands the positioning range according to the signal strength; when the terminal device is outdoors, reversely infers the distance between the terminal device and each base station; solves the terminal device position coordinates and corrects the distance error; when the terminal device is indoors, constructs an indoor signal fingerprint library, performs dynamic time warping matching, performs online positioning, and obtains the corrected terminal device position; based on the corrected terminal device position, adjusts the directional antenna angle and restarts the signal search process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of position determination, and in particular to a terminal device position determination system and method based on LSTM. Background Art

[0002] With the rapid development of the Internet of Things (IoT) and smart devices, accurate terminal device location determination technology has become a key requirement in areas such as security monitoring, intelligent transportation, and emergency rescue. Currently, mainstream terminal device location determination methods include outdoor positioning technologies based on satellite positioning systems, and indoor positioning technologies based on Wi-Fi fingerprints, Bluetooth beacons, and cellular networks. However, these technologies have many limitations in practical applications.

[0003] Traditional positioning technologies are sensitive to environmental changes. Object movement in indoor environments and weather changes in outdoor scenes can significantly affect signal quality, leading to increased positioning errors and making it difficult to meet the requirements for stable positioning in dynamic and complex environments. Existing methods often use fixed-dimensional feature extraction and simple matching algorithms, which cannot effectively process signal sequences of varying sampling frequencies and lengths, and struggle to fully exploit the temporal and spatial characteristics of the signal. In areas of weak signal coverage, traditional methods are unable to obtain sufficient positioning information due to insufficient signal strength and a small number of effective base stations, often resulting in positioning failures or excessive errors. Summary of the Invention

[0004] The purpose of the present invention is to provide a terminal device location determination system and method based on LSTM to solve the problems raised in the prior art.

[0005] To achieve the above object, the present invention provides the following technical solutions:

[0006] In a first aspect, the present application provides a method for determining the location of a terminal device based on LSTM, comprising the following steps:

[0007] Connect to the directional antenna, extract signal features, perform dynamic time warping preprocessing, and obtain the RSSI sequence;

[0008] Build an LSTM network. The input layer receives the RSSI sequence. The LSTM layer uses a bidirectional LSTM. A one-dimensional convolutional layer is added after the LSTM layer to extract local temporal features and integrate an attention mechanism. Use the LSTM network to classify indoor and outdoor locations. Obtain a spectrogram and input it into a CNN network. Spectrogram features are extracted, concatenated with local temporal features, and then input into a multi-layer perceptron for final position regression, outputting the terminal device location.

[0009] When the RSSI signal strength collected by the directional antenna is lower than the preset threshold, the positioning range is dynamically expanded based on the signal strength, with the terminal device location as the center;

[0010] When the terminal device is outdoors, it extracts information from all detected base stations within the extended positioning range, selects the primary serving base station, and constructs a base station coordinate set. It uses the COST-HATA model to calculate path loss and, combined with the RSSI sequence, infers the distance from the terminal device to each base station. It uses the maximum likelihood estimation method to solve the terminal device's location coordinates, introducing the signal fluctuation period to correct for distance errors.

[0011] When the terminal device is indoors, an indoor signal fingerprint library is constructed, dynamic time-warping matching is performed, and a weighted K-nearest neighbor algorithm is used for online positioning to obtain the corrected terminal device location.

[0012] Based on the corrected terminal device position, when the continuous positioning error is greater than the threshold, the directional antenna angle is automatically adjusted and the signal search process is restarted.

[0013] In combination with the first aspect, in a first implementation of the first aspect of the present application, accessing a directional antenna, extracting signal features, performing dynamic time warping preprocessing, and obtaining an RSSI sequence include:

[0014] Initialize the directional antenna, start the mobile phone signal detection function, enter the search mode, and extract the signal characteristics of each detected signal source, including physical layer characteristics, network layer characteristics, and signal strength characteristics; establish time series sampling for each signal source to obtain the RSSI sequence of each signal source;

[0015] The RSSI sequence of each signal source is Z-score normalized, and the RSSI sequence of the signal source with the highest signal-to-noise ratio is selected as the reference template. For each RSSI sequence to be aligned, the dynamic time warping algorithm is used to calculate the optimal alignment path and perform feature enhancement.

[0016] In combination with the first aspect, in a second embodiment of the first aspect of the present application, the LSTM network is constructed, the input layer receives the RSSI sequence, the LSTM layer adopts a bidirectional LSTM, a one-dimensional convolution layer is added after the LSTM layer, local temporal features are extracted, and an attention mechanism is integrated, including:

[0017] The tensor dimension is input into the input layer, mask marks are added to the positions where zeros are padded in the preprocessing, and the RSSI sequence is received. The LSTM layer uses a bidirectional LSTM, sets the number of hidden units and the initial bias of the forget gate. The forward LSTM captures past time series information, and the backward LSTM captures future time series information. The outputs of the forward and backward LSTMs are spliced in the feature dimension for regularization. The number of convolution kernels, convolution kernel size, and stride of the one-dimensional convolution layer are set, the padding method is same, and the activation function is LeakyReLU. The integrated attention mechanism is specifically implemented as multi-head self-attention, which performs linear transformations of queries, keys, and values, calculates attention weights, and performs residual connections and layer normalization.

[0018] In combination with the first aspect, in a third embodiment of the first aspect of the present application, the LSTM network is used to classify indoor and outdoor positions, a spectrum graph is obtained and input into a CNN network, the spectrum graph features are extracted, and the spectrum graph features are spliced with local time series features. The spectrum graph features are input into a multilayer perceptron for final position regression, and the terminal device position is output, including:

[0019] The preprocessed RSSI sequence is input into the trained LSTM network, and the feature vector output by the attention mechanism is extracted. The probability distribution of indoor and outdoor is output through the softmax classifier. When the probability distribution of indoor is greater than 50%, it is judged as indoor, otherwise it is judged as outdoor. Confidence assessment is performed. Time consistency check is performed to verify the signal characteristics.

[0020] Start the spectrum analyzer and extract the spectrum graph; input the spectrum graph into the CNN network, set the loss function to contrast loss, perform triple sampling and data enhancement; extract the feature vector output by the global average pooling layer, perform feature dimensionality reduction and feature normalization to obtain the spectrum graph features; concatenate the local time series features with the spectrum graph features, perform weighted fusion, and obtain the fused features; input the fused features into the multi-layer perceptron, construct the first hidden layer and the second hidden layer, and directly connect the fused features to the second hidden layer; in the output layer, for indoor scenes, it is a three-dimensional vector, specifically the x, y, and z coordinates; for outdoor scenes, it is a two-dimensional vector, specifically the longitude and latitude, and the activation function is selected as tanh; perform position regression optimization and output the terminal device position.

[0021] In combination with the first aspect, in a fourth embodiment of the first aspect of the present application, when the RSSI signal strength collected by the directional antenna is lower than a preset threshold, dynamically expanding the positioning range according to the signal strength with the terminal device position as the center includes:

[0022] In outdoor scenarios, the maximum communication distance is reverse-calculated based on the COST-HATA path loss model to obtain the extended radius. In indoor scenarios, the extension radius is determined by horizontal and vertical expansion based on the building where the terminal device is located and floor height and wall penetration loss. The directional antenna parameters are adjusted to enhance the signal. Based on electronic map data, unreachable areas are excluded, and DBSCAN clustering is performed on all signal sources within the extended area. In indoor scenarios, a circular area centered on the longitude and latitude is output, while in outdoor scenarios, a rectangular area in the building coordinate system is output.

[0023] In combination with the first aspect, in a fifth implementation of the first aspect of the present application, when the terminal device is outdoors, extracting all detected base station information within the extended positioning range, screening the primary serving base station to construct a base station coordinate set, including:

[0024] Sort all detected base stations by reference signal received power from high to low, prioritizing the candidate base stations with the strongest signals, with 5G base stations having the highest priority. Ensure that the candidate base stations are spatially dispersed, calculate the azimuth differences between the candidate base stations, and eliminate base stations with an angle difference less than a set threshold from the selected base station. A minimum of w base stations is retained, where w is a positive integer set by the user. If the number of 5G base stations is insufficient, 4G base stations are added.

[0025] The operator's public positioning database is queried using the cell ID and tracking area code to obtain the latitude and longitude coordinates of the base station; the latitude and longitude coordinates of the base station are converted into a local Cartesian coordinate system to construct a base station coordinate set.

[0026] In combination with the first aspect, in a sixth implementation of the first aspect of the present application, the COST-HATA model is used to calculate the path loss, and the RSSI sequence is combined to reversely infer the distance between the terminal device and each base station, including:

[0027] Determine the applicable frequency range of the COST-HATA model and categorize the environment types into dense urban areas, general urban areas, suburban areas, and rural areas based on building density and distribution characteristics; set the base station antenna height and mobile station antenna height, and configure the frequency correction factor based on the environment type; match the terminal device location with the electronic map and automatically determine the environment type based on building density; calculate the basic path loss based on the signal frequency, base station height, and distance; adjust the basic path loss based on the frequency correction factor using a correction formula for different environment types and antenna heights; and linearly adjust the basic path loss when the signal frequency exceeds the default range;

[0028] The RSSI sequence is smoothed and filtered using the sliding window averaging method. The theoretical received power is calculated based on the base station transmit power, base station antenna gain, and terminal antenna gain. The distance between the terminal device and each base station is inferred from the relationship between the RSSI value in the RSSI sequence and the theoretical received power.

[0029] In combination with the first aspect, in a seventh implementation of the first aspect of the present application, the method of using the maximum likelihood estimation method to solve the terminal device location coordinates and introducing the signal fluctuation period to correct the distance error includes:

[0030] The distance between the terminal device and each base station is expressed as the sum of the true distance and the measurement error. The measurement error is assumed to follow a zero-mean Gaussian distribution, with a variance related to signal strength fluctuations. Based on the distance and Gaussian distribution, a likelihood function is constructed. The likelihood function represents the probability of observing the current distance given the terminal device location. The likelihood function is converted to a log-likelihood function.

[0031] Perform Fourier transform on the RSSI sequence and convert it to the frequency domain to identify the main peaks in the spectrum and determine the dominant frequency of the signal fluctuation; calculate the dominant period of the signal fluctuation as the environmental characteristic parameter, and extract the maximum, minimum and change rate of the signal strength within the dominant period; establish a mapping relationship between the signal fluctuation period and the measurement error; divide the signal fluctuation period into short period, medium period and long period, and apply different error correction strategies to different period ranges; calculate the correction coefficient based on the signal fluctuation period and the signal strength change rate, and the correction coefficient is inversely proportional to the length of the signal fluctuation period and directly proportional to the signal strength change rate; based on the correction coefficient, correct the inferred distance from the terminal device to each base station, and the corrected distance is equal to the original distance multiplied by the correction coefficient.

[0032] In combination with the first aspect, in an eighth implementation of the first aspect of the present application, when the terminal device is indoors, constructing an indoor signal fingerprint library, performing dynamic time warping matching, and using a weighted K-nearest neighbor algorithm for online positioning to obtain a corrected terminal device position include:

[0033] Divide the indoor area into regular grids and set the grid spacing; collect multiple signal sources, construct time series, perform feature extraction and preprocessing, and build an indoor signal fingerprint library;

[0034] The terminal device collects signal sequences in real time, with the collection duration consistent with the fingerprint library, to construct an online signal sequence. The DTW distance between the online signal sequence and the signal sequence of each reference point in the fingerprint library is calculated. The DTW distance measures the similarity between two time series. While calculating the DTW distance, the optimal alignment path is recorded.

[0035] The K value is selected based on the complexity of the environment, and the K reference points with the smallest DTW distance are selected as neighbors. The weight is calculated based on the inverse of the DTW distance, with the closer the distance, the greater the weight. The coordinates of the K neighbors are weighted averaged to obtain the corrected terminal device position.

[0036] In a second aspect, the present application provides a terminal device location determination system based on LSTM, comprising:

[0037] Signal acquisition module: includes: a signal feature extraction unit and an RSSI sequence generation unit; wherein the signal feature extraction unit is connected to a directional antenna to extract signal features, and the RSSI sequence generation unit performs dynamic time warping preprocessing to obtain an RSSI sequence;

[0038] Terminal device location acquisition module: includes: LSTM network construction unit, location classification unit and terminal device location acquisition unit; the LSTM network construction unit constructs an LSTM network, the input layer receives the RSSI sequence, the LSTM layer uses a bidirectional LSTM, and a one-dimensional convolutional layer is added after the LSTM layer to extract local temporal features and integrate an attention mechanism; the location classification unit uses the LSTM network to classify indoor and outdoor locations, and the terminal device location acquisition unit obtains a spectrogram and inputs it into the CNN network, extracts spectrogram features, splices them with local temporal features, and inputs them into the multi-layer perceptron for final position regression, outputting the terminal device location;

[0039] Positioning range expansion module: including: positioning range expansion unit; wherein, when the RSSI signal strength collected by the directional antenna is lower than a preset threshold, the positioning range expansion unit dynamically expands the positioning range based on the signal strength with the terminal device position as the center;

[0040] Outdoor location correction module: includes: base station coordinate set construction unit, distance inversion unit and distance error correction unit; among them, when the terminal device is outdoors, the base station coordinate set construction unit extracts the information of all detected base stations within the extended positioning range, selects the main service base station to construct the base station coordinate set; the distance inversion unit uses the COST-HATA model to calculate the path loss, combined with the RSSI sequence, to infer the distance between the terminal device and each base station; the distance error correction unit uses the maximum likelihood estimation method to solve the terminal device position coordinates, and introduces the signal fluctuation period to correct the distance error;

[0041] Indoor position correction module: includes: a fingerprint library construction unit and a terminal device position correction unit; wherein, when the terminal device is indoors, the fingerprint library construction unit constructs an indoor signal fingerprint library, and the terminal device position correction unit performs dynamic time warping matching and uses the weighted K nearest neighbor algorithm for online positioning to obtain the corrected terminal device position;

[0042] Correction execution module: includes: an antenna angle adjustment unit and a signal search process restart unit; wherein, the antenna angle adjustment unit automatically adjusts the directional antenna angle based on the corrected terminal device position when the continuous positioning error is greater than the threshold, and the signal search process restart unit restarts the signal search process.

[0043] Compared with the prior art, the present invention has the following beneficial effects:

[0044] 1. The present invention can dynamically capture the long-term and short-term temporal dependencies of RSSI sequences through the gating mechanism of the LSTM neural network. Combined with the dynamic time warping preprocessing technology, it can achieve unified feature encoding for sequences with different sampling frequencies and variable lengths, breaking through the limitation of the fixed input dimension of the traditional model and significantly improving the accuracy of signal feature extraction.

[0045] 2. The present invention constructs an LSTM network structure including a temporal feature enhancement layer and integrates an attention mechanism to automatically weight the signal strength features at key time points and suppress environmental noise interference. At the same time, the temporal features extracted by LSTM are deeply integrated with the spatial features of the spectrum graph extracted by CNN, and position regression is achieved through a multi-layer perceptron, giving full play to the complementary advantages of multi-source data and improving the precision of indoor and outdoor position discrimination.

[0046] 3. This invention designs dynamic range expansion and scenario-specific positioning strategies for weak signal coverage scenarios. When signal strength is insufficient, the system automatically expands the positioning range centered on the terminal's location. Based on indoor and outdoor scenarios, it uses optimized algorithms for base station triangulation and Wi-Fi fingerprint matching, respectively. It also incorporates signal propagation models and historical data for error correction, ensuring high-precision positioning even in complex environments. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 This is a schematic diagram of the steps of a terminal device location determination method based on LSTM of the present invention;

[0048] Figure 2 This is a system structure diagram of a terminal device position determination system based on LSTM of the present invention. DETAILED DESCRIPTION

[0049] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0050] Example: Figure 1-Figure 2 As shown, the present invention provides a technical solution.

[0051] like Figure 1 As shown in a schematic diagram of the steps of a terminal device location determination method based on LSTM, the present application provides a terminal device location determination method based on LSTM, comprising the following steps:

[0052] Step S100: Connect a directional antenna, extract signal features, perform dynamic time warping preprocessing, and obtain an RSSI sequence;

[0053] Specifically, the directional antenna is initialized, the mobile phone signal detection function is started, and the search mode is entered. For each detected signal source, the signal characteristics are extracted, including physical layer characteristics, network layer characteristics, and signal strength characteristics. Time series sampling is established for each signal source to obtain the RSSI sequence of each signal source.

[0054] The RSSI sequence of each signal source is Z-score normalized, and the RSSI sequence of the signal source with the highest signal-to-noise ratio is selected as the reference template. For each RSSI sequence to be aligned, the dynamic time warping algorithm is used to calculate the optimal alignment path and perform feature enhancement.

[0055] Step S200: Construct an LSTM network. The input layer receives the RSSI sequence. The LSTM layer uses a bidirectional LSTM. A one-dimensional convolutional layer is added after the LSTM layer to extract local temporal features and integrate an attention mechanism. The LSTM network is used to classify indoor and outdoor locations. A spectrogram is obtained and input into a CNN network to extract spectrogram features. The features are then concatenated with the local temporal features and input into a multi-layer perceptron for final position regression, outputting the terminal device location.

[0056] Specifically, the tensor dimension is input to the input layer, mask marks are added to the positions where zeros are padded in the preprocessing, and the RSSI sequence is received; the LSTM layer uses a bidirectional LSTM, sets the number of hidden units and the initial bias of the forget gate, the forward LSTM captures past time series information, and the backward LSTM captures future time series information. The outputs of the forward and backward LSTMs are spliced in the feature dimension for regularization; the number of convolution kernels, the convolution kernel size, and the step size of the one-dimensional convolution layer are set, the padding method is the same, and the activation function is LeakyReLU; the integrated attention mechanism is specifically implemented as multi-head self-attention, which performs linear transformations of queries, keys, and values, calculates attention weights, and performs residual connections and layer normalization.

[0057] Furthermore, the preprocessed RSSI sequence is input into the trained LSTM network, the feature vector output by the attention mechanism is extracted, and the probability distribution of indoor and outdoor is output through the softmax classifier. When the probability distribution of indoor is greater than 50%, it is judged as indoor, otherwise it is judged as outdoor. Confidence assessment is performed; time consistency check is performed to verify the signal characteristics;

[0058] Start the spectrum analyzer and extract the spectrum graph; input the spectrum graph into the CNN network, set the loss function to contrast loss, perform triple sampling and data enhancement; extract the feature vector output by the global average pooling layer, perform feature dimensionality reduction and feature normalization to obtain the spectrum graph features; concatenate the local time series features with the spectrum graph features, perform weighted fusion, and obtain the fused features; input the fused features into the multi-layer perceptron, construct the first hidden layer and the second hidden layer, and directly connect the fused features to the second hidden layer; in the output layer, for indoor scenes, it is a three-dimensional vector, specifically the x, y, and z coordinates; for outdoor scenes, it is a two-dimensional vector, specifically the longitude and latitude, and the activation function is selected as tanh; perform position regression optimization and output the terminal device position.

[0059] In one specific embodiment, the input layer tensor dimensions in the LSTM network are: [batch_size=64, time_steps=100, features=5]. A masking mechanism adds a Boolean mask to locations padded with zeros during preprocessing (e.g., for sequences shorter than 100 steps) to prevent the model from learning invalid values. The bidirectional LSTM layer has 128 hidden units, and the forget gate has an initial bias of -1.0 to enhance gradient stability. The forward and backward LSTM outputs are concatenated along the feature dimension (from 128×2=256), and 20% dropout regularization is applied. For the one-dimensional convolutional layer, 64 convolution kernels are set, with a size of 7×1 (to capture local features of seven consecutive time steps), a stride of 1, and padding to maintain the same sequence length. The activation function is LeakyReLU (α=0.1) to mitigate the vanishing gradient problem.

[0060] A multi-head self-attention mechanism is introduced, with 8 heads and 64 dimensions per head. The query (Q), key (K), and value (V) are mapped using independent weight matrices. Weight calculation uses scaled dot-product attention. Residual connections and layer normalization are implemented to prevent gradient decay and improve training stability. When fed an RSSI sequence in a shopping mall, the model outputs an indoor probability of 98.2%; in an outdoor parking lot scenario, the outdoor probability is 97.5%.

[0061] In the CNN network, the spectrogram input dimensions are [64 × 128 × 3] (RGB three-channel, with power density mapped to color values). Data augmentation is performed with random rotations of ±15°, scaling by 0.9-1.1 times, and brightness adjustment by ±20% to improve model generalization.

[0062] In the network structure, convolutional block 1 consists of 64 3×3 convolution kernels with a stride of 2, an output of 32×64×64, and a ReLU activation function. Convolutional block 2 consists of 128 3×3 convolution kernels with a stride of 2, an output of 16×32×128, and a ReLU activation function. The output is a 256-dimensional feature vector, which is then compressed to 128 dimensions using PCA after dimensionality reduction.

[0063] Indoor spectrum: High-frequency (2.4GHz / 5GHz) Wi-Fi signal peaks are evident, and the features extracted by CNN include hotspot distribution patterns. Outdoor spectrum: Low-frequency (800MHz / 1800MHz) cellular signals dominate, and the features reflect the distribution of macro base stations.

[0064] For feature fusion, the LSTM time series features are 128-dimensional (attention mechanism output), and the CNN spectral features are 128-dimensional (after dimensionality reduction). The concatenated dimension is 256-dimensional.

[0065] The first hidden layer of the multilayer perceptron has 256 neurons, with the activation function Swish. The second hidden layer has 128 neurons, with the activation function ReLU, receiving fused features and a residual connection. In the output layer, indoor coordinates are: 3D coordinates (x, y, z), normalized to the range [-1, 1] using tanh, and mapped to the actual building coordinate system (error ≤ 3 meters). Outdoor coordinates are: 2D latitude and longitude, mapped to the range [-1, 1] using tanh, and the error after denormalization is ≤ 5 meters. The optimizer is AdamW (learning rate 0.001, weight decay 0.0001), and convergence is achieved after 200 epochs of training. For a test point in a store, the predicted coordinates are (12.5m, 8.2m, 3rd floor), while the actual coordinates are (12.1m, 8.5m, 3rd floor), with a horizontal error of 0.4m, indicating the correct floor. At the parking lot test point, the predicted latitude and longitude are (30.1234°, 120.5678°), and the true value is (30.1230°, 120.5682°), with an error of 3.8 meters.

[0066] Step S300: When the RSSI signal strength collected by the directional antenna is lower than a preset threshold, the positioning range is dynamically expanded based on the signal strength, with the terminal device location as the center;

[0067] Specifically, in outdoor scenarios, the maximum communication distance is reversely calculated based on the COST-HATA path loss model to obtain the extended radius; in indoor scenarios, the building where the terminal device is located is used as the center, and the extension is carried out according to the floor height and wall penetration loss, including horizontal and vertical extension; the parameters of the directional antenna are adjusted to strengthen the signal; based on electronic map data, unreachable areas are excluded, and DBSCAN clustering is performed on all signal sources in the extended area; in indoor scenarios, a circular area centered on the longitude and latitude is output, and in outdoor scenarios, a rectangular area in the building coordinate system is output.

[0068] In one specific embodiment, the outdoor weak coverage area is an urban canyon, with two high-rise buildings 30 meters apart and each 150 meters tall. The average RSSI is -95dBm, below the preset threshold of -90dBm. The indoor weak coverage area is the B2 floor of an underground parking garage, which has no windows and 50cm thick walls. The average RSSI is -100dBm. The LSTM preliminary positioning is (30.1230°, 120.5670°) with a confidence level of 0.55 (low confidence). The LSTM preliminary positioning is a coordinate on the first floor of a shopping mall (5.2m, 8.7m), but signal characteristics indicate a possible cross-floor location (RSSI fluctuation >15dB).

[0069] In outdoor scenarios, the maximum communication range was calculated based on the COST-HATA model, yielding a range of 280 meters. The extended radius was 500 meters, the smaller of the minimum preset distance of 500 meters and 2*280 meters. The gain was increased from 25dBi to 30dBi, the scanning step angle was reduced from 5° to 2°, and the scanning time was extended to 60 seconds. High-rise buildings on both sides of the canyon were excluded, while roads and open spaces were retained. DBSCAN clustering retained five base stations, distributed in azimuths of 120°, 180°, 240°, 300°, and 360°, ensuring uniform coverage. A 500-meter radius circular area centered on the initial coordinates contained three active base stations (RSRP > -95dBm).

[0070] In indoor scenarios, the system expands horizontally to a 50-meter radius and vertically by two floors upward (1st floor to 3rd floor) and two floors downward (1st floor to B1), for a total coverage of five floors (B2 to 3rd floor). The trigger condition is the detection of three Wi-Fi signals with the same SSID and an 18dB strength difference, indicating possible cross-floor coverage. The system switches to the 2.4GHz band, increases the gain to 33dBi, and focuses on scanning ceilings and elevator shafts. Based on the mall's electronic map, it excludes unreachable areas such as walls and elevator shafts, retaining corridors, shops, and stairwells. DBSCAN clustering identifies four Wi-Fi hotspot clusters, corresponding to the 1st floor lobby, 2nd floor restaurant, B1 parking lot, and B2 equipment room. The expanded area is a rectangular region (x∈[-50m, 50m], y∈[-50m, 50m], z∈[-10m, 15m]) in the mall's building coordinate system, covering five floors.

[0071] For outdoor scenarios, before expansion, only one base station was detected, resulting in a positioning error of 48 meters. After expansion, three base stations were detected, reducing the triangulation error to 5.2 meters. For indoor scenarios, before expansion, the system relied on a single-layer fingerprint library, resulting in a positioning error of 12 meters (actually located on the B1 floor). After expansion, the B1 layer fingerprint was integrated, resulting in a WKNN matching error of 1.8 meters, confirming accurate floor identification.

[0072] Step S400: When the terminal device is outdoors, extract information about all detected base stations within the extended positioning range, select the primary serving base station to construct a base station coordinate set; use the COST-HATA model to calculate path loss, and combine it with the RSSI sequence to infer the distance from the terminal device to each base station; use the maximum likelihood estimation method to solve the terminal device's location coordinates, and introduce the signal fluctuation period to correct the distance error;

[0073] Specifically, all detected base stations are sorted from high to low by reference signal received power, with the candidate base stations with the strongest signals being prioritized, with 5G base stations having the highest priority. The candidate base stations are spatially dispersed, and the azimuth differences between them are calculated. Base stations with angle differences less than a set threshold from the selected base stations are eliminated, retaining at least w base stations, where w is a positive integer set by the user. When the number of 5G base stations is insufficient, 4G base stations are added.

[0074] The operator's public positioning database is queried using the cell ID and tracking area code to obtain the latitude and longitude coordinates of the base station; the latitude and longitude coordinates of the base station are converted into a local Cartesian coordinate system to construct a base station coordinate set.

[0075] Furthermore, the frequency range applicable to the COST-HATA model is determined, and the environment types are divided into dense urban areas, general urban areas, suburban areas, and rural areas based on building density and distribution characteristics; the base station antenna height and mobile station antenna height are set, and the frequency correction factor is configured according to the environment type; the terminal device location is matched with the electronic map, and the environment type is automatically determined based on the building density; the basic path loss is calculated based on the signal frequency, base station height, and distance; the basic path loss is adjusted based on the correction formula based on the frequency correction factor for different environment types and antenna heights; when the signal frequency exceeds the default range, the basic path loss is linearly adjusted;

[0076] The RSSI sequence is smoothed and filtered using the sliding window averaging method. The theoretical received power is calculated based on the base station transmit power, base station antenna gain, and terminal antenna gain. The distance between the terminal device and each base station is inferred from the relationship between the RSSI value in the RSSI sequence and the theoretical received power.

[0077] Furthermore, the distance from the terminal device to each base station is expressed as the sum of the true distance and the measurement error. The measurement error is assumed to follow a zero-mean Gaussian distribution, with a variance related to signal strength fluctuations. Based on the distance and Gaussian distribution, a likelihood function is constructed. The likelihood function represents the probability of observing the current distance given the terminal device location. The likelihood function is converted to a log-likelihood function.

[0078] Perform Fourier transform on the RSSI sequence and convert it to the frequency domain to identify the main peaks in the spectrum and determine the dominant frequency of the signal fluctuation; calculate the dominant period of the signal fluctuation as the environmental characteristic parameter, and extract the maximum, minimum and change rate of the signal strength within the dominant period; establish a mapping relationship between the signal fluctuation period and the measurement error; divide the signal fluctuation period into short period, medium period and long period, and apply different error correction strategies to different period ranges; calculate the correction coefficient based on the signal fluctuation period and the signal strength change rate, and the correction coefficient is inversely proportional to the length of the signal fluctuation period and directly proportional to the signal strength change rate; based on the correction coefficient, correct the inferred distance from the terminal device to each base station, and the corrected distance is equal to the original distance multiplied by the correction coefficient.

[0079] In one specific embodiment, the following are arranged in descending order of RSRP: 5G base station A (RSRP = -85dBm), 5G base station B (-88dBm), LTE base station C (-90dBm), 5G base station D (-92dBm), LTE base station E (-95dBm), LTE base station F (-98dBm), GSM base station G (-102dBm), and LTE base station H (-105dBm). 5G base stations are prioritized: the first three 5G base stations (A, B, and D) are selected, all with RSRP greater than -92dBm.

[0080] Azimuth detection was performed. Base stations A (45°), B (135°), and D (270°) had angle differences of 90°, 135°, and 180°, respectively. These differences were all greater than the 30° threshold, meeting the dispersion requirement. Ultimately, three base stations were retained, meeting the minimum requirement for triangulation positioning (w = 3).

[0081] Query the operator database to obtain the longitude and latitude, and convert them to the local Cartesian coordinate system.

[0082] The COST-HATA model distance is reversed. The environment type is a dense urban area (C = 3dB), the base station antenna height is 40 meters (database updated value, not the default 30 meters), and the mobile station height is 1.5 meters. The frequency range is: 5G base station frequency 3500MHz, which exceeds the model default of 2000MHz and requires linear expansion correction. Taking base station A as an example, the basic path loss is calculated to be ,in, . Perform frequency expansion correction, .

[0083] The base station transmit power is 43dBm, the antenna gain is 18dBi, and the terminal gain is 3dBi. The theoretical received power is 64-L. From the measured RSSI = -85dBm, we can get: d is about 150 meters.

[0084] A Fourier transform of the RSSI sequence (100 sampling points) from base station A identified a dominant frequency of 0.5 Hz (period of 2 seconds), which is a medium period (1-5 seconds). The signal strength change rate within the period was -80 dBm (maximum) and -90 dBm (minimum), with a rate of change of 5 dB / second. The error correction coefficient was calculated, and the corrected distance was 187.5 meters.

[0085] The log-likelihood function is established and the terminal coordinates are obtained iteratively: (x=92m,y=88m), which are converted to longitude and latitude (30.1238°,120.5679°).

[0086] Step S500: When the terminal device is indoors, an indoor signal fingerprint library is constructed, dynamic time warping matching is performed, and a weighted K-nearest neighbor algorithm is used for online positioning to obtain a corrected terminal device position.

[0087] Specifically, the indoor area is divided into regular grids and the grid spacing is set; multiple signal sources are collected, time series are constructed, feature extraction and preprocessing are performed, and an indoor signal fingerprint library is constructed;

[0088] The terminal device collects signal sequences in real time, with the collection duration consistent with the fingerprint library, to construct an online signal sequence. The DTW distance between the online signal sequence and the signal sequence of each reference point in the fingerprint library is calculated. The DTW distance measures the similarity between two time series. While calculating the DTW distance, the optimal alignment path is recorded.

[0089] The K value is selected based on the complexity of the environment, and the K reference points with the smallest DTW distance are selected as neighbors. The weight is calculated based on the inverse of the DTW distance, with the closer the distance, the greater the weight. The coordinates of the K neighbors are weighted averaged to obtain the corrected terminal device position.

[0090] In one specific embodiment, the grid spacing is 1.5 meters by 1.5 meters, with a total of approximately 2,200 reference points deployed. The data acquisition device is a smartphone (supporting Wi-Fi and Bluetooth), which stays at each reference point for 10 seconds and collects signals at 100ms intervals. The signal sources are 15 stable Wi-Fi access points (signal strength > -85dBm) and 5 Bluetooth beacons. Each time series contains 100 sampling points (10 seconds by 10Hz), and statistical features such as mean, standard deviation, skewness, and kurtosis are extracted. A feature vector is constructed for each access point: [MAC address, RSSI mean, RSSI standard deviation, signal fluctuation frequency].

[0091] The fingerprint characteristics of reference point P1 (5.0m, 3.0m) are as follows: AP1 (MAC:12:34): RSSI mean = -75dBm, standard deviation = 3dB, fluctuation frequency = 0.2Hz. AP2 (MAC:56:78): RSSI mean = -82dBm, standard deviation = 5dB, fluctuation frequency = 0.1Hz.

[0092] Calculate the DTW distance between point Q and the reference point P1 in the fingerprint library:

[0093] Sequence length: 100 points.

[0094] Local cost function: Euclidean distance |Q_i-P1_j|.

[0095] Cumulative cost matrix: C[100×100], using Sakoe-Chiba band constraint (bandwidth = 5).

[0096] Optimal path: records the path with the minimum cumulative cost, and the path curvature = 1.2 (indicating the degree of time axis expansion).

[0097] Final DTW distance: D(Q,P1)=18.5dB.

[0098] Calculate the DTW distance between point Q and all reference points in the fingerprint library. Some results are as follows:

[0099] D(Q,P1)=18.5dB, D(Q,P2)=22.3dB, D(Q,P3)=15.7dB, D(Q,P4)=28.9dB, D(Q,P5)=19.8dB.

[0100] Based on the complexity of the environment, K is set to 5. The five reference points with the smallest DTW distance are {P3, P1, P5, P2, P6}. Weights are calculated based on the inverse of the DTW distance: W3 = 1 / 15.7 = 0.064, W1 = 1 / 18.5 = 0.054, W5 = 1 / 19.8 = 0.051, W2 = 1 / 22.3 = 0.045, and W6 = 1 / 24.1 = 0.041. Normalized weights: W3 = 0.286, W1 = 0.240, W5 = 0.227, W2 = 0.201, and W6 = 0.183.

[0101] The coordinates of the reference points are: P3 (7.5m, 4.0m), P1 (5.0m, 3.0m), P5 (8.0m, 5.5m), P2 (6.5m, 2.5m), and P6 (9.0m, 4.5m). The weighted calculation is: x = 7.5 × 0.286 + 5.0 × 0.240 + 8.0 × 0.227 + 6.5 × 0.201 + 9.0 × 0.183 ≈ 7.32m. y = 4.0 × 0.286 + 3.0 × 0.240 + 5.5 × 0.227 + 2.5 × 0.201 + 4.5 × 0.183 ≈ 4.05m.

[0102] The final positioning result is: Q point coordinates = (7.32m, 4.05m).

[0103] Step S600: Based on the corrected terminal device position, when the continuous positioning error is greater than the threshold, the directional antenna angle is automatically adjusted and the signal search process is restarted.

[0104] like Figure 2 As shown in the system structure diagram of a terminal device location determination system based on LSTM, the present application provides a terminal device location determination system based on LSTM, including:

[0105] Signal acquisition module: includes: a signal feature extraction unit and an RSSI sequence generation unit; wherein the signal feature extraction unit is connected to a directional antenna to extract signal features, and the RSSI sequence generation unit performs dynamic time warping preprocessing to obtain an RSSI sequence;

[0106] Terminal device location acquisition module: includes: LSTM network construction unit, location classification unit and terminal device location acquisition unit; the LSTM network construction unit constructs an LSTM network, the input layer receives the RSSI sequence, the LSTM layer uses a bidirectional LSTM, and a one-dimensional convolutional layer is added after the LSTM layer to extract local temporal features and integrate an attention mechanism; the location classification unit uses the LSTM network to classify indoor and outdoor locations, and the terminal device location acquisition unit obtains a spectrogram and inputs it into the CNN network, extracts spectrogram features, splices them with local temporal features, and inputs them into the multi-layer perceptron for final position regression, outputting the terminal device location;

[0107] Positioning range expansion module: including: positioning range expansion unit; wherein, when the RSSI signal strength collected by the directional antenna is lower than a preset threshold, the positioning range expansion unit dynamically expands the positioning range based on the signal strength with the terminal device position as the center;

[0108] Outdoor location correction module: includes: base station coordinate set construction unit, distance inversion unit and distance error correction unit; among them, when the terminal device is outdoors, the base station coordinate set construction unit extracts the information of all detected base stations within the extended positioning range, selects the main service base station to construct the base station coordinate set; the distance inversion unit uses the COST-HATA model to calculate the path loss, combined with the RSSI sequence, to infer the distance between the terminal device and each base station; the distance error correction unit uses the maximum likelihood estimation method to solve the terminal device position coordinates, and introduces the signal fluctuation period to correct the distance error;

[0109] Indoor position correction module: includes: a fingerprint library construction unit and a terminal device position correction unit; wherein, when the terminal device is indoors, the fingerprint library construction unit constructs an indoor signal fingerprint library, and the terminal device position correction unit performs dynamic time warping matching and uses the weighted K nearest neighbor algorithm for online positioning to obtain the corrected terminal device position;

[0110] Correction execution module: includes: an antenna angle adjustment unit and a signal search process restart unit; wherein, the antenna angle adjustment unit automatically adjusts the directional antenna angle based on the corrected terminal device position when the continuous positioning error is greater than the threshold, and the signal search process restart unit restarts the signal search process.

[0111] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above and that the invention can be embodied in other specific forms without departing from the spirit or essential characteristics of the invention. Therefore, the embodiments should be considered in all respects as illustrative and non-restrictive, and the scope of the invention is defined by the appended claims, not the foregoing description, and all variations within the meaning and range of equivalents of the claims are intended to be included therein. Any reference sign in a claim should not be construed as limiting the claim to which it relates.

Claims

1. A terminal device location determination method based on LSTM, characterized in that: The following steps are involved: Connect to the directional antenna, extract signal features, perform dynamic time warping preprocessing, and obtain the RSSI sequence; Build an LSTM network. The input layer receives the RSSI sequence. The LSTM layer uses a bidirectional LSTM. A one-dimensional convolutional layer is added after the LSTM layer to extract local temporal features and integrate an attention mechanism. Use the LSTM network to classify indoor and outdoor locations. Obtain a spectrogram and input it into a CNN network. Spectrogram features are extracted, concatenated with local temporal features, and then input into a multi-layer perceptron for final position regression, outputting the terminal device location. When the RSSI signal strength collected by the directional antenna is lower than the preset threshold, the positioning range is dynamically expanded based on the signal strength, with the terminal device location as the center; When the terminal device is outdoors, it extracts information from all detected base stations within the extended positioning range, selects the primary serving base station, and constructs a base station coordinate set. It uses the COST-HATA model to calculate path loss and, combined with the RSSI sequence, infers the distance from the terminal device to each base station. The maximum likelihood estimation method is used to solve the terminal device location coordinates, and the signal fluctuation period is introduced to correct the distance error; The distance between the terminal device and each base station is expressed as the sum of the true distance and the measurement error. The measurement error is assumed to follow a zero-mean Gaussian distribution, with a variance related to signal strength fluctuations. Based on the distance and Gaussian distribution, a likelihood function is constructed. The likelihood function represents the probability of observing the current distance given the terminal device location. The likelihood function is converted to a log-likelihood function. Perform a Fourier transform on the RSSI sequence, convert it to the frequency domain, identify the main peaks in the spectrum, and determine the dominant frequency of the signal fluctuation; calculate the dominant period of the signal fluctuation as an environmental characteristic parameter, and extract the maximum, minimum, and change rate of the signal strength within the dominant period; establish a mapping relationship between the signal fluctuation period and the measurement error; divide the signal fluctuation period into short, medium, and long periods, and apply different error correction strategies to different period ranges; calculate a correction coefficient based on the signal fluctuation period and the signal strength change rate, and the correction coefficient is inversely proportional to the length of the signal fluctuation period and directly proportional to the signal strength change rate; based on the correction coefficient, correct the inferred distance from the terminal device to each base station, and the corrected distance is equal to the original distance multiplied by the correction coefficient; When the terminal device is indoors, an indoor signal fingerprint library is constructed, dynamic time-warping matching is performed, and a weighted K-nearest neighbor algorithm is used for online positioning to obtain the corrected terminal device location. Based on the corrected terminal device position, when the continuous positioning error is greater than the threshold, the directional antenna angle is automatically adjusted and the signal search process is restarted.

2. The method for determining the location of a terminal device based on LSTM according to claim 1, wherein: The method of accessing a directional antenna, extracting signal features, and performing dynamic time warping preprocessing to obtain an RSSI sequence includes: Initialize the directional antenna, start the mobile phone signal detection function, enter the search mode, and extract the signal characteristics of each detected signal source, including physical layer characteristics, network layer characteristics, and signal strength characteristics; establish time series sampling for each signal source to obtain the RSSI sequence of each signal source; The RSSI sequence of each signal source is Z-score normalized, and the RSSI sequence of the signal source with the highest signal-to-noise ratio is selected as the reference template. For each RSSI sequence to be aligned, the dynamic time warping algorithm is used to calculate the optimal alignment path and perform feature enhancement.

3. The method for determining the location of a terminal device based on LSTM according to claim 1, wherein: The LSTM network is constructed in such a way that the input layer receives the RSSI sequence, the LSTM layer adopts a bidirectional LSTM, a one-dimensional convolutional layer is added after the LSTM layer to extract local temporal features, and an attention mechanism is integrated, including: The tensor dimension is input into the input layer, mask marks are added to the positions where zeros are padded in the preprocessing, and the RSSI sequence is received. The LSTM layer uses a bidirectional LSTM, sets the number of hidden units and the initial bias of the forget gate. The forward LSTM captures past time series information, and the backward LSTM captures future time series information. The outputs of the forward and backward LSTMs are spliced in the feature dimension for regularization. The number of convolution kernels, convolution kernel size, and stride of the one-dimensional convolution layer are set, the padding method is same, and the activation function is LeakyReLU. The integrated attention mechanism is specifically implemented as multi-head self-attention, which performs linear transformations of queries, keys, and values, calculates attention weights, and performs residual connections and layer normalization.

4. The method for determining the location of a terminal device based on LSTM according to claim 1, wherein: The method uses an LSTM network to classify indoor and outdoor locations, obtains a spectrogram and inputs it into a CNN network, extracts spectrogram features, combines them with local temporal features, and inputs them into a multi-layer perceptron for final location regression, outputting the terminal device location, including: The preprocessed RSSI sequence is input into the trained LSTM network, and the feature vector output by the attention mechanism is extracted. The probability distribution of indoor and outdoor is output through the softmax classifier. When the probability distribution of indoor is greater than 50%, it is judged as indoor, otherwise it is judged as outdoor. Confidence assessment is performed. Time consistency check is performed to verify the signal characteristics. Start the spectrum analyzer and extract the spectrum graph; input the spectrum graph into the CNN network, set the loss function to contrast loss, perform triple sampling and data enhancement; extract the feature vector output by the global average pooling layer, perform feature dimensionality reduction and feature normalization to obtain the spectrum graph features; concatenate the local time series features with the spectrum graph features, perform weighted fusion, and obtain the fused features; input the fused features into the multi-layer perceptron, construct the first hidden layer and the second hidden layer, and directly connect the fused features to the second hidden layer; in the output layer, for indoor scenes, it is a three-dimensional vector, specifically the x, y, and z coordinates; for outdoor scenes, it is a two-dimensional vector, specifically the longitude and latitude, and the activation function is selected as tanh; perform position regression optimization and output the terminal device position.

5. The method for determining the location of a terminal device based on LSTM according to claim 1, wherein: When the RSSI signal strength collected by the directional antenna is lower than a preset threshold, the positioning range is dynamically expanded based on the signal strength with the terminal device location as the center, including: In outdoor scenarios, the maximum communication distance is reverse-calculated based on the COST-HATA path loss model to obtain the extended radius. In indoor scenarios, the extension radius is determined by horizontal and vertical expansion based on the building where the terminal device is located and floor height and wall penetration loss. The directional antenna parameters are adjusted to enhance the signal. Based on electronic map data, unreachable areas are excluded, and DBSCAN clustering is performed on all signal sources within the extended area. In indoor scenarios, a circular area centered on the longitude and latitude is output, while in outdoor scenarios, a rectangular area in the building coordinate system is output.

6. The method for determining the location of a terminal device based on LSTM according to claim 1, wherein: When the terminal device is outdoors, extracting information of all detected base stations within the extended positioning range, screening the primary serving base station to construct a base station coordinate set, including: Sort all detected base stations by reference signal received power from high to low, prioritizing the candidate base stations with the strongest signals, with 5G base stations having the highest priority. Ensure that the candidate base stations are spatially dispersed, calculate the azimuth differences between the candidate base stations, and eliminate base stations with an angle difference less than a set threshold from the selected base station. A minimum of w base stations is retained, where w is a positive integer set by the user. If the number of 5G base stations is insufficient, 4G base stations are added. The operator's public positioning database is queried using the cell ID and tracking area code to obtain the latitude and longitude coordinates of the base station; the latitude and longitude coordinates of the base station are converted into a local Cartesian coordinate system to construct a base station coordinate set.

7. The method for determining the location of a terminal device based on LSTM according to claim 1, wherein: The COST-HATA model is used to calculate the path loss, and the RSSI sequence is combined to infer the distance between the terminal device and each base station, including: Determine the applicable frequency range of the COST-HATA model and categorize the environment types into dense urban areas, general urban areas, suburban areas, and rural areas based on building density and distribution characteristics; set the base station antenna height and mobile station antenna height, and configure the frequency correction factor based on the environment type; match the terminal device location with the electronic map and automatically determine the environment type based on building density; calculate the basic path loss based on the signal frequency, base station height, and distance; adjust the basic path loss based on the frequency correction factor using a correction formula for different environment types and antenna heights; and linearly adjust the basic path loss when the signal frequency exceeds the default range; The RSSI sequence is smoothed and filtered using the sliding window averaging method. The theoretical received power is calculated based on the base station transmit power, base station antenna gain, and terminal antenna gain. The distance between the terminal device and each base station is inferred from the relationship between the RSSI value in the RSSI sequence and the theoretical received power.

8. The method for determining the location of a terminal device based on LSTM according to claim 1, wherein: When the terminal device is indoors, an indoor signal fingerprint library is constructed, dynamic time warping matching is performed, and a weighted K-nearest neighbor algorithm is used for online positioning to obtain a corrected terminal device position, including: Divide the indoor area into regular grids and set the grid spacing; collect multiple signal sources, construct time series, perform feature extraction and preprocessing, and build an indoor signal fingerprint library; The terminal device collects signal sequences in real time, with the collection duration consistent with the fingerprint library, to construct an online signal sequence. The DTW distance between the online signal sequence and the signal sequence of each reference point in the fingerprint library is calculated. The DTW distance measures the similarity between two time series. While calculating the DTW distance, the optimal alignment path is recorded. The K value is selected based on the complexity of the environment, and the K reference points with the smallest DTW distance are selected as neighbors. The weight is calculated based on the inverse of the DTW distance, with the closer the distance, the greater the weight. The coordinates of the K neighbors are weighted averaged to obtain the corrected terminal device position.

9. A terminal device location determination system based on LSTM, using the terminal device location determination method based on LSTM according to any one of claims 1 to 8, comprising: Signal acquisition module: includes: a signal feature extraction unit and an RSSI sequence generation unit; wherein the signal feature extraction unit is connected to a directional antenna to extract signal features, and the RSSI sequence generation unit performs dynamic time warping preprocessing to obtain an RSSI sequence; Terminal device location acquisition module: includes: LSTM network construction unit, location classification unit and terminal device location acquisition unit; the LSTM network construction unit constructs an LSTM network, the input layer receives the RSSI sequence, the LSTM layer uses a bidirectional LSTM, and a one-dimensional convolutional layer is added after the LSTM layer to extract local temporal features and integrate an attention mechanism; the location classification unit uses the LSTM network to classify indoor and outdoor locations, and the terminal device location acquisition unit obtains a spectrogram and inputs it into the CNN network, extracts spectrogram features, splices them with local temporal features, and inputs them into the multi-layer perceptron for final position regression, outputting the terminal device location; Positioning range expansion module: including: positioning range expansion unit; wherein, when the RSSI signal strength collected by the directional antenna is lower than a preset threshold, the positioning range expansion unit dynamically expands the positioning range based on the signal strength with the terminal device position as the center; Outdoor location correction module: includes: base station coordinate set construction unit, distance inversion unit and distance error correction unit; among them, when the terminal device is outdoors, the base station coordinate set construction unit extracts the information of all detected base stations within the extended positioning range, selects the main service base station to construct the base station coordinate set; the distance inversion unit uses the COST-HATA model to calculate the path loss, combined with the RSSI sequence, to infer the distance between the terminal device and each base station; the distance error correction unit uses the maximum likelihood estimation method to solve the terminal device position coordinates, and introduces the signal fluctuation period to correct the distance error; Indoor position correction module: includes: a fingerprint library construction unit and a terminal device position correction unit; wherein, when the terminal device is indoors, the fingerprint library construction unit constructs an indoor signal fingerprint library, and the terminal device position correction unit performs dynamic time warping matching and uses the weighted K nearest neighbor algorithm for online positioning to obtain the corrected terminal device position; Correction execution module: includes: an antenna angle adjustment unit and a signal search process restart unit; wherein, the antenna angle adjustment unit automatically adjusts the directional antenna angle based on the corrected terminal device position when the continuous positioning error is greater than the threshold, and the signal search process restart unit restarts the signal search process.

Citation Information

Patent Citations

  • Indoor and outdoor seamless positioning system and method for intelligent mobile phone and mobile terminal

    CN106255065A

  • Indoor terminal positioning method and related device

    CN110493715A