A federated positioning method based on personalized patch and dynamic fusion
By configuring personalized patches for each client and dynamically merging them, the problem of insufficient adaptability of the global model to local data is solved, achieving efficient personalized positioning and reducing resource consumption and positioning errors.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING UNIV OF TECH
- Filing Date
- 2026-02-12
- Publication Date
- 2026-06-23
AI Technical Summary
In existing federated positioning technologies, the global model struggles to capture local data feature preferences, local personalized training is costly, and dynamic adaptation capabilities are insufficient, resulting in high positioning errors and wasted resources.
Configure personalized patches for each client, and use these personalized patches in conjunction with a globally shared model to extract parameters from similar clients through a dynamic fusion mechanism to improve the adaptability of the local model.
It improves the personalized performance of the global model on local data, reduces positioning error and training cost, enhances the model's adaptability to dynamic indoor environments, and improves positioning accuracy.
Smart Images

Figure CN122269438A_ABST
Abstract
Description
Technical Field
[0001] This invention is a federated positioning method based on personalized patching and dynamic fusion, belonging to the field of indoor positioning and federated learning technology. Background Technology
[0002] In the field of indoor positioning, Wi-Fi-based fingerprint positioning technology has become one of the core solutions for location services in the Internet of Things (IoT) environment due to the low-cost deployment and wide coverage of wireless devices. The core of fingerprint positioning is to build a fingerprint database containing RSS fingerprints and location information offline. Online, users match real-time collected RSS data with the fingerprint database or input it into a machine learning model pre-trained from the offline database to achieve real-time positioning. However, traditional centralized fingerprint positioning requires users to upload raw RSS data to build a massive fingerprint database, which is time-consuming, labor-intensive, and carries the risk of leaking sensitive location information. Federated learning (FL), as a distributed privacy-preserving framework, has been introduced into fingerprint positioning. Each local client only uploads model parameters instead of raw data, and the server aggregates the parameters to build a global model. This approach reuses data from multiple clients while protecting privacy, becoming the mainstream research direction for current federated positioning technology.
[0003] While federated learning effectively protects user privacy and allows for global model training without uploading raw data, its application in real-world scenarios still faces several key challenges. In IoT environments, client data exhibits non-independent identically distributed (Non-IID) characteristics. This is because different devices have varying activity ranges and data collection scenarios. The global model focuses on learning general features, making it difficult to capture the feature preferences of local data, such as the distribution patterns of AP signals in specific areas. In local scenarios, positioning errors are significantly higher than with centralized training models, resulting in global generalization but local inaccuracies. If centralized training is performed separately on the client side to improve the accuracy of local models, it consumes significant terminal computing power and time, and the general feature extraction capabilities already learned by the global model cannot be reused, leading to a double waste of computing power and data resources, especially unsuitable for the resource constraints of IoT terminal devices. Existing federated personalization methods often use fixed-structure private modules to supplement the global model, failing to dynamically adjust parameters according to changes in data distribution. When client data distribution changes with the environment, personalization performance rapidly degrades, making it difficult to adapt to long-term dynamic indoor positioning scenarios.
[0004] To overcome the aforementioned difficulties, this invention proposes a federated positioning method based on personalized patches and dynamic fusion. This method compensates for the insufficient personalization capabilities of the global model by adding personalized patches to local clients and learning the representational preferences of the local models. Specifically, this method configures a private personalized patch for each client, while all clients share the location encoder of the global model. The personalized patches enhance the adaptability of the global model to local data, thus compensating for the insufficient local personalization capabilities of the global model. Simultaneously, a dynamic fusion method is used to allow local personalized patches to extract and combine parameters from local models that are highly correlated with the local data distribution, thereby improving personalization capabilities. Summary of the Invention
[0005] This invention designs a federated localization method based on personalized patching and dynamic fusion, aiming to address the technical bottlenecks of existing federated localization technologies, such as the difficulty of the global model in capturing local data feature preferences, high local personalized training costs, and insufficient dynamic adaptation capabilities. Specifically, while fully utilizing the feature extraction capabilities of the global model's feature encoder, a decision layer more suited to the data preferences of each local client is provided. Furthermore, the similarity of data distributions among clients is calculated, allowing personalized patches to extract knowledge from local models uploaded by clients with similar distributions. This improves the personalized localization capabilities of the global model while accelerating the enhancement of personalization capabilities.
[0006] To achieve the above objectives, the present invention provides the following solution:
[0007] A federated location method based on personalized patching and dynamic fusion, the method comprising:
[0008] Step 1: Location based on personalized patches
[0009] Step 2: Data Feature Extraction
[0010] Step 3: Similarity Calculation and Knowledge Extraction
[0011] Step 4: Combine the shared feature encoder and the private location estimator to perform location estimation.
[0012] The location based on personalized patches specifically includes the following steps:
[0013] Consider decoupling the parameters of the fingerprint localization model: , These represent the feature encoder parameters and the location decoder parameters in the localization model, respectively. Each client has a private set of these parameters. The entire positioning system shares a common [feature / system]. and (Globally shared model). The purpose of personalized positioning is:
[0014]
[0015] In the formula, This indicates the use of a private personalization layer for each local client. Combined with global sharing model To improve the global model in each local data Performance on the surface.
[0016] Based on the structural characteristics of the localization model, the location decoder was selected as the personalized patch. This system comprises multiple linear and regularization layers. The regularization layers scale and gain the data in the hidden layers, aiming to balance the differences in data distribution caused by different data sources and processing methods, thus making network model training faster and more accurate. The linear layers perform linear fitting based on the data provided by the upper layers, obtaining accurate prediction results based on learnable weights. The rich regularization layers in the personalized patches obtain hidden layer representations that better reflect local data preferences, while the linear layers construct linear / non-linear relationships based on local feature preferences, addressing the personalization issue.
[0017] The problem addressed by regularization layers is that as the number of network layers increases, the data distribution changes between layers, leading to slower training speeds and potentially the vanishing gradient problem. The solution is to fix the mean and variance of the output of each layer, i.e., layer normalization algorithms, which normalize the input using the mean and variance of each sample. Layer normalization algorithms normalize the input by calculating the mean and variance of all neurons in a given layer on a training sample, while also adding a gain to each neuron. and bias This is used to achieve a linear transformation, which is applied after normalization and before the activation function.
[0018]
[0019] In the formula, This represents the mean. Represents variance. These are trainable parameters.
[0020] During personalized localization, the parameters of the location decoder in the global localization model are replaced with those in the personalized patch. The acquired RSS fingerprint data is then input into the model to obtain the results. By combining a private model and a shared model, the feature extraction capabilities of the global model on fingerprint data are fully utilized, combined with the ability of the personalized patch to extract local data preferences, thus enhancing personalization capabilities.
[0021] The data feature extraction specifically includes the following steps:
[0022] The output of the penultimate linear layer of the location estimator in the local model is used as the data representation vector. The location estimator is a network module used in the federated positioning system to estimate location sequences. The reason for choosing this layer's output as the representation vector is that the hidden layer data is generated by correlation analysis between Wi-Fi fingerprint features and corresponding location sequences, directly reflecting the distribution characteristics of local client data. For each category, the hidden layer representation is a... A 3D matrix Represents the hidden layer dimension. It is the length of the position sequence, which will be expanded into a single value when statistical data features are finally analyzed. The vector.
[0023] Based on all category labels and their corresponding representation vectors, a two-dimensional matrix of local data features is constructed:
[0024]
[0025] in This represents the total number of category labels covered by all clients. If a certain category label is missing from the data of a local client, then that category label is missing from... The corresponding representation vector is set to empty;
[0026] The central server receives data uploaded by all participating local clients. Then, a global data feature matrix is calculated based on the weighted average of the data volume from each client. The formula is as follows:
[0027]
[0028] in, The total number of clients participating in the training. For effective uploading Number of clients, For the first Local data volume per client;
[0029] To reduce data transmission volume and subsequent computational costs, Principal Component Analysis (PCA) is used to reduce the dimensionality of data features for efficient communication. Singular Value Decomposition (SVD) within PCA is employed to solve the problem. The specific steps are as follows:
[0030] Pick Not empty inside 3D representation vector matrix as input matrix Perform singular value decomposition on it:
[0031]
[0032] in, It is a left singular matrix. It is a singular value diagonal matrix. It is a right singular matrix;
[0033] For matrix Perform staged singular value decomposition, retaining the previous... Singular values and singular vectors Each column corresponds to a principal component, resulting in Principal component matrix :
[0034]
[0035] The similarity calculation and knowledge extraction specifically include the following steps:
[0036] Step 1: Calculate the data distribution similarity and combined weights among clients. Based on the local data principal component matrix and shared location decoder parameters, solve for the optimal combined weights for each client by minimizing the local expected loss. The specific steps are as follows:
[0037] Define the similarity metric objective function: (The function is defined with respect to the first...) The target object is a client, which is different from other clients. Combined weight of each client Solve using the following objective function:
[0038]
[0039] in, For the first The optimal combination weight vector for each client. This is a distance metric function used to quantize the first... The client and the first Shared location decoder parameters for each client The distribution differences are calculated using a variant of Euclidean distance; For the first Total data volume for each client; For the first The variance term of the local data features of each client is calculated from the principal component matrix Z, reflecting the dispersion of the data distribution. The aim is to minimize the difference between the local model's location decoder and the location decoders of other local models, as this allows the local model's location decoder to generalize better and improve performance. Finally, a linear weight for combination is calculated. Based on this weight, the location decoders of all local models participating in training are combined, which will be explained later. In solving... During the process, the distance between information is represented by the data tags of each client. variance with each client Using the sum of the values as the objective function, a quadratic programming problem is solved to obtain the optimal combination of weights. .
[0040] Step 2: The local client calculates the combined weights obtained in Step 1. The location decoder in the local model of similar clients is combined with its own personalized patch parameters. Perform dynamic fusion:
[0041]
[0042] in, Indicates the current round of federated learning. This represents the pair of personalization layers for each local client i. Local model reference weights, Indicates the first The location decoder in the shared model uploaded by a local client; Indicates the first A client-side personalization layer; Indicates the number of participating clients; This represents a constraint coefficient that controls the extent of fusion during knowledge extraction. All local models are linearly combined with the personalization layer according to this weighted combination to extract location decoder parameters from specific local models.
[0043] Beneficial effects:
[0044] This invention proposes a federated positioning method based on personalized patching and dynamic fusion. It optimizes the design by combining a federated learning framework with a Wi-Fi fingerprint positioning model, and its core comprises two key modules: personalized patching and dynamic fusion. Personalized patching uses a private location decoder to specifically capture local data feature preferences, addressing the problem of the global model's "excessive generalization but insufficient personalization." The dynamic fusion mechanism calculates the similarity of data distribution among clients, reusing parameter knowledge from similar clients to reduce local training costs and device computing power consumption, while balancing the generalization ability of the global model with local positioning accuracy. This effectively improves the personalized performance of the federated positioning system in Non-IID data scenarios and enhances the model's adaptability and stability to dynamic indoor environments in the Internet of Things. In the public dataset UJIIndoorLoc, the floor recognition rate can reach 99.41%, and the average positioning error can be reduced to 2.1m, which is a significant improvement in accuracy compared with existing personalized methods such as FedPer and MTFL. On the Tampere dataset, the floor recognition rate can reach 99.5%, and the average positioning error can be reduced to 2.3m. Both the average positioning error and the floor recognition rate are better than traditional federated positioning methods, achieving a synergistic optimization of privacy protection and personalized positioning accuracy. Attached Figure Description
[0045] Figure 1 This is a network structure diagram of the federated positioning method based on personalized patching and dynamic fusion provided by the present invention.
[0046] Figure 2 This is an overall algorithm framework diagram of the federated positioning method based on personalized patching and dynamic fusion provided by the present invention. Detailed Implementation
[0047] The purpose of this invention is to provide a federated localization method based on personalized patching and dynamic fusion, addressing the problem in federated learning where the global model cannot effectively extract the data feature preferences of different clients. By adding personalized patches to local clients, the insufficient personalization capability of the global model is compensated for, and the local model's representation preferences are learned. A dynamic fusion method is used to combine parameters based on data correlation, improving personalization efficiency.
[0048] The present invention will now be described in detail with reference to the accompanying drawings. It should be noted that the described embodiments are intended only to facilitate the understanding of the present invention and are not intended to limit it in any way.
[0049] Figure 1 This is a network structure diagram of the fingerprint positioning method provided by the present invention; Figure 2 This is an overall algorithm framework diagram of the fingerprint positioning method provided by the present invention.
[0050] The federated location method based on personalized patching and dynamic fusion provided by this invention specifically includes:
[0051] Step 1: Location based on personalized patches
[0052] The personalized patch is derived from the location decoder of each positioning model, such as Figure 1 Based on the structural characteristics of the FTLoc localization model, the location decoder is selected as the personalized patch. This system comprises multiple linear and regularization layers. The regularization layers scale and gain the data in the hidden layers, aiming to balance the differences in data distribution caused by different data sources and processing methods, thus making network model training faster and more accurate. The linear layers perform linear fitting based on the data provided by the upper layers, obtaining accurate prediction results based on learnable weights. The rich regularization layers in the personalized patches obtain hidden layer representations that better reflect local data preferences, while the linear layers construct linear / non-linear relationships based on local feature preferences, addressing the personalization issue.
[0053] like Figure 2Private personalized patches do not participate in the aggregation of the global model. During local training, the globally shared model downloaded from the cloud is trained. After completion, the globally shared feature encoder is used to train the personalized patches. Then, each client uploads the parameters of the local model to the cloud for aggregation, while the personalized patches remain in place.
[0054] Step 2: Data Feature Extraction
[0055] The data feature extraction includes data feature dimensionality reduction and calculation of the global data feature matrix. Data features are used to statistically analyze the label values and corresponding representation vectors of each element appearing in the location sequence of all samples in the local data. The function of the location decoder is to analyze the relationship between fingerprints and location sequences; therefore, the hidden layers of the location decoder directly or indirectly imply the characteristics of location and fingerprint data. Here, the output of the penultimate linear layer of the location decoder is used as the representation vector.
[0056] Step 3: Similarity Calculation and Knowledge Extraction
[0057] The similarity calculation and knowledge extraction are performed by calculating the correlation between each client and other clients based on the data features extracted from each client. Principal Component Analysis (PCA) and minimizing local expected loss are used to extract data features and calculate correlations, respectively. Then, the personalized patch extracts knowledge from the uploaded local model based on the correlation. In other words, the server selectively sends parameters of some local models from some clients to specific clients, accelerating the training process of the personalized patch.
[0058] Step 4: Combine the shared feature encoder and the private location estimator to perform location estimation.
[0059]
[0060] Personalized Federated Location Algorithm Pseudocode
[0061]
[0062] Table 1 Related Concepts
[0063] Implementation details
[0064] The dataset used in the experiment was the UJIIndoorLoc dataset. To achieve non-independent and identically distributed data for each client, the dataset was divided into p subsets based on the device identifiers. Then, every m subsets were merged to form the data for one client, resulting in p / m clients, where m was set to 2. The training data was then divided into 9 Non-IID client datasets based on the device ID. The experiment was implemented in PyTorch 1.13.0, and all training processes were performed on a computer running Ubuntu 20.04 with the following configuration: CPU: Intel i9-14900K, GPU: NVIDIA GeForce RTX 3090 24GB, RAM: 64GB. Furthermore, during local client training, the Batch_size was set to 8, the local iteration count (local_epoch) was set to 1, the initial learning rate was set to 0.0001, and the global iteration count was set to 350.
[0065] To demonstrate the effectiveness of the proposed method, its performance in local areas is compared with that of two other personalized federated learning methods, FedPer and MTFL, as well as the global model, and the results of local centralized training. In each client's data set, 80% is used for training the global model in federated learning, and 20% is allocated as a test set to evaluate personalized performance. Performance metrics include mean positioning error and floor prediction accuracy. The average performance of the personalized method on the test set across all clients is used as the evaluation metric for the model's personalized capability.
[0066]
[0067] Table 1 Performance Comparison of Various Methods
[0068] As shown in Table 1, on the UJIIndoorLoc dataset, the proposed method achieves a high positioning accuracy of 2.10m with the smallest average positioning error. Compared to the global model's performance in local testing (gmodel-localtest, 4.52m), the accuracy is improved by 2.42m; compared to the locally trained model's performance in local testing (personal-localtest, 3.96m), the accuracy is improved by 1.86m; and compared to MTFL (2.81m) and FedPer (3.1m), the accuracy is improved by 0.71m and 1m, respectively. Furthermore, the proposed method's accuracy convergence speed is superior to the comparison methods, the global model performance, and the locally trained model performance. Regarding floor prediction accuracy, the final results of the five methods are similar, all reaching over 99%. It can be seen that adding personalized patches and implementing dynamic fusion can effectively improve the global model's personalization capabilities and accelerate model performance improvement.
[0069] This invention designs a federated positioning method based on personalized patching and dynamic fusion. This method improves the personalization performance of the global model by adding personalized patches to acquire the feature preferences of local data. Simultaneously, a dynamic fusion method is employed to analyze the correlation between data using local model representations, enabling personalized patches to selectively extract knowledge from local models with similar data distributions during updates. The personalized patching and dynamic fusion method accelerates the convergence speed of personalized patches while maintaining the personalization capability of the global model. Experiments verify that this method effectively improves the personalization capability of the global model on local data, enhances the practicality of federated positioning, and achieves better results compared with other algorithms. This method can be applied to the field of federated indoor positioning, effectively alleviating the problem of insufficient personalization capability of the global model on local data in federated positioning and improving the global model's personalization capability for local data.
[0070] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any modifications and substitutions that can be conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A federated location method based on personalized patching and dynamic fusion, characterized in that, The method includes: Step 1: Each client adds a private personalized patch, which does not participate in the aggregation of the global model; during local training, the globally shared model downloaded from the cloud is trained; the globally shared model includes a shared encoder and decoder; after completion, the personalized patch is trained using the globally shared feature encoder; then each client uploads the parameters of the local model to the cloud for aggregation, while the personalized patch remains in place. Step 2: While performing local training, it is necessary to generate some data features based on the characteristics of the local data. Here, the concept of category representation vector in the attention mechanism is used to count the label value and its corresponding representation vector of each element in the position sequence of all samples in the local data. The function of the position decoder is to analyze the relationship between fingerprint and position sequence. The hidden layer of the position decoder directly or indirectly implies the characteristics of position and fingerprint data. The output of the second to last linear layer of the position decoder is used as the representation vector. Step 3: Based on the data features extracted from each client, calculate the correlation between each client and other clients; use Principal Component Analysis (PCA) and minimizing local expected loss to complete the extraction of data features and the calculation of correlations respectively; then, the personalized patch extracts knowledge from the uploaded local model based on the correlation, extracts the location decoder parameters from the specific local model, and accelerates the training process of the personalized patch. Step 4: During runtime, the personalized localization algorithm combines a shared feature encoder and a private location estimator to perform location estimation.
2. The federated positioning method based on personalized patching and dynamic fusion according to claim 1, characterized in that, The personalized patch mentioned in step 1 is a private location decoder containing a layer normalization layer, a linear layer, and a Dropout layer. The layer normalization operation formula is as follows: ; in, For input data, , These are the mean and variance of the input data, respectively. For smoothing terms, , These are trainable parameters.
3. The federated positioning method based on personalized patching and dynamic fusion according to claim 1, characterized in that, The local data feature matrix described in step 2 is generated by extracting principal components through singular value decomposition, and is used to share the representation vector output by the penultimate linear layer of the location decoder. Based on, among which It is the set of real numbers. Represents the hidden layer dimension. It is the length of the position sequence; the singular value decomposition formula is: ; in, It is a left singular matrix. It is a singular value diagonal matrix. For a right singular matrix, for the matrix Perform staged singular value decomposition, retaining the previous... Singular values and singular vectors Each column corresponds to a principal component, resulting in Principal component matrix ; 。 4. The federated positioning method based on personalized patching and dynamic fusion according to claim 1, characterized in that, The specific steps for similarity calculation and knowledge extraction described in step 3 are as follows: The similarity of data distribution among clients is solved by minimizing the local expected loss, with the objective function being: ; in, This indicates a distance calculation method used to represent the distributional differences between two data points; It is a shared decoder for local models uploaded by global clients. This indicates the number of clients participating in the training. This represents the combined weights between the i-th local model and the other local models. For client data volume, It is a variance term calculated based on the data characteristics of each client, used for weight adjustment; The preset iteration cycle is set, and the personalized patch parameter update formula is as follows: ; Where t represents the current federated learning round, This represents the reference weights of the personalization layer for each local client i relative to the j local models. This represents the location decoder in the shared model uploaded by the j-th local client; This represents the personalization layer of the i-th client; m represents the number of participating clients. This represents the constraint coefficient, which controls the extent of fusion during knowledge extraction; After linearly combining all local models with the personalization layer according to this weighted combination, it is used to achieve the effect of specific Extract location decoder parameters from the local model.