Federated learning image classification method based on local differential privacy
Patent Information
- Application Number
- CN202111059634.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-10
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2041-09-10
AI Technical Summary
Existing technologies have privacy leakage issues in image classification, especially in the medical field, and homomorphic encryption methods bring high computing and communication overhead, making it difficult to effectively protect data privacy and reduce computing and storage overhead.
Using a federated learning method based on local differential privacy, the local client perturbs and uploads the weight parameters, and the central server performs aggregate updates, avoiding the encryption and decryption process, reducing computing and storage overhead, and controlling the degree of privacy protection by selecting privacy budgets of different sizes. .
On the premise of ensuring the privacy and security of training data, the training efficiency of the convolutional neural network model is improved, the computing and storage overhead is reduced, and the degree of privacy protection is flexibly controlled.
Smart Images

Figure CN113850272B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image processing and relates to a federated learning image classification method based on local differential privacy, which can be used for medical image classification. Background Art
[0002] Image classification is an image processing method that distinguishes different categories of images based on the different features reflected by different categories of targets in the image information. The main image classification method is currently implemented by training convolutional neural network models, which requires a large amount of training image data. However, user image data contains a large amount of user privacy information, so the interaction of massive image data during convolutional neural network model training will inevitably bring privacy and security issues. For example, in the medical field, since medical data is very sensitive and usually contains personal privacy information, the process of data sharing among multiple medical institutions will lead to the leakage of patient privacy.
[0003] For the above reasons, a privacy-preserving method is needed to support data sharing and model training. Google proposed federated learning in 2016. Its main process is: the server randomly assigns values to global model parameters for initialization and distributes the model to each participant. Each participant trains the model locally with its own data, and then sends the updated model parameters back to the server. The server updates the global model accordingly and distributes it to each participant again, and then performs a new round of iterative updates. Federated learning, as a privacy-preserving distributed framework, can achieve model construction by only uploading model parameter updates without sharing local data among the participants, which can guarantee the privacy and security of training data to a certain extent. However, existing studies have shown that attackers can reverse the local original data of the participants by uploading updated model parameters. For example, the server has the ability to use the aggregated results to analyze and obtain the statistical characteristics of the data uploaded by the participants, which will still lead to the privacy leakage of the participants. Therefore, how to protect the model parameters shared by the participants is an important issue.
[0004] For example, the patent application with application publication number CN 112949741 A and titled "Convolutional neural network image classification method based on homomorphic encryption" discloses a convolutional neural network image classification method based on homomorphic encryption, the steps of which mainly include: building a multi-party deep learning scenario model; the parameter server initializes encryption parameters; each user generates his own public key and private key; the parameter server generates his own public key and private key; the auxiliary server generates his own public key and private key, as well as a joint public key; each user obtains a training image sample set and a test image sample set; the parameter server builds a convolutional neural network model and initializes the training parameters; user P obtains and uploads the gradient vector ciphertext; the parameter server aggregates the gradient ciphertext vector; the parameter server and the auxiliary server homomorphically re-encrypt the aggregated gradient vector ciphertext; user P obtains the training result of the convolutional neural network model; each user obtains the image classification result. Since the training of the convolutional neural network model itself is a computationally intensive task with high computational and communication overhead, even without encryption, a high-throughput computing unit is required, and homomorphic encryption brings high computational and communication overhead and requires additional auxiliary servers. Summary of the invention
[0005] The purpose of the present invention is to address the deficiencies of the above-mentioned prior art and propose a federated learning image classification method based on local differential privacy, which reduces the computational storage overhead while ensuring the privacy and security of training data and classification accuracy.
[0006] To achieve the above object, the technical solution adopted by the present invention includes the following steps:
[0007] (1) Building a federated learning scenario model:
[0008] The construction includes a central server and I local clients L = {L i |1≤i≤I}, where I≥2, L i represents the i-th local client;
[0009] (2) The local client obtains the training sample set and the test sample set:
[0010] Each local client L i Obtain N images containing M target categories and annotate each image. Then use more than half of the images and their labels as the training sample set and the remaining images and their labels as the test sample set, where M ≥ 2 and N ≥ 500.
[0011] (3) Construct an image classification model H based on a convolutional neural network:
[0012] The local client L constructs an image classification model based on a convolutional neural network. The convolutional neural network includes an input layer, m convolutional layers-ReLU layers-pooling layers, and an output layer, where m ≥ 2. The output layer includes multiple fully connected layers stacked in sequence.
[0013] (4) Local client L initialization parameters:
[0014] The number of initialization iterations of the local client L is t, the maximum number of iterations is T, T ≥ 50, and the current image classification model based on convolutional neural network is H t , H t The weight parameter is w t , w t The number of parameter values is k, k ≥ 10000, and let t = 0, H t =H;
[0015] (5) The local client L locally updates the weight parameters of the convolutional neural network-based image classification model H:
[0016] (5a) The local client L randomly selects c·N training samples from the training sample set with replacement as the current convolutional neural network-based image classification model H t The input is forward propagated to obtain the predicted label set Where c is the sampling factor, represents the predicted label corresponding to the qth training sample, 1≤q≤c·N;
[0017] (5b) The local client L uses the cross entropy loss function and passes each predicted label and its corresponding true label Calculate the image classification model H t The loss value Then ask For H t The weight parameter w t The partial derivative of Then, the stochastic gradient descent method is used to In H t The back propagation method is used to t Update and get the locally updated weight parameter Δ i w t ;
[0018] (6) Local client L weight parameter Δ i w t Perform local differential privacy perturbation and upload:
[0019] (6a) Each local client L i Select the updated weight parameter Δi w t The θ with the largest absolute value u k parameters, and find the correlation between each selected parameter and Δ i w t The quotient of the value C with the largest absolute value in the equation is used to obtain the standardized disturbance input value. where θ u Indicates the selection parameter factor, 0.01≤θ u ≤1,x j represents the jth disturbance input value, 1≤j≤θ u k;
[0020] (6b) Each local client L i For each perturbation input value x j Generate a random number u t ∈[0,1], and judge Is it true? If so, from the interval Medium uniform collection x j The disturbance output value y j , otherwise, from the interval Medium uniform collection x j The disturbance output value y j , where A represents the boundary of the perturbation output, ε represents the privacy budget, 0.1≤ε≤10;
[0021] (6c) The local client L will u k perturbation output values are combined into an upload vector and will Upload to the central server;
[0022] (7) The central server obtains the image classification model based on the convolutional neural network after the weight parameters are globally updated and sends it:
[0023] The central server uploads the vector Aggregation is performed to obtain Aggregation results Implement the locally updated weight parameter Δ i w t The global update of the weight parameter w t Image classification model after local and global updates Sent to each local client L i ;
[0024] (8) The central server obtains the trained image classification model based on convolutional neural network:
[0025] The central server determines whether t≥T is true. If so, it obtains the trained image classification model H' based on the convolutional neural network. If not, it sets t=t+1. And execute step (5);
[0026] (9) The local client obtains the image classification results:
[0027] Each local client L i The test sample set is used as the input of the trained convolutional neural network-based image classification model H' for forward propagation to obtain the predicted labels of all test samples.
[0028] Compared with the prior art, the present invention has the following advantages:
[0029] First: The local client of the present invention selects some weight parameters from the locally updated weight parameters of the image classification model to form an upload vector, thereby realizing local differential privacy perturbation of the weight parameters. The central server then aggregates the uploaded vectors to realize global update of the locally updated weight parameters, thereby avoiding the frequent encryption and decryption process of the prior art, reducing the computing and storage overhead, and effectively improving the training efficiency of the convolutional neural network model while ensuring the privacy and security of the training data and the classification accuracy.
[0030] Second: In the process of performing local differential privacy perturbations on the locally updated weight parameters, the local client of the present invention can determine the interval of the output value corresponding to the collected perturbation input value by selecting privacy budgets of different sizes, thereby achieving control over the degree of privacy protection, and is suitable for image classification in scenarios with different privacy protection requirements. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 It is a flow chart for implementing the present invention. DETAILED DESCRIPTION
[0032] The present invention is further described in detail below with reference to the accompanying drawings and specific embodiments:
[0033] Reference Figure 1 , the present invention comprises the following steps:
[0034] Step 1) Build a federated learning scenario model:
[0035] The construction includes a central server and I local clients L = {L i |1≤i≤I}, where I≥2, L i represents the i-th local client; in this embodiment, I=10.
[0036] Step 2) The local client obtains the training sample set and the test sample set:
[0037] Each local client L i Obtain N images containing M target categories and annotate each image. Then use more than half of the images and their labels as the training sample set and the remaining images and their labels as the test sample set, where M ≥ 2 and N ≥ 500.
[0038] In this embodiment, the MNIST handwritten digital image dataset is used. The labels corresponding to the dataset are numbers from 0 to 9. Let M = 10. The MNIST dataset includes 60,000 training image samples and 10,000 test image samples. Each image sample is a grayscale image with a size of 28×28. The dataset is divided into 10 parts and used as 10 local clients for local training. Training samples and test samples are evenly distributed to each local client.
[0039] Step 3) Build an image classification model H based on convolutional neural network:
[0040] The local client L constructs an image classification model based on a convolutional neural network. The convolutional neural network includes an input layer, m convolutional layers-ReLU layers-pooling layers, and an output layer, where m ≥ 2. The output layer includes multiple fully connected layers stacked in sequence.
[0041] In this embodiment, the number of convolutional layers-ReLU layers-pooling layers is 2, the number of fully connected layers is 3, the size of the convolution kernels in the two convolutional layers-ReLU layers-pooling layers is 5, the step size is 1, the padding of the convolutional layer in the first convolutional layer-ReLU layer-pooling layer is 2, the number of convolution kernels is set to 6, the padding of the convolutional layer in the second convolutional layer-ReLU layer-pooling layer is 0, and the number of convolution kernels is set to 16. The input of the first fully connected layer is 400, and the output is 120, the input of the second fully connected layer is 120, and the output is 84, and the input of the third fully connected layer is 84, and the output is 10.
[0042] Step 4) Local client L initializes parameters:
[0043] The number of initialization iterations of the local client L is t, the maximum number of iterations is T, T ≥ 50, and the current image classification model based on convolutional neural network is H t , H t The weight parameter is w t , w t The number of parameter values is k, k ≥ 10000, and let t = 0, H t =H; in this embodiment, T=100, k=61706.
[0044] Step 5) The local client L locally updates the weight parameters of the convolutional neural network-based image classification model H:
[0045] Step 5a) The local client L randomly selects c·N training samples from the training sample set with replacement as the current convolutional neural network-based image classification model H t The input is forward propagated to obtain the predicted label set Where c is the sampling factor, represents the predicted label corresponding to the qth training sample, 1≤q≤c·N;
[0046] In this step, through the first layer of convolution, 6 28×28 feature maps are obtained, and then pooling is performed to reduce the feature dimension to obtain 6 14×14 feature maps, and then the second layer of convolution and pooling operations are performed. Finally, the pooling layer is classified through three fully connected layers to obtain 10 prediction labels.
[0047] Step 5b) The local client L uses the cross entropy loss function and passes each predicted label and its corresponding true label Calculate the image classification model H t The loss value Then ask For H t The weight parameter w t The partial derivative of Then, the stochastic gradient descent method is used to In H t The back propagation method is used to t Update and get the locally updated weight parameter Δ i w t ;
[0048] In this step, the local client L calculates the image classification model H t The loss value For H t The weight parameter w t To update, the calculation and update formulas are:
[0049]
[0050]
[0051] Where α is the learning rate, 0.001≤α≤1, ln represents the logarithm with the natural constant e as the base, represents the gradient operator, and in this embodiment, α=0.01.
[0052] Step 6) The local client L pairs weight parameter Δ i w t Perform local differential privacy perturbation and upload:
[0053] Step 6a) Each local client L i Select the updated weight parameter Δ i w t The θ with the largest absolute value u k parameters, and find the correlation between each selected parameter and Δ i w t The quotient of the value C with the largest absolute value in the equation is used to obtain the standardized disturbance input value. where θ u Indicates the selection parameter factor, 0.01≤θ u ≤1,x j represents the jth disturbance input value, 1≤j≤θ u k;
[0054] In this step, the weight parameters of the image classification model contain k = 61706 values. If all are uploaded, it will bring high computing and communication overhead. Studies have shown that uploading 1% of the weight parameter values can make the model converge well and the larger the absolute value of the parameter value, the greater the impact on model training. Before perturbing the parameter value, it is necessary to standardize the parameter value to the [-1,1] interval, which can reduce the error caused by the perturbation. In this embodiment, the parameter factor θ is selected u =0.01.
[0055] Step 6b) Each local client L i For each perturbation input value x j Generate a random number u t ∈[0,1], and judge Is it true? If so, from the interval Medium uniform collection x j The disturbance output value y j , otherwise, from the interval Medium uniform collection x j The disturbance output value y j , where A represents the boundary of the perturbation output, ε represents the privacy budget, 0.1≤ε≤10;
[0056] Local differential privacy protection fully considers the possibility of local data leakage during the data upload process and the central server, and provides quantifiable privacy protection for local data. It adjusts the required privacy protection level through the privacy budget ε. The smaller ε is, the better the privacy protection level is and the lower the probability of data leakage is. In this embodiment, let ε = 1.
[0057] In this step, local differential privacy requires a perturbation method F for any two input values x j and x′ j , output value y j , all need to be satisfied It is also necessary to ensure that the global integral of the probability density function of the perturbation output value is 1, so the range of the perturbation output value needs to be defined as [-A, A].
[0058] By building where pdf(y j =z|x j ) represents the probability density function of the perturbation output value, left(x j ) represents the left boundary of the high probability output segment, right(x j ) represents the right boundary of the high probability output segment, and p represents the probability value of the high probability output segment. j =0, x j = 1, we can calculate It can be verified that the above privacy constraints and probability constraints are met.
[0059] Step 6c) The local client L sends θ u k perturbation output values are combined into an upload vector and will Upload to the central server;
[0060] In this step, the upload vector is Even if the upload vector is leaked during the data upload process or in the central server, the attacker can obtain Due to the existence of local differential privacy noise, the attacker cannot infer the local client model.
[0061] Step 7) The central server obtains the image classification model based on the convolutional neural network after the weight parameters are globally updated and sends it:
[0062] The central server uploads the vector Aggregation is performed to obtain Aggregation results Implement the locally updated weight parameter Δ i w t The global update of the weight parameter w t Image classification model after local and global updates Sent to each local client L i ;
[0063] In this step, the aggregation formula is
[0064] For any given input value x j ∈[-1,1], according to the above probability density function Calculate the input value x j Corresponding output value y j The mathematical expectation of We can get E[y j ]=x j , which means that the perturbation of the weight parameter value is unbiased, so no additional operation is required during aggregation.
[0065] Step 8) The central server obtains the trained image classification model based on convolutional neural network:
[0066] The central server determines whether t≥T is true. If so, it obtains the trained image classification model H' based on the convolutional neural network. If not, it sets t=t+1. And execute step (5);
[0067] Step 9) The local client obtains the image classification results:
[0068] Each local client L i The test sample set is used as the input of the trained convolutional neural network-based image classification model H' for forward propagation to obtain the predicted labels of all test samples.
[0069] In this step, the average classification accuracy of all local clients is 94%, which is comparable to the existing methods. The existing methods use homomorphic encryption processes mainly including key generation, homomorphic encryption, homomorphic assignment, and homomorphic decryption. In the training process of image classification models based on convolutional neural networks, due to the existence of a large number of weight parameter values, the encryption and decryption process consumes a lot of computing resources. The present invention only needs to disturb each uploaded weight parameter value once, and the calculation process is only a simple numerical calculation. Because the present invention does not require additional auxiliary servers, it reduces computing and storage overhead.
Claims
1. A federated learning image classification method based on local differential privacy, characterized in that: The steps include: (1) Building a federated learning scenario model: The construction includes a central server and I local clients L = {L i |1≤i≤I}, where I≥2, L i represents the i-th local client; (2) The local client obtains the training sample set and the test sample set: Each local client L i Obtain N images containing M target categories and annotate each image. Then use more than half of the images and their labels as the training sample set and the remaining images and their labels as the test sample set, where M ≥ 2 and N ≥ 500. (3) Construct an image classification model H based on a convolutional neural network: The local client L constructs an image classification model based on a convolutional neural network. The convolutional neural network includes an input layer, m convolutional layers-ReLU layers-pooling layers, and an output layer, where m ≥ 2. The output layer includes multiple fully connected layers stacked in sequence. (4) Local client L initialization parameters: The number of initialization iterations of the local client L is t, the maximum number of iterations is T, T ≥ 50, and the current image classification model based on convolutional neural network is H t , H t The weight parameter is w t , w t The number of parameter values is k, k ≥ 10000, and let t = 0, H t =H; (5) The local client L locally updates the weight parameters of the convolutional neural network-based image classification model H: (5a) The local client L randomly selects c·N training samples from the training sample set with replacement as the current convolutional neural network-based image classification model H t The input is forward propagated to obtain the predicted label set Where c is the sampling factor, represents the predicted label corresponding to the qth training sample, 1≤q≤c·N; (5b) The local client L uses the cross entropy loss function and passes each predicted label and its corresponding true label Calculate the image classification model H t The loss value Then ask For H t The weight parameter w t The partial derivative of Then, the stochastic gradient descent method is used to In H t The back propagation method is used to t Update and get the locally updated weight parameter Δ i w t ; (6) Local client L weight parameter Δ i w t Perform local differential privacy perturbation and upload: (6a) Each local client L i Select the updated weight parameter Δ i w t The θ with the largest absolute value u k parameters, and find the correlation between each selected parameter and Δ i w t The quotient of the value C with the largest absolute value in the equation is used to obtain the standardized disturbance input value. where θ u Indicates the selection parameter factor, 0.01≤θ u ≤1,x j represents the jth disturbance input value, 1≤j≤θ u k; (6b) Each local client L i For each perturbation input value x j Generate a random number u t ∈[0,1], and judge Is it true? If so, from the interval Medium uniform collection x j The disturbance output value y j , otherwise, from the interval Medium uniform collection x j The disturbance output value y j , where A represents the boundary of the perturbation output, ε represents the privacy budget, 0.1≤ε≤10; (6c) The local client L will u k perturbation output values are combined into an upload vector and will Upload to the central server; (7) The central server obtains the image classification model based on the convolutional neural network after the weight parameters are globally updated and sends it: The central server uploads the vector Aggregation is performed to obtain Aggregation results Implement the locally updated weight parameter Δ i w t The global update of the weight parameter w t Image classification model after local and global updates Sent to each local client L i ; (8) The central server obtains the trained image classification model based on convolutional neural network: The central server determines whether t≥T is true. If so, it obtains the trained image classification model H' based on the convolutional neural network. If not, it sets t=t+1. And execute step (5); (9) The local client obtains the image classification results: Each local client L i The test sample set is used as the input of the trained convolutional neural network-based image classification model H' for forward propagation to obtain the predicted labels of all test samples.
2. The method for federated learning image classification based on local differential privacy according to claim 1, characterized in that: The image classification model H based on convolutional neural network described in step (3), wherein the number of convolutional layer-ReLU layer-pooling layer layers is 2, the number of fully connected layers is 3, the size of the convolution kernel of the two convolutional layers-ReLU layers-pooling layers is 5, the step size is 1, the padding of the convolution layer in the first convolutional layer-ReLU layer-pooling layer is 2, the number of convolution kernels is set to 6, and the padding of the convolution layer in the second convolutional layer-ReLU layer-pooling layer is 0, and the number of convolution kernels is set to 16.
3. The method for federated learning image classification based on local differential privacy according to claim 1, characterized in that: The local client L in step (5b) calculates the image classification model H t The loss value For H t The weight parameter w t To update, the calculation and update formulas are: Where α is the learning rate, 0.001≤α≤1, ln represents the logarithm with the natural constant e as the base, Represents the gradient operator.
4. The method for federated learning image classification based on local differential privacy according to claim 1, characterized in that: The central server described in step (7) classifies the image into a model H t The weight parameter w t Aggregation is performed, and the aggregation formula is:
