A face image sample expansion method based on generative adversarial network
Through the face image sample expansion method based on GAN, the occluded face image is generated, which solves the problem that the traditional method cannot effectively expand the face detection data set, improves the accuracy of face detection and image generation quality, and is especially suitable for occluded people. Face detection scenario.
Patent Information
- Application Number
- CN202111487467.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-07
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2041-12-07
AI Technical Summary
It is difficult to effectively expand the face detection data set with the existing technology, especially when the face is occluded, the traditional image enhancement method is not applicable, making it difficult for the face detection model to detect the occluded face image.
Using a face image sample expansion method based on generative adversarial networks (GAN), the S-CoderGAN network is trained to generate occlusion face images, and combined with Wasserstein GAN and period consistency training processes, the network structure is optimized to improve image generation quality and detection accuracy. .
The generated occluded face images are of higher quality and can effectively improve the accuracy of face detection, especially in special scenes such as customs security inspections and crowded places.
Smart Images

Figure CN114255497B
Abstract
Description
[Technical field]
[0001] The invention belongs to the technical field of artificial intelligence recognition and image processing, and in particular relates to an image sample expansion method for face detection data. [Background technology]
[0002] In recent years, deep learning-based methods have achieved good performance in many fields, which largely relies on massive data. In tasks that require face detection, it is also quite difficult to collect real-time face data. And data labeling of occluded faces is also a very labor-intensive and time-consuming task. Solving the shortage of occluded face data sets and expanding face data sets are key issues that need to be solved at present.
[0003] Image dataset expansion and image enhancement have always been areas that researchers have been working hard to overcome. Whether it is traditional image enhancement methods including adding noise, radiometric transformation, cropping, flipping, etc., or methods using information deletion for detection work, the improvement of the robustness of deep learning models is limited. However, in face detection work, due to the small pixel area of the face image, there are too few valid images available for enhancement, which makes most image enhancement methods not applicable. Therefore, using more face image data to train the face detection model is a more effective means. The generative adversarial network used in the present invention to perform face image sample expansion is a more effective means. [Summary of the invention]
[0004] The purpose of the present invention is to solve the problem that the traditional face enhancement and expansion methods add noise, radial transformation, cropping, flipping, etc., because the pixel area of the face image is small, especially when part of the area is blocked, it cannot be effectively enhanced and expanded, and the face detection model has difficulty in detecting such blocked face images. A face image sample expansion method based on a generative adversarial network is proposed. The operation flow of the method is as follows Figure 1As shown, first use the face data set that needs to be expanded to train the S-CoderGAN network, then use the generator of the trained and improved S-CoderGAN network to generate more occluded face images, and finally use the generated occluded face images to train the face detection model to improve the detection accuracy. This method is based on the network structure optimized for the occluded face image generation task of the deep convolutional generative adversarial network (DeepConvolution GAN, DCGAN), the purpose is to expand the existing face data samples, further enrich the face occlusion images, and improve the performance of the face detection algorithm. The S-Coder (Source Coder) original domain coding module is added to the network to realize the controllable generation and coverage of occluded elements. And by modifying the network layer structure, the Wasserstein distance optimization network training used in WGAN (Wasserstein GAN) is added. On this basis, a training process with consistent cycles is used to further increase the stability of network training and improve the image generation quality. The quality of the image data generated by the method of the present invention is compared subjectively and quantitatively with the images generated by other GAN networks. On this basis, the generated occluded face data set is sent to a variety of face detection algorithms for training and testing. Experimental results show that the images generated by the method of the present invention have better quality and are more practical, and the use of an expanded face occlusion dataset can effectively improve the accuracy of face detection.
[0005] Technical solution of the present invention
[0006] A face image sample expansion method based on a generative adversarial network comprises the following steps:
[0007] Module 1: Generator module designed with a residual structure using skip connection;
[0008] Module 2: Adding an S-coder controllable coding module (S-Coder Module) based on the One-Hot Encoding algorithm to the generative adversarial network;
[0009] Module 3: Use the Sigmoid layer to design the true and false discrimination submodule of the discriminant network, and use the Softmax layer to design the label discrimination submodule of the discriminant network. Use these two submodules to construct the discriminator module (Discriminator);
[0010] Step 3: Use a cycle-consistent training process, that is, the combination of two sets of generators in the S-Coder GAN generative adversarial network, and send the generated image back to another generator with the same structure to obtain the reconstructed image, thereby improving training stability;
[0011] Step 4: Finally, use the trained S-Coder GAN to generate adversarial networks to generate face image samples with various face occluders to obtain the expanded data set.
[0012] The S-Coder GAN generates an adversarial network structure that uses a vector mask to encode the input training target domain image, and the encoding and the original domain image information are input into the network for contact operation as new input to the generator.
[0013] In the S-Coder GAN generative adversarial network structure, the generated face image is sent to the discriminator. At this time, the front part of the discriminator shares parameters, uses the residual network to extract features, and sends the features to a network containing a Sigmoid layer network to output the true and false information of the image, and at the same time sends the features to another network containing a Softmax layer network to output the image category information.
[0014] In the S-Coder GAN generative adversarial network structure, two groups of identical generative adversarial networks are used to form a similar cycle-consistent generative adversarial network structure for training, and cycle consistency loss is used for constraint. During training, Wasserstein loss is used to optimize the generator and discriminator.
[0015] Advantages and positive effects of the present invention
[0016] The present invention proposes a facial image sample expansion method based on a generative adversarial network, a codec module and cycle-consistent training. By expanding the data of existing unobstructed facial image samples, the purpose of enhancing the processing accuracy of the face detection algorithm is achieved. Based on the advantages and disadvantages of the existing DCGAN network, this technology combines the codec technology and a better optimization function to design a new network structure to improve the image generation quality. Inspired by the cycle-consistent training process, the cycle-consistent loss is combined to make the GAN network training more stable, which solves the problem of model training difficulties to a certain extent. After a variety of GAN network generated image quality comparison experiments, the network in this paper has good performance in terms of generated image quality and image richness. In the face data set expansion and face detection comparison experiments, a variety of classic face detection models have different degrees of improvement in the detection accuracy of occluded faces. For special occluded face detection scenarios such as customs security inspection and crowded places, the application of this technology can provide great help.
Brief Description of the Drawings
[0017] Figure 1 It is the overall operation flow chart of the present invention;
[0018] Figure 2 It is a structural diagram of the overall network of the present invention;
[0019] Figure 3 It is the micro-step convolution structure used in the generator network and the generator network composition diagram;
[0020] Figure 4 It is the convolution structure used in the discriminator network and the composition diagram of the discriminator network;
[0021] Figure 5 These are the results of various generative networks generating images on the CIFAR10 dataset; among them, (a) is the image generated by the DCGAN network, (b) is the image generated by the DCGAN-res residual structure, (c) is the image generated by the WGAN, (d) is the image generated by the WGAN-GP, and (e) is the image generated by the network of the present invention;
[0022] Figure 6 This is a comparison chart of the quality of generation of various generative networks in the CIFAR10 dataset;
[0023] Figure 7 This is the effect of generating an occluded face image. The left side is the cropped face image in the original image, the middle is the network-enhanced face image occluded by sunglasses, and the right side is the network-enhanced face image occluded by a mask;
[0024] Figure 8 This is a comparison chart of the detection accuracy of various face detection models after the data set is expanded. [Specific implementation method]
[0025] Example
[0026] This embodiment uses Python language and PyTorch framework to construct image sample generation based on deep convolutional generative adversarial network (DCGAN), codec module, and cycle consistent training method. The main implementation operations involved are the construction of basic network and backbone network, among which the codec module is the biggest innovation of the algorithm.
[0027] The present invention provides a face image sample expansion method based on a generative adversarial network. The overall generative adversarial network structure of the present invention is as follows: Figure 2As shown in the figure, it consists of a coding module (S-Coder Module), two generator networks (Generator1, Generator2), and a discriminator network (Discriminator). After the target image (Target Image) is encoded by the coding module (Target Code), it is passed to the first generator (Generator1) together with the image to be enhanced (Source Image). The fake image and the target image are sent to the discriminator (Discriminator) for decoding, and the image type (Label) and image true and false information (Fake / Real) are output. The weight of the first generator (Generator1) is adjusted to further optimize the overall network parameters, thereby improving the image sample generation ability of the generator. At the same time, the generated image (Image) and the original image code (SourceCode) are sent to the second generator (Generator2) to reconstruct the original image. The original image and the reconstructed image are constrained by using a periodic consistent Loss to keep the distribution consistent, and the network parameters of the second generator (Generator2) are optimized.
[0028] The method of the present invention specifically comprises the following steps:
[0029] Step 1, obtain the original face training sample set;
[0030] Step 2: Follow Figure 3 The network operation steps shown in the figure send the face images in the face training sample set to the generative adversarial network, train the generative adversarial network, and generate new face image samples containing facial occlusion elements; wherein: DCGAN is used as the network infrastructure, and Figure 3 The residual module shown in Figure 2 builds a deconvolution structure as the basis of the S-CoderGAN generative adversarial network.
[0031] Step 3: Use a vector mask to encode the input training image. The encoder can generate an i-dimensional vector c based on the known labels provided by the i-type data set, and contact the encoding with the input image distribution information as a new input to the generator network.
[0032] Step 4: Follow Figure 4 The steps shown send the generated image to the discriminator. At this time, the front part of the discriminator shares parameters, and the residual network extracts features and sends them to two sub-modules with different structures. One module uses the Sigmoid layer to output the true or false information of the image, and the other module uses the Softmax layer to output the image category information.
[0033] The losses of the discriminator model and the generator model optimized by a given label encoding are:
[0034]
[0035]
[0036] in It is a function for optimizing the discriminator. x is the real image. The feature vector extracted by the discriminator D is compared with the real label c to calculate the distance, and the discriminator D is continuously optimized. It is a function that optimizes the generator. G(x,c) is a false sample output by the generator G and sent to the discriminator D, thereby continuously optimizing the generator D.
[0037] Step 5: Use two groups of identical generative adversarial networks to form a similar cycle-consistent generative adversarial network structure for training, and use cycle consistency loss for constraints.
[0038]
[0039] This formula represents the generator G ab That is, Generator (a to b) converts image A into a fake image B-fake, DB determines the authenticity of B-fake, and G ba That is, Generator (b to a) converts B-fake back to the reconstructed image A-rec; another generator G ba Convert B to A-fake, DA determines the authenticity of A-fake, and G ab Convert A-fake back to B-rec. Use cycle consistency loss to ensure that A-rec(B-rec) approaches the distribution of A(B) to achieve better training stability. ab (x), G ba (y) represents the data domain x, y, which is sent into the network for generation and reconstruction, and the L1 paradigm is used to calculate the distance with itself, and it is continuously optimized
[0040] And use Wasserstein loss during training, that is The generator and discriminator are optimized. At the same time, the overall loss of the network is as follows. The discriminator is used to distinguish the generated image from the real image. Maximize, so the loss function of the discriminator network as follows:
[0041]
[0042] in is the Wasserstein loss, is the discriminator image classification loss, and γ is the component weight of the loss, which is usually set to 1.
[0043] In the generator, in order to make the generated image closer to the real image, minimize Generator network loss function As follows:
[0044]
[0045] in is the generator category loss, is the period-consistent loss, γ and β are the weights of the loss components, usually set to 5.
[0046] The above is an example of training a generative adversarial network for face occlusion images. In the end, a generative model can be obtained that can expand the data samples of existing face images.
[0047] In order to verify the image data generation capability of the GAN network of the present invention, we first select the three-channel image sample cifar-10 image data set to generate an extended sample image, verify the image generation quality and the practicality of the extended image, and thus verify the algorithm capability. The cifar-10 data set consists of 60,000 color image samples of 32×32 pixels, which are divided into 10 categories such as airplane, truck, horse, etc., with 10,000 images in each category. And 50,000 images are composed of 5 batches as training sets, and the other 10,000 images are used as test sets. The Cifar-100 data set has 100 categories. Each category has 600 color images of size 32×32, of which 500 are used as training sets and 100 are used as test sets, totaling 60,000 images. The experimental parameters are set as follows: Batch-size is 100, training image is 32×32, generator input is a vector composed of random noise and encoding information, generator and discriminator learning rate is initially 0.01, and decreases to 10% of the current rate every 100 epochs. The experimental generated image results are shown below: Figure 5 After comparing with DCGAN, DCGAN-res, WGAN, and WGAN-GP, the IS and FID indicators are used for quantitative evaluation. The results are as follows: Figure 6 .
[0048] By judging the results of the five networks trained on the same dataset with the same number of training iterations, it can be seen that the GAN network proposed in this paper is close to WGAN-GP in image generation quality and richness in the cifar-10 dataset, and is superior to other GAN networks.
[0049] In the actual face image sample expansion operation, the WIDER FACE dataset is selected as the training set and expansion object because the WIDER FACE dataset has more scenes and richer face scales. WIDER FACE is cleaned and screened by labels such as posture, scale, and face occlusion to obtain more than 30,000 cleaned images that meet the expansion requirements, including about 13,000 original occluded faces, which are used as training images. The MAFA dataset is used as a test set to effectively evaluate different face detection algorithms before and after expansion.
[0050] The WIDER-FACE dataset is a benchmark dataset for face detection, containing 32,203 images and 393,703 annotated faces, of which the training set contains 158,989 faces and the validation set contains 39,496 faces. The dataset provides multiple category annotations, and each subset contains three levels of detection difficulty: Easy, Medium, and Hard. The MAFA dataset is a specially proposed occluded face detection dataset, containing 30,811 images, 35,806 occluded faces, and at least one face is occluded in each image. It is specifically used to evaluate the performance of various algorithms for occluded face detection.
[0051] The generative adversarial network is used to expand the original dataset with facial occlusion elements, adding mask and sunglasses facial occlusion, greatly improving the richness of faces, and expanding the original widerface dataset into a widerface-mask dataset. After the expansion, the number of occluded faces in the widerface-mask dataset will increase by 50%, 100%, 150% and 200% compared to the original number of occluded faces, and further improve the richness of facial occlusion elements. Generate a face image such as Figure 7 As shown in the figure, from left to right are the original face image, the face image blocked by sunglasses, and the face image blocked by a mask. After testing three face detection algorithms: Single Shot Scale-invariant Face Detector (S3FD), FaceBoxes, and DenseBox, the face image detection accuracy is as follows: Figure 8 .
[0052] In this experiment, the three models did not perform better on the MAFA dataset when trained with the base dataset than on the original test dataset. This problem is caused by the richer scenes and face occlusion elements in the MAFA dataset. After training with WIDERFACE-mask (50%), the accuracy of occluded face detection can be improved by 3% to 6%. When the dataset expansion ratio reaches 150%, the improvement in detection accuracy is no longer significant. However, the occluded face images generated by the GAN network are effective in improving detection accuracy, and a variety of classic face detection models have different degrees of improvement in the detection accuracy of occluded faces. For special occluded face detection scenarios such as customs security inspections and crowded places, the application of this technology can provide great help.
Claims
1. A face image sample expansion method based on a generative adversarial network, comprising the following steps: Step 1: Obtain the original face training sample set; Step 2: sending the face images in the face training sample set to the S-Coder GAN generative adversarial network, and training the generative adversarial network to generate new face image samples containing facial occlusion elements; in: The structure of the generative adversarial network consists of the following modules: Module 1: Generator module designed with a residual structure using skip-layer connections; Module 2: Adding an S-coder controllable encoding module based on a one-hot encoding algorithm to the generative adversarial network; Module 3: Use the Sigmoid layer to design the true and false discrimination submodule of the discriminant network, and use the Softmax layer to design the label discrimination submodule of the discriminant network, and use these two submodules to construct the discriminator module; Step 3: The target image is encoded by the encoding module and input into the first generator together with the original image. The generated fake image and the target image are sent to the discriminator for decoding. The original image is encoded by the encoding module and input into the second generator together with the fake image to reconstruct the original image. The reconstructed image and the original image are constrained by the cycle consistency loss, and the generator and the discriminator are optimized by the Wasserstein loss during training. Step 4: Finally, use the trained S-Coder GAN to generate adversarial networks to generate face image samples with various face occluders to obtain the expanded data set.
2. The face image sample expansion method based on the generative adversarial network as claimed in claim 1, It is characterized in that The S-Coder GAN generative adversarial network sends the generated face image to the S-Coder GAN discriminator. At this time, the front part of the discriminator shares parameters and uses the residual network to extract features. The features are sent to sub-network a and sub-network b; network a is a network containing a Sigmoid layer, which outputs the true or false information of the image, and the other network b contains a Softmax layer, which outputs the image category information.
