Federal learning method and device based on double adversarial training under industrial Internet of Things

By adopting a federated learning method with dual adversarial training in the industrial Internet of Things, training feature extractors and classifiers in stages, selectively uploading feature extractors, solving the problem of insufficient balance between personalized and shared knowledge in the existing technology, and achieving efficient and low-cost model collaborative learning.

CN120258095AActive Publication Date: 2025-07-04QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES) +1

Patent Information

Application Number
CN202510742210.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-05
Publication Date
2025-07-04
Estimated Expiration
2045-06-05

AI Technical Summary

Technical Problem

The existing federated learning methods are difficult to balance between personalized and shared knowledge in the industrial Internet of Things, resulting in insufficient generalization capabilities of the model and the inability to adapt to the multi-source heterogeneous and dynamically changing industrial field environment, and at the same time, the communication overhead is high.

Method used

The federated learning method of dual adversarial training is adopted, and the model is divided into two parts: feature extractor and classifier. Through phased training and selective upload of feature extractors, combining cross-entropy loss and adversarial training loss, the personalization and generalization capabilities of the model are optimized to reduce unnecessary communication.

Benefits of technology

On the basis of ensuring model performance, the communication cost is reduced, the model's personalized adaptability and generalization ability in a multi-device environment is improved, and efficient collaborative learning is achieved in the industrial Internet of Things environment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120258095A_ABST
    Figure CN120258095A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of feature extraction, and more specifically relates to a federated learning method and device based on double adversarial training under an industrial Internet of Things. The method comprises the following steps: a server initializes a global model and sends the global model to a client; each client updates a local model based on the received global information; after the local model is updated, each client enters a local training stage; then, each client recalculates a local feature prototype, and the feature extractor uploads the local feature prototype in turns; then the following local information is uploaded to the server, and if the current round is in the uploading round set, the local feature extractor uploads the local information; and finally, the server aggregates the local feature prototype, the local classifier and the received local feature extractor, and then issues the aggregated information to each client. The method solves the problem that the existing federal learning method is not enough in balance mechanism design between individuation and shared knowledge and is difficult to adapt to the multi-source heterogeneous and dynamic change environment of an industrial field.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of feature extraction, and more specifically, relates to a federated learning method and device based on dual adversarial training under industrial Internet of Things. Background Art

[0002] In the industrial Internet of Things scenario, widely deployed edge terminal devices continuously collect high-frequency sensing data from different working conditions, production links, and environmental conditions. These data usually have high dimensions, strong noise, and significant distribution differences, and are directly related to key business indicators such as production efficiency, equipment health, and safety warning. Due to the strict data privacy protection requirements between enterprises or devices, traditional centralized machine learning methods cannot achieve centralized aggregation and unified modeling of data. At the same time, limited by network bandwidth, communication delay, and edge computing resource constraints, it is also impractical to upload data to the central server for processing. Therefore, federated learning, as a distributed learning framework that supports cross-device and cross-edge node model training locally and realizes collaborative modeling through parameter aggregation, shows wide applicability in the industrial Internet of Things. It not only avoids the risk of raw data leakage but also improves the model training efficiency, providing a safe and feasible solution path for industrial intelligence.

[0003] For example, Chinese Patent Document CN119670916A discloses a federated learning method and device based on feature contrast optimization and classifier dynamic integration. The method includes: initializing a global model by a server and sending it to each client participating in federated learning. The client updates the local model based on the received global model and trains the updated local model, and then uses the trained local feature extractor to extract features from its local private data set to construct a local feature prototype set. Then, the local model, the local feature prototype set, and the total sample size of the client are uploaded to the server. When performing global aggregation, the server uses contrast learning technology to improve the quality of the global feature prototype. Finally, the aggregated global prototype and the global feature prototype set are sent to each client to execute the next round of learning until the local model converges or reaches the set communication rounds. However, the feature extractor and feature prototype in this method need to be transmitted in each communication round, which results in high communication overhead. Moreover, this patent integrates the global classifier and the local classifier at the parameter level to achieve a balance between the model generalization ability and the personalized performance. However, this parameter-level fusion method has certain limitations and may not be able to fully integrate the advantages of the two types of classifiers.

[0004] Although federated learning provides a new paradigm for the intelligent modeling of industrial Internet of Things (IIoT), the current personalized federated learning methods still have significant technical bottlenecks. Specifically, the existing methods lack a well-designed balance mechanism between personalization and shared knowledge, resulting in models that either overly rely on local data training, neglecting the common knowledge contained in global information and reducing the generalization ability of the models; or emphasizing the uniformity of global aggregated parameters and ignoring the non-independent and identically distributed characteristics of data distributions among terminal devices, thus being unable to effectively adapt to personalized task requirements. This problem of insufficient and inappropriate utilization of global aggregated information limits the model's ability to balance "personality" and "commonality" simultaneously, making it difficult to adapt to the multi-source heterogeneous and dynamically changing environment in industrial sites. When pursuing a more efficient and robust personalized federated learning framework, there is an urgent need for an optimization mechanism that can enhance the adaptability of personalized models and effectively utilize global shared knowledge. Summary of the Invention

[0005] The present invention aims to overcome at least one of the above-mentioned defects of the prior art and provides a federated learning method based on dual adversarial training for industrial Internet of Things to solve the problems that the existing federated learning methods lack a well-designed balance mechanism between personalization and shared knowledge, are difficult to adapt to the multi-source heterogeneous and dynamically changing environment in industrial sites, and have a relatively high communication overhead at the same time.

[0006] The present invention also discloses a device loaded with the federated learning method based on dual adversarial training for industrial Internet of Things.

[0007] The detailed technical solution of the present invention is as follows: A federated learning method based on dual adversarial training for industrial Internet of Things, the method comprising: S1. The server initializes a global model and distributes the global model to each client participating in federated learning, where the client refers to an industrial device or a terminal; S2. Each client updates its local model based on the received global information: When performing the first local model update, each client initializes its local model as the received global model; In subsequent rounds, when the client receives a new round of global feature extractor from the server, the client updates its local feature extractor. In order to better enable the local model to adapt to personalized tasks, the local classifier part remains unchanged and no update operation is performed, so as to ensure that the local classifier can focus on handling the specific requirements of local tasks; S3. After the local model is updated, each client enters the local training stage. The feature extractor and classifier in the local model adopt a phased independent training method. The training sequence is to first train the local classifier and then train the local feature extractor. In the first local training round, the local feature extractor and local classifier are trained only based on the data-driven cross-entropy loss. In non-first local training, the feature extractor is jointly constrained by both the cross-entropy loss and the global feature prototype loss, and the classifier is optimized and trained by superimposing the adversarial training loss on the cross-entropy loss. Through the complementary integration of the global generalization ability and local personalization ability at the knowledge level, it helps the model to better adapt to personalized needs while maintaining generalization; S4. After each client completes the first round of local training and before uploading local information to the server, calculate the upload round set of the feature extractor, and there is no need to recalculate in subsequent rounds. Then each client recalculates the local feature prototype, and then uploads the following local information to the server: the recalculated local feature prototype, the local feature extractor, the local classifier, the total number of training samples owned by the client, and the number of training samples for each category. Among them, the sample quantity information is only uploaded after the first round of training is completed. If the current round is in the upload round set, the local feature extractor will be uploaded; S5. The server uses the category sample quantity and the total sample quantity as the basis for setting the aggregation weights respectively, aggregates the local feature prototype and local classifier uploaded by the client, and generates the global feature prototype and global classifier. If the local feature extractor is uploaded in the current round, it will be weighted and aggregated based on the total sample quantity to obtain the global feature extractor. Then the aggregated information is sent to the clients participating in federated learning; S6. Repeat steps S2 to S5 until the local model converges or reaches the preset number of communication rounds.

[0008] Preferably according to the present invention, step S2 specifically includes: For the first round of local model update, both the local feature extractor and the local classifier are updated using the global feature extractor and the global classifier: (1) Among them, represents the local feature extractor after the first round of update, represents the global feature extractor, represents the local classifier after the first round of update, represents the global classifier, and the superscript represents the state after update and before training; For the round of local model update, , client judges that the Whether the content newly downloaded by the server after the secondary aggregation contains a global feature extractor: If so, use this global feature extractor to update the local feature extractor: (2) Among them, represents the feature extractor before the th local training after the th local update, represents the global feature extractor obtained after the th aggregation on the server side; If not, the feature extractor continues to use the feature extractor after the th local update training : (3) For the local classifier, continue to use the local classifier after the th local update training: (4) Among them, represents the local classifier before the th local training after the th local update, represents the local classifier after the th local update training.

[0009] According to the preferred embodiment of the present invention, step S3 specifically includes: For the first round of local training, both the local classifier and the feature extractor are trained only using the data-driven cross-entropy loss: (5) (6) In formulas (5) and (6), represents the local classifier after the first round of training, represents the local classifier after the first round of update, represents the gradient for calculating the loss related to the local classifier, represents the sample in the local dataset, represents the local dataset of the client, represents the cross-entropy loss, represents the input feature information of the image, represents the label corresponding to the input feature information of the image, represents the local feature extractor after the first round of training, represents the local feature extractor after the first round of update, Represents calculating the gradient of the loss related to the local feature extractor.

[0010] Preferably according to the present invention, step S3 specifically further includes: For the round of local training, when, the local classifier is trained using a combination of adversarial training loss and data-driven cross-entropy loss: Since the local feature prototype is required to be used in the adversarial loss, the current local feature prototype needs to be calculated before this operation: (7) (8) Wherein, represents the set of local feature prototypes obtained before training the local classifier and the local feature extractor, contains local feature prototypes of classes. For the th class, it is represented as represents the th client local dataset belonging to the th class of each sample dataset, represents a single sample in represents the local feature extraction function, represents the th client local dataset belonging to the th class of the sample dataset size, represents the local feature extractor before training after the th round of local update; Then download the global feature prototype set from the server side of the previous round, and the global classifier to construct the losses of two local personalized discriminators, namely the loss of the prototype discriminator and the loss of the classifier discriminator : For the loss of the prototype discriminator is as follows, this loss function is used to train : (9) In formula (9), represents the loss of the th client when training the prototype discriminator in the th round, represents belonging to the a class is the logarithmic function with base as the prototype discriminant function is the local classification function represents the local classifier after the th round of local update represents the global feature prototype belonging to the th class represents the local feature prototype of the th class obtained before training the local classifier and local feature extractor For the classifier discriminator the loss is as follows, and this loss function is used to train : (10) In formula (10), represents the loss of the th client when training the classifier discriminator in the th round, represents belonging to the th class is the logarithmic function with base as the classifier discriminant function represents the global classification function represents the global classifier obtained after aggregation of the th round represents the global feature prototype belonging to the th class is the local classification function represents the local classifier after the th round of local update Based on the above two discriminator losses, the first-order adversarial training loss of the local classifier as the generator is obtained for training : (11) In formula (11), represents the first-order adversarial training loss of the th client in the th round of training, is the prototype discriminant function is the local classification function represents the local classifier after the th round of local update represents the local feature prototype of the The local feature prototype of a class is the discriminant function of the classifier indicating the global feature prototype belonging to the th class

[0011] At the same time, the cross-entropy loss composed of local prototypes is added to obtain the second-order adversarial training loss (which can be simply referred to as the adversarial training loss at this time), thereby effectively alleviating the forgetting of local knowledge by the local classifier when adapting to local tasks: (12) Therefore, the total loss of training the local classifier is: (13) The local classifier is trained using stochastic gradient descent to obtain the trained local classifier : (14) For the feature extractor, the training of the local feature extractor is guided by the global feature prototype to help the local feature extractor improve its generalization ability: (15) (16) Among them, represents the loss composed of the global feature prototype represents the Euclidean norm represents the global feature prototype belonging to the th class represents the local feature extractor after the t-th round of training represents the local classifier after the t-th round of training

[0012] According to the preference of the present invention, step S4 specifically includes: After the client completes the first round of local training and before uploading local information to the server, calculate the ratio of the local feature extractor to the local feature prototype parameters , and selectively upload the local feature extractor through This method can effectively reduce the communication cost of the entire system. The local feature extractor is only uploaded when necessary, thereby reducing unnecessary communication overhead. If only relying on the global feature prototype to guide the training of the local feature extractor, it may not be possible to ensure that the local feature extractor obtains sufficient generalization ability. At the same time, if the feature extractor is uploaded in each round, on the one hand, it will bring too high communication cost, and on the other hand, it may also lead to an excessive decline in the personalization ability of the local feature extractor. The ratio of the local feature extractor to the local feature prototype parameters The calculation formula is as follows: (17) Wherein represents the number of calculation parameters; Then, the multiples of are excluded from the communication rounds. At these rounds, the local feature extractor does not upload, and then the set of feature extractor upload rounds is obtained; Recalculate the local feature prototype to obtain the set of local feature prototypes to be uploaded : (18) (19) In formulas (18) and (19), represents the set of local feature prototypes obtained after training the local feature extractor, contains the local feature prototypes of classes. For the th class among them, it is expressed as , represents the th client local dataset in which the sample datasets belonging to the th class are included, represents a single sample in represents the local feature extraction function, represents the th client local dataset in which the sample dataset belonging to the th class is located, represents the th local feature extractor after local training in the

[0013] Preferably according to the present invention, step S5 specifically includes: If the feature extractor is received in the current aggregation round, based on the total amount of client samples, set the aggregation weight to obtain the global feature extractor : (20) (21) In formula (20), represents the weight set based on the total amount of the th client samples; For the classifier, also based on the total amount of client samples, set the aggregation weight to obtain the global classifier : (22) For feature prototype aggregation, the sample size of each class is used as the aggregation weight to obtain the global feature prototype: (23) (24) (25); In formulas (23)-(25), represents the weight set based on the sample size of the -th client and the -th class, represents the size of the sample data set belonging to the -th class in the local dataset of the -th client ( similarly), represents the global feature prototype set obtained after the -th global aggregation, is the global feature prototype containing classes. For the -th class among them, it is expressed as , while represents the local feature prototype belonging to the -th class obtained after the

[0014] According to the preferred embodiment of the present invention, in the initial round, the global information in step S2 includes a global feature extractor and a global classifier, and these two parts constitute the global model; in non-initial rounds, it must include a global feature prototype and a global classifier, and if the server has a newly aggregated global feature extractor, it includes the global feature extractor.

[0015] In another aspect of the present invention, there is also provided an apparatus for implementing the federated learning method based on dual adversarial training in the industrial Internet of Things, including: at least one processor; and a memory storing instructions that, when executed by the at least one processor, cause the at least one processor to execute the federated learning method based on dual adversarial training in the industrial Internet of Things as described above.

[0016] In another aspect of the present invention, there is also provided a machine-readable storage medium storing executable instructions that, when executed, cause the machine to execute the federated learning method based on dual adversarial training in the industrial Internet of Things as described above.

[0017] Compared with the prior art, the beneficial effects of the present invention are: (1)Based on the characteristics of devices and data in the industrial Internet of Things (IIoT) scenario, and according to the dimensions of the feature extractor and the prototype, the present invention selectively transmits the feature extractor, thereby improving the performance of the model in a multi-device environment while ensuring that the system transmission cost is comparable to that of traditional federated learning methods.

[0018] (2)The present invention extracts and processes the effective knowledge in the global classifier, while ensuring the personalized characteristics of the local classifiers of each industrial device, supplements the knowledge of the local classifiers in the missing categories, and then improves their generalization ability in the existing categories, optimizing the knowledge sharing effect in multi-device collaboration.

[0019] (3)To a certain extent, the present invention realizes an effective balance among the generalization ability, personalized characteristics of the model, and system communication cost in the IIoT environment, ensuring efficient cooperation among devices while reducing communication overhead. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 is a flowchart of the federated learning method based on dual adversarial training under the industrial Internet of Things of the present invention.

[0021] Figure 2 is a schematic diagram of the implementation process of the federated learning method described in Embodiment 1 of the present invention.

[0022] Figure 3 is an experimental result graph of the generalization performance test of the present invention on the acceleration sensor-action recognition dataset.

[0023] Figure 4 is an experimental result graph of the personalized performance test of the present invention on the acceleration sensor-action recognition dataset.

[0024] Figure 5 is an experimental result graph of the convergence test of the present invention on the acceleration sensor-action recognition dataset. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0025] The following further describes the present disclosure in conjunction with the drawings and embodiments.

[0026] It should be noted that the following detailed description is exemplary and is intended to provide further explanation of the present disclosure. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which the present disclosure belongs.

[0027] In the case of no conflict, the embodiments and features in the embodiments of the present disclosure can be combined with each other.

[0028] Embodiment 1 As Figure 1 andFigure 2 As shown in Figure 2 , this embodiment provides a federated learning method based on dual adversarial training for the industrial Internet of Things (IIoT). Aiming at the IIoT environment, it aims to address the personalized modeling challenges brought about by the heterogeneity of edge devices and the differences in data distribution. In practical applications, the data collected by sensors deployed in different factories, production lines, or industrial devices is affected by various factors such as geographical location, manufacturing processes, device brands, and operating loads, showing significant heterogeneity and non-independent and identically distributed characteristics. Traditional federated learning methods are difficult to balance the consistency and personalization of models among multiple nodes. To address this issue, the present invention proposes a personalized federated learning method based on dual adversarial training, which is designed specifically for the distributed intelligent modeling requirements of the IIoT. This method divides the model into a feature extractor and a classifier, and respectively performs feature extraction and status classification on the operating data of industrial devices. By introducing a prototype discriminator and a classifier discriminator to construct a dual adversarial structure, the local classifier participates in the training as a generator, continuously optimizing the model to adapt to the local working conditions while retaining the general knowledge from other industrial nodes. This method is applicable to the status classification task of industrial devices, can effectively improve the adaptability of the model to data from different industrial nodes, and enhance the accuracy and stability in key scenarios such as worker behavior detection, equipment fault analysis, and production line optimization.

[0029] The following introduces the terms and system settings used in the present invention.

[0030] The present invention models a federated learning system framework that includes edge nodes and a central server. In this system, parameter interaction can be carried out between each client and the server to complete the distributed collaborative training of the model. For the convenience of description, it is assumed that the currently introduced is the th client (subscript ), and the stage after the th local update training (superscript ), at this time the local model of the client is (similarly for other stages). The client holds a private dataset , the samples have classification labels, the category set is denoted as , and the total number of categories is . Each sample is denoted as ([[]] ), where represents the total number of training samples in the dataset of client .

[0031] The following introduces the module division and function description of the present invention, taking the th client, after the th local update training and before the th local update training as an example. The same applies to other clients and rounds.

[0032] In the present invention, the model consists of a feature extraction module and a classification module, which respectively process the feature encoding of the input data and the final classification prediction task. Let the parameters of the local feature extractor be , and the parameters of the local classifier be , that is consists of and . And the local feature extraction function is , and the local classification function is . Specifically, for any input sample ( ), first, the feature extractor generates a feature vector (for example, if the local feature extractor is used, it is ), and then the classification function processes this feature vector to output the final classification result. For example, if the local classifier is used, it is ; The above process also applies to the global feature extractor and the global classifier, and the global information has no client subscript .

[0033] The method is specifically as follows: S1. The server initializes the global model and distributes this global model to each client participating in federated learning. The client refers to an industrial device or a terminal; S2. Each client updates the local model based on the received global information: When the local model is updated for the first time, each client initializes the local model as the received global model; by providing a suitable initial value for the local model, the stability of the model in the initial training stage is ensured, thereby accelerating convergence and improving the training effect; In subsequent rounds, when the client receives a new round of global feature extractors from the server, the client updates the local feature extractor. In order to better adapt the local model to the personalized task, the local classifier part remains unchanged and no update operation is performed, so as to ensure that the local classifier can focus on the specific needs of processing local tasks. Specifically as follows: For the first round of local model update, both the local feature extractor and the local classifier are updated using the global feature extractor and the global classifier: (1) Among them, represents the local feature extractor after the first round of update, represents the global feature extractor, represents the local classifier after the first round of update, represents the global classifier, and the superscript represents the state after update and before training; For the round of local model update, The client judges whether the content newly downloaded by the server after the -th aggregation contains a global feature extractor: If so, use this global feature extractor to update the local feature extractor: (2) Among them, represents the feature extractor before the -th local training after the -th local update, represents the global feature extractor obtained after the -th aggregation on the server side; If not, the feature extractor continues to use the feature extractor after the -th local update training : (3) For the local classifier, continue to use the local classifier after the -th local update training: (4) Among them, represents the local classifier before the -th local training after the -th local update, represents the local classifier after the -th local update training; The global information contains a global feature extractor and a global classifier at the initial round, and these two parts constitute the global model; at non-initial rounds, it must contain a global feature prototype and a global classifier, and if the server has a newly aggregated global feature extractor, it contains the global feature extractor.

[0034] S3. After the local model is updated, each client enters the local training phase. In the local model, the feature extractor and the classifier are trained independently in stages. The training sequence is to first train the local classifier and then the local feature extractor. This method refines the training objectives and improves the flexibility of the training process, enabling the model to better adapt to the requirements of different tasks. In the first local training round, the local feature extractor and the local classifier are trained only based on the data-driven cross-entropy loss. In non-first local training, the feature extractor is jointly constrained by both the cross-entropy loss and the global feature prototype loss. By fully leveraging the powerful transfer ability of the feature extractor, a feature extractor with strong generalization ability is learned, thereby effectively alleviating the negative impact of heterogeneous data on the model performance. The classifier is optimized and trained by superimposing the adversarial training loss on the basis of the cross-entropy loss. Through the complementary integration of the global generalization ability and the local personalization ability at the knowledge level, the model is helped to better adapt to personalized needs while maintaining generalization ability, as follows: For the first round of local training, both the local classifier and the feature extractor are trained only using the data-driven cross-entropy loss: (5) (6) In equations (5) and (6), represents the local classifier after the first round of training, represents the local classifier after the first round of update, represents the gradient for calculating the loss related to the local classifier, represents the samples in the local dataset, represents the local dataset of the client, represents the cross-entropy loss, represents the input feature information of the image, represents the label corresponding to the input feature information of the image, represents the local feature extractor after the first round of training, represents the local feature extractor after the first round of update, represents the gradient for calculating the loss related to the local feature extractor.

[0035] For the round of local training, When, the local classifier is trained using the combination of the adversarial training loss and the data-driven cross-entropy loss: Since the local feature prototype is required in the adversarial loss, the current local feature prototype needs to be calculated before this operation. The feature prototype is the centroid of the feature vectors of each category extracted by the feature extractor: (7) (8) Among them, represents the set of local feature prototypes obtained before training the local classifier and local feature extractor, which contains local feature prototypes of classes. For the -th class, it is denoted as . represents the -th client's local dataset in which each sample dataset belongs to the -th class, represents a single sample in , represents the local feature extraction function, represents the size of the sample dataset belonging to the -th class in the -th client's local dataset, represents the local feature extractor before training after the -th round of local update; Then, download the global feature prototype set from the server side in the previous round, and the global classifier to construct the losses of two local personalized discriminators, namely the loss of the prototype discriminator and the loss of the classifier discriminator For the loss of the prototype discriminator is as follows. This loss function is used to train : (9) In formula (9), represents the loss of the -th client when training the prototype discriminator in the -th round, represents belonging to 's -th class, is the logarithmic function with as the base, is the prototype discrimination function, is the local classification function, represents the local classifier after the -th round of local update, represents the global feature prototype belonging to the -th class, represents the local feature prototype of the -th class obtained before training the local classifier and local feature extractor; For the classifier discriminator the loss is as follows, and this loss function is used for training : (10) In Equation (10), represents the loss of the th client when training the classifier discriminator in the th round, represents the th class belonging to , is the logarithmic function with as the base, is the classifier discrimination function, represents the global classification function, represents the global classifier obtained after aggregation of the th, represents the global feature prototype of the th class, is the local classification function, represents the local classifier after the th round of local update; Based on the above two discriminator losses, the first-order adversarial training loss of the local classifier as the generator is obtained , which is used for training . Through this process, it helps the local classifier obtain the generalization knowledge in the global classifier, thereby enhancing the generalization ability of the local personalized classifier. The first-order adversarial training loss is as follows: (11) In Equation (11), represents the first-order adversarial training loss of the th client in the th round of training, is the prototype discrimination function, is the local classification function, represents the local classifier after the th round of local update, represents the local feature prototype of the th class obtained before training the local classifier and local feature extractor, is the classifier discrimination function, represents the global feature prototype of the th class.

[0036] At the same time, the cross-entropy loss composed of local prototypes is added to obtain the second-order adversarial training loss (which can be simply referred to as the adversarial training loss at this time), thus effectively alleviating the forgetting of local knowledge by the local classifier when adapting to local tasks: (12) Therefore, the total loss of training the local classifier is: (13) The local classifier is trained using stochastic gradient descent to obtain the trained local classifier : (14) For the feature extractor, the training of the local feature extractor is guided by the global feature prototype to help the local feature extractor improve its generalization ability: (15) (16) Among them, represents the loss composed of the global feature prototype, represents the Euclidean norm, represents belonging to the -th class of global feature prototype, represents the local feature extractor after the t -th round of training, represents the local classifier after the t -th round of training.

[0037] S4. After each client completes the first round of local training and before uploading local information to the server, calculate the set of upload rounds of the feature extractor, and there is no need to recalculate in subsequent rounds; then each client recalculates the local feature prototype, and then uploads the following local information to the server: the recalculated local feature prototype, the local feature extractor, the local classifier, the total number of training samples owned by the client, and the number of training samples for each category. Among them, the sample number information is only uploaded after the first round of training is completed. If the current round is in the set of upload rounds, the local feature extractor is uploaded only. Specifically as follows: After the client completes the first round of local training and before uploading local information to the server, calculate the ratio of the local feature extractor to the local feature prototype parameters, and pass it through To selectively upload the local feature extractor, this method can effectively reduce the communication cost of the entire system. The local feature extractor is only uploaded when necessary, thus reducing unnecessary communication overhead. If only relying on the global feature prototype to guide the training of the local feature extractor, it may not be possible to ensure that the local feature extractor obtains sufficient generalization ability. At the same time, if the feature extractor is uploaded in each round, on the one hand, it will bring too high communication cost, and on the other hand, it may also cause the over-reduction of the personalization ability of the local feature extractor. The ratio of the local feature extractor to the local feature prototype parameters The calculation formula is as follows: (17) Where represents the calculated number of parameters; Then multiples are excluded from the communication rounds. During these rounds, the local feature extractor is not uploaded (uploaded in other rounds), and then the set of feature extractor upload rounds is obtained; Recalculate the local feature prototype to obtain the set of local feature prototypes to be uploaded : (18) (19) In equations (18) and (19), represents the set of local feature prototypes obtained after training the local feature extractor, contains local feature prototypes of classes. For the th class among them, it is denoted as , represents the th client local dataset belonging to the th class, represents a single sample in represents the local feature extraction function, represents the th client local dataset belonging to the th class, represents the th local feature extractor after local training in the

[0038] S5. The server uses the category sample size and the total sample size as the basis for setting the aggregation weights respectively, aggregates the local feature prototypes and local classifiers uploaded by the clients to generate global feature prototypes and a global classifier; if a local feature extractor is uploaded in the current round, it performs weighted aggregation based on the total sample size to obtain a global feature extractor, and then sends the aggregation information to the clients participating in federated learning, specifically as follows: If a feature extractor is received in the current aggregation round, based on the total client sample size, set the aggregation weight ( indicating the weight set based on the total sample size of the -th client) to obtain a global feature extractor : (20) (21) For the classifier, also based on the total client sample size, set the aggregation weight to obtain a global classifier : (22) For the aggregation of feature prototypes, use the sample size of each class as the aggregation weight to obtain global feature prototypes: (23) (24) (25); In formulas (23)-(25), indicates the weight set based on the sample size of the -th client for the -th class, represents the size of the sample data set belonging to the -th client's local data set for the -th class ( similarly), represents the global feature prototype set obtained after the -th global aggregation, is the global feature prototype containing classes. For the -th class among them, it is expressed as , and represents the local feature prototype belonging to the -th class obtained after the

[0039] S6. Repeat steps S2 to S5 until the local model converges or the preset number of communication rounds is reached.

[0040] The effectiveness of the present invention is verified by the following specific experiments: Regarding the experimental configurations and the experimental results of the present invention, the following contents are included: (1) Dataset and model settings The present invention conducts experiments on the data collected by the acceleration sensor to complete the action recognition and classification tasks. This dataset contains the acceleration signal data of multiple action categories, and each sample records the time series signals of different actions. The training set contains a large amount of acceleration data, and the test set is used to evaluate the performance of the model. In the experiment, the model adopted is a three-layer convolutional neural network. The number of convolutional filters in each layer of the network is 16, 32, and 64 respectively, the sizes of the convolutional kernels are 5x5, 5x5, and 3x3 respectively, the rectified linear unit is selected as the activation function, and the max pooling operation is combined for feature dimensionality reduction. Finally, a fully connected layer containing 128 neurons is connected to an output layer corresponding to the number of action categories for classification prediction to complete the classification tasks related to the industrial Internet of Things.

[0041] (2)Training settings and data splitting During the local training process, the feature extractor and the classifier will be trained separately, and each component is independently trained for 3 rounds. The global communication rounds are set to 100 rounds. Each client uses 300 samples for training, where 20% of the data is evenly distributed to all categories, and the remaining 80% of the data is randomly assigned to 3 specific categories. Through this data distribution method, the heterogeneous situation of industrial Internet of Things data can be effectively simulated.

[0042] (3)Comparison methods The compared FedAvg, FedPer, FedProto, MOON, and FedRep are all federated learning methods, among which FedAvg and MOON are traditional federated learning methods, and FedPer, MOON, and FedRep are personalized federated learning methods.

[0043] (4)Experimental results To verify the generalization ability and personalized effect of the present invention under industrial Internet of Things data, experiments were conducted under different distributions and the same distribution conditions of the training set and the test set, and the experimental results are as Figure 3 and Figure 4 shown. The method of the present invention shows a higher average accuracy (i.e., the mean of the accuracies of each client) than the comparison methods in these two different scenarios. In addition, to evaluate the convergence of the method, a convergence test was conducted, and the loss values before and after model training were calculated. As Figure 5 shown, the loss value of the method of the present invention tends to be stable after about 80 rounds of training, and the model gradually converges.

[0044] Example 2, This embodiment also provides an apparatus for implementing a federated learning method based on dual adversarial training in an industrial Internet of Things, including: At least one processor; and A memory storing instructions that, when executed by the at least one processor, cause the at least one processor to execute the federated learning method based on dual adversarial training in the industrial Internet of Things as described above.

[0045] In this embodiment, the apparatus may include, but is not limited to: personal computers, server computers, workstations, desktop computers, laptop computers, notebook computers, mobile computing devices, smart phones, tablet computers, cellular phones, personal digital assistants (PDAs), handheld devices, messaging devices, wearable computing devices, consumer electronic devices, and so on.

[0046] Embodiment 3 This embodiment also provides a machine-readable storage medium storing executable instructions that, when executed, cause the machine to execute the federated learning method based on dual adversarial training in the industrial Internet of Things as described above.

[0047] Specifically, a system or apparatus equipped with a readable storage medium may be provided, on which software program code for implementing the functions of any one of the above embodiments is stored, and the computer or processor of the system or apparatus is caused to read and execute the instructions stored in the readable storage medium.

[0048] In this case, the program code read from the readable medium itself can implement the functions of any one of the above embodiments, so the machine-readable code and the readable storage medium storing the machine-readable code constitute a part of this specification.

[0049] Examples of the readable storage medium include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD-RW), magnetic tapes, non-volatile memory cards, and ROMs. Optionally, the program code may be downloaded from a server computer or a cloud via a communication network.

[0050] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the technical solutions of the present invention, rather than limitations on the specific implementation manners of the present invention. Any modifications, equivalent replacements, and improvements made within the spirit and principle of the claims of the present invention shall be included within the protection scope of the claims of the present invention.

Claims

1. A federated learning method based on dual adversarial training under the industrial Internet of Things, characterized in that The method includes: S1. The server initializes the global model and distributes the global model to each client participating in federated learning, where the client refers to an industrial device or a terminal; S2. Each client updates the local model based on the received global information: When performing the first local model update, each client initializes the local model as the received global model; In subsequent rounds, when the client receives a new round of global feature extractor from the server, the client updates the local feature extractor, while the local classifier part remains unchanged without any update operation; S3. After completing the local model update, each client enters the local training stage; The feature extractor and classifier in the local model adopt a phased independent training method. The training sequence is to first train the local classifier and then train the local feature extractor; in the first local training round, the local feature extractor and local classifier are trained only based on the data-driven cross-entropy loss; while in non-first local training, the feature extractor is jointly constrained by both the cross-entropy loss and the global feature prototype loss, and the classifier is optimized and trained by superimposing the adversarial training loss on the basis of the cross-entropy loss; S4. After each client completes the first round of local training and before uploading the local information to the server, calculate the upload round set of the feature extractor, and there is no need to recalculate in subsequent rounds; then each client recalculates the local feature prototype, and then uploads the following local information to the server: the recalculated local feature prototype, the local feature extractor, the local classifier, the total number of training samples owned by the client, and the number of training samples for each category. Among them, the sample quantity information is only uploaded after the first round of training is completed. If the current round is in the upload round set, the local feature extractor is uploaded only then; S5. The server uses the category sample quantity and the total sample quantity as the basis for setting the aggregation weights respectively, aggregates the local feature prototype and local classifier uploaded by the client to generate the global feature prototype and global classifier; if the local feature extractor is uploaded in the current round, perform weighted aggregation based on the total sample quantity to obtain the global feature extractor; then send the aggregation information to the clients participating in federated learning; S6. Repeat steps S2 to S5 until the local model converges or reaches the preset number of communication rounds.

2. The federated learning method based on dual adversarial training under the industrial Internet of Things according to claim 1, wherein Step S2 specifically includes: For the first round of local model update, both the local feature extractor and local classifier are updated using the global feature extractor and global classifier: (1) Among them, represents the local feature extractor after the first round of update, represents the global feature extractor, represents the local classifier after the first round of update, represents the global classifier, and the superscript indicates the state after update and before training; For the round of local model update, , the client judges whether the content newly downloaded from the server after the th aggregation contains a global feature extractor: If available, use this global feature extractor to update the local feature extractor: (2) Among them, represents the feature extractor before the th local training after the th local update; represents the global feature extractor obtained after the th aggregation by the server side; If not, the feature extractor continues to use the feature extractor after the th local update training : (3) For the local classifier, continue to use the local classifier after the th local update training: (4) Among them, represents the local classifier before the th local training after the th local update, and represents the local classifier after the th local update training.

3. The federated learning method based on dual adversarial training under the industrial Internet of Things according to claim 2, characterized in that, Step S3 specifically includes: For the first round of local training, both the local classifier and feature extractor are trained only using the data-driven cross-entropy loss: (5) (6) In formulas (5) and (6), represents the local classifier after the first round of training, represents the local classifier after the first round of update, represents the gradient for calculating the loss related to the local classifier, represents the samples in the local dataset, represents the local dataset of the client, represents the cross-entropy loss, represents the input feature information of the image, represents the label corresponding to the input feature information of the image, represents the local feature extractor after the first round of training, represents the local feature extractor after the first round of update, represents the gradient for calculating the loss related to the local feature extractor.

4. The federated learning method based on dual adversarial training under the industrial Internet of Things according to claim 3, wherein Step S3 specifically further includes: For the round of local training, when, the local classifier is trained using a combination of adversarial training loss and data-driven cross-entropy loss: Since the local feature prototype is required in the adversarial loss, it is necessary to calculate the current local feature prototype before performing this operation: (7) (8) Among them, represents the set of local feature prototypes obtained before training the local classifier and local feature extractor, which contains local feature prototypes of classes. For the -th class, it is denoted as which represents the -th client's local dataset and the sample datasets of each sample belonging to the -th class in it, where represents a single sample in represents the size of the sample dataset of the -th class in the -th client's local dataset before training after the -th round of local update; Then download the global feature prototype set of the previous round from the server side , and the global classifier , to construct the losses of two local personalized discriminators, namely the loss of the prototype discriminator and the loss of the classifier discriminator : For the prototype discriminator the loss is as follows, and this loss function is used for training : (9) In formula (9), represents the loss of the -th client when training the prototype discriminator in the -th round, represents the -th class belonging to , is the logarithmic function with as the base, is the prototype discriminant function, is the local classification function, represents the local classifier after the -th round of local update, represents the global feature prototype belonging to the -th class, represents the local feature prototype of the -th class obtained before training the local classifier and local feature extractor; For the classifier discriminator the loss is as follows, and this loss function is used for training : (10) In formula (10), represents the loss of the -th client when training the classifier discriminator in the -th round, represents belonging to the -th class, is the logarithmic function with as the base, is the classifier discriminant function, represents the global classification function, represents the global classifier obtained after aggregating the -th round, represents the global feature prototype belonging to the -th class, is the local classification function, represents the local classifier after the -th round of local update; Based on the above two discriminator losses, the first-order adversarial training loss of the local classifier as the generator is obtained , for training : (11) In formula (11), represents the first-order adversarial training loss during the client's round of training, is the prototype discrimination function, is the local classification function, represents the local classifier after the round of local update, represents the local feature prototype of the th class obtained before training the local classifier and local feature extractor, is the classifier discrimination function, represents the global feature prototype belonging to the th class; Add the cross-entropy loss composed of local prototypes at the same time to obtain the second-order adversarial training loss : (12) So the total loss of training the local classifier is as follows: (13) The local classifier is trained using stochastic gradient descent to obtain the trained local classifier : (14) For the feature extractor, use the global feature prototype to guide the training of the local feature extractor: (15) (16) Among them, represents the loss composed of the global feature prototype, represents the Euclidean norm, represents belonging to the global feature prototype of the t-th round of training of the local feature extractor, represents the local classifier after the t-th round of training.

5. The federated learning method based on dual adversarial training under the industrial Internet of Things according to claim 4, characterized in that Step S4 specifically includes: Before uploading local information to the server after the client completes the first round of local training, calculate the ratio of the local feature extractor to the local feature prototype parameters : (17) Among them represents the number of calculation parameters; Then, multiples of are excluded from the communication rounds. During these rounds, the local feature extractor does not upload, thereby obtaining the set of feature extractor upload rounds; Recalculate the local feature prototype to obtain the set of local feature prototypes to be uploaded : (18) (19) In formulas (18) and (19), represents the set of local feature prototypes obtained after training the local feature extractor, which contains local feature prototypes for classes. For the -th class, it is denoted as ; represents the -th client's local dataset that belongs to the -th class, where represents the local feature extraction function, ; represents the size of the sample dataset belonging to the -th class in the -th client's local dataset, represents the local feature extractor after the -th round of local training.

6. The federated learning method based on dual adversarial training under the industrial Internet of Things according to claim 5, characterized in that, Step S5 specifically includes: If a feature extractor is received in the current aggregation round, set the aggregation weight based on the total number of client samples to obtain a global feature extractor : (20) (21) In formula (20), represents the weight set based on the total number of samples of the th client; For the classifier, the aggregation weight is also set based on the total amount of client samples to obtain a global classifier : (22) For the aggregation of the feature prototype, use the sample quantity of each class as the aggregation weight to obtain the global feature prototype: (23) (24) (25); In formulas (23) - (25), represents the weight set based on the sample size of the th client for the th class. represents the size of the sample data set belonging to the th class in the local data set of the th client. Similarly, represents the global feature prototype set obtained after the th global aggregation. is the global feature prototype containing classes. For the th class among them, it is represented as , and represents the local feature prototype belonging to the kth class obtained after the th round of local training.

7. The federated learning method based on dual adversarial training under the industrial Internet of Things according to claim 1, wherein When the global information described in S2 is in the initial round, it contains a global feature extractor and a global classifier, and these two parts constitute the global model; in non-initial rounds, it must contain a global feature prototype and a global classifier, and if the server has a newly aggregated global feature extractor, it contains the global feature extractor.

8. An apparatus for implementing a federated learning method based on dual adversarial training under industrial Internet of Things, characterized in that, The device includes: at least one processor; and a memory storing instructions that, when executed by the at least one processor, cause the at least one processor to execute the federated learning method based on dual adversarial training under industrial Internet of Things as described in any one of claims 1 to 7.

9. A machine-readable storage medium, characterized in that, An executable instruction is stored on the machine-readable storage medium, and when the instruction is executed, it causes the machine to execute the federated learning method based on dual adversarial training under industrial Internet of Things as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Model migration federal learning method based on block chain

    CN114492851A

  • Large model cutting federated learning method and system based on local features

    CN117521856A

  • Cooperative edge cache optimization method based on asynchronous federated learning and perception clustering

    CN117873402A

  • Accelerated adaptive federated learning algorithm of client level in data heterogeneous scene

    CN118070920A

  • Federal learning method and device based on double-component second-order aggregation and re-optimization classifier part, and computer readable storage medium

    CN118114750A

Cited By

  • Class-level federal forgetting method and system based on double-layer expert mixing and TF-IDF discriminant pruning

    CN120911536A