Data recovery method and device based on federated learning
By determining the target rational coefficients and data input characteristics in the federated learning model, the data recovery problem of label smoothing or label mixing technology in the federated learning model is solved, and fast and accurate data recovery and computing resource savings are achieved.
Patent Information
- Application Number
- CN202410539856.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-30
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2044-04-30
AI Technical Summary
The prior art is difficult to recover data using label smoothing or label mixing techniques in federated learning models.
The target rational coefficient is determined by determining the target fully connected layer gradient vector, initial rational coefficient and preset label features based on the federated learning model, and then the target fully connected layer data input features are determined, and the original image data is restored based on these features.
In the absence of model bias terms, quickly and accurately restore the source data of the federated learning model using label smoothing or label mixing technology, reduce computing resource consumption, protect user privacy, and ensure data security.
Smart Images

Figure CN118644423B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a data recovery method and device based on federated learning. Background Art
[0002] Federated learning aims to allow participating members to train the same model together, thereby improving model training efficiency and data privacy security. The privacy protection of federated learning is mainly achieved by restricting non-data owners from accessing sensitive data during the training process. In the context of federated learning, data recovery is often an important issue. When the data of a participant is lost or damaged, it is usually hoped that this information can be recovered through the data of other participants.
[0003] At present, there has been some research on data recovery methods based on federated learning models. By optimizing the distance loss between the gradient obtained by backpropagation of the randomly initialized image input network and the true gradient, the pixel value of the initialized image can be supervised to adjust the data distribution of the real local image, thereby restoring the original data involved in the training. However, this method has great limitations. Its fully connected layer network must contain bias terms, and the labels must be known or binary hard labels must be used. For source data that uses label smoothing or label mixing technology, even if it is a single data, the relevant recovery algorithm is powerless. Summary of the invention
[0004] The present application provides a data recovery method and device based on federated learning, which is used to solve the defect in the prior art that it is difficult to recover the federated learning model data using label smoothing or label mixing technology.
[0005] In a first aspect, the present application provides a data recovery method based on federated learning, comprising:
[0006] Determine the target rational coefficient based on the target fully connected layer gradient vector, initial rational coefficient and preset label features of the federated learning model;
[0007] Determining the target fully connected layer data input feature based on the target rational coefficient and the target fully connected layer gradient vector;
[0008] The original image data is restored based on the gradient information of the previous layer of the target fully connected layer and the data input features of the target fully connected layer.
[0009] Optionally, the target rational coefficient is determined based on the target fully connected layer gradient vector, the initial rational coefficient and the preset label feature of the federated learning model, including:
[0010] Determining a pseudo label based on the target fully connected layer gradient vector and the initial rational coefficient;
[0011] The target rational coefficient is determined based on the preset label feature and the pseudo label.
[0012] Optionally, determining the target rational coefficient based on the preset label feature and the pseudo label includes:
[0013] Determining an objective function based on the preset label features and the pseudo labels;
[0014] Applying an optimization algorithm to determine an optimized value of the objective function;
[0015] The optimized value is used as the target rational coefficient.
[0016] Optionally, restoring the original image data based on the gradient information of a previous layer of the target fully connected layer and the data input feature of the target fully connected layer includes:
[0017] Determining gradient information of the target fully connected layer data input feature;
[0018] Determine the data input feature of the previous layer of the target fully connected layer based on the gradient information of the previous layer of the target fully connected layer and the gradient information of the data input feature of the target fully connected layer;
[0019] Based on the data input features of the previous layer of the target fully connected layer and the gradient information of the first two layers of the target fully connected layer, the original image data is restored from the fully connected network.
[0020] Optionally, the recovering the original image data from the fully connected network based on the data input feature of the previous layer of the target fully connected layer and the gradient information of the first two layers of the target fully connected layer includes:
[0021] Determine the gradient information of the data input feature of the previous layer of the target fully connected layer;
[0022] Determine the data input feature information of the first fully connected layer based on the gradient information of the data input feature of the previous layer of the target fully connected layer and the gradient information of the first two layers of the target fully connected layer;
[0023] The first fully connected layer data input feature information is used as the original image data.
[0024] Optionally, the method further comprises:
[0025] Determine the loss function and parameter matrix of the target fully connected layer;
[0026] Based on the loss function and the parameter matrix, the target fully connected layer gradient vector is determined.
[0027] In a second aspect, the present application also provides a data recovery device based on federated learning, comprising:
[0028] A first determination module is used to determine a target rational coefficient based on a target fully connected layer gradient vector, an initial rational coefficient and a preset label feature of a federated learning model;
[0029] A second determination module, configured to determine the target fully connected layer data input feature based on the target rational coefficient and the target fully connected layer gradient vector;
[0030] The data recovery module is used to restore the original image data based on the gradient information of the previous layer of the target fully connected layer and the data input features of the target fully connected layer.
[0031] In a third aspect, the present application further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the first aspect when executing the program.
[0032] In a fourth aspect, the present application further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.
[0033] In a fifth aspect, the present application further provides a computer program product, comprising a computer program, which implements the method described in the first aspect when executed by a processor.
[0034] The data recovery method and device based on federated learning provided in the present application determine the data input features through the gradient information of the federated learning model, and then restore the original image data. In the absence of model bias terms, the source data using label smoothing or label mixing technology in the federated learning model can be quickly and accurately restored, thereby reducing computing resource consumption, protecting user privacy, ensuring data security, avoiding unhealthy market competition, and ensuring the economic benefits of the enterprise. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the technical solutions in the present application or the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0036] Figure 1 It is a flowchart of the data recovery method based on federated learning provided by this application;
[0037] Figure 2 It is a structural diagram of a data recovery device based on federated learning provided by the present application;
[0038] Figure 3 It is a structural schematic diagram of the electronic device provided by this application. DETAILED DESCRIPTION
[0039] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in this application. Obviously, the described embodiments are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0040] Figure 1 is a flow chart of a data recovery method based on federated learning provided in an embodiment of the present application. Figure 1 The embodiment of the present application provides a data recovery method based on federated learning, the execution subject of which may be an electronic device, for example, a controller, and the method may include:
[0041] Step 110, determining a target rational coefficient based on a target fully connected layer gradient vector, an initial rational coefficient, and a preset label feature of the federated learning model;
[0042] Step 120: Determine the target fully connected layer data input features based on the target rational coefficients and the target fully connected layer gradient vector;
[0043] Step 130: restore the original image data based on the gradient information of the previous layer of the target fully connected layer and the data input features of the target fully connected layer.
[0044] Gradient reversal attacks aim to reconstruct local private data through stolen gradient information under the framework of federated learning. This application follows the generally recognized setting in this field, in which an honest-but-curious server attempts to reconstruct private training data and labels based on the gradient information uploaded by the user. On the one hand, it fully understands the model structure and parameters (hence it is a white-box attack), and can completely obtain the uploaded gradients from the user. The server will not maliciously and actively change the training protocol, modify the gradient data in order to achieve a more favorable attack effect or affect the performance of the model itself, but can only store and infer the original data from it. This application assumes that this process follows the standard federated learning protocol, uses the FedAvg secure aggregation algorithm to process the user's gradient data, and all users do not actively change the gradient data, whether for malicious attacks to interfere with the overall model training process, or for privacy protection and other motivations.
[0045] In step 110, the last fully connected layer of the federated learning model can be used as the target fully connected layer. The controller can extract the gradient vector of the target fully connected layer, and specifically can select the maximum L1 norm row (column) with the same input feature dimension of the target fully connected layer as the gradient vector. The controller can determine the target rational coefficient based on the target fully connected layer gradient vector of the federated learning model, the initial rational coefficient and the preset label feature. Specifically, the preset label feature is a label feature represented by label mixing or label smoothing.
[0046] In step 120, the controller may multiply the target rational coefficient with the target fully connected layer gradient vector to obtain the target fully connected layer data input feature.
[0047] In step 130, the controller can restore the fully connected layer information layer by layer based on the gradient information of the previous layer of the target fully connected layer and the target fully connected layer data input features, thereby obtaining the original image data.
[0048] The data recovery method based on federated learning provided in the embodiment of the present application determines the data input features through the gradient information of the federated learning model, and then recovers the original image data. In the absence of a model bias term, the source data using label smoothing or label mixing technology in the federated learning model can be quickly and accurately recovered, thereby reducing computing resource consumption, protecting user privacy, ensuring data security, avoiding unhealthy market competition, and ensuring the economic benefits of the enterprise.
[0049] In one embodiment, the data recovery method based on federated learning further includes:
[0050] Determine the loss function and parameter matrix of the target fully connected layer;
[0051] Based on the loss function and parameter matrix, the target fully connected layer gradient vector is determined.
[0052] Consider the unbiased target fully connected layer f: exist:
[0053] z=f(x)=Wx
[0054] Among them, z is the previous value of the normalized layer (logits), f is the target fully connected layer, x is the data input feature, W is the target fully connected layer parameter matrix, I is the dimension of the input feature, and C is the number of classification categories.
[0055] The loss function (cross entropy loss) of the target fully connected layer can be expressed as:
[0056]
[0057] in, is the loss function of the target fully connected layer (cross entropy loss function), z is the value before normalization, y is the label vector, C is the number of classification categories, and y i is the i-th component of the label vector y, p i Outputs the classification probability of the i-th column for the post-normalized exponential function (SoftMax) layer.
[0058] Let φ(·) represent the SoftMax function, then:
[0059]
[0060] Among them, z is the value before normalization, z i is the i-component of the value before normalization, and C is the number of classification categories.
[0061] The controller calculates the gradient of the rth row of the fully connected layer parameter matrix W, and the target fully connected layer gradient vector g is obtained. r :
[0062]
[0063] Further simplifying the above formula, we have:
[0064]
[0065] Among them, g r is the target fully connected layer gradient vector r component, is the loss function of the target fully connected layer (cross entropy loss function), W r is the target fully connected layer parameter matrix r row, C is the number of classification categories, z r is the r component of the value before normalization, y r is the r component of the label vector, x is the data input feature, p r Output the classification probability of the rth row for the normalized exponential function layer.
[0066] The data recovery method based on federated learning provided in the embodiment of the present application determines the gradient vector through the loss function and parameter matrix of the target fully connected layer, provides data preparation for the subsequent determination of data input features based on gradient information, and can quickly and accurately recover the source data using label smoothing or label mixing technology in the federated learning model, thereby reducing the consumption of computing resources.
[0067] In one embodiment, the target rational coefficient is determined based on the target fully connected layer gradient vector, the initial rational coefficient and the preset label feature of the federated learning model, including:
[0068] Determine the pseudo label based on the target fully connected layer gradient vector and the initial rational coefficient;
[0069] Based on the preset label features and pseudo labels, the target rational coefficients are determined.
[0070] because It can be concluded that the gradient vector of the target fully connected layer is just a scalar multiple of the input feature of the target fully connected layer data. If x itself is unknown, then there is no way to find y from the above formula. However, the label vector y can be considered as the gradient For simplicity, this application can select the i-th component of the label vector y to complete the following derivation:
[0071] y i =p i -(p i -y i )
[0072] =φ(f(x * )) i -g i / x *
[0073] =φ(f((p r -y r ) -1 g r )) i -g i (p r -y r ) / g r
[0074] Among them, y i is the i-th component of the label vector y, p i is the classification probability of the i-th column output by the post-normalized exponential function layer, f is the target fully connected layer, x * is the actual target fully connected layer data input feature, g i is the target fully connected layer gradient vector i component, p r The classification probability of the rth row is output by the normalized exponential function layer, y r is the r component of the label vector, g r is the target fully connected layer gradient vector r component.
[0075] If we use λ r g r to replace the real input features, where λ r is a non-zero scalar multiple (initial rational coefficient) of the value to be optimized, then the pseudo-labels can be written as:
[0076]
[0077] when The real input features can be obtained and the true soft label y * . r * is the target rational coefficient. r Values can be used to obtain different label data distributions Based on such mathematical characteristics, this application helps find the accurate landmark value λ by presetting the label features and designing the corresponding objective function of the pseudo-label r (That is, the target rational coefficients are determined through the target function).
[0078] The data recovery method based on federated learning provided in the embodiment of the present application determines the target rational coefficients through the target fully connected layer gradient vector, the initial rational coefficients and the preset label features, and then restores the original image data. It can quickly and accurately restore the source data using label smoothing or label mixing technology in the federated learning model, protect user privacy, and ensure data security.
[0079] In one embodiment, based on the preset label features and the pseudo labels, determining the target rational coefficients includes:
[0080] Determine the objective function based on the preset label features and pseudo labels;
[0081] Applying an optimization algorithm to determine the optimal value of the objective function;
[0082] Take the optimized values as the objective rational coefficients.
[0083] This application uses label smoothing and label mixing techniques as examples of label enhancement for analysis. For smoothed labels with unknown label smoothing coefficients, the simplest and most effective means of supervising label distribution should be to minimize the variance of all components except the largest class. Similarly, for label mixing techniques, the variance of all components except the two largest classes should be supervised. The objective function determined based on preset label features and pseudo labels is as follows:
[0084]
[0085] in, is the loss function of the target fully connected layer, C represents the number of classification categories, is the exclusion set containing the corresponding highest component (one or two), is a pseudo label, For different label data distributions.
[0086] In order to unify the two types of label enhancement methods, this application introduces the concept of exclusion sets. Ideally, if the above-mentioned enhanced labels are perfectly restored, the variance of all components except the exclusion set should reach the global minimum value of 0. For such tasks, there are other functions that can achieve the required effect by utilizing the distribution characteristics of labels, but such variance loss has unexpectedly high accuracy, which is sufficient to meet the requirements of the task, and the principle is clear and the implementation is simple, so it is adopted as the default optimization target.
[0087] Based on the above formula, the label recovery problem can be transformed into finding the global optimal solution in the loss function. Here, we can first consider the commonly used optimizers based on the gradient descent principle, such as Adam, L-BFGS, etc.
[0088] For most untrained networks, the global optimal solution of the function is the first local minimum in the search process (the experiment starts the search from ±1). However, such a gradient descent-based method is susceptible to multiple local optimal solutions and the gradient vanishing phenomenon, especially for trained networks. Trained networks have local optimal solutions, but the local optimum is not the variance zero point. Faced with such functional properties, the first-order search method based on gradient descent will encounter difficulties. At the same time, compared with untrained networks, the variance function values of trained neural networks in the function target search domain are generally smaller, and the gradient values and the function values themselves are maintained at a small level, so the gradient vanishing phenomenon is prone to occur - that is, the absolute value of the gradient is too small, resulting in too small an optimal point update step, slow iteration or even unchanged.
[0089] Normally, the optimized value of the objective function can be determined based on the label recovery algorithm of the gradient descent optimizer. However, although the first-order optimization method based on gradient descent runs faster and has satisfactory accuracy, it cannot fully adapt to all function forms. In this case, the particle swarm optimization (PSO) is a better choice for finding the global optimal solution. It is hardly affected by local optimality and gradient disappearance, but it requires more iterations and computing resources in the implementation process, so it takes a longer running time. In this application, L-BFGS can be used first to find the global optimal solution (optimized value), and if the search fails, the particle swarm algorithm is used. The optimized value of the determined objective function is the target rational coefficient, and the pseudo-label used as the optimization target is the real enhanced soft label after the optimization is completed.
[0090] The label recovery problem helps search for the true scalar multiple λ by creating a variance loss function r. In this process, the label distribution feature is the only means to derive the true multiple, so this condition is a necessary condition for this method. This naturally leads to a question about the proposed new label recovery method: if the unknown label data enhancement characteristics, the unknown label has a variance characteristic, is the label that meets the conditions theoretically the only one that exists? In order to prove that the above requirements for the label distribution feature conditions are not the limitation of the proposed method, but a necessary condition for all analytical label recovery methods, based on the idea of the label recovery algorithm, the following analysis is completed.
[0091] Based on the above formula: It can be concluded that for a given gradient information, the label recovered based on it is essentially a scalar λ r Therefore, if the recovery condition is only the gradient information, plus the basic restriction that the true label has each component value in [0,1], then there will be a λ r In this feasible range, any specific value can correspond to a reasonable label.
[0092] If we only obtain gradient information and expect to restore the image based on it, then any value within a certain range can be used as a reasonable λ r , generating labels where each component is positive and the sum is 1. This is why an additional variance loss is needed to supervise the distribution of label data. Based on this, the label distribution feature is a guide to select λ from the corresponding label cluster. r A necessary condition for selection. At the same time, the method of this application is applicable to all labels. It is first compatible with conventional hard label recovery, and can also be used for other label enhancement methods. Only by understanding the label distribution characteristics and designing an ideal loss function for this type of label enhancement method, any type of enhanced label can be accurately restored.
[0093] The data recovery method based on federated learning provided in the embodiment of the present application determines the optimization value of the objective function through the label recovery algorithm of L-BFGS optimization and particle swarm optimization, determines the target rational coefficient, and obtains the real label value at the same time, thereby restoring the original image data. It is applicable to various types of labels, can quickly and accurately restore the source data in the federated learning model, reduce computing resource consumption, protect user privacy, ensure data security, avoid unhealthy market competition, and ensure the economic benefits of the enterprise.
[0094] In one embodiment, restoring the original image data based on the gradient information of the previous layer of the target fully connected layer and the data input feature of the target fully connected layer includes:
[0095] Determine the gradient information of the input features of the target fully connected layer data;
[0096] Determine the input features of the previous layer of the target fully connected layer based on the gradient information of the previous layer of the target fully connected layer and the gradient information of the input features of the target fully connected layer data;
[0097] Based on the data input features of the previous layer of the target fully connected layer and the gradient information of the first two layers of the target fully connected layer, the original image data is restored from the fully connected network.
[0098] Further, in one embodiment, based on the data input feature of the previous layer of the target fully connected layer and the gradient information of the first two layers of the target fully connected layer, the original image data is restored from the fully connected network, including:
[0099] Determine the gradient information of the data input features of the previous layer of the target fully connected layer;
[0100] Determine the data input feature information of the first fully connected layer based on the gradient information of the data input feature of the previous layer of the target fully connected layer and the gradient information of the first two layers of the target fully connected layer;
[0101] The first fully connected layer data input feature information is used as the original image data.
[0102] The controller applies the label recovery algorithm (optimization algorithm) to recover the features of the last fully connected layer (target fully connected layer) of the network and the true labels, and then calculates the gradient information of the fully connected layer data input features. The input features of the previous layer of the network are restored based on the gradient information of the previous layer of the target fully connected layer and the gradient information of the target fully connected layer data input features. The input features of each layer are restored layer by layer in the same way until the input feature information of the first layer of the fully connected network is restored. This feature information is the original image data.
[0103] Consider an unbiased fully connected layer, which takes as input feature x, has a parameter matrix W, and outputs an unactivated feature z = Wx, with a loss function The number of columns is i and the number of rows is r, then:
[0104]
[0105]
[0106] Among them, we need to choose i so that Non-zero. If the activation function is ReLU, then With the previous layer For other activation functions, the idea is similar. We only need to give Just add a coefficient.
[0107] Therefore, after recovering the gradient of the input features of this layer and the output features of the previous layer, the input features of the previous fully connected layer can be iteratively recovered. This recovery step successfully avoids the calculation of the output features before each layer is activated, especially when the activation function is not strictly monotonic.
[0108] The data recovery method based on federated learning provided in the embodiment of the present application recovers the input features of each layer through the gradient information of the fully connected layer and the gradient information of the input features of the fully connected layer, and then recovers the original image data. It can quickly and accurately recover the source data in the federated learning model, reduce the consumption of computing resources, reduce computing costs, and is easy to deploy and use.
[0109] The data recovery device based on federated learning provided in the present application is described below. The data recovery device based on federated learning described below and the data recovery method based on federated learning described above can refer to each other.
[0110] Figure 2 Schematic diagram of the structure of the data recovery device based on federated learning provided in the embodiment of the present application. Figure 2 The data recovery device based on federated learning provided in the embodiment of the present application may include:
[0111] A first determination module 210, configured to determine a target rational coefficient based on a target fully connected layer gradient vector, an initial rational coefficient and a preset label feature of a federated learning model;
[0112] A second determination module 220, configured to determine the target fully connected layer data input feature based on the target rational coefficient and the target fully connected layer gradient vector;
[0113] The data recovery module 230 is used to restore the original image data based on the gradient information of the previous layer of the target fully connected layer and the data input features of the target fully connected layer.
[0114] The data recovery device based on federated learning provided in the embodiment of the present application determines the data input features through the gradient information of the federated learning model, and then recovers the original image data. In the absence of a model bias term, it can quickly and accurately recover the source data using label smoothing or label mixing technology in the federated learning model, reduce computing resource consumption, protect user privacy, ensure data security, avoid unhealthy market competition, and ensure the economic benefits of the enterprise.
[0115] Specifically, the above-mentioned data recovery device based on federated learning provided in the embodiment of the present application can implement all the method steps implemented by the method embodiment in which the execution subject is the controller, and can achieve the same technical effect. The parts and beneficial effects of this embodiment that are the same as the method embodiment will not be described in detail here.
[0116] Figure 3 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 3 As shown, the electronic device may include: a processor 310, a communication interface 320, a memory 330 and a communication bus 340, wherein the processor 310, the communication interface 320, and the memory 330 communicate with each other through the communication bus 340. The processor 310 may call the logic instructions in the memory 330 to execute the data recovery method based on federated learning, for example, including:
[0117] Determine the target rational coefficient based on the target fully connected layer gradient vector, initial rational coefficient and preset label features of the federated learning model;
[0118] Determining the target fully connected layer data input feature based on the target rational coefficient and the target fully connected layer gradient vector;
[0119] The original image data is restored based on the gradient information of the previous layer of the target fully connected layer and the data input features of the target fully connected layer.
[0120] In addition, the logic instructions in the above-mentioned memory 330 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk.
[0121] On the other hand, the present application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to perform the steps of the data recovery method based on federated learning provided by the above methods, for example, including:
[0122] Determine the target rational coefficient based on the target fully connected layer gradient vector, initial rational coefficient and preset label features of the federated learning model;
[0123] Determining the target fully connected layer data input feature based on the target rational coefficient and the target fully connected layer gradient vector;
[0124] The original image data is restored based on the gradient information of the previous layer of the target fully connected layer and the data input features of the target fully connected layer.
[0125] In another aspect, the present application further provides a computer program product, the computer program product comprising a computer program, the computer program may be stored on a non-transitory computer-readable storage medium, and when the computer program is executed by a processor, the computer can execute the steps of the data recovery method based on federated learning provided by the above methods, for example, including:
[0126] Determine the target rational coefficient based on the target fully connected layer gradient vector, initial rational coefficient and preset label features of the federated learning model;
[0127] Determining the target fully connected layer data input feature based on the target rational coefficient and the target fully connected layer gradient vector;
[0128] The original image data is restored based on the gradient information of the previous layer of the target fully connected layer and the data input features of the target fully connected layer.
[0129] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0130] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0131] It should also be noted that the terms "first", "second", etc. in the embodiments of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first" and "second" are generally of the same type, and the number of objects is not limited. For example, the first object can be one or more.
[0132] In the embodiments of the present application, the term "and / or" describes the association relationship of the associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.
[0133] "Determine B based on A" in the embodiments of the present application means that the factor A should be considered when determining B. It is not limited to "B can be determined based on A alone", but should also include: "Determine B based on A and C", "Determine B based on A, C and E", "Determine C based on A, and further determine B based on C", etc. In addition, it can also include taking A as a condition for determining B, for example, "When A meets the first condition, use the first method to determine B"; for another example, "When A meets the second condition, determine B", etc.; for another example, "When A meets the third condition, determine B based on the first parameter", etc. Of course, it can also be a condition that takes A as a factor for determining B, for example, "When A meets the first condition, use the first method to determine C, and further determine B based on C", etc.
[0134] In the embodiments of the present application, the term "plurality" refers to two or more than two, and other quantifiers are similar.
[0135] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A data recovery method based on federated learning, characterized in that: include: Determine the target rational coefficient based on the target fully connected layer gradient vector, initial rational coefficient and preset label features of the federated learning model; Determining the target fully connected layer data input feature based on the target rational coefficient and the target fully connected layer gradient vector; Restoring the original image data based on the gradient information of the previous layer of the target fully connected layer and the data input features of the target fully connected layer; The target fully connected layer gradient vector, the initial rational coefficient and the preset label feature based on the federated learning model are used to determine the target rational coefficient, including: Determining a pseudo label based on the target fully connected layer gradient vector and the initial rational coefficient; Determining the target rational coefficient based on the preset label feature and the pseudo label; The determining the target rational coefficient based on the preset label feature and the pseudo label includes: Determining an objective function based on the preset label features and the pseudo labels; Applying an optimization algorithm to determine an optimized value of the objective function; Using the optimized value as the target rational coefficient; The method of restoring the original image data based on the gradient information of the previous layer of the target fully connected layer and the data input feature of the target fully connected layer includes: Determining gradient information of the target fully connected layer data input feature; Determine the data input feature of the previous layer of the target fully connected layer based on the gradient information of the previous layer of the target fully connected layer and the gradient information of the data input feature of the target fully connected layer; Based on the data input features of the previous layer of the target fully connected layer and the gradient information of the first two layers of the target fully connected layer, recovering the original image data from the fully connected network; The method of restoring the original image data from the fully connected network based on the data input feature of the previous layer of the target fully connected layer and the gradient information of the first two layers of the target fully connected layer includes: Determine the gradient information of the data input feature of the previous layer of the target fully connected layer; Determine the data input feature information of the first fully connected layer based on the gradient information of the data input feature of the previous layer of the target fully connected layer and the gradient information of the first two layers of the target fully connected layer; The first fully connected layer data input feature information is used as the original image data.
2. The data recovery method based on federated learning according to claim 1, characterized in that: The method further comprises: Determine the loss function and parameter matrix of the target fully connected layer; Based on the loss function and the parameter matrix, the target fully connected layer gradient vector is determined.
3. A data recovery device based on federated learning, characterized in that: include: A first determination module is used to determine a target rational coefficient based on a target fully connected layer gradient vector, an initial rational coefficient and a preset label feature of a federated learning model; A second determination module, configured to determine the target fully connected layer data input feature based on the target rational coefficient and the target fully connected layer gradient vector; A data recovery module, used to recover the original image data based on the gradient information of the previous layer of the target fully connected layer and the data input features of the target fully connected layer; The target fully connected layer gradient vector, the initial rational coefficient and the preset label feature based on the federated learning model are used to determine the target rational coefficient, including: Determining a pseudo label based on the target fully connected layer gradient vector and the initial rational coefficient; Determining the target rational coefficient based on the preset label feature and the pseudo label; The determining the target rational coefficient based on the preset label feature and the pseudo label includes: Determining an objective function based on the preset label features and the pseudo labels; Applying an optimization algorithm to determine an optimized value of the objective function; Using the optimized value as the target rational coefficient; The method of restoring the original image data based on the gradient information of the previous layer of the target fully connected layer and the data input feature of the target fully connected layer includes: Determining gradient information of the target fully connected layer data input feature; Determine the data input feature of the previous layer of the target fully connected layer based on the gradient information of the previous layer of the target fully connected layer and the gradient information of the data input feature of the target fully connected layer; Based on the data input features of the previous layer of the target fully connected layer and the gradient information of the first two layers of the target fully connected layer, recovering the original image data from the fully connected network; The method of restoring the original image data from the fully connected network based on the data input feature of the previous layer of the target fully connected layer and the gradient information of the first two layers of the target fully connected layer includes: Determine the gradient information of the data input feature of the previous layer of the target fully connected layer; Determine the data input feature information of the first fully connected layer based on the gradient information of the data input feature of the previous layer of the target fully connected layer and the gradient information of the first two layers of the target fully connected layer; The first fully connected layer data input feature information is used as the original image data.
4. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the data recovery method based on federated learning as described in claim 1 or 2 is implemented.
5. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the data recovery method based on federated learning as described in claim 1 or 2 is implemented.
6. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the data recovery method based on federated learning as described in claim 1 or 2 is implemented.
Citation Information
Patent Citations
Generation-based method for measuring federal learning protocol data security
CN115438753A
Batch label recovery method and device oriented to federated learning privacy disclosure attack
CN115758445A