Image highlight removal method based on federated learning and attention generative adversarial network
Through federated learning and attention generation adversarial network, the problems of image highlight removal and data privacy protection are solved, efficient highlight removal and image detail retention are achieved, and the generalization ability and accuracy of the model are improved.
Patent Information
- Application Number
- CN202410740465.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-08
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2044-06-08
AI Technical Summary
The existing technology has insufficient representation capabilities and data privacy protection problems in image highlight removal, especially in computer vision tasks that require high-quality input. Moreover, due to the data island phenomenon, the trained model lacks generalization ability and has low accuracy.
Using a method based on federated learning and attention generative adversarial network, a global attention generative adversarial network model is defined through the central server, and training and parameter aggregation are performed on the client, and the attention mechanism is used to enhance the model's feature extraction and removal of highlight areas. Ability to ensure data privacy and security.
It effectively removes highlights, enhances the representation ability of the model, retains image details, reduces the risk of data leakage through the federated learning framework, and improves the generalization ability and accuracy of the model.
Smart Images

Figure CN118657688A
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of image processing technology, and in particular relates to an image highlight removal method based on federated learning and attention generative adversarial network. Background Art
[0002] In an era of unprecedented data growth, the demand for image data in various fields has surged, especially in sensitive areas such as digital forensics, medical diagnosis, and surveillance. However, the acquisition of high-quality images has been challenged by the complexity of the real world, such as highlight illumination, which can significantly degrade the quality of highlight areas. This degradation has an adverse impact on the performance of computer vision tasks that require high-quality input, such as stereo matching, text recognition, and image segmentation. Therefore, it is crucial to develop models that can effectively remove highlights. In addition, since image data often contains personal information (such as ID cards), data privacy protection is particularly important. Restricted by laws and regulations, trade secrets, personal privacy and other factors, customers can only use local data to train highlight removal models, resulting in the "data island" phenomenon. Models trained in this way not only lack generalization capabilities, but also have low accuracy due to the limitation of the amount of training data.
[0003] As a distributed machine learning framework, federated learning can effectively help multiple clients train models while meeting privacy protection, data security, and government regulatory requirements. It is widely used in healthcare, the Internet of Things, smart transportation, and other fields. Specifically, federated learning builds a global model on a central server and starts a local training process on the client. After training, the client sends the updated local parameters to the central server for aggregation. Finally, a global model with generalization capabilities is obtained. In this process, there is no need to upload local data to the server, which ensures privacy and security and avoids the risk of sensitive data being attacked. In addition, through the cooperation of clients, the efficiency of data utilization is greatly improved.
[0004] In addition to privacy issues, the accuracy of the highlight removal model on each client also needs to be improved. In recent years, deep learning methods have been well developed in highlight removal, but they encounter the following challenges: (1) Existing methods have insufficient representation capabilities. For example, generative adversarial networks cannot completely remove highlights, resulting in the loss of key information of the original image; (2) Sensitive information such as proprietary or personal images will be exposed during the collection process.
[0005] Therefore, in view of the above situation, there is an urgent need to develop an image highlight removal method based on federated learning and attention-generated adversarial networks to overcome the shortcomings in current practical applications. Summary of the invention
[0006] The present invention proposes an image highlight removal method based on federated learning and attention-generated adversarial network, which is specifically implemented by the following technical means:
[0007] The image highlight removal method based on federated learning and attention-generated adversarial network includes the following steps:
[0008] Step 1: The central server defines a global attention generative adversarial network model, which includes a highlight detection network H, a highlight removal network R, and a discriminator G, and broadcasts the initial global network parameters w to the client. 0,h ,w 0,r and w 0,g ;
[0009] Step 2: The central server starts the client scheduling process and sends the global model parameters and communication round t to the client;
[0010] Step 3: The client builds an attention-generating adversarial network environment and uses the adversarial network model to remove highlights from the image.
[0011] Step 4: Update the model parameters through stochastic gradient descent and pass the updated parameters to the central server;
[0012] Step 5: The central server starts the parameter aggregation process and updates the global parameters.
[0013] Furthermore, in step 1, the central server defines the global attention generative adversarial network model and initializes the model parameters, including:
[0014] The central server defines the highlight detection network H, highlight removal network R and discriminator G of the attention adversarial generation network, and initializes the network parameters of the closed-loop learning to w 0,h ,w 0,r and w 0,g , establish a client scheduling process for subsequent model training;
[0015] The highlight detection network H adopts a fully convolutional structure, which includes three downsampling layers and three upsampling layers, three convolutional layers are arranged after each upsampling layer, and two convolutional layers are arranged after each downsampling layer;
[0016] The highlight removal network R adopts an encoder-decoder structure as a backbone network, and there is a jump connection between the encoder and the decoder;
[0017] The encoder is responsible for capturing the information of the image, gradually reducing the spatial dimension through a series of convolutional layers and pooling layers to increase the feature depth, and adding an attention mechanism to the feature extraction stage of the encoder to focus on the highlight area; the decoder increases the dimension of the input image features and gradually constructs a highlight-free image;
[0018] The discriminator G is used to identify the local area of the image and distinguish the difference between the generated highlight-free image and the real highlight-free image. Each downsampling layer of the discriminator G includes a convolution module, a batch normalization module and an activation function.
[0019] Furthermore, in step 2, the operation of the client scheduling process includes:
[0020] In each round of communication, the central server sends the current global model parameters and communication round information to the client, and the client c∈{1,2,...,C} receives the server global model parameters and communication round (w t,h =w 0,h ,w t,r =w 0,r ,w t,g =w 0,g ,t=1), update the local model parameters w τ,h c ,w τ,r c ,w τ,g c And participate in the communication round τ:
[0021] w τ,h c ←w t,h
[0022] w τ,r c ←w t,r
[0023] w τ,g c ←w t,g
[0024] τ←t
[0025] The client uses the model parameters to train the local closed-loop cross-modal generation model.
[0026] Furthermore, in step 3, the client's operation of removing image highlights includes:
[0027] The local data set of customer c is D c express;
[0028] The complete data set containing all surface material data consists of the data for each customer c, using express;
[0029] The client collects N pairs of images, including the specular highlight image S = {S 1 ,...,S N}, the corresponding non-highlight image I = {I 1 ,...,I N}, and a binary mask image M indicating the highlight position = {M 1 ,...,M N};
[0030] First, the client uses the highlight detection network H to detect the image S n Perform specular highlight processing and generate a mask to identify the highlight area in Collected the parameters of the highlight detection network on client c;
[0031] Second, the client generates the mask As input, the highlight removal network R is used to remove specular highlights, restore the text content, and generate the corresponding highlight-free image. in Collect the parameters of the highlight removal network on client c;
[0032] Among them, the feature map output at the encoder layer l is input into the attention mechanism to mine the correlation between visual features; the attention mechanism uses three parameter matrices: W Q ,W K and W V ;
[0033] First, these parameter matrices will be entered into Linearly transform into corresponding attention feature matrices, named QX, KX and VX respectively;
[0034]
[0035]
[0036]
[0037] Secondly, the attention weight matrix A is calculated by the Softmax function to obtain the feature map The distribution of attention;
[0038] Where d is the scaling factor that reduces the variance;
[0039] Apply the attention weight matrix A to the attention feature matrix VX and substitute it into the activation function to obtain:
[0040] Aout =act(A×VX), where act is the activation function;
[0041] Will output A out It will be used as the input of the next convolutional layer feature extraction to enhance the feature extraction effect;
[0042] Finally, the client uses the discriminator G to evaluate the generated highlight-free image and the true non-highlight image I n The difference between.
[0043] Further, in step 4, the operation of updating parameters by the client through stochastic gradient descent includes: In order to optimize the performance of the highlight detection network, the highlight removal network and the discriminator, the following loss function is established as a constraint;
[0044] 1) Detection loss function, used to evaluate the generated mask With the real mask M n The error between:
[0045]
[0046] 2) Reconstruct the loss function, including:
[0047] Pixel-aware loss function
[0048]
[0049] Feature-aware loss function
[0050]
[0051] where i and j represent the size of the image, φ is the feature map of the pre-trained VGG, and is the Gram matrix;
[0052] 3) Define GAN loss using hinge loss:
[0053] The adversarial loss of the highlight removal network R is
[0054] The loss for training the discriminator G is
[0055] 4) Apply the pre-trained text detection and recognition model CTPN to supervise text recovery;
[0056]
[0057] Among them, μ f and μ k They are the f-th layer feature map of CTPN and the k-th layer feature map of DenseNet respectively;
[0058] Based on the above loss function, the parameters w of the three networks are updated using the stochastic gradient descent method SGD 0,h ,w 0,r and w 0,g ;
[0059]
[0060]
[0061]
[0062] Among them, α, β, and γ are the learning rates of the highlight detection network H, the highlight removal network R, and the discriminator G respectively; thus, a stochastic gradient descent update of the generative adversarial network is completed.
[0063] Furthermore, in step 5, the central server performs the following operations to update the global parameters:
[0064] The central server aggregates the local parameters of rounds t∈{1,2,...,T} using the federated averaging algorithm:
[0065]
[0066]
[0067]
[0068] After T rounds of communication, a global attention adversarial generative network model capable of generating highlight-free images was obtained.
[0069] The beneficial effects of the present invention are as follows: the present invention adopts a federated learning framework to define a global removal network on a central server, as well as to train a local model on each client, and transmit the updated model parameters to the central server for aggregation, rather than transmitting the original data itself. The use of federated learning greatly reduces the risk of data leakage and ensures that sensitive information remains on the client's device. For each client, we integrate an attention mechanism into a framework based on a generative adversarial network, enabling the model to focus on the detailed features of the highlighted area and its surroundings, thereby enhancing the model's representation capabilities. This effectively removes highlights while retaining image details. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] Figure 1 A flowchart of an image highlight removal method based on federated learning and attention-generated adversarial networks provided in an embodiment of the present invention.
[0071] Figure 2A parameter transfer flow chart of an image highlight removal method based on federated learning and attention-generated adversarial networks provided in an embodiment of the present invention.
[0072] Figure 3 A comparison of the highlight removal performance of the federated attention generative adversarial network in the present invention and other methods in two datasets.
[0073] Figure 4 A comparison chart of text recognition performance of different methods. DETAILED DESCRIPTION
[0074] The present application scheme is further described as follows in conjunction with the accompanying drawings:
[0075] See attached Figure 1 and 2 , an image highlight removal method based on federated learning and attention-generated adversarial network, including:
[0076] Step 1: The central server defines a global attention generative adversarial network model with a highlight detection network H, a highlight removal network R, and a discriminator G, and broadcasts the initial global network parameters w to the client. 0,h ,w 0,r and w 0,g ; Among them, the operations of generating the adversarial network model and initializing the model parameters include:
[0077] The central server defines the highlight detection network H, highlight removal network R and discriminator G of the attention adversarial generation network;
[0078] The highlight detection network H adopts a fully convolutional structure, including three downsampling layers and three upsampling layers. Three convolutional layers are arranged after each upsampling layer, and two convolutional layers are arranged after each downsampling layer.
[0079] The highlight removal network R uses an encoder-decoder structure as the main backbone network, where there is a jump connection between the encoder and the decoder. We added an attention mechanism in the feature extraction stage of the encoder to help the model focus on the highlight area, which is particularly important for maintaining the accuracy and authenticity of the generated image. The encoder is responsible for capturing the information of the image, gradually reducing the spatial dimension and increasing the feature depth through a series of convolutional layers and pooling layers. The decoder increases the dimension of the input image features and gradually constructs a highlight-free image.
[0080] The discriminator G focuses on identifying local areas of the image rather than the entire image. This approach enables the discriminator to more accurately distinguish the difference between the generated highlight-free images and the real highlight-free images, and enhances the model's sensitivity to details. According to the standard convolutional neural network, each downsampling layer of the discriminator G consists of a convolution module, batch normalization, and an activation function. The downsampling layer reduces the spatial dimension of the image through convolution operations, which helps the model capture more abstract and high-level features. The batch normalization layer standardizes the activation values of the input layer to speed up training, improve model stability, and alleviate the covariate shift problem. We use LeakyReLU as the activation function. Unlike the standard ReLU activation function, LeakyReLU allows the gradient to be non-zero when the input is negative, which can promote the activation of neurons;
[0081]
[0082] The network parameters for the closed-loop learning initialized by the central server are w 0,h ,w 0,r and w 0,g , establish a client scheduling process for subsequent model training.
[0083] Step 2: The central server starts the client scheduling process and sends the global model parameters and communication round t to the client. The operations include:
[0084] In each round of communication, the central server sends the current global model parameters and communication round information to the client. The client c∈{1,2,...,C} receives the server global model parameters and communication round (w t,h =w 0,h ,w t,r =w 0,r ,w t,g =w 0,g , t=1), update the local model parameters w τ,h c ,w τ,r c ,w τ,g c And participate in the communication round τ:
[0085] w τ,h c ←w t,h
[0086] w τ,r c ←w t,r
[0087] w τ,g c ←w t,g
[0088] τ←t;
[0089] The client uses the model parameters to train the local closed-loop cross-modal generation model.
[0090] Step 3: The client builds an attention-generating adversarial network environment and uses the model to remove highlights from the image. The operations include:
[0091] We use D c represents the local dataset of customer c; the complete dataset containing all surface material data consists of the data of each customer c and can be used express.
[0092] Assume that the client collects N pairs of images, including the specular highlight image S = {S 1 ,...,S N}, the corresponding highlight-free image I = {I 1 ,...,I N}, and a binary mask image M indicating the highlight position = {M 1 ,...,M N}.
[0093] First, the client uses the highlight detection network H to detect the image S n Perform specular highlight processing and generate a mask to identify the highlight area in The parameters of the highlight detection network on client c are collected.
[0094] The client then generates the mask As input, the highlight removal network R is used to remove specular highlights, restore the text content, and generate the corresponding highlight-free image. in Collect the parameters of the highlight removal network on client c. Specifically, in the encoder, the feature map output by layer l is is input into the attention mechanism to mine the correlation between visual features. The attention mechanism mainly uses three learnable parameter matrices: W Q ,W K and W V .
[0095] First, these matrices will be entered into Linearly transformed into the corresponding attention feature matrices, named QX, KX and VX respectively.
[0096]
[0097]
[0098]
[0099] Then, the attention weight matrix A is calculated by the Softmax function to obtain the feature map Attention distribution:
[0100]
[0101] Where d is a scaling factor that reduces variance. The relative importance of a particular feature determines its weight in the computation of the feature representation. More important features are assigned higher weights, and these features play a decisive role in the formation of the final feature representation. Since these weights are calculated based on a comprehensive analysis of the entire input feature set, the result of applying the attention weight matrix A to the attention feature matrix VX is an integrated feature representation. The result contains information not only from a single feature, but also from other features, ensuring that a wide range of contextual dependencies are captured at a more macro level.
[0102] A out =act(A×VX);
[0103] Among them, act is the activation function, output A out It will be used as the input of the next convolutional layer feature extraction to enhance the feature extraction effect;
[0104] Finally, the client uses the discriminator G to evaluate the generated highlight-free image and the true non-highlight image I n The difference between.
[0105] Step 4: Update the model parameters through stochastic gradient descent and pass the updated parameters to the central server. The operations include:
[0106] In order to optimize the performance of the highlight detection network, highlight removal network, and discriminator, the following loss function is established as a constraint:
[0107] 1) Detection loss function, used to evaluate the generated mask With the real mask M n The error between:
[0108]
[0109] 2) Reconstruct the loss function, including:
[0110] Pixel-aware loss
[0111]
[0112] and feature-aware loss
[0113]
[0114] where i and j represent the size of the image, φ is the feature map of the pre-trained VGG, and is the Gram matrix.
[0115] 3) We use hinge loss to define GAN loss. To do this,
[0116] The adversarial loss of the highlight removal network R is
[0117] The loss for training the discriminator G is
[0118] 4) In this work, we focus more on restoring text occluded by highlights. To this end, we apply the pre-trained text detection and recognition model CTPN to supervise text restoration:
[0119]
[0120] where μ f and μ k They are the f-th layer feature map of CTPN and the k-th layer feature map of DenseNet respectively.
[0121] Using these loss functions, the parameters w of the three networks are updated using stochastic gradient descent (SGD) 0,h ,w 0,r and w 0,g ;
[0122]
[0123]
[0124]
[0125] Among them, α, β, and γ are the learning rates of the highlight detection network H, the highlight removal network R, and the discriminator G. So far, a stochastic gradient descent update of the generative adversarial network has been completed.
[0126] Step 5: The central server starts the parameter aggregation process and updates the global parameters. The operations include:
[0127] The central server aggregates the local parameters of rounds t∈{1,2,...,T} using the federated averaging algorithm:
[0128]
[0129]
[0130]
[0131] After T rounds of communication, a global attention adversarial generative network model capable of generating highlight-free images was obtained.
[0132] The applicability of the image highlight removal method based on federated learning and attention-generated adversarial network proposed in the present invention to image highlight removal is analyzed through simulation experiment data. The Tensorflow framework is used in the simulation experiment. The specific contents are as follows:
[0133] The simulation adopts multi-threading to simulate the real environment, creating parameter aggregation threads and C client scheduling threads. The client scheduling thread is in a suspended state.
[0134] Use the Tensorflow framework to build the server configuration: the network architecture is divided into three main sub-networks - highlight detection network H, highlight removal network R and discriminator G.
[0135] The highlight detection network H adopts a fully convolutional architecture, and each layer has three layers of downsampling and upsampling. Each downsampling layer is followed by two convolutional layers, and each upsampling layer is followed by three convolutional layers.
[0136] The highlight removal network R is configured as an encoder-decoder network with skip connections, including two downsampling layers, an attention module for focusing on salient features, four residual modules for enhancing feature propagation without loss, and two upsampling layers for reconstructing the output.
[0137] The discriminator G consists of one convolutional layer, 5 downsampling layers, a kernel size of 5, and a stride of 2. Spectral normalization is applied throughout to stabilize the training process.
[0138] Start the client scheduling thread:
[0139] Get the initial model parameters and communication rounds (w t,h =w 0,h ,w t,r =w 0,r ,w t,g =w 0,g ,t=1), assigned to the closed-loop learning network, and taking the image with highlights as input, the client local parameter w is updated using stochastic gradient descent τ,h c ,w τ,r c ,w τ,g c , and sent to the central server.
[0140] The central server starts the parameter aggregation thread and performs parameter aggregation according to the federated average aggregation algorithm to complete the tactile data training task under multi-user collaboration.
[0141] The simulation data uses the SD1 and SD2 databases to evaluate the image highlight removal method based on federated learning and attention-generated adversarial networks. The SD1 dataset includes 3679 original images containing supermarket and street texts, while the SD2 dataset includes 2025 original identity and driver's license images containing a large amount of text information, which requires enhanced privacy protection. Using the Cycles rendering engine of the 3D computer graphics software Blender, 27,700 sets of images are automatically generated, each with specular highlights, as well as corresponding non-specular images and specular masks. The highlight shapes include circles, triangles, ellipses, and rings, and the lighting intensity is randomly set in the range of [40, 70] to simulate real-world lighting conditions.
[0142] The CTPN text detection model identifies text regions where specular highlights are specifically applied to emphasize text regions in images. The SD1 dataset randomly divides samples into training, validation, and test sets in a ratio of 8:1:1. The SD2 dataset follows the same partitioning strategy. In addition, in order to simulate multi-user highlight removal model training tasks through federated learning, we distribute the training samples across 10 devices. Each device is assigned a different number of highlight images.
[0143] The hyperparameters used in the simulation are: communication round T = 10000, local epoch E = 3, learning rate α = 0.0001, batch size b = 4. After 10000 communications, save the trained network. Use the trained network to classify the test set and obtain the classification accuracy of the test set, which is the result in the figure.
[0144] exist Figure 3 In this paper, we use several images from the SD1 and SD2 datasets as examples to visually compare the highlight removal effects of the federated attention generative adversarial network method with two competitors. In addition to visually comparing the effects of highlight removal of three different methods, we also compare the text recognition performance of images processed by these methods, such as Figure 4 shown.
[0145] The analysis of the experimental results shows that the method proposed in the present invention has excellent highlight removal generation capability. Figure 3 It can be observed that, in contrast, the images processed by the federated attention generative adversarial network can not only effectively remove highlights, but also avoid introducing new shadows that may hinder text recognition. This advantage is due to the attention mechanism inside the network, which can effectively identify and focus on areas with high brightness in the image. The training of the generative adversarial network enhances the ability to detect and remove salient areas, thereby improving the overall image clarity of the optical character recognition task. Figure 4It can be clearly seen that the text recognition performance of the unprocessed highlight image is low, the part blocked by the highlight cannot be recognized normally, and only 14 text information is detected. The image processed by other methods achieves limited highlight removal and detects 15 text data. At the same time, the federated attention generative adversarial network uses its attention mechanism to focus on the highlight area and successfully detects 16 text data in full.
[0146] The above-mentioned preferred implementation modes should be regarded as illustrative examples of the implementation modes of the present application scheme. Any technical deductions, replacements, improvements, etc. that are identical or similar to the present application scheme or made based on this scheme should be regarded as within the scope of protection of this patent.
Claims
1. A method for removing image highlights based on federated learning and attention-generated adversarial networks, characterized in that: The following steps are involved: Step 1: The central server defines a global attention generative adversarial network model, which includes a highlight detection network H, a highlight removal network R, and a discriminator G, and broadcasts the initial global network parameters w to the client. 0,h ,w 0,r and w 0,g ; Step 2: The central server starts the client scheduling process and sends the global model parameters and communication round t to the client; Step 3: The client builds an attention-generating adversarial network environment and uses the adversarial network model to remove highlights from the image. Step 4: Update the model parameters through stochastic gradient descent and pass the updated parameters to the central server; Step 5: The central server starts the parameter aggregation process and updates the global parameters.
2. The image highlight removal method based on federated learning and attention-generated adversarial network according to claim 1 is characterized in that: In step 1, the central server defines the global attention generative adversarial network model and initializes the model parameters, including: The central server defines the highlight detection network H, highlight removal network R and discriminator G of the attention adversarial generation network, and initializes the network parameters of the closed-loop learning to w 0,h ,w 0,r and w 0,g , establish a client scheduling process for subsequent model training; The highlight detection network H adopts a fully convolutional structure, which includes three downsampling layers and three upsampling layers, three convolutional layers are arranged after each upsampling layer, and two convolutional layers are arranged after each downsampling layer; The highlight removal network R adopts an encoder-decoder structure as a backbone network, and there is a jump connection between the encoder and the decoder; The encoder is responsible for capturing image information, gradually reducing the spatial dimension through a series of convolutional layers and pooling layers to increase feature depth, and adding an attention mechanism to focus on highlight areas during the feature extraction stage of the encoder; the decoder increases the dimension of input image features and gradually constructs a highlight-free image; The discriminator G is used to identify the local area of the image and distinguish the difference between the generated highlight-free image and the real highlight-free image. Each downsampling layer of the discriminator G includes a convolution module, a batch normalization module and an activation function.
3. The image highlight removal method based on federated learning and attention-generated adversarial network according to claim 2 is characterized in that: The activation function adopts the LeakyReLU function.
4. The image highlight removal method based on federated learning and attention-generated adversarial network according to claim 1 is characterized in that: In step 2, the client scheduling process includes: In each round of communication, the central server sends the current global model parameters and communication round information to the client, and the client c∈{1,2,...,C} receives the server global model parameters and communication round (w t,h =w 0,h ,w t,r =w 0,r ,w t,g =w 0,g , t=1), update the local model parameters w τ,h c ,w τ,r c ,w τ,g c And participate in the communication round τ: In τ,h c ←in t,h In τ,r c ←in t,r In τ,g c ←in t,g τ←t; The client uses the model parameters to train the local closed-loop cross-modal generation model.
5. The method for removing image highlights based on federated learning and attention-generated adversarial network according to claim 1, characterized in that: In step 3, the client's operations to remove image highlights include: The local data set of customer c is D c express; The complete data set containing all surface material data consists of the data for each customer c, using express; The client collects N pairs of images, including the specular highlight image S = {S 1 ,...,S N }, the corresponding highlight-free image I = {I 1 ,...,I N }, and a binary mask image M indicating the highlight position = {M 1 ,...,M N }; First, the client uses the highlight detection network H to detect the image S n Perform specular highlight processing and generate a mask to identify the highlight area in Collected the parameters of the highlight detection network on client c; Second, the client generates the mask As input, the highlight removal network R is used to remove specular highlights, restore the text content, and generate the corresponding highlight-free image. in Collect the parameters of the highlight removal network on client c; Among them, the feature map output at the encoder layer l is input into the attention mechanism to mine the correlation between visual features; the attention mechanism uses three parameter matrices: W Q ,W K and W V ; First, these parameter matrices will be entered into Linearly transform into corresponding attention feature matrices, named QX, KX and VX respectively; Secondly, the attention weight matrix A is calculated by the Softmax function to obtain the feature map The distribution of attention; Where d is the scaling factor that reduces the variance; Apply the attention weight matrix A to the attention feature matrix VX and substitute it into the activation function to obtain: A out =act(A×VX), where act is the activation function; Will output A out It will be used as the input of the next convolutional layer feature extraction to enhance the feature extraction effect; Finally, the client uses the discriminator G to evaluate the generated highlight-free image and the true non-highlight image I n The difference between.
6. The method for removing image highlights based on federated learning and attention-generated adversarial networks according to claim 1, characterized in that: In step 4, the client updates the parameters through stochastic gradient descent, including: In order to optimize the performance of the highlight detection network, highlight removal network, and discriminator, the following loss function is established as a constraint; 1) Detection loss function, used to evaluate the generated mask With the real mask M n The error between: 2) Reconstruct the loss function, including: Pixel-aware loss function Feature-aware loss function where i and j represent the size of the image, φ is the feature map of the pre-trained VGG, and is the Gram matrix; 3) Define GAN loss using hinge loss: The adversarial loss of the highlight removal network R is The loss for training the discriminator G is 4) Apply the pre-trained text detection and recognition model CTPN to supervise text recovery; Among them, μ f and μ k They are the f-th layer feature map of CTPN and the k-th layer feature map of DenseNet respectively; Based on the above loss function, the parameters w of the three networks are updated using the stochastic gradient descent method SGD 0,h ,w 0,r and w 0,g ; Among them, α, β, and γ are the learning rates of the highlight detection network H, the highlight removal network R, and the discriminator G respectively; thus, a stochastic gradient descent update of the generative adversarial network is completed.
7. The method for removing image highlights based on federated learning and attention-generated adversarial networks according to claim 1, characterized in that: In step 5, the central server performs the following operations to update global parameters: The central server aggregates the local parameters of rounds t∈{1,2,...,T} using the federated averaging algorithm: After T rounds of communication, a global attention adversarial generative network model capable of generating highlight-free images was obtained.
Citation Information
Patent Citations
Image mirror surface highlight removal method based on weak supervised learning
CN115170427A
Federal learning data reconstruction method based on generative adversarial neural network
CN117274071A
Dynamic federal learning method for privacy protection of mobile recommendation system
CN117592554A
