Federal learning deep optimization method combining data space and middleware

By combining the federated learning method of data space and middleware, using deep learning models such as RabbitMQ and ResNet, the problems of data privacy protection and data islands are solved, data security and model performance are improved, and a variety of application scenarios are adapted to.

CN119203221APending Publication Date: 2024-12-27QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES) +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411253793.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-09
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

In the prior art, data privacy protection and data island problems are difficult to solve, and there is a risk of data leakage and user distrust during data transmission, which cannot effectively ensure data security.

Method used

Combining the federated learning deep optimization method of data space and middleware, the client preprocesses and segments the data set, and sends byte format data to the server through RabbitMQ middleware, and the server performs one-hot encoding and trains the model. , run the federated averaging process to update the global model, adopt deep learning models such as ResNet to improve feature extraction and model performance.

Benefits of technology

It effectively solves the problems of data privacy protection and data islands, avoids the risk of data leakage, ensures data security, improves model performance and system scalability, and complies with strict data protection regulations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119203221A_ABST
    Figure CN119203221A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of federated learning, and particularly provides a federated learning deep optimization method combining data space and middleware. The method comprises the following steps: segmenting a preprocessed data set by a client to obtain a plurality of segmented data sets; the client converts the plurality of segmented data sets into data in a byte format, and sends the data to a specified queue in the RabbitMQ through a network; the server receives the data sent by the client through the specified queue, preprocesses the data, and converts the label of the data into one-hot code; the server side obtains a trained model through one-hot coding; according to the method, the problems of data privacy protection and data islands are solved, the risk of data leakage and the problem of ditrust among users are avoided while the data are sent to the server, and the data security is effectively guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of federated learning, and in particular to a federated learning deep optimization method combining data space and middleware. Background Art

[0002] Data space is an underlying framework for distributed multi-label data storage throughout the life cycle of all objects. It is a technical system that allows data to be connected securely and efficiently. Focusing on the association between data and users, and the mapping between data and business processes, it organizes and associates object-oriented full life cycle businesses to form a standardized data business flow; it uses data identity technology and multi-level permission access control mechanisms to clarify the boundaries of data sovereignty, thereby achieving the purpose of data sovereignty return and data decentralization and circulation, and then builds a security wall for data through multi-level protection security algorithms and data desensitization technology.

[0003] Middleware is a type of software located between the operating system and the application program, mainly used to solve the communication and data exchange problems between applications. It provides a way to simplify application development and maintenance. Main features. Middleware can decouple different parts of the application so that each part can be developed and maintained independently. And the middleware provides a mechanism for communication between applications and supports data exchange between different systems and platforms. RabbitMQ is a message middleware that accepts and forwards messages. RabbitMQ sends messages to queues through producers, and then consumers receive messages from queues. RabbitMQ is a powerful, flexible and reliable message middleware that is suitable for a variety of scenarios that require asynchronous communication and data exchange, from simple task queues to complex distributed systems, and can provide effective solutions.

[0004] Data space is the basis for storing and managing data. It includes not only physical storage media, but also the organization and access methods of data. Middleware acts as a communication bridge between applications, providing data access, exchange and management functions. It ensures the consistency and integrity of data by coordinating transactions in different data spaces, and protects data security during data transmission. However, the construction of data space still has problems with data privacy protection and data silos. When sending data to the server, there is a risk of data leakage and a problem of distrust between users, which cannot effectively guarantee data security. Summary of the invention

[0005] In view of this, the present invention provides a federated learning deep optimization method that combines data space and middleware to solve the problems of data privacy protection and data islands, and while sending data to the server, avoids the risk of data leakage and the problem of distrust between users, and effectively ensures data security.

[0006] In a first aspect, the present invention provides a method for deep optimization of federated learning combining data space and middleware, the method comprising:

[0007] The client preprocesses the data set, and segments the preprocessed data set to obtain multiple segmented data sets;

[0008] The client connects to the RabbitMQ middleware, converts the divided data sets into byte format data, and sends the byte format data to the specified queue in the RabbitMQ middleware through the network;

[0009] The server connects to the RabbitMQ middleware, receives the byte-formatted data sent by the client through the specified queue, pre-processes the data, and converts the data labels into one-hot encoding;

[0010] The server trains the created model through one-hot encoding to obtain the trained model; runs the federated averaging process to update the global model.

[0011] Optionally, the client preprocesses the data set and segments the preprocessed data set to obtain multiple segmented data sets, including:

[0012] The dataset is normalized and coded, and the pixel values ​​of the image are scaled from 0-255 to 0-1. The labels of the dataset are converted to one-hot encoding. In multi-classification, one-hot encoding represents each label as a binary vector with a length equal to the number of categories, with only one position being 1 and the other positions being 0.

[0013] The data set is divided into multiple subsets, each subset simulates the data of a client for federated learning; the multiple subsets include data set 1 to data set k, where k is a positive integer; the number of clients is defined to determine the number of clients participating in federated learning, and then the data of each client is packaged into a specific format; the data subset of each client includes an input image and its corresponding label.

[0014] Optionally, the client connects to the RabbitMQ middleware or the server connects to the RabbitMQ middleware, including:

[0015] Make sure the RabbitMQ server is installed and running, then use Python's Pike library to communicate with the RabbitMQ server and establish a TCP connection.

[0016] Optionally, converting the divided multiple data sets into data in byte format, and sending the data in byte format to a designated queue in RabbitMQ middleware through a network includes:

[0017] Convert the divided data sets into byte format data, and send the byte format data to the specified queue through the basic_publish method of RabbitMQ middleware; each message represents a subset of the client's data; after sending the message, wait for RabbitMQ's confirmation to ensure that the message is sent and stored in the specified queue.

[0018] Optionally, receiving the data in byte format sent by the client through the designated queue, preprocessing the data, and converting the label of the data into one-hot encoding includes:

[0019] Receive byte-formatted data sent by the client from the specified queue in the RabbitMQ middleware; define a callback function that is called when data is received; use the basic_consume method to receive data from the specified queue and bind the callback function to the data queue; preprocess the received data to ensure that the labels are converted to one-hot encoding for use in model training.

[0020] Optionally, the created model includes:

[0021] ResNet is used as the basic model to define a deep learning model for federated learning training. The deep learning model includes a convolution layer for feature extraction. It uses adaptive convolution, which combines standard convolution with self-attention mechanism to capture features of different scales by dynamically adjusting the convolution kernel weights. Its expression AdaptiveConv(x) is:

[0022] AdaptiveConv(x)=σ((W*x+b)⊙α(x));

[0023] Among them, ⊙ represents the element-by-element product; α(x) represents the weight generated by the self-attention mechanism, σ represents the activation function, W represents the weight matrix; b represents the bias term; x represents the input;

[0024] Batch normalization is used to normalize each batch of data to accelerate training and stabilize the model. Its expression BN(x) is:

[0025]

[0026] Among them, μ represents the mean of the batch data; σ 2 Represents the variance of the batch data; ∈ represents a positive number; γ and β represent the scaling parameter and translation parameter of the training respectively;

[0027] The residual module is used to solve the degradation problem of deep networks. It retains the input information through skip connection. Its expression y is:

[0028] y=ReLU(x+F(x,{W i}));

[0029] Where x represents the input; F(x,{W i}) represents the transformation of multiple convolutions and activations on x; ReLU represents the ReLU activation function;

[0030] The pooling layer is used for downsampling to reduce the size of the feature map; combining maximum pooling and average pooling, and integrating different downsampling strategies, its expression HybridPooling(x) is:

[0031] HybridPooling(x)=λ·MaxPooling(x)+(1-λ)·AvgPooling(x);

[0032] Among them, Max means taking the maximum value in the pooling window; Avg means taking the average value in the pooling window; λ is an adjustable parameter that controls the ratio of maximum pooling to average pooling;

[0033] L1 and L2 regularization are added to the original loss function CrossEntropyLoss(·) to prevent overfitting. The expression Loss is:

[0034]

[0035] Among them, λ1 and λ2 both represent regularization functions; ∥W∥1 represents the L1 regularization term, represents the L2 regularization term; y represents the true value; represents the predicted value;

[0036] The fully connected layer is used to map features to the final output category, and its expression Dense(x) is:

[0037] Dense(x) = σ(W·x+b);

[0038] Among them, W represents the weight matrix; b represents the bias term; σ represents the activation function.

[0039] Optionally, running a federated averaging process to update a global model includes:

[0040] First, the federated average algorithm is initialized, and then multiple federated training rounds are run. In each round, updates are received from the client and the global model is updated on average. The expression of the federated average update ω is t+1 for:

[0041]

[0042] Among them, ω t represents the global model weight of the tth round; η represents the learning rate; n k represents the data volume of client g; n represents the sum of data volume of all clients; Represents the model for updating client g.

[0043] In the technical solution provided by the present invention, the method includes that the client preprocesses the data set and segments the preprocessed data set to obtain multiple segmented data sets; the client connects to the RabbitMQ middleware, converts the multiple segmented data sets into data in byte format, and sends the data in byte format to a designated queue in the RabbitMQ middleware through the network; the server connects to the RabbitMQ middleware, receives the data in byte format sent by the client through the designated queue, preprocesses the data, and converts the label of the data into one-hot encoding; the server trains the created model through one-hot encoding to obtain the trained model; and runs a federated averaging process to update the global model. The method solves the problems of data privacy protection and data islands, and while sending the data to the server, avoids the risk of data leakage and the problem of distrust between users, and effectively ensures the security of the data. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0045] Figure 1 A flowchart of a federated learning deep optimization method provided by an embodiment of the present invention;

[0046] Figure 2 A schematic diagram of the internal flow of a client provided by an embodiment of the present invention;

[0047] Figure 3 A schematic diagram of the internal flow of the server provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0048] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0049] It should be clear that the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0050] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "said" and "the" used in the embodiments of the present invention are also intended to include plural forms, unless the context clearly indicates other meanings.

[0051] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0052] The word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.

[0053] In the embodiment of the present invention, Figures 1 to 3 As shown, the method includes:

[0054] The client preprocesses the data set, and segments the preprocessed data set to obtain multiple segmented data sets.

[0055] In the embodiment of the present invention, firstly, a data set is selected, that is, the data set to be used is determined, and then the built-in method of the deep learning framework is used to download the data set.

[0056] In the embodiment of the present invention, the client preprocesses the data set and segments the preprocessed data set to obtain multiple segmented data sets, including:

[0057] The dataset is normalized and coded, and the pixel values ​​of the image are scaled from 0-255 to 0-1. The labels of the dataset are converted to one-hot encoding. In multi-classification, one-hot encoding represents each label as a binary vector with a length equal to the number of categories, with only one position being 1 and the other positions being 0.

[0058] In the embodiment of the present invention, normalized encoding makes the data suitable for training deep learning models; normalization processing helps to accelerate the training process of neural networks and improve the performance of the model; one-hot encoding is a label representation method commonly used in machine learning.

[0059] The data set is divided into multiple subsets, each subset simulates the data of a client for federated learning; the multiple subsets include data set 1 to data set k, where k is a positive integer; the number of clients is defined to determine the number of clients participating in federated learning, and then the data of each client is packaged into a specific format; the data subset of each client includes an input image and its corresponding label.

[0060] The client connects to the RabbitMQ middleware, converts the divided multiple data sets into byte format data, and sends the byte format data to the specified queue in the RabbitMQ middleware through the network.

[0061] In an embodiment of the present invention, converting the divided multiple data sets into data in byte format, and sending the data in byte format to a designated queue in RabbitMQ middleware through a network includes:

[0062] Convert the divided data sets into byte format data, and send the byte format data to the specified queue through the basic_publish method of RabbitMQ middleware; each message represents a subset of the client's data; after sending the message, wait for RabbitMQ's confirmation to ensure that the message is sent and stored in the specified queue.

[0063] The server connects to the RabbitMQ middleware, receives the byte-formatted data sent by the client through the specified queue, preprocesses the data, and converts the data labels into one-hot encoding.

[0064] In the embodiment of the present invention, the byte format data sent by the client is received by a designated queue, and the data is preprocessed to convert the label of the data into a one-hot encoding, including:

[0065] Receive byte-formatted data sent by the client from the specified queue in the RabbitMQ middleware; define a callback function that is called when data is received; use the basic_consume method to receive data from the specified queue and bind the callback function to the data queue; preprocess the received data to ensure that the labels are converted to one-hot encoding for use in model training.

[0066] In the embodiment of the present invention, the callback function processes the received data and saves or further processes it.

[0067] In the embodiment of the present invention, the client is connected to the RabbitMQ middleware or the server is connected to the RabbitMQ middleware, including:

[0068] Make sure the RabbitMQ server is installed and running, then use Python's Pike library to communicate with the RabbitMQ server and establish a TCP connection.

[0069] The server trains the created model through one-hot encoding to obtain the trained model; runs the federated averaging process to update the global model.

[0070] In the embodiment of the present invention, the purpose of connecting to the RabbitMQ middleware is to establish a connection with the RabbitMQ data queue in order to send and receive data.

[0071] In the embodiment of the present invention, the created model includes:

[0072] ResNet is used as the basic model to define a deep learning model for federated learning training. The deep learning model includes a convolution layer for feature extraction. It uses adaptive convolution, which combines standard convolution with self-attention mechanism to capture features of different scales by dynamically adjusting the convolution kernel weights. Its expression AdaptiveConv(x) is:

[0073] AdaptiveConv(x)=σ((W*x+b)⊙α(x));

[0074] Among them, ⊙ represents the element-by-element product; α(x) represents the weight generated by the self-attention mechanism, σ represents the activation function, W represents the weight matrix; b represents the bias term; x represents the input;

[0075] Batch normalization is used to normalize each batch of data to accelerate training and stabilize the model. Its expression BN(x) is:

[0076]

[0077] Among them, μ represents the mean of the batch data; σ2 Represents the variance of the batch data; ∈ represents a positive number; γ and β represent the scaling parameter and translation parameter of the training respectively;

[0078] The residual module is used to solve the degradation problem of deep networks. It retains the input information through skip connection. Its expression y is:

[0079] y=ReLU(x+F(x,{W i}));

[0080] Where x represents the input; F(x,{W i}) represents the transformation of multiple convolutions and activations on x; ReLU represents the ReLU activation function;

[0081] The pooling layer is used for downsampling to reduce the size of the feature map; combining maximum pooling and average pooling, and integrating different downsampling strategies, its expression HybridPooling(x) is:

[0082] HybridPooling(x)=λ·MaxPooling(x)+(1-λ)·AvgPooling(x);

[0083] Among them, Max means taking the maximum value in the pooling window; Avg means taking the average value in the pooling window; λ is an adjustable parameter that controls the ratio of maximum pooling to average pooling;

[0084] L1 and L2 regularization are added to the original loss function CrossEntropyLoss(·) to prevent overfitting. The expression Loss is:

[0085]

[0086] Among them, λ1 and λ2 both represent regularization functions; ∥W∥1 represents the L1 regularization term, represents the L2 regularization term; y represents the true value; represents the predicted value;

[0087] The fully connected layer is used to map features to the final output category, and its expression Dense(x) is:

[0088] Dense(x) = σ(W·x+b);

[0089] Among them, W represents the weight matrix; b represents the bias term; σ represents the activation function.

[0090] In the embodiment of the present invention, b is generally a scalar used to add a constant offset in the transformation; the activation function includes a softmax function.

[0091] In the embodiment of the present invention, a federated averaging process is run to update the global model, including:

[0092] First, the federated average algorithm is initialized, and then multiple federated training rounds are run. In each round, updates are received from the client and the global model is updated on average. The expression of the federated average update ω is t+1 for:

[0093]

[0094] Among them, ω t represents the global model weight of the tth round; η represents the learning rate; n k represents the data volume of client g; n represents the sum of data volume of all clients; Represents the model for updating client g.

[0095] In the embodiment of the present invention, federated learning is a technology that establishes a machine learning model through collaboration among multiple parties under the premise of protecting data privacy and security. Its core idea is to establish a virtual shared model through parameter exchange under an encryption mechanism without sharing the original data, thereby realizing joint training of data and model optimization. In this process, the middleware plays a vital role, providing functions such as communication mechanism, task scheduling, and security assurance to ensure the smooth progress of the federated learning process. The significance of federated learning lies in its ability to realize joint modeling of multi-party data without leaking the original data. This not only complies with strict data protection regulations, but also effectively prevents data leakage, while breaking data silos and tapping into the greater value of data. It promotes the innovation and development of artificial intelligence technology, enabling enterprises to drive the deep integration and application of artificial intelligence in various industries without leaving the local data environment.

[0096] The deep convolutional neural network structure ResNet (Residual Neural Network) successfully trained a 152-layer neural network by using residual modules. The main innovation of ResNet is the introduction of residual modules in the network, in which a skip connection is added between the input and output to add the input directly to the output. This design allows the network to learn the residual more easily, thereby solving the problems of gradient disappearance and model degradation. The structure of ResNet includes basic blocks and bottleneck blocks, in which the bottleneck block first reduces the dimension and then increases the dimension through a 1×1 convolution layer, mainly for the purpose of reducing computational complexity. The design of ResNet allows the depth of the network to continue to increase without performance degradation, which enables ResNet to improve the performance of the model by increasing the depth.

[0097] In the embodiment of the present invention, the data space access to federated learning can effectively ensure data security, so that the data can be processed locally without being sent to the server, thereby avoiding the risk of data leakage. Federated learning overcomes the shortcomings of traditional centralized machine learning, such as the risk of privacy leakage caused by centralized data processing and the dependence on the computing power of the central server. Through distributed collaboration, federated learning achieves data privacy protection, security improvement and model performance enhancement.

[0098] The present invention has the following beneficial effects:

[0099] 1. Data privacy protection: Federated learning effectively protects data privacy by training models on local devices without uploading data to the server, complying with increasingly stringent data protection regulations. 2. Data silo problem: Federated learning allows different data owners to collaborate on model training without sharing original data, effectively solving the data silo problem and promoting data integration and sharing. 3. Improve model performance: Especially in the case of uneven data distribution, federated learning can train more accurate and robust models by combining data and experience from different sources. 4. Architecture flexibility: Federated learning supports multiple modes such as horizontal, vertical and federated transfer learning to adapt to different data characteristics and business needs. 5. Security: Federated learning enhances the security of the model training process through technical means such as homomorphic encryption and secure multi-party computing, effectively resisting the risks of data leakage and malicious attacks. 6. Model testing and tuning: Model testing and tuning methods for federated learning, such as personalized federated evaluation and optimization, can evaluate and optimize machine learning systems distributed on different client devices to improve the accuracy and robustness of the model.

[0100] The innovation of the present invention lies in that the method introduces complex deep learning models (such as ResNet50) and advanced data processing methods to achieve a higher level of model expression ability and data processing efficiency. Traditional federated learning models often use simple neural network structures, while this method can capture richer feature information and adapt to diverse application scenarios by using complex models such as ResNet50. At the same time, advanced data preprocessing and feature extraction methods are used to make data processing in a distributed environment more efficient and accurate. By combining advanced technologies such as adaptive convolution and hybrid pooling, the model can better cope with the diversity and complexity of data and provide more accurate prediction results. Innovations also include the dynamic allocation and management of data in the data space, so that the system can intelligently adjust the model training strategy according to the distribution of data, and further improve the generalization ability and stability of the model.

[0101] The combination of data space and federated learning in the present invention has significant advantages in privacy protection and decentralized data processing. Traditional centralized machine learning methods usually require all data to be centralized to a central server, which not only increases the overhead of data transmission, but also poses the risk of privacy leakage. The distributed storage method of the data space enables data to be stored on each client, avoiding centralized data processing. In federated learning, each client trains the model locally and only sends model updates to the central server for aggregation. This method effectively protects user privacy and reduces the risk of sensitive data leakage. At the same time, decentralized data processing can share the computing pressure of the central server and improve the scalability and robustness of the system. By combining data space and federated learning, efficient and distributed machine learning model training can be achieved while ensuring data privacy.

[0102] The RabbitMQ middleware of the present invention is a high-performance message queue system that can handle a large number of concurrent messages and ensure the real-time and reliability of data transmission. In the process of federated learning, model updates and aggregation results need to be frequently transmitted between the client and the server. Through the RabbitMQ middleware, the client can send the model parameters of the local training to the message queue, and the central server obtains the data from the queue for aggregation update. This not only simplifies the communication process, but also can effectively alleviate the communication delay and data loss problems caused by network fluctuations. The asynchronous communication mechanism of the RabbitMQ middleware enables the system to maintain efficient operation when processing large-scale clients, avoiding performance bottlenecks and system crashes caused by synchronous communication.

[0103] In the technical solution provided by the present invention, the method includes that the client preprocesses the data set and segments the preprocessed data set to obtain multiple segmented data sets; the client connects to the RabbitMQ middleware, converts the multiple segmented data sets into data in byte format, and sends the data in byte format to a designated queue in the RabbitMQ middleware through the network; the server connects to the RabbitMQ middleware, receives the data in byte format sent by the client through the designated queue, preprocesses the data, and converts the label of the data into one-hot encoding; the server trains the created model through one-hot encoding to obtain the trained model; and runs a federated averaging process to update the global model. The method solves the problems of data privacy protection and data islands, and while sending the data to the server, avoids the risk of data leakage and the problem of distrust between users, and effectively ensures the security of the data.

[0104] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0105] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A federated learning deep optimization method combining data space and middleware, characterized in that: The method comprises: The client preprocesses the data set, and segments the preprocessed data set to obtain multiple segmented data sets; The client connects to the RabbitMQ middleware, converts the divided data sets into byte format data, and sends the byte format data to the specified queue in the RabbitMQ middleware through the network; The server connects to the RabbitMQ middleware, receives the byte-formatted data sent by the client through the specified queue, pre-processes the data, and converts the data labels into one-hot encoding; The server trains the created model through one-hot encoding to obtain the trained model; runs the federated averaging process to update the global model.

2. The method according to claim 1, characterized in that The client preprocesses the data set and segments the preprocessed data set to obtain multiple segmented data sets, including: The dataset is normalized and coded, and the pixel values ​​of the image are scaled from 0-255 to 0-1. The labels of the dataset are converted to one-hot encoding. In multi-classification, one-hot encoding represents each label as a binary vector with a length equal to the number of categories, with only one position being 1 and the other positions being 0. The data set is divided into multiple subsets, each subset simulates the data of a client for federated learning; the multiple subsets include data set 1 to data set k, where k is a positive integer; the number of clients is defined to determine the number of clients participating in federated learning, and then the data of each client is packaged into a specific format; the data subset of each client includes an input image and its corresponding label.

3. The method according to claim 1, characterized in that The client connects to the RabbitMQ middleware or the server connects to the RabbitMQ middleware, including: Make sure the RabbitMQ server is installed and running, then use Python's Pike library to communicate with the RabbitMQ server and establish a TCP connection.

4. The method according to claim 1, characterized in that The step of converting the divided multiple data sets into data in byte format and sending the data in byte format to a designated queue in the RabbitMQ middleware through a network includes: Convert the divided data sets into byte format data, and send the byte format data to the specified queue through the basic_publish method of RabbitMQ middleware; each message represents a subset of the client's data; after sending the message, wait for RabbitMQ's confirmation to ensure that the message is sent and stored in the specified queue.

5. The method according to claim 1, characterized in that The method receives the byte format data sent by the client through the designated queue, preprocesses the data, and converts the data label into one-hot encoding, including: Receive byte-formatted data sent by the client from the specified queue in the RabbitMQ middleware; define a callback function that is called when data is received; use the basic_consume method to receive data from the specified queue and bind the callback function to the data queue; preprocess the received data to ensure that the labels are converted to one-hot encoding for use in model training.

6. The method according to claim 1, characterized in that The created model includes: ResNet is used as the basic model to define a deep learning model for federated learning training. The deep learning model includes a convolution layer for feature extraction. It uses adaptive convolution, which combines standard convolution with self-attention mechanism to capture features of different scales by dynamically adjusting the convolution kernel weights. Its expression AdaptiveConv(x) is: AdaptiveConv(x)=σ((W*x+b)⊙α(x)); Among them, ⊙ represents the element-by-element product; α(x) represents the weight generated by the self-attention mechanism, σ represents the activation function, W represents the weight matrix; b represents the bias term; x represents the input; Batch normalization is used to normalize each batch of data to accelerate training and stabilize the model. Its expression BN(x) is: Among them, μ represents the mean of the batch data; σ 2 Represents the variance of the batch data; ∈ represents a positive number; γ and β represent the scaling parameter and translation parameter of the training respectively; The residual module is used to solve the degradation problem of deep networks. It retains the input information through skip connection. Its expression y is: y=ReLU(x+F(x,{W i }))? Where x represents the input; F(x,{W i }) represents the transformation of multiple convolutions and activations on x; ReLU represents the ReLU activation function; The pooling layer is used for downsampling to reduce the size of the feature map; combining maximum pooling and average pooling, and integrating different downsampling strategies, its expression HybridPooling(x) is: HybridPooling(x)=λ·MaxPooling(x)+(1-λ)·AvgPooling(x); Among them, Max means taking the maximum value in the pooling window; Avg means taking the average value in the pooling window; λ is an adjustable parameter that controls the ratio of maximum pooling to average pooling; L1 and L2 regularization are added to the original loss function CrossEntropyLoss(·) to prevent overfitting. The expression Loss is: Among them, λ1 and λ2 both represent regularization functions; ∥W∥1 represents the L1 regularization term, represents the L2 regularization term; y represents the true value; represents the predicted value; The fully connected layer is used to map features to the final output category, and its expression Dense(x) is: Dense(x)=σ(W·x+b); Among them, W represents the weight matrix; b represents the bias term; σ represents the activation function.

7. The method according to claim 1, characterized in that The running of the federated averaging process to update the global model includes: First, the federated average algorithm is initialized, and then multiple federated training rounds are run. In each round, updates are received from the client and the global model is updated on average. The expression of the federated average update ω is t+1 for: Among them, ω t represents the global model weight of the tth round; η represents the learning rate; n k represents the data volume of client g; n represents the sum of data volume of all clients; Represents the model for updating client g.