Internet of vehicles equipment identification method and system based on federated learning

By adopting a federated learning-based method in the identification of Internet of Vehicles devices, the inefficiency and data privacy security problems in the prior art are solved, efficient and accurate device identification is achieved, and the privacy of client data is effectively protected.

CN120180207APending Publication Date: 2025-06-20STATE GRID HUBEI ELECTRIC POWER INFORMATION & TELECOMMUNICATION COMPANY +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510075940.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-17
Publication Date
2025-06-20

AI Technical Summary

Technical Problem

The prior art has inefficiency and data privacy security problems in the identification of Internet of Vehicles equipment. Centralized training occupies too much bandwidth, and traditional distributed learning methods are difficult to effectively ensure data privacy and security.

Method used

The Internet of Vehicles device identification method based on federated learning is adopted, and the local device client data set is obtained for preprocessing, and training is carried out based on regional personalized federated learning algorithms, personalized parameters and calibration parameters are updated, and data privacy is ensured in combination with differential privacy protection technology.

Benefits of technology

It improves the accuracy and efficiency of identification of Internet of Vehicles equipment, ensures the privacy and security of client data, and avoids data leakage and privacy risks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120180207A_ABST
    Figure CN120180207A_ABST
Patent Text Reader

Abstract

The invention discloses an Internet of Vehicles equipment identification method and system based on federated learning, and the method comprises the steps: firstly collecting and preprocessing a local data set of Internet of Vehicles equipment, then distributing a global model to each local client, training and updating personalized parameters by each client based on local data, adjusting the gradient of a loss function according to a calibration parameter, and carrying out the recognition of the local data set of the Internet of Vehicles equipment; then updating calibration parameters and uploading and sharing personalized parameters, aggregating the parameters by a cloud to update a global model, and finally iteratively optimizing a local model by utilizing the updated global model and local calibration parameters to complete an equipment identification task; the method is based on federated learning and introduces a personalized federated learning strategy, so that each device can perform personalized training according to the characteristics of local data, the generalization ability of the model is improved, and personalized fine adjustment is performed on the basis, thereby improving the personalized recognition accuracy and improving the recognition efficiency. And meanwhile, through local training and introduction of a differential privacy technology during parameter sharing, the data privacy of the client is effectively protected.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to device identification means, belonging to the field of vehicle networking device identification and edge computing, and particularly relates to a vehicle networking device identification method and system based on federated learning. Background Art

[0002] With the continuous development and maturity of vehicle networking technology, the number of edge devices has shown a significant increase. The addition of these devices has deepened the connection among people, but at the same time has brought numerous challenges to network management. Facing such a large and complex device network, the effectiveness of device identification has become increasingly important. To address this challenge, deep learning technology has been widely applied to the field of vehicle networking device identification, and device identification can be effectively achieved by analyzing and learning the characteristics and behaviors of devices.

[0003] In the prior art, traditional deep learning training methods are mainly divided into two categories: centralized training and distributed training. In centralized learning, all data is stored on a central node, which is inefficient and occupies too much bandwidth when facing a large number of edge devices; in contrast, distributed learning updates model parameters by splitting data and performing parallel training on multiple nodes, effectively solving the bandwidth and computational burden problems of centralized training. However, although distributed learning methods can alleviate the disadvantages of centralized training to a certain extent, with the frequent occurrence of network attacks, traditional distributed learning methods cannot effectively guarantee data privacy and security. Therefore, there is an urgent need for a new type of distributed learning framework aimed at improving the accuracy and efficiency of complex vehicle networking device identification and effectively protecting the privacy and security of customer data during this process. Summary of the Invention

[0004] The object of the present invention is to overcome the above-mentioned defects and problems existing in the prior art, and provide a vehicle networking device identification method and system based on federated learning with accurate device identification and effective guarantee of privacy and security.

[0005] To achieve the above object, the technical solution of the present invention is: a vehicle networking device identification method based on federated learning, including:

[0006] S1. Obtain the local device client dataset F of the vehicle networking device i , and perform preprocessing; the local device client dataset F i is expressed as follows:

[0007]

[0008] Wherein: is the data packet of the local device client traffic data f i , is The corresponding tag, A i is the set of type tags for the local device client i, N i is the number of traffic data instances of the local device client i;

[0009] S2. Based on the regional personalized federated learning algorithm, using the global model as the local model, the cloud shares the local model with each local device client i;

[0010] S3. Each local device client i performs local training based on the local device client dataset F i to update the personalized parameters of the local model; during the update, according to the calibration parameters during the previous update correct the local model, and adjust the gradient of the loss function according to the current personalized parameters ;

[0011] Then the update expression of the personalized parameters of the local device client i in the t-th round of communication is as follows:

[0012]

[0013] Where: is the personalized parameter after the (t + 1)-th round of update, is the personalized parameter of the local device client i in the t-th round, L i is the loss function of the local device client i, η is the learning rate, is the calibration parameter of the local device client i in the t-th round of communication;

[0014] S4. Each local device client i updates the calibration parameters of the local model based on the local device client dataset F i ; during the update, according to the personalized parameters during the previous update correct the local model, and adjust the gradient of the loss function according to the current calibration parameters ;

[0015] Then the update expression of the calibration parameters of the local device client i in the t-th round of communication is as follows:

[0016]

[0017] Where: is the calibration parameter after the (t + 1)-th round of update;

[0018] S5. Each local device client i uploads the updated personalized parameters to the cloud for sharing, forming a personalized parameter set and uploads the updated calibration parameters Save it locally; at the same time, when uploading to the cloud for sharing, inject noise for differential privacy protection;

[0019] S6. The cloud aggregates and calculates the average value of the personalized parameter sets to obtain the global shared parameter s t+1 , and based on the global shared parameter s t+1 Update the global model θ t+1 And share it with each local device client i;

[0020] The expression of the aggregation calculation is as follows:

[0021]

[0022] Where: s t+1 Is the personalized parameter obtained in the (t + 1)-th round of communication, and m is the number of local device clients;

[0023] S7. Each local device client i, based on the global model θ t+1 And the calibration parameters saved locally Repeatedly perform step S2 to iteratively update the local model, and based on the local model updated in the (t + 1)-th round, identify the vehicle networking devices.

[0024] The step S1 specifically includes:

[0025] S11. Based on the intelligent local area network, obtain the local device traffic data f generated by each local device client during different communication behaviors i ;

[0026] The local device traffic data f i The data packet of Is expressed as follows:

[0027]

[0028] Where: Is the source IP, Is the source port, Is the destination IP, Is the destination port, Prot i Is the transport layer protocol, Is the payload information of each data packet;

[0029] S12. Classify the local device traffic data into different session flow sets according to the same or interchangeable network five-tuples, and split each conversation flow into different flow data segments according to different five-tuple criteria in chronological order;

[0030] S13. Convert the hexadecimal sequences in different data segments of the stream into tags; during the conversion process, disassemble the data packets in different data segments of the stream into a series of units, where each unit consists of two adjacent bytes, namely a dual-tuple structure.

[0031] In step S3, when performing local training, based on the local device client dataset F i Train the local model to determine the total loss function of the regional personalized federated learning algorithm;

[0032] The training objective of the local model is to minimize the local loss function, and its expression is as follows:

[0033]

[0034] Where: L i (s) is to minimize the local loss function, is the loss calculated by the local device client i for the kth data packet N i is the number of traffic data instances owned by the local device client i;

[0035] Then the expression of the total loss function of the regional personalized federated learning algorithm is as follows:

[0036]

[0037] Where: is to minimize the total loss function.

[0038] When updating the personalized parameters and calibration parameters in steps S3 - S4, introduce the Euclidean distance regularization term for optimization and fine-tuning; the optimization and fine-tuning objectives of the personalized parameters and calibration parameters are as follows:

[0039]

[0040] Where: λ i is the regularization parameter, L i is the loss function, S i is the personalized parameter of the local device client i, p i is the calibration parameter of the local device client i.

[0041] In step S7, identify the vehicle networking devices, specifically including:

[0042] S71. Use the Transformer encoder to perform feature learning on the device traffic data of the input vehicle networking devices, and process it through the multi-head self-attention mechanism to obtain the device traffic feature vectors of the vehicle networking devices;

[0043] S72. Input the device traffic feature vector into the Bi-LSTM recurrent neural network, and extract the forward and reverse features in the device traffic features through the forward and backward LSTM layers respectively;

[0044] S73. Based on the forward and reverse features in the device traffic features, train the Bi-LSTM recurrent neural network to generate a bidirectional hidden state vector;

[0045] S74. Merge the bidirectional hidden state vectors through a concatenation operation to obtain the final device recognition feature vector;

[0046] S75. Input the final device recognition feature vector into the classification layer to complete the device recognition task.

[0047] The specific steps of step S71 include:

[0048] S711. Let X = [x1, x2,..., x k be the data after traffic tokenization, and convert it into the input of the embedding layer through the parameter W H The expression is as follows:

[0049]

[0050] Among them: is the data matrix after being converted by the embedding layer;

[0051] S712. Combine with the positional embedding to obtain the final input vector E after positional embedding processing, and input E into multiple Transformer encoders. Then the input of the (N + 1)-th Transformer encoder is H 0 = E; After linear projection, convert the final input vector E into three vectors. The expression is as follows:

[0052] K N = W K H N , Q N = W Q H N , V N = W V H N ;

[0053] Among them: W K 、W Q 、W V are all linear transformation matrices; K N is the key vector after linear projection;

[0054] S713. Use the linearly projected key vector as the input of the multi-head self-attention mechanism, and output the weighted value vector. The expression is as follows:

[0055]

[0056] MultiH(Q, K, V) = Concat(head1,..., head H ) · W o ;

[0057] where: Q, K, and V are the query, key, and value matrices respectively; d K is the dimension of the vector K; head i is the i-th output of the H attention heads; ATT(·) is the operation of the self-attention mechanism, and MultiH(·) is the operation of the multi-head self-attention mechanism; Concat is the concatenation operation; W O is the learnable projection parameter;

[0058] S714. After being processed by the normalization layer and the feed-forward network layer containing several hidden neurons, output the device traffic characteristics of the vehicle networking device. The expression is as follows:

[0059]

[0060] Output = LayerNorm(H N + MultiH(Q, K, V)):

[0061] where: W1, W2, b1, and b2 are all parameters of the feed-forward network, and max(0, x) is the ReLU activation function.

[0062] Each Transformer encoder includes a multi-head self-attention sub-module and a feed-forward network layer sub-module; a residual connection is used between the multi-head self-attention layer sub-module and the feed-forward network layer sub-module, and a normalization layer is provided after each of them.

[0063] In the multi-head self-attention sub-module and the feed-forward network layer sub-module, an adapter module is inserted. The adapter module includes at least two feed-forward network layers. The first feed-forward network layer compresses the original D-dimensional vector into an M-dimensional vector, and the second feed-forward network layer projects the M-dimensional vector back to the D-dimensional vector.

[0064] The Bi-LSTM recurrent neural network includes at least two independent LSTM networks, one of which is a forward LSTM network and the other is a backward LSTM network.

[0065] A vehicle networking device recognition system based on federated learning. This system is applied to the above method. The system includes:

[0066] A data acquisition unit, configured to acquire a local device client dataset F of the vehicle networking device and perform preprocessing; the expression of the local device client dataset F is as follows: i , where: i is a data packet of the local device client traffic data f

[0067]

[0068] where: is the data packet of the local device client traffic data f i , is 's corresponding label, A i is the type label set of the local device client i, N i is the number of traffic data instances of the local device client i;

[0069] A model sharing unit, configured to use the global model as the local model based on the regional personalized federated learning algorithm, and the cloud shares the local model with each local device client i;

[0070] A personalization and calibration parameter update unit, configured to perform local training for each local device client i based on the local device client dataset F to update the personalized parameters of the local model; when updating, correct the local model according to the calibration parameters during the previous round of update, and adjust the gradient of the loss function according to the current personalized parameters; i then the update expression of the personalized parameters of the local device client i in the t-th round of communication is as follows:

[0071]

[0072]

[0073] where: is the personalized parameter after the (t + 1)-th round of update,

[0074] is the personalized parameter of the local device client i in the t-th round, L i is the loss function of the local device client i, η is the learning rate, is the calibration parameter of the local device client i in the t-th round of communication; Each local device client i updates the calibration parameters of the local model based on the local device client dataset F; when updating, correct the local model according to the personalized parameters during the previous round of update, and adjust the gradient of the loss function according to the current calibration parameters; i

[0075] ​​​​​​Then the update expression of the calibration parameter of the local device client i in the t-th round of communication is as follows:

[0076]

[0077] Where: is the calibration parameter updated in the (t + 1)-th round;

[0078] The parameter sharing unit is used for each local device client i to upload the updated personalized parameter to the cloud for sharing, forming a personalized parameter set and save the updated calibration parameter locally; at the same time, when uploading to the cloud for sharing, inject noise for differential privacy protection;

[0079] The aggregation calculation unit is used for the cloud to perform aggregation calculation on the personalized parameter set to obtain the global shared parameter s t+1 , and based on the global shared parameter s t+1 update the global model θ t+1 and share it with each local device client i;

[0080] The expression of the said aggregation calculation is as follows:

[0081]

[0082] Where: s t+1 is the personalized parameter obtained in the (t + 1)-th round of communication, and m is the number of local device clients;

[0083] The iterative update and recognition unit is used for each local device client i to repeat step S2 to iteratively update the local model based on the global model θ t+1 and the calibration parameter saved locally and identify the vehicle networking device based on the local model updated in the (t + 1)-th round.

[0084] Compared with the prior art, the beneficial effects of the present invention are:

[0085] In a method and system for identifying vehicle networking devices based on federated learning according to the present invention, the method first collects and preprocesses the local data sets of vehicle networking devices. Then, the cloud distributes the global model to each local device client. Each client trains and updates personalized parameters based on the local data set, and adjusts the loss function gradient according to the calibration parameters. Next, the client updates the calibration parameters and uploads the personalized parameters to the cloud. The cloud aggregates these parameters to update the global model. Finally, the client uses the updated global model and local calibration parameters to iteratively optimize the local model to complete the device identification task. In the application of this design, by combining federated learning with the introduction of a regional personalized federated learning strategy, each device can perform personalized training according to the characteristics of local data, improving the generalization ability of the model. On this basis, personalized fine-tuning is carried out to improve the personalized recognition accuracy. At the same time, through local training and the introduction of differential privacy technology when sharing parameters, the data privacy of the client is effectively protected. Therefore, the present invention not only accurately identifies devices but also effectively ensures privacy security. BRIEF DESCRIPTION OF THE DRAWINGS

[0086] Figure 1 It is a schematic diagram of the regional personalized federated learning algorithm of the present invention.

[0087] Figure 2 It is a vehicle networking architecture diagram in Embodiment 1 of the present invention.

[0088] Figure 3 It is a schematic diagram of device traffic preprocessing in Embodiment 1 of the present invention.

[0089] Figure 4 It is a schematic diagram of the pre-training of the Transformer encoder in Embodiment 1 of the present invention.

[0090] Figure 5 It is a schematic diagram of the adapter module structure in Embodiment 1 of the present invention.

[0091] Figure 6 It is a schematic diagram of the Bi-LSTM recurrent neural network in Embodiment 1 of the present invention.

[0092] Figure 7 It is a system structure diagram of the present invention.

[0093] Figure 8 It is a device structure diagram of the present invention.

[0094] In the figure: data acquisition unit 1, model sharing unit 2, personalized and calibration parameter update unit 3, parameter sharing unit 4, aggregation calculation unit 5, iterative update and recognition unit 6, processor 7, memory 8, computer program code 81. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0095] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.

[0096] Embodiment 1:

[0097] Referring to Figure 1 , a method for identifying vehicle networking devices based on federated learning includes:

[0098] S1. Obtain the local device client dataset F i of the vehicle networking device and perform preprocessing; the expression of the local device client dataset F i is as follows:

[0099]

[0100] Where: is the data packet of the local device client traffic data f i , is 's corresponding label, A i is the type label set of the local device client i, N i is the number of traffic data instances of the local device client i;

[0101] Referring to Figure 2 , in this embodiment, it is assumed that in a large vehicle networking system, there are multiple intelligent local area networks (LANs), and devices within each area network generate traffic data through different communication behaviors; these traffic data include information such as source IP, source port, destination IP, destination port, and transport layer protocol, and these features can effectively characterize the communication behavior of each device. Since there are significant differences in the traffic characteristics of different devices, the device recognition model faces certain generalization ability problems. Especially in the case of diverse device types and uneven data distribution, traditional centralized training methods may not be able to fully utilize the shared information between devices.

[0102] To address this challenge, this solution adopts a federated learning framework. In this framework, devices (i.e., local device clients) use their local data to train local models and achieve distributed model collaborative training by sending model updates rather than the original data to the central server; the central server is responsible for aggregating the model updates of each client to generate a global model, thereby improving the accuracy of device traffic recognition and the generalization ability of the model; at the same time, the federated learning framework can also ensure that the communication data of each device is not leaked, thus protecting user privacy.

[0103] Further, referring to Figure 3 , the step S1 specifically includes:

[0104] S11. Based on the intelligent local area network, obtain the local device traffic data f generated by each local device client during different communication behaviors i ;

[0105] The local device traffic data f i Data Packet It is expressed as follows:

[0106]

[0107] in: is the source IP address, is the source port, is the target IP, is the target port, Prot i is the transport layer protocol, Payload information for each data packet;

[0108] Each packet is characterized by a five-tuple of information (source IP, source port, destination IP, destination port, transport layer protocol), as well as the payload information of each packet. Therefore, the traffic dataset of each local device client i can be expressed as Where n is the length of the sequence of local device traffic data of the local device client, representing the communication behavior sequence of the device, and the set S of local device traffic data is defined as follows:

[0109] S={(f i , a i )|f i ∈F i , a i ∈A};

[0110] Where: A is the set of device type labels, a i is the type label of device i;

[0111] S12, classify the local device traffic data into different conversation flow sets according to the same or interchangeable network five-tuples (i.e., source IP, source port, destination IP, destination port, and transport layer protocol), and divide each conversation flow into different flow data segments according to the time sequence and different five-tuple standards, to ensure that each traffic segment comes from the same device type and contains rich payload information;

[0112] S13. Convert the hexadecimal sequences in different stream data segments into tags. During the conversion process, decompose the data packets of different stream data segments into a series of units, each of which consists of two adjacent bytes, i.e., a double-tuple structure.

[0113] In this embodiment, the segmentation method ensures that each traffic segment comes from the same device type and contains a rich data payload, which is crucial for subsequent feature extraction and pattern recognition. Compared with the vocabulary size of ordinary natural language processing (NLP) text processing, the range of single-byte values is relatively small, making conventional NLP processing methods not fully applicable. Therefore, in order to convert the hexadecimal sequence in the datagram into tokens that can be processed by the deep learning model, a new splicing method is adopted in this solution: that is, the data packet is disassembled into a series of units, each unit consisting of two adjacent bytes, namely the bigram structure; this binary encoding method not only improves the granularity of the tokens but also increases the scale of the token unit. After this operation, each bigram can be represented as a hexadecimal number between 0x0000 and 0xFFFF (i.e., from 0 to 65535), such a range far exceeds the range of single-byte values (0x00 to 0xFF, i.e., from 0 to 255), enabling the model to capture more comprehensive traffic features and device characteristics.

[0114] S2. Based on the regional personalized federated learning algorithm, using the global model as the local model, the cloud shares the local model with each local device client i.

[0115] S3. Each local device client i updates the personalized parameters of the local model based on the local device client dataset F i for local training; during the update, the correction of the local model is based on the calibration parameters during the previous round of update and the gradient of the loss function is adjusted according to the current personalized parameters ;

[0116] Then the update expression of the personalized parameters of the local device client i in the t-th round of communication is as follows:

[0117]

[0118] Where: is the personalized parameter after the (t + 1)-th round of update, is the personalized parameter of the local device client i in the t-th round, L i is the loss function of the local device client i, η is the learning rate, is the calibration parameter of the local device client i in the t-th round of communication;

[0119] In step S3, during local training, based on the local device client dataset F i train the local model to determine the total loss function of the regional personalized federated learning algorithm;

[0120] The training objective of the local model is to minimize the local loss function, which is expressed as follows:

[0121]

[0122] Where: L i (s) is the function that minimizes the local loss, For the local device client i for the kth data packet Calculated loss, N i is the number of traffic data instances owned by the local device client i;

[0123] Then the expression of the total loss function of the regional personalized federated learning algorithm is as follows:

[0124]

[0125] in: To minimize the total loss function.

[0126] In this embodiment, a high-performance federated learning model is achieved by minimizing the total loss function. Its distributed training in a cloud-edge collaborative environment is crucial. However, in the Internet of Vehicles system, edge nodes may have difficulty obtaining the optimal model due to limited local data or computing power. If all data is centralized in the cloud, privacy and security risks will be introduced. Federated learning solves this problem by exchanging information in the cloud center, thereby using local data patterns for model training. However, the high heterogeneity of data from different sources may lead to poor model performance for some clients, which in turn affects overall performance and fairness. Therefore, personalized federated learning came into being, which improves the generalization and adaptability of the model while retaining the data characteristics of each node.

[0127] S4, each local device client i is based on the local device client dataset F i Update the calibration parameters of the local model; when updating, use the personalized parameters from the previous update The local model is modified and based on the current calibration parameters Adjust the gradient of the loss function;

[0128] Then the update expression of the calibration parameters of the local device client i in the tth round of communication is as follows:

[0129]

[0130] in: is the calibration parameter after the t+1 round update;

[0131] Existing personalized federated learning methods usually rely on additional reference models or a large number of personalized parameters, which not only increases the communication cost but also occupies the precious storage resources of edge devices. In addition, when dealing with highly heterogeneous data distributions, these methods may have difficulty achieving effective personalized optimization while maintaining the global model consistency, resulting in poor model performance for some clients. The additional parameter set not only further increases the communication overhead but also wastes the storage space of edge devices by storing redundant information. Therefore, inspired by traditional centralized deep learning, in this embodiment, personalized federated learning is adopted as the basic method, and a personalized model s i and a calibration model p i are introduced; the personalized model s i is the local target model to be trained, while the calibration model p i is inherited from the global model of the server in the previous round of training; when training the personalized model s i , an Euclidean distance regularization term λ i ||s i -p i || is introduced into the optimization objective to balance the relationship between the calibration model and the personalized model, ensuring that the personalized parameter S i of each client does not deviate too far from the calibration model p i , so as to ensure that the personalized model can maintain the generalization ability and recognition accuracy of the model while fully adapting to the local data characteristics.

[0132] This design effectively reduces the communication overhead by only transmitting the finally trained local personalized parameter S i , while retaining the calibration model p i locally, improving the communication efficiency of the system and the storage efficiency of edge devices. In addition, the training of the calibration model p i also refers to the personalized model and learns some personalized parameters to ensure that the calibration model can capture the personalized characteristics of local data; this design ensures that the subsequent learning of personalized parameters can retain its own personalized characteristics and avoid excessive forgetting, thus maintaining the efficiency and generalization ability of the global model while meeting the personalized needs of each client. Finally, the optimization fine-tuning objectives of the personalized parameters and the calibration parameters are as follows:

[0133]

[0134] where: λ i is the regularization parameter, which is used to balance the weights of the personalized ability and the generalization ability of the model; L i is the loss function; s i is the personalized parameter of the local device client i; p i is the calibration parameter of the local device client i.

[0135] S5. Each local device client i uploads the updated personalized parameters to the cloud for sharing, forming a personalized parameter set and saves the updated calibration parameters locally; meanwhile, when uploading to the cloud for sharing, noise is injected for differential privacy protection;

[0136] By introducing differential privacy technology, noise is injected into the data during the training process, effectively protecting the data privacy of the clients and avoiding the leakage of sensitive information when sharing model updates; the application of differential privacy ensures that each client can fully protect the privacy of local data when updating the model, solving the deficiencies of existing distributed learning algorithms in terms of privacy protection.

[0137] S6. The cloud performs aggregated calculation of the average value on the personalized parameter set to obtain the global shared parameter s t+1 and updates the global model θ t+1 based on the global shared parameter s t+1 and shares it with each local device client i;

[0138] The expression of the aggregated calculation is as follows:

[0139]

[0140] where: s t+1 is the personalized parameter obtained in the (t + 1)-th round of communication, and m is the number of local device clients;

[0141] S7. Each local device client i repeats step S2 to iteratively update the local model based on the global model θ t+1 and the calibration parameters saved locally and identifies the vehicle networking devices based on the locally updated model in the (t + 1)-th round.

[0142] In this embodiment, the traffic of vehicle networking devices usually presents a time series structure, and there is a certain correlation between adjacent data packets. Therefore, when performing device identification, the model needs to learn the correlation between the marked input data packets to improve the classification performance; this process is called the "fine-tuning" technology in the field of natural language processing (NLP). Since the pre-trained encoder is device-independent, the encoder can be applied to the traffic representation of any device after fine-tuning.

[0143] In addition, the lengths of traffic data packets of different devices usually fluctuate, and the lengths of data packets may also vary in the traffic flow of the same device. For this reason, this solution adopts a module based on Transformer and combines it with Bi-LSTM to explore multi-dimensional data representation, thereby effectively capturing the complex features in the device traffic data.

[0144] See Figure 4 , and use a pre-trained Transformer encoder to extract byte connection features from the traffic data of vehicle networking devices. The specific steps are as follows:

[0145] S71. Use the Transformer encoder to perform feature learning on the input device traffic data of the vehicle networking device, and process it through the multi-head self-attention mechanism to obtain the device traffic feature vector of the vehicle networking device;

[0146] The step S71 specifically includes:

[0147] S711. Let X = [x1, x2,..., x k be the data after traffic tokenization, and convert it into the input of the embedding layer through the parameter W H . Its expression is as follows:

[0148]

[0149] Where: is the data matrix after conversion by the embedding layer;

[0150] S712. Combine with the positional embedding to obtain the final input vector E after positional embedding processing, and input E into multiple Transformer encoders. Then the input of the (N + 1)-th Transformer encoder is H 0 = E, (N = 1, 2,..., M - 1); After linear projection, the final input vector E is converted into three vectors, and its expression is as follows:

[0151] K N = w K H N , Q N = W Q H N , V N = W V H N ;

[0152] Where: W K , W Q , W V are all linear transformation matrices; K N is the key vector after linear projection;

[0153] S713. Use the key vector after linear projection as the input of the multi-head self-attention mechanism, and output the weighted value vector. Its expression is as follows:

[0154]

[0155] MultiH(Q, K, V) = Concat(head1, …, head H ) · W O ;

[0156] Where: Q, K, and V are the query, key, and value matrices respectively; d K is the dimension of vector K; head i is the i-th output of the H attention heads; ATT(·) is the operation of the self-attention mechanism, and MultiH(·) is the operation of the multi-head self-attention mechanism; Concat is the concatenation operation; W O is the learnable projection parameter;

[0157] S714. After being processed by the normalization layer and the feed-forward network layer containing several hidden neurons, the device traffic characteristics of the vehicle networking device are output, and its expression is as follows:

[0158]

[0159] Output = LayerNorm(H N + MultiH(Q, K, V));

[0160] Where: W1, W2, b1, and b2 are all parameters of the feed-forward network, and max is the ReLU activation function. Finally, the dynamically embedded H N+1 obtained through encoding can be passed to the next encoding layer for further encoding, or used as the device traffic characteristic H T of the vehicle networking device for output.

[0161] See Figure 5 , each Transformer encoder includes a multi-head self-attention sub-module and a feed-forward network layer sub-module; a residual connection is adopted between the multi-head self-attention layer sub-module and the feed-forward network layer sub-module, and a normalization layer is provided after each of them.

[0162] In order to adapt to the local data pattern of the edge node for personalized learning, an adapter module is inserted into both the multi-head self-attention sub-module and the feed-forward network layer sub-module to provide customized services;

[0163] Considering the computational resource limitations of edge nodes, the adapter module is designed with a bottleneck structure to reduce the number of parameters. The adapter module includes at least two feed-forward network layers (FNNs). The first feed-forward network layer compresses the original D-dimensional vector into an M-dimensional vector for personalized task learning; the second feed-forward network layer projects the M-dimensional vector back to the D-dimensional vector. By setting M << D, the adapter module can effectively maintain parameter efficiency and be compatible with edge devices; in addition, the adapter module also includes a residual connection to ensure that the network can approximate the identity mapping even when the initial parameters are close to zero, thus ensuring the consistency and stability of local training.

[0164] S72. Input the device traffic feature vector into a Bi-LSTM recurrent neural network, and extract the forward and reverse order features in the device traffic features through the forward and backward LSTM layers respectively;

[0165] S73. Based on the forward and reverse order features in the device traffic features, train the Bi-LSTM recurrent neural network to generate a bidirectional hidden state vector;

[0166] S74. Merge the bidirectional hidden state vectors through a concatenation operation to obtain the final device recognition feature vector;

[0167] S75. Input the final device recognition feature vector into the classification layer to complete the device recognition task.

[0168] See Figure 6 , the Bi-LSTM recurrent neural network includes at least two independent LSTM networks, one of which is a forward LSTM network and the other is a backward LSTM network. The basic components of an LSTM are three gate units, namely an input gate, a forget gate, and an output gate. The update process of each unit when the network input is X is as follows:

[0169] f = σ(W f ·[h -1 , X] + b f );

[0170] i = σ(W i ·[h -1 , X] + b i );

[0171] c = tanh(W c ·[h -1 , X] + b c );

[0172] c = f · c -1 + i · c;

[0173] o = σ(W o ·[h -1, X] + b o );

[0174] h = o · tanh(c):

[0175] Where: σ is the Sigmoid function; h and H represent the current and previous hidden states respectively; W f , W i , W c , W o are all learnable weights; b f , b i , b c , b o are all learnable biases;

[0176] Assume that the forward and backward hidden states of the Bi-LSTM recurrent neural network are and H respectively, then the output of the Bi-LSTM recurrent neural network for the length sequence is Obtain H B and H T After that, these two representation vectors are used as inputs and injected into the classification layer to complete the device recognition task.

[0177] In this solution, by combining the Transformer encoder and Bi-LSTM, in-depth analysis and characterization of traffic data can be carried out in multiple dimensions. Specifically, the Transformer encoder performs excellently in processing sequence data, and its self-attention mechanism can globally capture patterns in the traffic byte payload, thus effectively characterizing the data information of device traffic; while the Bi-LSTM recurrent neural network focuses on processing short-term and long-term dependencies in sequence data. Through the LSTM layers in the forward and backward directions, the Bi-LSTM recurrent neural network can provide a comprehensive understanding of the characteristics of the packet length sequence, and this hybrid learning mode enhances the characterization ability for different Internet of Things devices.

[0178] Embodiment 2:

[0179] See Figure 7 , a vehicle networking device recognition system based on federated learning, which is applied to the method described in Embodiment 1. The system includes:

[0180] Data acquisition unit 1, which is used to acquire the local device client dataset F i of the vehicle networking device and perform preprocessing; The expression of the local device client dataset F i is as follows:

[0181]

[0182] Where: For the local device client traffic data f i The data packet of is The corresponding label of, A i is the set of type labels of the local device client i, N i is the number of traffic data instances of the local device client i;

[0183] Furthermore, the data acquisition unit 1 is used for preprocessing according to the following steps:

[0184] S11. Based on the intelligent local area network, obtain the local device traffic data f generated by each local device client during different communication behaviors i ;

[0185] The local device traffic data f i The data packet of is expressed as follows:

[0186]

[0187] Wherein: is the source IP, is the source port, is the destination IP, is the destination port, Prot i is the transport layer protocol, is the payload information of each data packet;

[0188] S12. Classify the local device traffic data into different session flow sets according to the same or interchangeable network five-tuples, and split each conversation flow into different flow data segments according to different five-tuple criteria in chronological order;

[0189] S13. Convert the hexadecimal sequence in different flow data segments into tags; during the conversion, disassemble the data packets in different flow data segments into a series of units, where each unit consists of two adjacent bytes, that is, a dual-tuple structure.

[0190] The model sharing unit 2 is used to use the global model as the local model based on the regional personalized federated learning algorithm, and the cloud will share the local model with each local device client i;

[0191] The personalization and calibration parameter update unit 3 is used for each local device client i to perform local training based on the local device client dataset F i to update the personalized parameters of the local model; during the update, correct the local model according to the calibration parameters during the previous round of update and adjust the gradient of the loss function according to the current personalized parameters ;

[0192] Then the update expression of the personalized parameter of the local device client i in the t-th round of communication is as follows:

[0193]

[0194] Where: is the personalized parameter after the update in the (t + 1)-th round, is the personalized parameter of the local device client i in the t-th round, L i is the loss function of the local device client i, and η is the learning rate. is the calibration parameter of the local device client i in the t-th round of communication;

[0195] Each local device client i updates the calibration parameter of the local model based on the local device client dataset F i When updating, correct the local model according to the personalized parameter in the previous round of update and adjust the gradient of the loss function according to the current calibration parameter ;

[0196] Then the update expression of the calibration parameter of the local device client i in the t-th round of communication is as follows:

[0197]

[0198] Where: is the calibration parameter after the update in the (t + 1)-th round;

[0199] Furthermore, the personalized and calibration parameter update unit 3 determines the total loss function and fine-tuning optimization according to the following steps:

[0200] When performing local training, train the local model based on the local device client dataset F i to determine the total loss function of the regional personalized federated learning algorithm;

[0201] The training objective of the local model is to minimize the local loss function, and its expression is as follows:

[0202]

[0203] Where: L i (s) is to minimize the local loss function, is the loss calculated by the local device client i for the k-th data packet and N i is the number of traffic data instances owned by the local device client i;

[0204] Then the expression of the total loss function of the regional personalized federated learning algorithm is as follows:

[0205]

[0206] Wherein: To minimize the total loss function.

[0207] When updating the personalized parameters and calibration parameters, an Euclidean distance regularization term is introduced for optimization fine-tuning; the optimization fine-tuning objectives of the personalized parameters and calibration parameters are as follows:

[0208]

[0209]

[0210] Wherein: λ i Is the regularization parameter, L i Is the loss function, s i Are the personalized parameters of the local device client i, p i Are the calibration parameters of the local device client o.

[0211] The parameter sharing unit 4 is used for each local device client o to upload the updated personalized parameters To the cloud for sharing, forming a personalized parameter set And save the updated calibration parameters Locally;

[0212] The aggregation calculation unit 5 is used for the cloud to aggregate and calculate the average value of the personalized parameter set to obtain the global shared parameter s t+1 And based on the global shared parameter s t+1 Update the global model θ t+1 And share it with each local device client i;

[0213] The expression of the said aggregation calculation is as follows:

[0214]

[0215] Wherein: s t+1 Are the personalized parameters obtained in the (t + 1)-th round of communication, and m is the number of local device clients;

[0216] The iterative update and recognition unit 6 is used for each local device client i to repeat step S2 to iteratively update the local model based on the global model θ t+1 And the calibration parameters saved locally And identify the vehicle networking devices based on the locally updated model in the (t + 1)-th round.

[0217] Furthermore, the iterative update and recognition unit 6 identifies the vehicle networking devices according to the following steps:

[0218] S71. Use a Transformer encoder to perform feature learning on the device traffic data of the input Internet of Vehicles (IoV) devices, and process it through a multi-head self-attention mechanism to obtain the device traffic feature vectors of the IoV devices;

[0219] S72. Input the device traffic feature vectors into a Bi-LSTM recurrent neural network, and respectively extract the forward and reverse order features in the device traffic features through the forward and backward LSTM layers;

[0220] S73. Based on the forward and reverse order features in the device traffic features, train the Bi-LSTM recurrent neural network to generate bidirectional hidden state vectors;

[0221] S74. Merge the bidirectional hidden state vectors through a concatenation operation to obtain the final device recognition feature vectors;

[0222] S75. Input the final device recognition feature vectors into a classification layer to complete the device recognition task.

[0223] Embodiment 3:

[0224] Refer to Figure 8 , an Internet of Vehicles (IoV) device recognition device based on federated learning, the device includes a processor 7 and a memory 8;

[0225] The memory 8 is used to store computer program code 81 and transmit the computer program code 81 to the processor 7;

[0226] The processor 7 is used to execute the IoV device recognition method based on federated learning described in Embodiment 1 according to the instructions in the computer program code 81.

[0227] In this embodiment, there is also a computer-readable storage medium, and computer-executable instructions are stored in the computer-readable storage medium. When the computer-executable instructions are executed on a computer, the IoV device recognition method based on federated learning described in Embodiment 1 is implemented.

[0228] Generally speaking, the computer instructions for implementing the method of the present invention can be carried by any combination of one or more computer-readable storage media. A non-transitory computer-readable storage medium can include any computer-readable medium except for the signal propagating temporarily itself.

[0229] A computer-readable storage medium may, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples (a non-exhaustive list) of the computer-readable storage medium include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, the computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0230] Computer program code for performing the operations of the present invention may be written in one or more programming languages or combinations thereof. The programming languages include object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages such as the "C" language or similar programming languages. In particular, the Python language suitable for neural network computing and platform frameworks based on TensorFlow, PyTorch, etc. can be used. The program code may be executed entirely on the user's computer, partially on the user's computer, executed as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or connected to an external computer (e.g., by connecting through the Internet using an Internet service provider).

[0231] For the above-mentioned devices and non-transitory computer-readable storage media, reference may be made to the specific description of a method for identifying vehicle networking devices based on federated learning and its beneficial effects, which will not be elaborated herein.

[0232] Although the embodiments of the present invention have been shown and described above, it should be understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those of ordinary skill in the art may make changes, modifications, substitutions, and variations to the above embodiments within the scope of the present invention.

Claims

1. A method for identifying Internet of Vehicles devices based on federated learning, characterized in that: include: S1. Obtain the local device client dataset F of the connected vehicle device i , and preprocessing; the local device client data set F i The expression is as follows: Where: f i k The local device client traffic data f i Data packets, f i k The corresponding label, A i is the type tag set of the local device client i, N i is the number of traffic data instances of the local device client i; S2, based on the regional personalized federated learning algorithm, the global model is used as the local model, and the cloud shares the local model with each local device client i; S3, each local device client i based on the local device client dataset F i Perform local training to update the personalized parameters of the local model; when updating, the calibration parameters of the previous update are used Modify the local model and adjust it according to the current personalized parameters Adjust the gradient of the loss function; Then the update expression of the personalized parameters of the local device client i in the tth round of communication is as follows: in: is the personalized parameter after the t+1 round update, is the personalized parameter of the local device client i in round t, L i is the loss function of the local device client i, η is the learning rate, is the calibration parameter of the local device client i in round t of communication; S4, each local device client i is based on the local device client dataset F i Update the calibration parameters of the local model; when updating, use the personalized parameters from the previous update The local model is modified and based on the current calibration parameters Adjust the gradient of the loss function; Then the update expression of the calibration parameters of the local device client i in the tth round of communication is as follows: in: is the calibration parameter after the t+1 round update; S5. Each local device client i updates the personalized parameters Upload to the cloud for sharing and form a personalized parameter set The updated calibration parameters Save it locally; when uploading it to the cloud for sharing, inject noise for differential privacy protection; S6. The cloud aggregates and calculates the average value of the personalized parameter set to obtain the global shared parameter s t+1 , and based on the global shared parameter s t+1 Update the global model θ t+1 And share it with each local device client i; The expression of the aggregate calculation is as follows: Where: s t+1 is the personalized parameter obtained in the t+1th round of communication, and m is the number of local device clients; S7, each local device client i based on the global model θ t+1 With calibration parameters saved locally Repeat step S2 to iteratively update the local model, and identify the Internet of Vehicles device based on the updated local model in round t+1.

2. The method for identifying Internet of Vehicles devices based on federated learning according to claim 1, characterized in that: The step S1 specifically includes: S11. Based on the intelligent local area network, obtain the local device traffic data f generated by each local device client during different communication behaviors i ; The local device traffic data f i Data packet f i k It is expressed as follows: in: is the source IP address, is the source port, is the target IP, is the target port, Prot i is the transport layer protocol, Payload information for each data packet; S12, classifying the local device traffic data into different conversation flow sets according to the same or interchangeable network quintuples, and dividing each conversation flow into different flow data segments according to the time sequence and different quintuple standards; S13. Convert the hexadecimal sequences in different stream data segments into tags. During the conversion process, decompose the data packets of different stream data segments into a series of units, each of which consists of two adjacent bytes, i.e., a double-tuple structure.

3. The method for identifying Internet of Vehicles devices based on federated learning according to claim 1, characterized in that: In step S3, when performing local training, based on the local device client data set F i Train the local model and determine the total loss function of the regional personalized federated learning algorithm; The training objective of the local model is to minimize the local loss function, which is expressed as follows: Where: L i (s) is to minimize the local loss function, l i (f i k , s) is the local device client i for the kth data packet f i k Calculated loss, N i is the number of traffic data instances owned by the local device client i; Then the expression of the total loss function of the regional personalized federated learning algorithm is as follows: in: To minimize the total loss function.

4. The method for identifying Internet of Vehicles devices based on federated learning according to claim 1, characterized in that: When the steps S3-S4 update the personalized parameters and calibration parameters, the Euclidean distance regularization term is introduced for optimization and fine-tuning; the optimization and fine-tuning objectives of the personalized parameters and calibration parameters are as follows: Where: i is the regularization parameter, L i is the loss function, s i is the personalized parameter of the local device client i, p i is the calibration parameter of the local device client i.

5. The method for identifying Internet of Vehicles devices based on federated learning according to claim 1, characterized in that: The step S7, identifying the Internet of Vehicles device, specifically includes: S71. Use the Transformer encoder to perform feature learning on the input device flow data of the Internet of Vehicles device, and process it through a multi-head self-attention mechanism to obtain a device flow feature vector of the Internet of Vehicles device; S72, input the device traffic feature vector into the Bi-LSTM recurrent neural network, and extract the positive sequence and reverse sequence features in the device traffic feature through the forward and reverse LSTM layers respectively; S73, based on the positive sequence and reverse sequence features in the device traffic features, train the Bi-LSTM recurrent neural network to generate a bidirectional hidden state vector; S74, merging the bidirectional hidden state vectors through a connection operation to obtain a final device identification feature vector; S75. Input the final device identification feature vector into the classification layer to complete the device identification task.

6. The method for identifying Internet of Vehicles devices based on federated learning according to claim 5, characterized in that: The step S71 specifically includes: S711, let X = [x1, x2, ..., x k ] is the data after traffic tokenization, and the parameter W H Converted to embedding layer input, its expression is as follows: in: is the data matrix after transformation by the embedding layer; S712, will Combined with the position embedding, the final input vector E after position embedding is obtained, and E is input into multiple Transformer encoders. Then the input of the N+1th Transformer encoder is H 0 =E; after linear projection, the final input vector E is converted into three vectors, whose expressions are as follows: K N =W K H N ,Q N =W Q H N ,V N =W V H N ; Where: W K , W Q , W V are all linear transformation matrices; K N is the linearly projected key vector; S713. Use the linearly projected key vector as the input of the multi-head self-attention mechanism and output the weighted value vector, which is expressed as follows: head i =ATT(QW i Q ,KW i K ,VW i V ); MultiH(Q,K,V)=Concat(head1,...,head H )·W O ; Where: Q, K, V are query, key and value matrices respectively; d K is the dimension of vector K; head i is the i-th output of H attention heads; ATT(·) is the operation of the self-attention mechanism, MultiH(·) is the operation of the multi-head self-attention mechanism; Concat is the concatenation operation; W O is the learnable projection parameter; S714, after being processed by a normalization layer and a feedforward network layer containing several hidden neurons, the device traffic characteristics of the Internet of Vehicles device are output, and the expression is as follows: Output=LayerNorm(H N +MultiH(Q,K,V)); Among them: W1, W2, b1, b2 are the parameters of the feedforward network, and max(0, x) is the ReLU activation function.

7. The method for identifying Internet of Vehicles devices based on federated learning according to claim 6, characterized in that: Each Transformer encoder includes a multi-head self-attention submodule and a feedforward network layer submodule; a residual connection is used between the multi-head self-attention layer submodule and the feedforward network layer submodule, and a normalization layer is provided thereafter.

8. The method for identifying Internet of Vehicles devices based on federated learning according to claim 7, characterized in that: An adapter module is inserted into the multi-head self-attention submodule and the feedforward network layer submodule. The adapter module includes at least two feedforward network layers. The first feedforward network layer compresses the original D-dimensional vector into an M-dimensional vector, and the second feedforward network layer projects the M-dimensional vector back to a D-dimensional vector.

9. The method for identifying Internet of Vehicles devices based on federated learning according to claim 5, characterized in that: The Bi-LSTM recurrent neural network includes at least two independent LSTM networks, one of which is a forward LSTM network and the other is a reverse LSTM network.

10. A vehicle networking device identification system based on federated learning, characterized in that: The system is applied to the method described in any one of claims 1 to 9, and the system comprises: A data acquisition unit (1) is used to acquire a local device client data set F of a connected vehicle device. i , and preprocessing; the local device client data set F i The expression is as follows: Where: f i k The local device client traffic data f i Data packets, f i k The corresponding label, A i is the type tag set of the local device client i, N i is the number of traffic data instances of the local device client i; A model sharing unit (2), used for sharing the local model with each local device client i in the cloud based on a regional personalized federated learning algorithm with the global model as the local model; A personalization and calibration parameter updating unit (3) is used for each local device client i based on the local device client data set F i Perform local training to update the personalized parameters of the local model; when updating, the calibration parameters of the previous update are used Modify the local model and adjust it according to the current personalized parameters Adjust the gradient of the loss function; Then the update expression of the personalized parameters of the local device client i in the tth round of communication is as follows: in: is the personalized parameter after the t+1 round update, is the personalized parameter of the local device client i in round t, L i is the loss function of the local device client i, η is the learning rate, is the calibration parameter of the local device client i in round t of communication; Each local device client i is based on the local device client dataset F i Update the calibration parameters of the local model; when updating, use the personalized parameters from the previous update The local model is modified and based on the current calibration parameters Adjust the gradient of the loss function; Then the update expression of the calibration parameters of the local device client i in the tth round of communication is as follows: in: is the calibration parameter after the t+1 round update; The parameter sharing unit (4) is used for each local device client i to update the personalized parameters Upload to the cloud for sharing and form a personalized parameter set The updated calibration parameters Save it locally; when uploading it to the cloud for sharing, inject noise for differential privacy protection; The aggregation calculation unit (5) is used to aggregate and calculate the average value of the personalized parameter set in the cloud to obtain the global shared parameter s t+1 , and based on the global shared parameter s t+1 Update the global model θ t+1 And share it with each local device client i; The expression of the aggregate calculation is as follows: Where: s t+1 is the personalized parameter obtained in the t+1th round of communication, and m is the number of local device clients; Iterative updating and identification unit (6) is used for each local device client i based on the global model θ t+1 With calibration parameters saved locally Repeat step S2 to iteratively update the local model, and identify the Internet of Vehicles device based on the updated local model in round t+1.