{'fraction_non_alphanumeric': 0.036611184114469265, 'fraction_numerical': 0.009490436560081764, 'mean_word_length': 4.824192176870748, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Protecting Facial Privacy: Generating Adversarial Identity Masks via Style-robust Makeup Transfer

While deep face recognition (FR) systems have shown amazing performance in identification and verification, they also arouse privacy concerns for their excessive surveillance on users, especially for public face images widely spread on social networks. Recently, some studies adopt adversarial examples to protect photos from being identified by unauthorized face recognition systems. However, existing methods of generating adversarial face images suffer from many limitations, such as awkward visual, white-box setting, weak transferability, making them difficult to be applied to protect face privacy in reality. In this paper, we propose adversarial makeup transfer GAN (AMT-GAN), a novel face protection method aiming at constructing adversarial face images that preserve stronger black-box transferability and better visual quality simultaneously. AMT-GAN leverages generative adversarial networks (GAN) to synthesize adversarial face images with makeup transferred from reference images. In particular, we introduce a new regularization module along with a joint training strategy to reconcile the conflicts between the adversarial noises and the cycle consistence loss in makeup transfer, achieving a desirable balance between the attack strength and visual changes. Extensive experiments verify that compared with state of the arts, AMT-GAN can not only preserve a comfortable visual quality, but also achieve a higher attack success rate over commercial FR APIs, including Face++, Aliyun, and Microsoft.

. Comparison with existing adversarial attacks on FR systems in the black-box setting. The images in (a) are directly extracted from their papers. The numbers listed below images are the verification confidence of the target identity given by commercial FR APIs, and a higher score represent a stronger attack ability. The blue is from Face++, the green is from Aliyun, and the red is from Microsoft Azure (The same color code will be used hereinafter).

Introduction
Recent years have witnessed the fast development of face recognition (FR) based on deep neural networks (DNNs).
The powerful face recognition systems, however, also pose a great threat to personal privacy. For example, it has been shown that FR systems can be used to identify social media profiles and track user relationships through large-scale photo analysis [16,31]. Such kind of excessive surveillance on users urgently demands an effective approach to help individuals protect their face images against unauthorized FR systems.
Launching data poisoning attacks towards the training dataset or the gallery dataset of malicious FR models is a promising solution to protect facial privacy [3,29]. However, these schemes require that the adversary (i.e., the users in our scenario) can inject poisoned face images into the datasets. Once the target model is trained or makes inference over clean datasets, they are likely to become invalid.
Another strategy is to make use of adversarial examples to launch evasion attacks and protect face images from being illegally identified [26,32,40]. Adversarial face images are more suitable for protecting user privacy in real-world scenarios since they only need to modify users' own data regardless of the settings of the target model. Unfortunately, existing approaches of generating adversarial face examples suffer from several limitations when they are considered to protect face privacy on social media: (1) Accessibility to target models. Most existing schemes belong to white-box attack (i.e., the adversary has full knowledge of the target model) [11,24], or query-based black-box attack (i.e., the adversary can arbitrarily query the target model) [9]. They are infeasible for protecting users' privacy since the users have no idea which kind of DNNs the third-party tracker is running; (2) Poor visual quality. As shown in Fig. 1, existing adversarial attacks on FR system fail to preserve the image quality in the black-box setting. Patch-based adversarial attacks [22,37] often cause a fairly bizarre and conspicuous change on source images, and the state-of-the-art perturbation-based method [40] makes the modified face fill with awkward noises; (3) Weak transferability. Fig. 1 also demonstrates that the state of the art has a relatively low attack success rate on commercial APIs. In summary, it is still challenging to balance the trade-off between the visual quality and attack ability of adversarial face images in the black-box setting.
In this paper, we solve this problem from a new perspective. Different from existing works trying to place multifarious restrictions on perturbations and then dig a better gradient-based algorithm to construct adversarial examples, we focus on organizing the perturbations, although extensive and visible, in a reasonable way such that they appear natural and comfortable, under the condition that a high attack ability is maintained. We therefore leverage makeup as the key idea for arranging perturbations. Specifically, we propose a new framework called adversarial makeup transfer GAN (AMT-GAN) to generate adversarial face im-ages with the natural appearance and stronger black-box attack strength. ATM-GAN first exploits a set of generative adversarial networks to construct adversarial examples that can inherit makeup styles from a reference image. In order to reconcile the conflicts between the adversarial noises and the cycle consistence loss in makeup transfer, we incorporate a newly designed regularization module by exploiting the disentanglement function of the encoderdecoder architecture and the residual dense blocks in the image super-resolution. As a result, the adversarial toxicity can be compatibly alleviated in the cycle reconstruction phase, making the generator focus on building robust mappings between the source domain and the target style domain with adversarial features. In addition, we introduce a joint training strategy which integrates the traditional G-D game in the GAN training and the newly designed regularization module, as well as the transferability enhancement process to encourage the generator to catch, imitate, and reconstruct the common adversarial features which can effectively transfer between different models.
To the best of our knowledge, we propose the first joint training framework to address the collapse phenomenon of the cycle consistency and the domain mappings of the generator when the image-to-image translation GANs are used to craft adversarial examples. Our joint training framework can be extended to other security-sensitive fields when GAN is considered, such as Deepfake [35]. In summary, we make the following contributions: • We propose AMT-GAN, a more practical approach for protecting face images against unauthorized FR systems, by constructing adversarial examples with outstanding black-box attack performance and natural appearance that derive cosmetic styles from any chosen reference images.
• We design a regularization module based on feature disentanglement to improve the visual quality of adversarial images, and then develop a joint training pipeline to train the generator, the discriminator, and the regularization module, such that the generator can accomplish two jobs (i.e., makeup-transfer and adversarial attack) simultaneously and build robust mappings among different data manifolds.

Related Works
To protect face privacy, AMT-GAN leverages adversarial examples which are originally designed to disable DNNs in the machine learning community. Thus, we first discuss existing works on adversarial attacks in the context of privacy protection, followed by recent research on style transfer.

Adversarial Attacks on Face Recognition
Broad studies have shown that the DNNs are fatally vulnerable to adversarial examples [11,24,32], and many adversarial algorithms have been developed to attack face recognition system [9,25,30,37]. Depending on the adversary's knowledge of the target model, the adversarial face attacks can be divided into white-box attacks and black-box attacks.
The white-box attacks [11,18,24] and query-based black-box attacks [9,13] heavily rely on the accessibility to the target model, which is a stringent prerequisite in practice. Transferability-based black-box attacks are thus more suitable for protecting face images in real-world scenarios [7,37,40,44]. However, most existing transferabilitybased attacks [7,38] are designed to solve an optimization problem, which is not only time-consuming, but also likely to be trapped in over-fitting and degrades the transferability [37]. In addition, to maintain the attack strength on different black-box models, transferability-based attacks usually generate images with perceptible noises [7,8]. Recent work [40] tried to solve this problem by adding a new penalty function to fit the privacy-preserving scenario. However, as illustrated in Fig. 1, the perturbations are still outrageous. Using GAN [10] to craft adversarial samples [36] can achieve improvement in terms of image noises, but it is still challenging to maintain GAN's stability for data with high-definition in adversarial task. [25] turns to craft adversarial samples by swapping the latent features of face images from a GAN, however, it changes original face attributes dramatically (such as turning closed mouth to open), which are not desirable for users in social media. The patch-based adversarial attacks on FR systems [22,30,37,41] are also not compatible for the same reason.

Style Transfer and Makeup Transfer
Style transfer [4] is an image-to-image translation technique that aims to separate and recombine the content and style information of images. Built on the style transfer framework, makeup transfer [1,5,12,19,23] is proposed to transfer the makeup style of the reference image to the source image while keeping the result of face recognition unchanged. Both style transfer and makeup transfer rely on the cycle consistency loss or its variants [43,45] to maintain the stability of source images.
Recently, [46] made the first attempt to exploit the makeup transfer to generate adversarial face images in a white-box setting. Then [41] tried to construct adversarial cosmetic face images with transferability property to realize black-box attacks. However, it not only has a low attack success rate, but also fails to preserve the image visual quality where the modifications added to the source image is abnormal and noticeable, especially when the styles between reference and source images are significantly different, as explicitly depicted in our experiments Fig. 4.
It is indicated that adversarial noise may cause dysfunction on the cycle consistency loss [27,39], and gets confirmed in this paper. In the literature, it is still challenging to amicably incorporate makeup transfer into adversarial examples, generating a natural adversarial face image that maintains a high attack success rate on black-box face

Problem Formulation
In this section, we formulate the problem of adversarial attacks with makeup transfer on FR systems. To protect facial privacy effectively against malicious FR models, we mainly consider targeted adversarial attack (i.e.impersonation attack) that aims to generate adversarial examples which can be recognized as the specified target identity. Generally, the targeted adversarial attack on FR system can be formulated as: where D(·) represents a distance function such as crossentropy or cosine similarity, M k represents a DNN-based feature extractor for FR, x A and z stand for the adversarial face image and the target image respectively. As for makeup transfer, let X, Y ⊂ R H×W ×3 denote the makeup style domain of the source and reference images, respectively. Here, we use x ∈ X and y ∈ Y to represent the clean face images and x A ∈ X and y A ∈ Y to represent their adversarial face images, respectively. The adversarial makeup transfer is expected to train a function G: {x, y} → y A x , where the adversarial imageỹ A x has the same makeup style with y and the same visual identity with x.

Detailed Construction
The architecture of AMT-GAN is depicted in Fig 2. Generator G and discriminators D X , D Y . The generator G is supposed to generate adversarial examples for source images, while ensuring that the visual identity remains the same but the makeup style changes from the source domain to the reference domain. The discriminators D X and D Y are supposed to distinguish the distribution of fake images generated by G from that of the real images. Mathematically, the loss functions of GANs are formulated as: (3) To learn the bidirectional mappings (i.e., X → Y, Y → X) between the source and reference domain without supervised training data, we also utilize the cycle consistency loss function [45], which is a crucial element in the unsupervised image-to-image translation tasks. Generally, the cycle consistency loss function is depicted in Fig 3a and denoted as: where ∥ · ∥ 1 represents the L 1 norm. However, the cycle consistency loss is in conflict with the adversarial example. As shown in Fig 3b, when establishing the inverse mapping Y A → X, the generated adversarial examples G(x, y) is taken as the first input of G. Due to the adversarial modification on the samples from the clean domain X, G may fail to extract the features of G(x, y) and is thus unable to turn an adversarial input from adversarial domain Y A back to the clean domain X. As a result, the recovered G(G(x, y), x) may be significantly different from the source image x, i.e., G(G(x, y), x) is in an unexpected domain rather than the domain X. In short, due to the adversarial nature of G's outputs, it is hard for G to establish a robust inverse mapping Y A → X. This phenomenon makes the existing cycle consistency loss unsuitable for generating adversarial face images with makeup transfer (see our ablation study Fig. 6).
Regularization module H. To ensure the cycle consistency works well, we introduce a regularization module H in our framework. H is designed to generate clean images H(G(x, y)) with the same content, style, and dimensions as G(x, y) but without adversarial property. Namely, H transforms the generated image G(x, y) from the adversarial domain Y A to the clean domain Y . The combination of G and H maintains a new cycle consistency, i.e., the loop Fig. 3c.
To find an effective H, we first choose a pair of encoder and decoder as the basic architecture of H. Then we leverage the residual-in-residual dense block (RRDB) as a key block of H. RRDB is widely used in the field of image super-resolution [33]. These blocks will maintain and recover the content and texture information of the input while extracting and discarding the adversarial perturbations at the same time.
In our design, the regularization module H follows the same training process as the main networks G and D. The newly designed regularized cycle consistency loss is formulated as: H(G(x, y)), x)) − x ∥ 1 + ∥ H(G (H(G(y, x)), y)) − y ∥ 1 .
In addition, H is supposed to keep the output of G visually unchanged while alleviating the adversarial effects. So we let H accept the penalty by the returns from D X and D Y , which encourages H to reconstruct the real performance of G in style transfer, and it is defined as: , y)))).
(6) Note that in Eq. (2), we do not include the performance of H in L gan D , as we want to keep the two-player zero-sum game between the generator and the discriminators stable, and it is also unnecessary to adjust D X and D Y according to the performance of H.
Transferability enhancement module M . M consists of K pre-trained face recognition models {M k } k=1,...,K , which have high accuracy on public face images datasets. These local models serve as white-box models when we train our GANs and try to imitate the decision boundaries of potential target models which we cannot access.
In our method, inspired by [7,38], we use an ensemble training strategy with input diversity enhancement to encourage G to generate adversarial examples with high transferability and black-box attack success rate. The adversarial is defined as: , y), p))] where M k represents the feature extractor of the k-th local pre-trained white-box model, and we use cosine similarity as the distance function. T (·) represents the transformation function, and p is a pre-defined probability of whether the transformation will be conducted upon G(x, y). Specifically, we choose image resizing and Gaussian noising as the transformation function. Both of them can degrade Algorithm 1 The complete training process of AMT-GAN Input: Source image set X; reference image set Y ; target image z; generator G; regularization module H; discriminators D X , D Y ; local models M ; optimizer Adam. Parameter: Iterations T ; hyper-parameters Λ.
Randomly select source image x ∈ X and reference image y ∈ Y as the input of generator G;

4:
Updating D X and D Y with fixed G and H; 5: Calculate L D in Eq. (12); 6: Updating G with fixed D and H; 9: Calculate L G in Eq. (13); 10: ω G ← Adam(ω G , L G );

11:
Updating H with fixed G and D; 12: Calculate L H in Eq. (14); 13: the attack strength of adversarial examples whose adversarial modifications have faint transferability among different black-box models.
Accordingly, the adversarial attack loss of H is defined as: , y)))] note that the input diversity is not included as it is unnecessary for H to own transferability. Auxiliary Objectives. The histogram matching [23], denotes as HM (x, y), is usually used to simulate the color distribution of reference y while preserves the content information of x. Here, we use this objective function to ensure the makeup similarity on lips, eye shadows, and face regions as well as the reconstruction ability of H. In detail, the makeup loss is defined as: In addition, the generator G and the regularization module H are expected to preserve the original content and style information when the reference image is the source image itself, which is called self-reconstruction. This objective is significantly important for the generator G to maintain the structure information of resource images and avoid distortion of face attributes. The self-reconstruction path is defined as: G(x, x)), x) + ∥ H(G(y, y)) − y ∥ 1 +LP IP S(H (G(y, y)), y), (11) where the LPIPS [42] function measures perceptual similarity between two images.
Total Loss. The total loss for D X and D Y is as follow: The total loss of G is defined as: and the total loss of H is defined as: where Λ = (λ gan , λ reg , λ adv , λ make , λ idt ) represents the hyper-parameters. The entire training process is illustrated in Alg. 1.

Experimental Setting
Implementation details. We construct the architecture of G, D X , and D Y in AMT-GAN following [19]. For the training process, the hyper-parameters λ GAN , λ reg , λ adv , λ make , and λ idt are set to be 10, 10, 5, 2, and 5 respectively. We train the AMT-GAN by an Adam optimizer [21] with the learning rate of 0.0002, and set exponential decay rates as (β 1 , β 2 ) = (0.5, 0.999). Competitors.
We implement multiple benchmark schemes of adversarial attack, including PGD [24], MI-FGSM [7], TI-DIM [8], TIP-IM [40], and Adv-Makeup [41], to serve as the competitors for comparison. Note that PGD, MI-FGSM, and TI-DIM are very famous for their strong attack ability, TIP-IM is a very recent work which leverages adversarial examples to protect facial privacy, and Adv-makeup is the most relative scheme to ours which also exploits the makeup transfer to generate adversarial face images with transferability.
Datasets. Following [2,19], the Makeup Transfer (MT) dataset [23] is used as the training dataset, which consists of 1115 non-makeup images and 2719 makeup images. We choose two datasets as our test sets: (1) CelebA-HQ [20] is a widely used face image dataset with high quality. For the testing, we select a subset of CelebA-HQ, which contains 1, 000 face images with different identities. (2) LADNdataset [12] is a makeup dataset which contains 333 nonmakeup images and 302 makeup images. We use 332 nonmakeup images as the test images. We divide all the test images into 4 groups and aim images in each group to the same target identity.
Evaluation metrics. Following existing impersonation attacks [37,41], we use attack success rate (ASR) to evaluate the attack ability of different methods. We calculate the ASR at FAR@0.01 for black-box testing. For commercial APIs, we directly record the confidence scores returned by FR servers. A higher confidence score represents that the victim FR API believes the two input images are of the same person with a higher probability. We also leverage FID [15], PSNR(dB), and SSIM [34] to evaluate the image quality. FID measures the distance between two data distributions, which is often used to investigate whether a generated dataset is as natural as the dataset extracted from the real world. PSNR and SSIM are widely-used methods to measure the difference between two images.
All of our experiments are conducted on RTX3090 GPU 24GB * 1. For more experimental results, please refer to our supplementary.

Comparison Study
Evaluations on black-box attacks. Tab. 1 shows blackbox attacks on four different pre-trained models which have high accuracy on public datasets. For each target model, the other three models will serve as the ensemble training model. Note that for Adv-makeup these three models will serve as the meta-learning model. The results show that AMT-GAN has a strong attack ability in the black-box setting.
Evaluations on image quality. Tab. 2 shows the quantitative evaluations on image quality. Notably, compared with TIP-IM, although our method have a worse performance in terms of PSNR(db) and SSIM, AMT-GAN performs better for the FID result. This shows that the images generated by our method have more natural appearances than TIP-IM, although they get more information changed. This verifies our insight that arranging perturbations, instead of simply restricting them, is more important. We further attach the results of PSGAN [19], which is the most famous makeup transfer scheme, to show that it is normal to obtain similar evaluation results with these three metrics in the field of makeup transfer.   In addition, Adv-makeup seems to behave well in all the quantitative evaluations. However, it has an extremely low attack success rate as demonstrated in Tab. 1. Furthermore, we give a qualitative comparison of visual image quality between Adv-Makeup and AMT-GAN, both of which construct adversarial face images based on makeup transfer. As shown in Fig. 4, the images generated by Adv-Makeup have sharp margins among the eyes region. On the contrary, AMT-GAN has a more realistic makeup style with smooth details. This is because Adv-makeup only changes the eyes region of original faces in a patch-based way, which leads to a good performance on quantitative evaluations, but leaves insufficient black-box attack strength and unresolved margin problem.

Ablation Studies
Regularization module. Here we demonstrate the importance of the regularization module in maintaining the effectiveness and stability of AMT-GAN. As shown in Fig. 6 FID(↓) PSNR(↑) SSIM(↑) Adv-Makeup [41] 4 and Tab. 2, in the absence of the regularization module, the generator is likely to generate images with worse image quality, which indicates that the mappings between style domains are damaged to some degree. We owe this to the fact that the adversarial toxicity has poisoned the cycle reconstruction path. By applying the regularization module, the regularized cycle consistency loss can make the outputs of the generator more natural.
Style-robust makeup transfer. It is commonly expected that we can generate adversarial images with satisfied visual quality for any given makeup style. Thus it is desired to evaluate the impact of different references. We randomly choose 10 images from MT-dataset and LADNdataset with different makeup styles as the references for testing. As illustrated in Fig. 7, AMT-GAN is robust to the changes of makeup style, where the targeted adversarial  face images maintain a good balance between the content of source images and the makeup style of references. The right figure of Fig. 7 shows that the changes of references have weak impact on the attack strength.

Limitations and Future Work
Although AMT-GAN shows effectiveness on attacking commercial APIs, it tends to have a higher attack strength and a better visual quality in images of female, which is caused by the unbalance of gender in makeup transfer training dataset (e.g., MT-dataset [23]). We believe that this problem can be solved by developing a more general and comprehensive training dataset.
Another problem with AMT-GAN is that the structure information sometimes gets slightly unaligned although we have designed corresponding objective functions for alleviation. The same problem also exists in the field of makeup transfer [12,19], and may become worse in generating adversarial examples. We leave this point to our future works.
Finally, the experimental results in Tab. 2 show that existing popular metrics used to evaluate the quality of images are unsuitable for the scenario of makeup transfer. New metrics are needed to evaluate whether a face image appears more natural than another one. Besides, it is still desirable for us to further improve the visual quality of adversarial faces. It is amazing to restrict the regions of makeup transfer to a small area (e.g., eyes), which can also preserve a high attack success rate. We also leave these to our future works.

Conclusion
In this paper, focusing on protecting facial privacy against malicious deep face recognition (FR) models, we propose AMT-GAN to construct adversarial examples that achieve a stronger attack ability in the black-box setting, while maintaining a better visual quality. AMT-GAN is able to generate adversarial face images with makeup transferred from any reference image. The experiments over multiple datasets and target models show that AMT-GAN is highly effective towards different open-source FR models and commercial APIs, and achieves a satisfied balance between the visual quality of adversarial face images and their attack strength. Original Images AMT-GAN w/oH Outputs

AMT-GAN Outputs
Original Images AMT-GAN w/oH Outputs

AMT-GAN Outputs
Original Images AMT-GAN w/oH Outputs AMT-GAN Outputs Figure 9. Visual results of ablation study about regularization module. The images from the generator trained without the regularization module suffer from fake shadows, distortion of structure information, unaligned makeup position, etc., which are typical indications of weak domain mappings, caused by damaged cycle consistency loop by adversarial toxicity in the training phase. As the visual results here and the quantitative results in our paper have shown, the regularization module can eliminate or alleviate this phenomenon. Notably, as makeup transfer is still in development and may have some little issues, a small minority of images (no matter with or without regularization module) may have asymmetrical eye-shadow, which is beyond the scope of our investigation in this paper. Please zoom in for a better view.