{'fraction_non_alphanumeric': 0.02868346525306804, 'fraction_numerical': 0.016846997313194393, 'mean_word_length': 4.808519611978069, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Face Synthesis for Eyeglass-Robust Face Recognition

In the application of face recognition, eyeglasses could significantly degrade the recognition accuracy. A feasible method is to collect large-scale face images with eyeglasses for training deep learning methods. However, it is difficult to collect the images with and without glasses of the same identity, so that it is difficult to optimize the intra-variations caused by eyeglasses. In this paper, we propose to address this problem in a virtual synthesis manner. The high-fidelity face images with eyeglasses are synthesized based on 3D face model and 3D eyeglasses. Models based on deep learning methods are then trained on the synthesized eyeglass face dataset, achieving better performance than previous ones. Experiments on the real face database validate the effectiveness of our synthesized data for improving eyeglass face recognition performance.

However, in practical applications, there are still extra factors affecting the face recognition performance, e.g., facial expression, poses, occlusions etc. Eyeglasses, especially black-framed eyeglasses significantly degrade the face recognition accuracy (see Table 4). There are three common categories of eyeglasses: thin eyeglasses, thick eyeglasses, and sunglasses. In this work, we mainly focus on the category of thick black-framed eyeglasses, since the effects of thin eyeglasses are tiny, while the impact of sunglasses are too high because of serious identity information loss in face texture.
The main contributions of this work include: 1) A eyeglass face dataset named MeGlass, including about 1.7K identities, is collected and cleaned for eyeglass face recognition evaluation. It will be made public on https://github.com/ cleardusk/MeGlass. 2) A virtual eyeglass face image synthesis method is proposed. An eyeglass face training database named MsCeleb-Eyeglass is generated, which helps improve the robustness to eyeglass. 3) A novel metric learning method is proposed to further improves the face recognition performance, which is designed to adequately utilize the synthetic training data.
The rest of this paper is organized as follows. Section 2 reviews several related works. Our proposed methods are described in Section 3. The dataset description is in Section 4. Extensive experiments are conducted in Section 5 to validate the effectiveness of our synthetic training data and loss function. Section 6 summarizes this paper.

Related Work
Automatic eyeglasses removal. Eyeglasses removal is another method to reduce the effect of eyeglasses on face recognition accuracy. Several previous works [9,10,11,12] have studied on automatic eyeglasses removal. Saito et al. [9] constructed a non-eyeglasses PCA subspace using a group of face images without eyeglasses, one new face image was then projected on it to remove eyeglasses. Chenyu Wu et al. [10] proposed an intelligent image editing and face synthesis system for automatic eyeglasses removal, in which eyeglasses region was first detected and localized, then the corrupted region was synthesized adopting a statistical analysis and synthesis approach. Park et al. [12] proposed a recursive process of PCA reconstruction and error compensation to further eliminate the traces of thick eyeglasses. However, these works did not study the quantitative effects of eyeglasses removal on face recognition performance.
Virtual try-on. Eyeglass face image synthesis is similar to virtual eyeglass try-on. Recently, eyeglasses try-on has drawn attentions in academic community. Niswar et al. [15] first reconstructed 3D head model from single image, 3D eyeglasses were next fitted on it, but it lacked the rendering and blending process compared with our synthesis method. Yuan X et al. [13] proposed a interactive real time virtual 3D eyeglasses try-on system. Zhang, Q et al. [14] firstly took the refraction effect of corrective lenses into consideration. They presented a system for trying on prescription eyeglasses, which could produce a more real look of wearing eyeglasses.
Synthetic images for training. Recently, synthetic images generated from 3D models have been studied in computer vision [17,18,19,20]. These works adopted 3D models to render images for training object detectors and viewpoint classifiers. Because of the limited number of 3D models, they tweaked the rendering parameters to generate more synthetic samples to maximize the model usage.

Eyeglass image synthesis
We describe the details of eyeglass face synthesis in this section. To generate faces with eyeglasses, we estimate the positions of the 3D eyeglasses based on the fitted 3D face model and then render the 3D eyeglasses on the original face  images. The whole pipeline of our eyeglass faces synthesis is shown in Fig. 2. Firstly, we reconstruct the 3D face model based on pose adaptive 3DMM fitting method [22], which is robust to pose. Secondly, the 3D eyeglass is fitted on the reconstructed 3D face model. The fitting is based on the corresponding anchor points on the 3D eyeglass and 3D fitted face model, where the indices of these anchor points are annotated beforehand. Then z-buffer algorithm and Phong illumination model are adopted for rendering, and the rendered eyeglass image is blended on the original image to generate the final synthetic result.
The 3D eyeglass fitting problem is formed as Eq. 1, where f is the scale factor, P r is the orthographic projection matrix, p g is the anchor points on 3D eyeglass, p f is the anchor points on reconstructed 3D face model, R is the 3 × 3 rotation matrix determined by pitch(α), yaw(β), and roll(γ) and t 3d is the translation vector.
arg min Although the amount of images of MsCeleb is large, the model may overfit during training if the patterns of synthetic eyeglasses are simple. To increase the diversity of our synthetic eyeglass face images, we inject randomness into two steps of our pipeline: 3D eyeglass preparation and rendering. For 3D eyeglasses, we prepare four kinds of eyeglasses with different shapes and randomly select one as input. For eyeglass rendering, we explore three sets of parameters: light condition, pitch angle and vertical transition of eyeglass. For the light condition, the energies and directions are randomly sampled. Furthermore, to simulate the real situations of eyeglass wearing, we add small perturbations to the pitch angle ([−1.5, 0.8]) and vertical transition ([1, 2] pixel). Finally, we put together the synthetic eyeglass face images with original images as our training datasets. Conv3.x 3 × 3, 128 Global Pooling 512

Network and loss
Network We adapt a 22 layers residual network architecture based on [24] to fit our task. The original ResNet is designed for ImageNet [25], the input image size is 224 × 224, while ours is 120 × 120. Therefore, we substitute the original 7 × 7 convolution in first layer with 5 × 5 and stack one 3 × 3 convolution layer to preserve dimensions of feature maps. The details of our ResNet-22 are summarized in Table 1.
Loss Due to the disturbance of eyeglass on feature discrimination, we propose the Mining-Contrasive loss based on [26] to further enlarge the inter-identity differences and reduce intra-identity variations. The form of our proposed loss is in Eq. 2. ( Where f i and f j are vectors extracted from two input image samples, P is hard positive samples set, N is hard negative samples set, is cosine similarity between extracted vectors.
Gradual sampling. Besides, we employ the gradual process into data sampling to make the model fit the synthetic training images in a gentle manner. In naive sampling, the probability of eyeglass face image of each identity is fixed at 0.5. It means that we just brutally mix MsCeleb and MsCeleb-Eyeglass datasets. We then generalize the sampling probability as p = λ · n + p 0 , where n is the number of iterations, λ is the slope coefficient determining the gradual process, p 0 is the initialized probability value.

Dataset Description
In this section, we describe our dataset in detail and the summary is shown in Table 2.

Testing set
We select real face images with eyeglass from MegaFace [7] to form the MeGlass dataset. We first apply an attribute classifier to classify the eyeglass and noneyeglass face images automatically. After that, we select the required face images manually from the attibute-labeled face images. Our MeGlass dataset contains 14, 832 face images with eyeglasses and 33, 087 images without eyeglasses, from 1, 710 subjects. To be consistent with the evaluation protocol (in Section 4.3), we select two faces with eyeglasses and two faces without eyeglasses from each identity to build our testing set and the total number of images is 6, 880. Fig. 3 shows some examples of testing set with and without eyeglasses.

Training set
Two types of training set are adopted, one is only the MsCeleb and the other is the mixture of MsCeleb with synthetic MsCeleb-Eyeglass. Our MsCeleb clean list has 78, 765 identities and 5, 001, 877 images, which is slightly modified from [23]. For each image, we synthesize a eyeglass face image using the method proposed in Section 3.1. Therefore, there are totally 10, 003, 754 images from 78, 765 subjects in the mixture training set.

Evaluation protocol
In order to examine the effect of eyeglass on face recognition thoroughly, we propose four testing protocols to evaluate different methods. I) All gallery and probe images are without eyeglasses. There are two noneyeglass face images per person in gallery and probe sets, respectively. II) All gallery and probe images are with eyeglasses. There are two eyeglasses face images per person in gallery and probe sets, respectively. III) All gallery images are without eyeglasses, and all probe images are with eyeglasses. There are two non-eyeglass face images per person in gallery set and there are two eyeglass face images per person in probe set. IV) Gallery images contain both eyeglass images and non-eyeglass images, so as probe images. There are four face images (including two non-eyeglass and two eyeglass face images) per person for gallery and probe sets.

Experiments
Firstly, we evaluate the impact of eyeglasses on face recognition. Second, several experiments are conducted to study the effect of synthetic training data and proposed loss. In experiments, two losses including the classification loss A-Softmax and the metric learning based contrastive loss are investigated. Totally there are four deep learning models are trained based on different losses and training sets. Table 3 lists the four deep face models. For ResNet-22-A, we apply A-Softmax loss to learn the model from original MsCeleb dataset. We then finetune the model on MsCeleb dataset using contrastive loss to obtain ResNet-22-B. We also finetune the ResNet-22-A model on MsCeleb and its synthetic eyeglasses database to obtain ResNet-22-C. The ResNet-22-D is finetuned from base model ResNet-22-A using gradual sampling strategy with the slope coefficient λ of 0.00001 and p 0 of 0.

Experiments Settings
Our experiments are based Caffe [27] framework and Tesla M40 GPU. All face images are resized to size 120 × 120, then being normalized by subtracting 127.5 and being divided by 128. We use SGD with a mini-batch size of 128 to optimize the network, with the weight decay of 0.0005 and momentum of 0.9. Based on these configurations, the training speed can reach about 260 images per second on single GPU and the inference speed is about 1.5ms per face image.

Effect of eyeglass on face recognition
In this experiment, we use the original MsCeleb database only as the training set to examine the robustness of traditional deep learning model to eyeglasses. Table 4 shows the results of ResNet-A model tested on four protocols. From the results, one can see that the ResNet-A model achieves high recognition accuracy on protocol I, which is without eyeglass occlusion. However, its performance degrades significantly on protocols II-IV, where eyeglasses occlusion occurs in gallery or probe set, especially for the TPR at low FAR. It indicates that the performance of deep learning model is sensitive to eyeglasses occlusion.  For comparison, we further train deep face model, ResNet-C, using the mixture of the original MsCeleb and its synthesized eyeglasses version MsCeleb-Eyeglass. Table 5 and Table 6 show the comparison results of ResNet-B and ResNet-C following four protocols. It can be seen that using our synthesized eyeglass face images, it significantly improves the face recognition performance following protocol III-IV, especially at low FAR. It enhances about 20 percent when FAR=10 −6 on protocol IV, which is the hardest case in four configurations, indicating the effectiveness of virtual face synthesis data for the robustness improvement of face deep model. Moreover, with the face synthesis data , the proposed loss function with gradual sampling, model ResNet-22-D achieves the best results on four protocols.

Effectiveness of synthetic data and proposed loss
Finally, we also plot the ROC curves for four protocols in Fig. 4 to further validate the effectiveness of our synthetic training dataset and proposed loss function.

Conclusion
In this paper, we propose a novel framework to improve the robustness of face recognition with eyeglasses. We synthesize face images with eyeglasses as training data based on 3D face reconstruction and propose a novel loss function to address this eyeglass robustness problem. Experiment results demonstrate that our proposed framework is rather effective. In future works, the virtual-synthesis method may be extended to alleviate the impact of other factors on the robustness of face recognition encountered in real life application.