A face mask removal method based on generative adversarial network

By building a two-channel parallel generative adversarial network model, combined with face attribute vectors, the problem of recognition failure caused by wearing a mask is solved, high-precision mask removal and face generation are achieved, and the structure and texture quality of the image are improved. Practicality that meets social needs.

CN113222808BActive Publication Date: 2024-10-18SOUTHEAST UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110541759.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-18
Publication Date
2024-10-18
Estimated Expiration
2041-05-18

AI Technical Summary

Technical Problem

Wearing a mask causes facial recognition to fail, and computer vision methods for removing masks are inconvenient and lack high-precision solutions.

Method used

Using a method based on generative adversarial networks, we build two parallel generative adversarial network models, use generators and discriminators for adversarial training, and combine face attribute vectors to remove masks and generate real face images.

Benefits of technology

It improves the structural rationality and texture accuracy of face images, achieves high-fidelity mask removal effects, and solves the practical needs of hot social issues.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113222808B_ABST
    Figure CN113222808B_ABST
Patent Text Reader

Abstract

The invention discloses a face mask removal method based on a generative adversarial network. Firstly, two parallel generative adversarial networks are built, including a generation path and a reconstruction path, and face attributes are introduced as a priori input to guide the generation and reconstruction process of the network; a large open source face data set is preprocessed to locate the face to obtain coordinates, and then a mask is generated to simulate the effect of occlusion, so as to obtain a face data set wearing a mask; a face wearing a mask, a corresponding mask occlusion and some real attribute descriptions of the face are taken as input and put into a generative adversarial network for training, and adversarial learning is performed with the corresponding real and unoccluded face to obtain the weight and bias of the network; a face image wearing a mask and a priori input of the face attributes are input into the network to obtain a result, and the matching degree between the generated face and the real face can be improved on the basis of removing the mask and generating the face.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer vision, relates to face image repair and face image generation, and relates to a face mask removal method based on a generative adversarial network. Background Art

[0002] In recent years, artificial intelligence technology has been developing continuously. With the improvement of GPU computing power and the rise of big data, the effect of deep learning technology is getting better and better, and its application is becoming more and more extensive. At the same time, various deep learning models have emerged in the field of deep learning. Among them, generative adversarial network, as a method of unsupervised learning, is hailed as "the coolest idea in machine learning in the past 20 years". Generative adversarial network (GAN) was proposed by Ian Goodfellow et al. in 2014. It learns by letting two neural networks compete with each other. GAN mainly consists of two parts: generator (G) and discriminator (D). The G network randomly samples from the latent space as input, and the output results need to imitate the real samples of the training set as much as possible; the D network randomly samples from the real samples or the output of the G network as input, with the purpose of distinguishing the output of the G network from the real samples as much as possible. Through continuous confrontation and self-adjustment, the G network and the D network finally achieve the effect of the output of the G network being indistinguishable from the real one. Based on this feature, GAN has a wide range of applications, including generating image datasets, generating faces, style transfer, image editing, photo restoration, etc.

[0003] Wearing a mask is an effective way to prevent the spread of the virus, but it also brings many inconveniences to life, such as the failure of face recognition. On the one hand, masks are needed to achieve social isolation between people; on the other hand, the inconvenience of wearing masks needs to be overcome. Whether it is possible to use a computer vision method to remove the mask from the image, "guess" the face, and achieve an accurate prediction effect, such demand is increasing day by day. Summary of the invention

[0004] To solve the above problems, the present invention aims to provide a face mask removal method based on a generative adversarial network.

[0005] The technical solution adopted by the present invention is as follows: a method for removing a face mask based on a generative adversarial network, the method comprising the following steps:

[0006] (1) Build a two-way parallel generative adversarial network model;

[0007] (2) Preprocessing the face data set to obtain a face mask data set;

[0008] (3) Setting the neural network structure parameters and training parameters and initializing them;

[0009] (4) Taking the face image, mask image and face attributes as the input of the network;

[0010] (5) Train the network to obtain network weights and bias parameters, and obtain a network model;

[0011] (6) The masked face and the real face attributes are input into the network to obtain the result of removing the mask and generating the face.

[0012] Wherein, in step (1), the structure of building a two-way parallel generative adversarial network model is as follows:

[0013] (1.1) Generation path: The input is a face image wearing a mask, which is used to remove the mask and generate a face. The network includes five layers of encoders, five layers of decoders, and five layers of discriminators. A bypass is set between the third layer encoder and the third layer decoder, and a bypass is set between the fifth layer encoder and the first layer decoder; the third layer decoder contains a long-short attention model; the third layer of the discriminator contains a long-short attention model.

[0014] (1.2) Reconstruction path: The input is a real image containing only the area blocked by the mask, which is used to extract features and reconstruct the face. The network includes five layers of encoders, five layers of decoders, and five layers of discriminators. A bypass is set between the first layer of decoder and the first layer of decoder in (1.1), and a bypass is set between the third layer of decoder and the third layer of decoder in (1.1); the third layer of decoder contains a long-short attention model; the third layer of the discriminator contains a long-short attention model.

[0015] (1.3) Face attributes: Input a 1*7 vector containing only -1 and 1 to guide the network generation and reconstruction. The 7 dimensions represent 7 face attributes, which are big nose, fat cheeks, makeup, male, open mouth, no beard, and young. -1 represents no relevant attribute, and 1 represents relevant attribute. The face attribute vector is feature extracted, and feature superposition and feature estimation are performed with (1.1) generation path and (1.2) reconstruction path, and then fed back to the feature extraction part of (1.1) generation path and (1.2) reconstruction path.

[0016] (1.4) Among them, (1.1) the generation path and (1.2) the reconstruction path share parameters, (1.1) the generation path is used in both the network training phase and the network testing phase, and (1.2) the reconstruction path is only used in the network training phase.

[0017] The present invention is further improved in that: in step (2), the face data set is preprocessed as follows:

[0018] (2.1) Use a pose estimation neural network to perform pose estimation on a face dataset (CelebA) and remove images where faces cannot be detected;

[0019] (2.2) Perform face detection on the filtered images in (2.1) to obtain the face coordinates of each image;

[0020] (2.3) Connect and fill the coordinates in (2.2) to obtain a grayscale image similar to a mask, which is the mask dataset;

[0021] (2.4) Superimpose the mask dataset in (2.3) and the image in (2.1) one-to-one to obtain a dataset of faces wearing masks, which is used as the training set and test set of the network.

[0022] The present invention is further improved in that: in step (3), the two-way parallel generative adversarial network structure parameter setting and training parameter initialization are as follows:

[0023] (3.1) The input image size of the network is 256*256*3, the face mask image format is RGB, and the mask image format is grayscale image;

[0024] (3.2) The batch size of training is set to 8, and the initial learning rate is 1×e^(-4);

[0025] (3.3) The coefficient of the appearance matching loss is set to 20, the coefficient of the KL divergence loss is set to 20, the coefficient of the discriminator adversarial loss is set to 1, and the coefficient of the attribute discrimination loss is set to 1.

[0026] The present invention is further improved in that: in step (4), the input format and requirements are as follows:

[0027] (4.1) The input image size is 256*256*3, the input face image with mask is in RGB format, the input mask image is in grayscale format, and the input face attribute is a 1*7 vector containing only -1 and 1;

[0028] (4.2) The training set consists of 180,000 images and the test set consists of 2112 images; there must be a one-to-one correspondence between the input images and between the images and facial attributes.

[0029] The present invention is further improved in that: in step (5), the network training process is as follows:

[0030] (5.1) Build the network according to the preset structure and initialize the network weights and loss function coefficients;

[0031] (5.2) The face wearing a mask, the mask image and the face attribute vector are used as the input of the neural network;

[0032] (5.3) The loss function consists of appearance matching loss, KL divergence loss, discriminator adversarial loss and attribute discrimination loss, and different weight values ​​are used for different parts;

[0033] Among them, the appearance matching loss refers to the structure and texture error between the generated image and the real image;

[0034] Among them, KL divergence loss refers to the probability distribution error between the generated image and the real image, that is, the similarity error between the two images;

[0035] Among them, the discriminator adversarial loss refers to the discrimination error between the generated image and the real image of the generative adversarial network;

[0036] Among them, the attribute discrimination loss refers to the face attribute discrimination error between the generated image and the real image.

[0037] (5.4) Through training and cross-validation, the network parameters are continuously trained and updated to obtain the final neural network model.

[0038] The present invention is further improved in that: in step (6), the method for removing the mask and generating the face is as follows:

[0039] (6.1) Crop the face to be removed from the mask to a size of 256*256*3 and input it into the network. At the same time, input the corresponding mask and the real face attribute feature vector;

[0040] (6.2) The model will remove the mask from the face wearing the mask and generate the face. The whole process will try to ensure that the generated face conforms to the input attribute prior, and the final face image is obtained after the mask is removed.

[0041] Compared with the prior art, the technical solution of the present invention has the following beneficial technical effects:

[0042] 1. The present invention divides the task into two parts, generation and reconstruction, by constructing a two-way parallel generative adversarial network, thereby improving the speed of the task and the structural rationality and texture accuracy of the generated image;

[0043] 2. The present invention guides the generation process of the network by inputting facial attributes as a priori, thereby improving the authenticity of the results;

[0044] 3. The present invention proposes an innovative solution to solve social hot issues. The solution is reasonable and practical through practice. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 is a flow chart of a method for removing a facial mask based on a generative adversarial network of the present invention;

[0046] Figure 2 It is a two-way generative adversarial network structure diagram adopted by the present invention;

[0047] Figure 3 It is the mask shielding diagram made by the present invention;

[0048] Figure 4 It is a face mask image produced by the present invention;

[0049] Figure 5 It is the experimental result image of the present invention. DETAILED DESCRIPTION

[0050] The present invention is further explained below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the following specific embodiments are only used to illustrate the present invention and are not used to limit the scope of the present invention. It should be noted that the words "front", "rear", "left", "right", "upper" and "lower" used in the following description refer to directions in the accompanying drawings, and the words "inner" and "outer" refer to directions toward or away from the geometric center of a specific component, respectively.

[0051] A method for removing a face mask based on a generative adversarial network in this embodiment is shown in the flowchart as follows: Figure 1 As shown, the steps of the method are:

[0052] (1) Build a two-way parallel generative adversarial network model;

[0053] Figure 2 What is shown is the structure diagram of the two-way generative adversarial network used in the present invention. The specific network structure of the two-way generative adversarial network constructed by the present invention is as follows:

[0054] First-layer encoder: The first-layer convolution input is 3 channels, the output is 32 channels, the convolution kernel is 3*3, the step size is 1*1, and the padding is 1*1; the second-layer convolution input is 32 channels, the output is 32 channels, the convolution kernel is 3*3, the step size is 1*1, and the padding is 1*1; the bypass input is 3 channels, the output is 32 channels, the convolution kernel is 1*1, and the step size is 1*1; the output of the second layer is output after spectral normalization, LeakyReLU activation function, spectral normalization and average pooling.

[0055] The second layer encoder: after the average pooling layer, the convolution kernel size is 2, and the step size is 2; the first layer convolution input is 32 channels, the output is 32 channels, the convolution kernel is 3*3, the step size is 1*1, and the padding is 1*1; the second layer convolution input is 32 channels, the output is 64 channels, the convolution kernel is 3*3, the step size is 1*1, and the padding is 1*1; the bypass input is 32 channels, the output is 64 channels, the convolution kernel is 1*1, and the step size is 1*1; the output of the second layer is successively output after LeakyReLU activation function, spectral normalization, LeakyReLU activation function, and spectral normalization.

[0056] The third layer encoder: after the average pooling layer, the convolution kernel size is 2, and the step size is 2; the first layer convolution input is 64 channels, the output is 64 channels, the convolution kernel is 3*3, the step size is 1*1, and the padding is 1*1; the second layer convolution input is 64 channels, the output is 128 channels, the convolution kernel is 3*3, the step size is 1*1, and the padding is 1*1; the bypass input is 64 channels, the output is 128 channels, the convolution kernel is 1*1, and the step size is 1*1; the output of the second layer is successively output after LeakyReLU activation function, spectral normalization, LeakyReLU activation function, and spectral normalization.

[0057] The fourth and fifth encoders: after the average pooling layer, the convolution kernel size is 2 and the step size is 2; the first layer of convolution input is 128 channels, the output is 128 channels, the convolution kernel is 3*3, the step size is 1*1, and the padding is 1*1; the second layer of convolution input is 128 channels, the output is 128 channels, the convolution kernel is 3*3, the step size is 1*1, and the padding is 1*1; the bypass input is 128 channels, the output is 128 channels, the convolution kernel is 1*1, and the step size is 1*1; the output of the second layer is successively output after LeakyReLU activation function, spectral normalization, LeakyReLU activation function, and spectral normalization.

[0058] First layer decoder: The first layer convolution input is 128 channels, the output is 128 channels, the convolution kernel is 3*3, the step size is 1*1, and the padding is 1*1; the second layer convolution input is 128 channels, the output is 128 channels, the convolution kernel is 3*3, the step size is 1*1, and the padding is 1*1; the bypass input is 128 channels, the output is 128 channels, the convolution kernel is 1*1, and the step size is 1*1; the output of the second layer is successively output after LeakyReLU activation function, spectral normalization, LeakyReLU activation function, and spectral normalization.

[0059] The second layer decoder and the third layer decoder: the first layer convolution input is 128 channels, the output is 128 channels, the convolution kernel is 3*3, the step size is 1*1, and the padding is 1*1; the second layer is inverse convolution, the input is 128 channels, the output is 128 channels, the convolution kernel is 3*3, the step size is 2*2, the padding is 1*1, and the output is padded with 1*1; the bypass is inverse convolution, the input is 128 channels, the output is 128 channels, the convolution kernel is 3*3, the step size is 2*2, the padding is 1*1, and the output is padded with 1*1; the output of the second layer is output after channel normalization, LeakyReLU activation function, spectral normalization, channel normalization, LeakyReLU activation function, and spectral normalization.

[0060] Fourth layer decoder: The first layer convolution input is 131 channels, the output is 64 channels, the convolution kernel is 3*3, the step size is 1*1, and the padding is 1*1; the second layer is inverse convolution, the input is 64 channels, the output is 64 channels, the convolution kernel is 3*3, the step size is 2*2, the padding is 1*1, and the output is padded with 1*1; the bypass is inverse convolution, the input is 131 channels, the output is 64 channels, the convolution kernel is 3*3, the step size is 2*2, the padding is 1*1, and the output is padded with 1*1; the output of the second layer is output after channel normalization, LeakyReLU activation function, spectral normalization, channel normalization, LeakyReLU activation function, and spectral normalization.

[0061] Fifth layer decoder: The first layer of convolution input is 67 channels, output is 32 channels, the convolution kernel is 3*3, the step size is 1*1, and the padding is 1*1; the second layer is inverse convolution, the input is 32 channels, the output is 32 channels, the convolution kernel is 3*3, the step size is 2*2, the padding is 1*1, and the output is padded with 1*1; the bypass is inverse convolution, the input is 67 channels, the output is 32 channels, the convolution kernel is 3*3, the step size is 2*2, the padding is 1*1, and the output is padded with 1*1; the output of the second layer is output after channel normalization, LeakyReLU activation function, spectral normalization, channel normalization, LeakyReLU activation function, and spectral normalization.

[0062] Output layer: The convolution input is 32 channels, the output is 3 channels, the convolution kernel is 3*3, and the step size is 1*1; the output passes through the LeakyReLU activation function, mirror padding, spectral normalization and Tanh activation function.

[0063] The first layer of adversarial network: first passes through the LeakyReLU activation function; the first layer convolution input is 3 channels, the output is 32 channels, the convolution kernel is 3*3, the step size is 1*1, and the padding is 1*1; the second layer convolution input is 32 channels, the output is 32 channels, the convolution kernel is 3*3, the step size is 1*1, and the padding is 1*1; the bypass input is 3 channels, the output is 32 channels, the convolution kernel is 1*1, and the step size is 1*1; the output of the second layer is output after spectral normalization, LeakyReLU activation function, spectral normalization and average pooling.

[0064] The second layer encoder: after the average pooling layer, the convolution kernel size is 2, and the step size is 2; the first layer convolution input is 32 channels, the output is 32 channels, the convolution kernel is 3*3, the step size is 1*1, and the padding is 1*1; the second layer convolution input is 32 channels, the output is 64 channels, the convolution kernel is 3*3, the step size is 1*1, and the padding is 1*1; the bypass input is 32 channels, the output is 64 channels, the convolution kernel is 1*1, and the step size is 1*1; the output of the second layer is successively output after LeakyReLU activation function, spectral normalization, LeakyReLU activation function, and spectral normalization.

[0065] The third layer encoder: after the average pooling layer, the convolution kernel size is 2 and the step size is 2; the first layer convolution input is 64 channels, the output is 64 channels, the convolution kernel is 3*3, the step size is 1*1, and the padding is 1*1; the second layer convolution input is 64 channels, the output is 128 channels, the convolution kernel is 3*3, the step size is 1*1, and the padding is 1*1; the bypass input is 64 channels, the output is 128 channels, the convolution kernel is 1*1, and the step size is 1*1; the output of the second layer is successively output after LeakyReLU activation function, spectral normalization, LeakyReLU activation function, and spectral normalization.

[0066] The fourth and fifth encoders: after the average pooling layer, the convolution kernel size is 2 and the step size is 2; the first layer of convolution input is 128 channels, the output is 128 channels, the convolution kernel is 3*3, the step size is 1*1, and the padding is 1*1; the second layer of convolution input is 128 channels, the output is 128 channels, the convolution kernel is 3*3, the step size is 1*1, and the padding is 1*1; the bypass input is 128 channels, the output is 128 channels, the convolution kernel is 1*1, and the step size is 1*1; the output of the second layer is successively output after LeakyReLU activation function, spectral normalization, LeakyReLU activation function, and spectral normalization.

[0067] (2) Create a face mask dataset

[0068] Since there is currently no large open source face mask dataset, it is necessary to create a face dataset of people wearing masks. The steps to create the dataset are as follows:

[0069] (2.1) We use the open source dataset CelebA as the benchmark. CelebA is a face dataset containing more than 200,000 images, each with 40 attribute labels and covering large pose variations and different backgrounds.

[0070] (2.2) Use the pose estimation neural network to estimate the pose of all images in CelebA and remove images where faces cannot be detected;

[0071] (2.3) Perform face detection on the filtered images in (2.2) to obtain the face coordinates of each image;

[0072] (2.4) Connect and fill the coordinates in (2.3) to obtain a grayscale image similar to a mask, which is the mask dataset, such as Figure 3 ;

[0073] (2.5) The mask dataset in (2.4) and the filtered images in (2.2) are superimposed one-to-one to obtain a dataset of faces wearing masks, which is used as the training set and test set of the network, as shown in Figure 4 .

[0074] (3) Setting and initializing the neural network structure parameters and training parameters. The network structure parameters and training parameters in the present invention are initialized as follows:

[0075] (3.1) The batch size of the training is set to 8, the initial learning rate is 1×e^(-4), the optimization strategy is Adam, the momentum value is set to 0.1, the weight decay regularization term decay is set to 0.0005, and the activation function is LeakyReLU;

[0076] (3.2) The coefficient of the appearance matching loss is set to 20, the coefficient of the KL divergence loss is set to 20, the coefficient of the discriminator adversarial loss is set to 1, and the coefficient of the attribute discrimination loss is set to 1.

[0077] (4) Taking the face image, mask image and face attributes as the network input. The input requirements of the network training link in the present invention are as follows:

[0078] (4.1) The input image size is 256*256*3, the input face image with mask is in RGB format, the input mask image is in grayscale format, and the input face attribute is a 1*7 vector containing only -1 and 1;

[0079] (4.2) The training set consists of 180,000 images and the test set consists of 2112 images. Since the posture of each face image is different, the detected coordinates are also different, and the resulting mask images are also different. Therefore, a one-to-one correspondence is required between the input images and between the images and the face attributes.

[0080] (5) Model training.

[0081] (5.1) Build the network according to the preset structure and initialize the network weights and loss function coefficients;

[0082] (5.2) The face wearing a mask, the mask image and the face attribute vector are used as the input of the neural network;

[0083] (5.3) The loss function consists of appearance matching loss, KL divergence loss, discriminator adversarial loss and attribute discrimination loss, and different weight values ​​are used for different parts;

[0084] Among them, the appearance matching loss refers to the structure and texture error between the generated image and the real image;

[0085] Among them, KL divergence loss refers to the probability distribution error between the generated image and the real image, that is, the similarity error between the two images;

[0086] Among them, the discriminator adversarial loss refers to the discrimination error between the generated image and the real image of the generative adversarial network;

[0087] Among them, the attribute discrimination loss refers to the face attribute discrimination error between the generated image and the real image.

[0088] (5.4) Through training and cross-validation, the network parameters are continuously trained and updated to obtain the final neural network model.

[0089] (6) Remove the mask and generate the face.

[0090] (6.1) Crop the face to be removed from the mask to a size of 256*256*3 and input it into the network. At the same time, input the corresponding mask and the real face attribute feature vector;

[0091] (6.2) The model will remove the mask from the face wearing the mask and generate the face. The whole process will try to ensure that the generated face conforms to the input attribute prior. The final face image after removing the mask is shown in the experimental effect diagram. Figure 5 shown.

[0092] The technical means disclosed in the scheme of the present invention are not limited to the technical means disclosed in the above-mentioned implementation mode, but also include technical schemes composed of any combination of the above technical features.

Claims

1. A method for removing facial masks based on a generative adversarial network, characterized in that: The method comprises the following steps: (1) Building a two-way parallel generative adversarial network model; In step (1), the structure of building a two-way parallel generative adversarial network model is as follows: (1.1) Generation path: The input is a face image wearing a mask, which is used to remove the mask and generate a face; the network includes a five-layer encoder, a five-layer decoder, and a five-layer discriminator; a bypass is set between the third-layer encoder and the third-layer decoder, and a bypass is set between the fifth-layer encoder and the first-layer decoder; the third-layer decoder contains a long-short attention model; the third layer of the discriminator contains a long-short attention model; (1.2) Reconstruction path: The input is a real image containing only the area blocked by the mask, which is used to extract features and reconstruct the face; the network includes a five-layer encoder, a five-layer decoder, and a five-layer discriminator; a bypass is set between the first layer decoder and the first layer decoder in (1.1), and a bypass is set between the third layer decoder and the third layer decoder in (1.1); the third layer decoder contains a long-short attention model; the third layer of the discriminator contains a long-short attention model; (1.3) Face attributes: Input a 1*7 vector containing only -1 and 1 to guide the generation and reconstruction of the network; the 7 dimensions represent 7 face attributes, which are big nose, fat cheeks, makeup, male, open mouth, no beard and young, respectively. -1 represents no relevant attribute and 1 represents relevant attribute. The face attribute vector is feature extracted, and the feature is superimposed and estimated with (1.1) generation path and (1.2) reconstruction path, and then fed back to the feature extraction part of (1.1) generation path and (1.2) reconstruction path; (1.4) Among them, (1.1) the generated path and (1.2) the reconstructed path share parameters, (1.1) the generated path is used in both the network training phase and the network testing phase, and (1.2) the reconstructed path is only used in the network training phase. (2) Preprocessing the face data set to obtain a face mask data set; (3) Setting the neural network structure parameters and training parameters and initializing them; (4) Taking the face image, mask image and face attributes as the input of the network; (5) The network is trained to obtain network weights and bias parameters, thereby obtaining a network model; in step (5), the network training process is as follows: (5.1) Build the network according to the preset structure and initialize the network weights and loss function coefficients; (5.2) The face wearing a mask, the mask image and the face attribute vector are used as the input of the neural network; (5.3) The loss function consists of appearance matching loss, KL divergence loss, discriminator adversarial loss and attribute discrimination loss, and different weight values ​​are used for different parts; Among them, the appearance matching loss refers to the structural and texture errors between the generated image and the real image; the KL divergence loss refers to the probability distribution error between the generated image and the real image, that is, the similarity error between the two images; the discriminator adversarial loss refers to the discrimination error between the generated image and the real image of the generative adversarial network; the attribute discrimination loss refers to the discriminant error between the generated image and the real image; (5.4) Through training and cross-validation, the network parameters are continuously trained and updated to obtain the final neural network model; (6) The masked face and the real face attributes are input into the network to obtain the result of removing the mask and generating the face.

2. The method for removing a facial mask based on a generative adversarial network according to claim 1, characterized in that: In step (2), the face dataset is preprocessed as follows: (2.1) Use a pose estimation neural network to perform pose estimation on a face dataset (CelebA) and remove images where faces cannot be detected; (2.2) Perform face detection on the filtered images in (2.1) to obtain the face coordinates of each image; (2.3) Connect and fill the coordinates in (2.2) to obtain a grayscale image similar to a mask, which is the mask dataset; (2.4) Superimpose the mask dataset in (2.3) and the image in (2.1) one-to-one to obtain a dataset of faces wearing masks, which is used as the training set and test set of the network.

3. The method for removing a facial mask based on a generative adversarial network according to claim 1, characterized in that: In step (3), the structural parameters and training parameters of the two-way parallel generative adversarial network are set as follows: (3.1) The input image size of the network is 256*256*3, the face mask image format is RGB, and the mask image format is grayscale image; (3.2) The batch size of training is set to 8, and the initial learning rate is 1×e^(-4); (3.3) The coefficient of the appearance matching loss is set to 20, the coefficient of the KL divergence loss is set to 20, the coefficient of the discriminator adversarial loss is set to 1, and the coefficient of the attribute discrimination loss is set to 1.

4. The method for removing a facial mask based on a generative adversarial network according to claim 1, characterized in that : In step (4), the input format and requirements are as follows: (4.1) The input image size is 256*256*3, the input face image with mask is in RGB format, the input mask image is in grayscale format, and the input face attribute is a 1*7 vector containing only -1 and 1; (4.2) The training set consists of 180,000 images and the test set consists of 2112 images; there must be a one-to-one correspondence between the input images and between the images and facial attributes.

5. The method for removing face masks based on generative adversarial networks according to claim 1, characterized in that In step (6), the method for removing the mask and generating a face is as follows: (6.1) Crop the face to be removed from the mask to a size of 256*256*3 and input it into the network. At the same time, input the corresponding mask and the real face attribute feature vector; (6.2) The model will remove the mask from the face wearing the mask, generate the face, and finally obtain the face image after the mask is removed.

Citation Information

Patent Citations

  • Face shelter removal method, face shelter removal model construction method, equipment and medium

    CN108205659A

  • Face image restoration method based on multi-discriminator generative adversarial network

    CN109785258A