A federated learning method and device based on permutation invariance in a vehicle networking environment, and a medium
Patent Information
- Application Number
- CN202611080320.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-17
- Publication Date
- 2026-09-18
- Estimated Expiration
- 2046-07-17
AI Technical Summary
[0007]本公开实施例提供了一种车联网环境下基于置换不变性的联邦学习方法及装置、介质,以解决车联网场景下,直接应用FedAvg算法聚合多个汽车端时,产生的参数置换不变性问题以及由数据异构性引起的函数功能不一致问题
本发明通过步骤S3中带约束K-means聚类与置换矩阵,实现KAN网络节点的功能对齐,有效解决参数置换不变性导致的聚合失效问题,显著提升模型精度。针对数据异构性,步骤S4引入基于代价函数的节点动态新增机制,识别并融合各客户端独有特征,增强全局模型表达能力。采用逐层对齐策略,同步修正层间输入输出权重,确保网络映射逻辑一致。在车联网场景下,数据本地留存,保障隐私安全并降低通信开销,提升了全局模型的识别精度。
Smart Images

Figure CN122596192B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of federated learning technology, and to a federated learning method, device, and medium based on permutation invariance in a vehicle networking environment. Background Technology
[0002] Federated Learning (FL), as a distributed machine learning method, offers a new approach to solving the aforementioned challenges. It trains an algorithm across multiple distributed vehicles or servers without exchanging data samples, training a global model based on distributed data. Unlike traditional centralized machine learning techniques, it does not require uploading local data from distributed vehicles to a centralized node, effectively protecting user privacy. A typical federated learning framework in a connected vehicle scenario consists of a server and multiple vehicles. In each training round, the server distributes the current global model to each vehicle. Each vehicle trains its model locally using its own data, then uploads only the updated parts of the model to the server's information exchange area. The server then aggregates the models from all vehicles to form a new global model. This process iterates multiple rounds until the model reaches a preset accuracy or the desired number of training rounds.
[0003] In federated learning, the expressive power and convergence performance of the global model largely depend on the underlying network structure used by each vehicle. Traditionally, MLPs or CNNs are commonly used as the global model. In recent years, Kolmogorov-Arnold Networks (KANs) have gained widespread attention for their excellent interpretability and are increasingly being applied to federated learning. KANs are a type of neural network structure built upon the Kolmogorov-Arnold representation theorem. Instead of using the combination of linear weights on edges and fixed activation values at nodes, KANs learn nonlinear representations using univariate functions on the network edges and sum multiple univariate functions at the nodes, using continuous univariate functions and addition to represent multivariate functions. After using KANs as the local model for each vehicle, the server needs to aggregate the KAN parameters obtained from independent training at each vehicle to form the global model required for the next round of training. FedAvg typically uses a weighted average of the weights at the same parameter positions according to the proportion of data from each vehicle. However, for deep KANs, nodes within the same layer are functionally interchangeable: without changing the network's input-output relationship, nodes can be permuted and their corresponding edge function weight matrices rearranged to still represent the same mapping relationship and achieve the same function. This means that even if different vehicles learn equivalent feature representations, the specific arrangement of their weights in the parameter space may be misaligned. In the context of connected vehicle federation, after each vehicle is trained independently, alignment problems easily arise where the overall semantics are the same but the node indices differ. If the FedAvg aggregation method is still used to directly weight and average the misaligned parameters, it is equivalent to forcibly mixing the weights of non-corresponding parameters, which can easily cause problems such as misaligned function semantics and destroyed edge function shapes, leading to a decrease in global model accuracy.
[0004] Therefore, how to effectively match, align, and aggregate functions in KAN under the federated learning framework, solve the parameter permutation invariance problem, be compatible with the functional differences caused by data heterogeneity, identify and distinguish the common functions and unique characteristics in each client model, and avoid forcibly aligning neurons with inconsistent functions has become an urgent technical problem to be solved.
[0005] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this application, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0006] To provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. This summary is not intended as a general commentary, nor is it intended to identify key / important components or describe the scope of protection of these embodiments, but rather as a prelude to the detailed description that follows.
[0007] This disclosure provides a federated learning method, apparatus, and medium based on permutation invariance in a vehicle-to-everything (V2X) environment to address the parameter permutation invariance problem and the function inconsistency problem caused by data heterogeneity when directly applying the FedAvg algorithm to aggregate multiple vehicle terminals in a V2X scenario.
[0008] In some embodiments, the method includes: S1: The server initializes the global model and distributes it to each vehicle terminal. The global model is a KAN network model. S2: The vehicle trains the global model based on the local dataset and uploads the trained local model parameters to the server; S3: The server receives the local models uploaded by each vehicle, performs constrained K-means clustering matching on the nodes of each layer of the local model, and uses the permutation matrix obtained from the clustering to correct the input and output matrices of each vehicle model. S4: The server calculates the matching cost function of each layer. If the matching cost function is greater than the preset threshold, the number of nodes in the global model is dynamically increased by increasing the number of clusters, and virtual nodes are added at the corresponding positions in the vehicle model to complete the correction. S5: The server performs a weighted average aggregation of the corrected node weights to obtain the weights of nodes at each layer of the global model, and then distributes the updated global model to each vehicle terminal. S6: Each vehicle receives the updated global model, continues to train the global model based on local data, and uploads the updated model parameters to the server. The server uses the uploaded result as the input for the next communication round, repeating S3 to S6 until the preset number of communication rounds or accuracy requirements are reached. S7: Deploy the trained global model to the vehicle to perform real-time image recognition tasks.
[0009] In some embodiments, the permutation-invariant-based federated learning device in the vehicle-to-everything (V2X) environment includes a processor and a memory storing program instructions. The processor is configured to execute the permutation-invariant-based federated learning method in the V2X environment when running the program instructions.
[0010] In some embodiments, the storage medium stores program instructions that, when executed, perform the federated learning method based on permutation invariance in the vehicle-to-everything (V2X) environment.
[0011] The embodiments of this disclosure provide a federated learning method, apparatus, and medium based on permutation invariance in a vehicle-to-everything (V2X) environment, which can achieve the following technical effects: This invention achieves functional alignment of KAN network nodes through constrained K-means clustering and permutation matrix in step S3, effectively solving the aggregation failure problem caused by parameter permutation invariance and significantly improving model accuracy. To address data heterogeneity, step S4 introduces a dynamic node addition mechanism based on a cost function to identify and fuse unique features from each client, enhancing the global model's expressive power. A layer-by-layer alignment strategy is adopted to synchronously correct inter-layer input and output weights, ensuring consistent network mapping logic. In the context of connected vehicles, data is stored locally, ensuring privacy and reducing communication overhead, thereby improving the global model's recognition accuracy.
[0012] The above general description and the description below are exemplary and illustrative only and are not intended to limit this application. Attached Figure Description
[0013] One or more embodiments are illustrated by way of example with reference to the accompanying drawings. These illustrations and drawings do not constitute a limitation on the embodiments. Elements having the same reference numerals in the drawings are shown as similar elements. The drawings are not to be scaled. And wherein: Figure 1 This is a schematic diagram of the method flow of the present invention; Figure 2 This is a schematic diagram of the cloud server-side process provided in the embodiments of this disclosure; Figure 3 This is a schematic diagram of the automotive-side process provided in an embodiment of this disclosure; Figure 4 This is a schematic diagram illustrating how training accuracy changes with the number of training rounds, provided in an embodiment of this disclosure. Figure 5 This is a schematic diagram of the device structure provided in the embodiments of this disclosure. Detailed Implementation
[0014] To provide a more detailed understanding of the features and technical content of the embodiments of this disclosure, the implementation of the embodiments of this disclosure will be described in detail below with reference to the accompanying drawings. The accompanying drawings are for illustrative purposes only and are not intended to limit the embodiments of this disclosure. In the following technical description, for ease of explanation, several details are used to provide a full understanding of the disclosed embodiments. However, one or more embodiments may still be implemented without these details. In other cases, well-known structures and devices may be simplified in their depiction to simplify the drawings.
[0015] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this disclosure described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion.
[0016] Unless otherwise stated, the term "multiple" means two or more.
[0017] In this embodiment of the disclosure, the character " / " indicates that the objects before and after it are in an "or" relationship. For example, A / B means: A or B.
[0018] The term "and / or" describes an association between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or A and B.
[0019] The term "correspondence" can refer to an association or binding relationship. The correspondence between A and B means that there is an association or binding relationship between A and B.
[0020] Example 1 In the context of vehicle-to-everything (V2X) image recognition, assume that vehicle A and vehicle B learn and recognize cats, dogs, and trucks respectively, and both vehicles perform the image recognition task well. However, for vehicle A's model... For layer nodes, nodes 1, 2, and 3 may correspond to functions for extracting features from cats, dogs, and trucks, respectively; while for the automotive side B... Layer 1, 2, and 3 nodes may correspond to functions for extracting features from trucks, cats, and dogs, respectively. Although both vehicle ends can extract features from different images and achieve accurate recognition, when using the FedAvg algorithm for weighted aggregation to obtain the global model, the functions corresponding to the nodes at the corresponding positions on the two vehicle ends are not consistent, causing the layer 1 nodes to have different functions. The nodes 1, 2, and 3 of the global model cannot accurately extract the features of the cat, dog, and truck, thus affecting the accuracy of the global model.
[0021] Furthermore, the heterogeneity of data in the connected vehicle environment presents a deeper challenge to model alignment. Since different vehicles are often distributed across different physical environments, the data they acquire varies significantly. This inevitably leads to biases in the local model training process, causing the function parameters learned by each vehicle's model to only fit its own data distribution. In other words, only a portion of the function parameters from different vehicles may represent consistent functions and be suitable for matching and alignment, while another portion is unique to each vehicle, with completely different functions and unsuitable for matching and alignment. Forcing matching and alignment or directly applying the FedAvg algorithm for weighted aggregation will reduce the accuracy of the global model.
[0022] To address this, this embodiment provides a federated learning method based on permutation invariance in a vehicle-to-everything (V2X) environment. Through clustering, nodes with similar functions are grouped into the same cluster, thereby aligning nodes with the same function across different vehicles and mitigating the impact of parameter permutation invariance issues. Simultaneously, by identifying and distinguishing unique functions in each vehicle's model, the method identifies and adds weights for unique parameters, avoiding forced alignment of heterogeneous parameters and thus improving the aggregation accuracy of the global model. Figure 1 As shown, the method includes the following steps: S1: The server initializes the global model and distributes it to each vehicle terminal. The global model is a KAN network model. S2: The vehicle trains the global model based on the local dataset and uploads the trained local model parameters to the server; S3: The server receives the local models uploaded by each vehicle, performs constrained K-means clustering matching on the nodes of each layer of the local model, and uses the permutation matrix obtained from the clustering to correct the input and output matrices of each vehicle model. S4: The server calculates the matching cost function of each layer. If the matching cost function is greater than the preset threshold, the number of nodes in the global model is dynamically increased by increasing the number of clusters, and virtual nodes are added at the corresponding positions in the vehicle model to complete the correction. S5: The server performs a weighted average aggregation of the corrected node weights to obtain the weights of nodes at each layer of the global model, and then distributes the updated global model to each vehicle terminal. S6: Each vehicle receives the updated global model, continues to train the global model based on local data, and uploads the updated model parameters to the server. The server uses the uploaded result as the input for the next communication round, repeating S3 to S6 until the preset number of communication rounds or accuracy requirements are reached. S7: Deploy the trained global model to the vehicle to perform real-time image recognition tasks. Specifically, Figure 2This demonstrates a cloud server-side federated learning process based on permutation invariance in a connected vehicle environment; Figure 3 This demonstrates a federated learning process based on permutation invariance in a vehicle-to-everything (V2X) environment.
[0023] As a refinement of the above embodiments, in step S1, the cloud server initializes a global model M and extracts the structural metadata of the KAN model, recording the position, number of nodes, composition of edge functions, weight of basis functions, weight of spline functions and position of classifier layers of each KAN layer, and establishing the structural description information required for subsequent weight extraction, node matching, structural rearrangement, node addition and model reconstruction.
[0024] As a refinement of the above embodiment, in step S2, after the vehicle receives the model from the cloud server, it trains the initial model for several local epochs based on its local dataset to obtain a vehicle model with local data distribution characteristics, and then uploads the trained model parameters to the server.
[0025] As a refinement of the above embodiments, step S3, which involves constrained K-means clustering matching of nodes in each layer of the local model, specifically includes: S301: To address the unique characteristics of KAN, this invention performs a series of concatenation operations on node parameters before clustering to ensure parameter integrity. The server extracts the vehicle-side data based on the model structure metadata. Layer node weights. For the first layer node weights... The first layer Each node will be connected to by the server. The parameters of a univariate function are represented as a whole. For the first Number of layer nodes. Specifically, for each univariate function, its basis function weights and spline function weights are extracted and concatenated to form the complete function weights; subsequently, the layer node weights are... The first layer The corresponding nodes The complete node weights are formed by concatenating the weights of individual functions: , in, For the automotive end No. The first layer The node weight of each node. For the first The first layer The weight of the first complete function corresponding to each node. The function is a concatenation operation, which integrates multiple independent parameters into a whole in an orderly manner along the dimension. There are no numerical calculations in the concatenation process.
[0026] The node parameter vector is then flattened into a single node parameter vector for clustering matching. Finally, distance / similarity is measured within a unified metric space based on cosine or Euclidean distance.
[0027] S302: For automotive applications No. The server calculates the distance between each vehicle-end node's parameter vector and the cluster center based on Euclidean or cosine distance, and performs constrained K-means clustering. Based on the clustering results, it obtains the correspondence between each vehicle-end local node and each cluster, and constructs the vehicle-end node structure according to this correspondence. No. Layer substitution evidence The specific method is as follows: Let the first After hierarchical clustering, there are a total of One global cluster (global node); Constrained K-means for each local node Assign a cluster number: , Meaning: Client The Layer The local node is mapped to the first local node. A global node.
[0028] Construct the permutation matrix accordingly. ,for The set of 3D real matrices: , in, For real numbers, This is the cluster number for the global node.
[0029] Because K-means clustering cannot distinguish between parameter vectors involved in the matching process, it cannot determine whether parameter vectors come from the same vehicle end. During clustering, different nodes from the same vehicle end may be matched into the same cluster. To address this, this invention uses constrained K-means clustering, employing Euclidean or cosine distance as a metric to cluster function weights with similar distances into a single cluster, thus achieving matching and alignment and resolving the issue of nodes from the same end mistakenly entering the same cluster. Then, the FedAvg algorithm is used to weighted average the node weights within each cluster to obtain the global model. Since the K-means algorithm cannot distinguish between function parameters of different KAN layers, directly calculating distances and aligning the entire model may lead to node mismatches between different layers, resulting in a decrease in global model accuracy. Therefore, this invention adopts a layer-by-layer K-means clustering matching approach, performing clustering layer by layer. Each clustering only aligns the function parameters of the current KAN layer, processing from the first layer to the penultimate layer, avoiding inter-layer mismatches. After clustering at each layer, this invention obtains the correspondence between each vehicle-end local node and each cluster based on the clustering results, and constructs the vehicle-end according to this correspondence. No. Permutation matrix of layer This aligns nodes with similar functions but different arrangement positions, thus eliminating the differences caused by permutation invariance.
[0030] Specifically, the constrained K-means clustering includes: (1) Starting from the second layer of the local model on the vehicle side, select any node on the vehicle side as the initial cluster center, and use a random seed (i.e., a random number, 42 is selected in this embodiment) + the number of iteration rounds to form a seed, and randomize the processing sequence of the nodes to be aligned. (2) Perform constrained clustering on the current processing node, and check each cluster in order from near to far from the cluster center. Only allow the node to be assigned to a cluster that does not yet contain its own vehicle end members. (3) After each round of allocation, the cluster center is updated by weighted averaging of the nodes within the cluster until the cluster label is stable or the center displacement is below the threshold (set to this in this embodiment). ).
[0031] S303: The permutation matrix obtained from clustering is used to correct the input and output matrices of each vehicle-side model. The server uses the permutation matrix... For all car ends No. The layer output and input matrices are modified to achieve an equivalent form with optimal weights. Specifically, the server processes the data from the vehicle side... No. The layer input matrix and output matrix are left-multiplied respectively. Right multiplication The output and input matrices are converted from... Adjusted to , This represents the transpose of a matrix.
[0032] In the ideal scenario (where all vehicles train with the same optimal weights, without any substitutions, resulting in different equivalent forms of the optimal weights; i.e., all vehicles undergo the same initialization and have identical training samples), the vehicle's... The optimal output and input matrices of the layer are Under these conditions, all vehicle-end nodes have been aligned. However, due to different local initializations and training samples, the output and input matrices typically take the following form: , , That is, the car end No. The actual output matrix learned by the layer With input matrix The optimal weight matrix is obtained after permutation matrix. The equivalent form after transformation. The server needs to utilize the permutation matrix obtained from clustering. For all car end The layer output and input matrices are corrected to approximate the same equivalent form. Therefore, the server provides services to the car side. No. Left multiplication of layer input matrix The goal is to obtain the corrected input matrix that satisfies: , Alignment of the input matrix at the vehicle end is achieved; since the input end has already undergone permutation and rearrangement, to avoid misalignment of inter-layer feature mappings, the server aligns the input matrix at the vehicle end. No. Synchronous right multiplication of layer output matrix The goal is to output a matrix that satisfies: , This maintains normal mapping logic between layers. (This refers to the automotive side.) No. The layer's output and input matrices are composed of Adjusted to .
[0033] As a refinement of the above embodiments, in the context of connected vehicle federated learning, due to the different environments of each vehicle and the differences in local training samples, the node functions learned by different vehicles are not always one-to-one. For unique functional nodes trained based on local data, forcibly matching and aggregating them with nodes in other vehicles that have inconsistent functions can easily destroy the original feature representation of the nodes, leading to a decrease in the accuracy of the global model. Based on this, for the node function identification and addition process, step S4 adopts a node expansion mechanism based on a matching cost function. By balancing the cost of node similarity and model size, the number of clusters is dynamically adjusted to achieve the addition of global nodes. Specifically, this invention allows the first Global model node count of the layer Let the variable be a variable that satisfies the following constraints: That is, the first The number of nodes in the global model layer is not less than that in the vehicle side. No. The number of nodes in a layer (assuming each vehicle has the same number of nodes in the same layer) does not exceed the total number of nodes in all vehicles. After completing constrained K-means clustering in one layer, this invention constructs a matching cost function as a metric to determine whether to add global nodes.
[0034] After adding a node, the number of nodes in that layer of the global model increases, and the input weight matrix of the next layer is expanded (the newly added column is set to zero), thereby ensuring the integrity of the network structure.
[0035] In the training process, during the next round of local training, the virtual nodes will participate normally in forward and backward propagation.
[0036] Specifically, it includes: S401: Calculate the... The matching cost function for a layer is given by the following formula: , in, For matching cost function, This is the sum of the average intra-cluster distances of all clusters in the current clustering state. To balance the hyperparameters of intra-cluster similarity and model size, The number of clusters is related to the number of nodes in each layer of the model. In this embodiment, a 5-layer model is used, with 16, 32, 64, 128, and 128 nodes per layer. Therefore, The same values are taken for the corresponding layers.
[0037] For model size constraint functions, for example, one could use... , Set the maximum value for global nodes in this layer.
[0038] S402: If If the value is less than the preset threshold (range [1,3]), it indicates that the matching degree of each vehicle-end node in the current layer is high, and there is no need to add a new global node; aggregation can proceed directly. If the number of clusters exceeds a preset threshold, an iterative search is performed within the range from the current number of clusters to the maximum number of clusters. Each iteration adds one cluster and selects the node furthest from its cluster center based on the result of the previous constrained K-means algorithm. As the initial center of the newly added cluster ; S403: Move the node Remove from the original cluster and update its original cluster center, then set the updated initial cluster center. Initial center of the new cluster Using other cluster centers in this layer as starting points for clustering, and re-perform constrained K-means clustering until a cluster is found that makes... The optimal number of clusters that achieves the global minimum is taken as the final number of global nodes for that layer. By traversing the candidate cluster numbers, the server selects the number of clusters that minimizes the cost function as the final number of global nodes for that layer. , in, Let represent the number of clusters that minimize the cost function, and argmin represent the value of the independent variable that minimizes the function. Indicates the current cluster number (search starting point).
[0039] Because of the previous round of K-means clustering results, except for the nodes... The original cluster, and other clusters, only because among all nodes, nodes The one that is furthest from the cluster center of its own cluster is the one that is furthest from it. Become a new cluster The other clusters remain unchanged, and the cluster centers of the other clusters will be connected to... Together, they serve as the starting point for a new round of K-means clustering.
[0040] As a refinement of the above embodiments, step S5 includes: S501: The server needs to add virtual nodes at the corresponding positions in the car-side model based on the number of new global nodes, and set all their input and output weights to zero. Then, it uses a permutation matrix to modify the car-side model. No. The layer input and output matrices are corrected in the same way as described above.
[0041] S502: After the first layer of clustering matching is completed, the server first uses the obtained permutation matrix to correct and align the input and output matrices of the car-side layer. Then, the server performs a weighted average of the node weights to obtain the... The first layer The weights of each global node: ,
[0042] in, For the first The first layer The weight of each global node, For the automotive end The number of samples, The total number of samples, It's the automotive end. The actual trained first Layer Optimal weights for each node For all vehicles trained with the same optimal weights and without any substitutions, the vehicle's... No. Layer The optimal weights for each node.
[0043] This completes the alignment and addition of a global node at the first level. Return to step S3.
[0044] S503: When the server detects that the current layer is a classifier layer, since its input features have already been aligned in the matching of the previous layer, its output nodes directly correspond to the class labels of the dataset. Therefore, across all vehicle-side applications, assuming the target class space of the federated learning task is consistent, output nodes with the same index have completely consistent semantic meanings, there is no permutation invariance problem, and alignment is unnecessary. The weights of each vehicle-side classifier layer are directly collected and weighted according to the proportion of vehicle-side samples to obtain the global classifier weights. .
[0045] S504: The server assembles the global layer weights obtained from clustering and matching and adding nodes in each KAN layer with the aggregation results of the classifier layer to form a complete global model, and then sends it to each vehicle terminal.
[0046] In summary, this invention solves the problem of KAN parameter permutation invariance while dynamically adding global nodes based on the heterogeneity of vehicle-side data, thereby improving the expressive power and global accuracy of the federated aggregation model.
[0047] In practical vehicle-to-everything (V2X) image recognition scenarios, the system adopts a cloud-edge collaborative federated learning architecture. Each connected vehicle acts as an independent federated client, with onboard cameras capturing real-time images of the surrounding scenery while the vehicle is in motion. Due to the diverse distribution of vehicles, the captured images also exhibit diverse characteristics. For example, passenger cars and freight trucks traveling on roads, birds in suburban green spaces and roadside trees, cats and dogs on the roadside, and boats on riverside sections are all common sights in the driver's field of vision. All raw image data undergoes preprocessing such as image cropping and pixel normalization locally on the onboard terminal to build a training sample set. The original driving images remain locally in the vehicle and are not transmitted to the cloud, thus avoiding the risk of privacy information leakage at the source and effectively reducing the communication load caused by massive image transmission. Each vehicle uses a KAN network as the basic model for image recognition for local training. However, the inherent parameter permutation invariance of the KAN network can lead to index misalignment of nodes responsible for extracting similar image features after independent training by different vehicles. If the traditional FedAvg algorithm is used to weight and aggregate the parameters of each vehicle-side model, it will destroy the functional structure used for feature extraction in the KAN network, leading to problems such as target recognition confusion and insufficient overall recognition accuracy. To address this, the federated learning method based on parameter permutation invariance proposed in this invention performs permutation matching and alignment on nodes with the same function but misaligned indices when performing model aggregation in the cloud, and then performs parameter weighted aggregation. At the same time, considering the non-independent and identically distributed characteristics of vehicle network data, this invention distinguishes between general functional nodes applicable to all vehicles and vehicle-side unique feature nodes formed due to differences in vehicle driving areas and road conditions, and avoids forced matching and alignment of personalized feature nodes by adding global nodes.
[0048] The trained global model can be deployed to the vehicle to enable the vehicle to recognize animals such as cats, dogs, and birds, as well as vehicles such as trucks and airplanes.
[0049] This invention verifies the effectiveness of the algorithm through simulation experiments on the publicly available CIFAR-10 dataset. The experiment simulates federated learning for an image classification task using 16 vehicles. Each vehicle inputs images captured by its onboard camera into the global model for fast forward inference, mapping targets in the images to structured labels in the CIFAR-10 semantic space, thereby achieving vehicle image recognition. Figure 4 The experiments shown demonstrate that the results of this invention are superior to those of FedAvg: In terms of accuracy, the present invention outperformed the federated averaging algorithm in most communication rounds. In the final 10 rounds, the average accuracy of the present invention was 70.29%, while the federated averaging algorithm achieved 68.99%, representing an improvement of approximately 1.30%. Overall, the curve of the present invention is generally above that of the federated averaging algorithm, indicating that it has better final convergence accuracy and more stable test performance in scenarios with non-independent and identically distributed data.
[0050] In terms of speed, this invention achieves faster convergence in the early stages of training, reaching 60.59% in the 8th round, while the federated average algorithm only reaches 60.72% in the 10th round. During the mid-training phase, this invention also converges faster, exceeding 65% in the 13th round, reaching 65.29%, while the federated average algorithm only exceeds and stabilizes around 65% after approximately the 19th round. Therefore, this invention not only achieves higher final accuracy but also demonstrates a faster convergence speed.
[0051] In summary, this invention outperforms the federated averaging algorithm in both convergence speed and final accuracy: it climbs faster in the early stages and achieves higher stable accuracy in the later stages, making it more suitable for federated learning scenarios.
[0052] Example 2 Combination Figure 5 As shown, this disclosure provides a federated learning device 300 based on permutation invariance in a vehicle-to-everything (V2X) environment, including a processor 304 and a memory 301. Optionally, the device may further include a communication interface 302 and a bus 303. The processor 304, communication interface 302, and memory 301 can communicate with each other via the bus 303. The communication interface 302 can be used for information transmission. The processor 304 can call logical instructions in the memory 301 to execute the federated learning method based on permutation invariance in a V2X environment as described in the above embodiment.
[0053] Furthermore, the logic instructions in the aforementioned memory 301 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium.
[0054] The memory 301, as a computer-readable storage medium, can be used to store software programs and computer-executable programs, such as program instructions / modules corresponding to the methods in the embodiments of this disclosure. The processor 304 executes functional applications and data processing by running the program instructions / modules stored in the memory 301, thereby implementing the federated learning method based on permutation invariance in the vehicle network environment described above.
[0055] The memory 301 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the terminal device. Furthermore, the memory 301 may include high-speed random access memory and may also include non-volatile memory.
[0056] This disclosure provides a computer-readable storage medium storing computer-executable instructions configured to execute the above-described federated learning method based on permutation invariance in a vehicle-to-everything (V2X) environment.
[0057] The aforementioned computer-readable storage medium may be a transient computer-readable storage medium or a non-transitory computer-readable storage medium.
[0058] The technical solutions of this disclosure can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes one or more instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in this disclosure. The aforementioned storage medium can be a non-transitory storage medium, including: a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and other media capable of storing program code. It can also be a transient storage medium.
[0059] The foregoing description and accompanying drawings fully illustrate embodiments of this disclosure to enable those skilled in the art to practice them. Other embodiments may include structural, logical, electrical, procedural, and other changes. The embodiments represent only possible variations. Individual components and functions are optional unless explicitly required, and the order of operation may vary. Parts and features of some embodiments may be included in or replace parts and features of other embodiments. Moreover, the terminology used in this application is for describing embodiments only and is not intended to limit the claims. As used in the description of embodiments and claims, the singular forms “a,” “an,” and “the” are intended to equally include the plural forms unless the context clearly indicates otherwise. Similarly, the term “and / or” as used in this application means including one or more of the associated listed items and all possible combinations thereof. Additionally, when used in this application, the term "comprise" and its variations "comprises" and / or "comprising" refer to the presence of stated features, integrals, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or groups thereof. Without further limitations, an element defined by the phrase "comprises a..." does not exclude the presence of other identical elements in the process, method, or apparatus that includes said element. In this document, each embodiment may focus on the differences from other embodiments, and similar or identical parts between embodiments can be referred to mutually. For methods, products, etc., disclosed in the embodiments, if they correspond to the method section disclosed in the embodiments, the relevant parts can be referred to the description of the method section.
[0060] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the embodiments of this disclosure. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0061] The methods and products (including but not limited to devices and equipment) disclosed in the embodiments herein can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For instance, the division of units may be merely a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. In addition, the coupling or direct coupling or communication connection shown or discussed between each other may be through some interfaces, and the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units may be selected to implement this embodiment according to actual needs. In addition, the functional units in the embodiments of this disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0062] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than that shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. In the descriptions corresponding to the flowcharts and block diagrams in the accompanying drawings, the operations or steps corresponding to different blocks may also occur in a different order than disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. Each block in a block diagram and / or flowchart, and combinations of blocks in a block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
Claims
1. A federated learning method based on permutation invariance in a vehicle-to-everything (V2X) environment, characterized in that, A cloud-edge collaborative federated learning architecture applied to the Internet of Vehicles (IoV) scenario, the method includes the following steps: S1: The server initializes the global model and distributes it to each vehicle terminal. The global model is a KAN network model. S2: The vehicle trains the global model based on the local dataset and uploads the trained local model parameters to the server; S3: The server receives the local models uploaded by each vehicle, performs constrained K-means clustering matching on the nodes of each layer of the local model, and uses the permutation matrix obtained from the clustering to correct the input and output matrices of each vehicle model. S4: The server calculates the matching cost function of each layer. If the matching cost function is greater than the preset threshold, the number of nodes in the global model is dynamically increased by increasing the number of clusters, and virtual nodes are added at the corresponding positions in the vehicle model to complete the correction. Calculate the first The matching cost function for a layer is given by the following formula: , in, For the matching cost function, This is the sum of the average intra-cluster distances of all clusters in the current clustering state. To balance the hyperparameters of intra-cluster similarity and model size, This is the model size constraint function. Number of clusters; S5: The server performs a weighted average aggregation of the corrected node weights to obtain the weights of nodes at each layer of the global model, and then distributes the updated global model to each vehicle terminal. S6: Each vehicle receives the updated global model, continues to train the global model based on local data, and uploads the updated model parameters to the server. The server uses the uploaded result as the input for the next communication round, repeating S3 to S6 until the preset number of communication rounds or accuracy requirements are reached. S7: Deploy the trained global model to the vehicle to perform real-time image recognition tasks; The constrained K-means clustering matching of nodes in each layer of the local model specifically includes: For the automotive end The first layer For each node, extract the basis function weights and spline function weights of all univariate functions connected to it, and concatenate and flatten all function weights of the same node into a node parameter vector. Calculate the distance between the parameter vector of each vehicle end node and the cluster center based on Euclidean distance or cosine distance. Perform constrained K-means clustering, and obtain the correspondence between each local node in the vehicle and each cluster based on the clustering results. Construct the first node in the vehicle cluster. The permutation matrix of the layer; The constrained K-means clustering includes: Starting from the second layer of the local model on the vehicle side, select any node on the vehicle side as the initial cluster center, and use a random seed + the number of iteration rounds to construct a seed to randomize the processing sequence of the nodes to be aligned. Perform constrained clustering on the current processing node, checking each cluster in order of proximity to the cluster center, and only allowing the node to be assigned to a cluster that does not yet contain its own vehicle-end members; After each round of allocation, the cluster center is updated by weighted average of the nodes in the cluster until the cluster label is stable or the center displacement is below the threshold. The step of correcting and aligning the input and output matrices of each vehicle-end model using the permutation matrix obtained from clustering specifically includes: For the automotive end Left-multiplying the layer input matrix by the first car end The permutation matrix of the layer; for the first layer of the car end The layer output matrix is right-multiplied by the first car end. The transpose of the permutation matrix of the layer; The process involves calculating the matching cost function for each layer. If the matching cost function exceeds a preset threshold, the number of nodes in the global model is dynamically increased by increasing the number of clusters. Specifically, this includes: Calculate the first The matching cost function of the layer, if If the number of clusters exceeds a preset threshold, an iterative search is performed within the range from the current number of clusters to the maximum number of clusters. In each iteration, one cluster is added, and the node farthest from the center of its original cluster is selected. As the initial center of the newly added cluster ; Node Remove from the original cluster and update its original cluster center, then set the updated initial cluster center. Initial center of the new cluster Using other cluster centers in this layer as starting points for clustering, and re-perform constrained K-means clustering until a cluster is found that makes... The optimal number of clusters that achieves the global minimum is taken as the final number of global nodes at that layer; The step of adding virtual nodes at the corresponding positions on the vehicle-side model to complete the correction specifically includes: Based on the number of new global nodes, add virtual nodes at the corresponding positions in the vehicle-side model, and set all input and output weights of the virtual nodes to zero. Using the permutation matrix to perform the first step on the car end The layer input and output matrices are corrected.
2. The federated learning method based on permutation invariance in the vehicle-to-everything (V2X) environment according to claim 1, characterized in that, The server performs a weighted average aggregation of the corrected node weights, using the following formula: , in, For the first The first layer The weight of each global node, For the automotive end The number of samples, The total number of samples, For the automotive end No. The permutation matrix of the layer, It's the automotive end. The actual trained first Layer Optimal weights for each node For all vehicles trained with the same optimal weights and without any substitutions, the vehicle's... No. Layer The optimal weights of each node. For the vehicle side caused by local independent initialization and different training samples No. The permutation matrix of the layer.
3. The federated learning method based on permutation invariance in a vehicle-to-everything (V2X) environment according to claim 1, characterized in that, For the classifier layer of the KAN network model, the constrained K-means clustering matching and node addition operations are not performed. Instead, the weights of each classifier layer at the vehicle end are weighted and averaged according to the proportion of samples at the vehicle end to obtain the global classifier weight.
4. A federated learning device based on permutation invariance in a vehicle-to-everything (V2X) environment, comprising a processor and a memory storing program instructions, characterized in that, The processor is configured to execute, when running the program instructions, the federated learning method based on permutation invariance in a vehicle-to-everything (V2X) environment as described in any one of claims 1 to 3.
5. A storage medium storing program instructions, characterized in that, When the program instructions are executed, they perform the federated learning method based on permutation invariance in the vehicle networking environment as described in any one of claims 1 to 3.
Citation Information
Patent Citations
Clustering-based efficient federal segmentation learning method and device in Internet of Vehicles environment
CN118779677A
Road disease recognition model training method and system based on federated learning and multi-center data collaboration
CN121413808A