{'fraction_non_alphanumeric': 0.040536122915985615, 'fraction_numerical': 0.01939631687915441, 'mean_word_length': 4.82497619803237, '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': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Pre-training strategies and datasets for facial representation learning

What is the best way to learn a universal face representation? Recent work on Deep Learning in the area of face analysis has focused on supervised learning for specific tasks of interest (e.g. face recognition, facial landmark localization etc.) but has overlooked the overarching question of how to find a facial representation that can be readily adapted to several facial analysis tasks and datasets. To this end, we make the following 4 contributions: (a) we introduce, for the first time, a comprehensive evaluation benchmark for facial representation learning consisting of 5 important face analysis tasks. (b) We systematically investigate two ways of large-scale representation learning applied to faces: supervised and unsupervised pre-training. Importantly, we focus our evaluations on the case of few-shot facial learning. (c) We investigate important properties of the training datasets including their size and quality (labelled, unlabelled or even uncurated). (d) To draw our conclusions, we conducted a very large number of experiments. Our main two findings are: (1) Unsupervised pre-training on completely in-the-wild, uncurated data provides consistent and, in some cases, significant accuracy improvements for all facial tasks considered. (2) Many existing facial video datasets seem to have a large amount of redundancy. We will release code, and pre-trained models to facilitate future research.


Introduction
Supervised learning with Deep Neural Networks has been the standard approach to solving several Computer Vision problems over the recent past years [28,57,65,30,41]. Among others, this approach has been very successfully applied to several face (1) collection of large-scale unlabelled facial dataset, (2) (task agnostic) network pre-training for universal facial representation learning, and (3) facial task-specific fine-tuning. Our main result is that even when training on a completely in-the-wild, uncurated dataset downloaded from Flickr, this generic pipeline provides consistent and, in some cases, significant accuracy improvements for all facial tasks considered.
analysis tasks including face detection [7,88,18,38], recognition [63,74,75,84,17] and landmark localization [3,4,94,76]. For example, face recognition was one of the domains where even very early attempts in the area of deep learning demonstrated performance of super-human accuracy [53,68]. Beyond deep learning, this success can be largely attributed to the fact that for most face-related application domains, large scale datasets could be readily collected and annotated, see for example [8,4].
There are several concerns related to the above approach. Firstly, from a practical perspective, collecting and annotating new large scale face datasets is still necessary; examples of this are context-dependent domains like emotion recognition [24,69,70] and surveillance [6,22], or new considerations of existing problems like fair face recognition [59,66]. Secondly, from a methodological point of view, it is unsatisfactory for each application to require its own large-scale dataset, although there is only one object of interest -the human face.
To this end, we investigate, for the first time to our knowledge, the task of large-scale learning universal facial representation in a principled and systematic manner. In particular, we shed light to the following research questions: -"What is the best way to learn a universal facial representation that can be readily adapted to new tasks and datasets? Which facial representation is more amenable to few-shot facial learning?" -"What is the importance of different training dataset properties (including size and quality) in learning this representation? Can we learn powerful facial feature representations from uncurated facial data as well?" To address this, we make the following 4 contributions: 1. We introduce, for the first time, a comprehensive and principled evaluation benchmark for facial representation learning consisting of 5 important face analysis tasks, namely face recognition, AU recognition, emotion recognition, landmark localization and 3D reconstruction.
2. Within this benchmark, and for the first time, we systematically evaluate 2 ways of large-scale representation learning applied to faces: supervised and unsupervised pre-training. Importantly, we focus our evaluations on the case of few-shot facial learning where only a limited amount of data is available for the downstream tasks. 3. We systematically evaluate the role of datasets in learning the facial feature presentations by constructing training datasets of varying size and quality.
To this end, we considered ImageNet, several existing curated face datasets but also a new in-the-wild, uncurated face dataset downloaded from Flickr. 4. We conducted extensive experiments to answer the aforementioned research questions and from them we were able to draw several interesting observations and conclusions.
Our main findings are: (a) Even when training on a completely in-the-wild, uncurated dataset downloaded from Flickr, unsupervised pre-training pipeline provides consistent and, in some cases, significant accuracy improvements for all facial tasks considered. (b) We found that many existing facial video datasets seem to have a large amount of redundancy. Given that unsupervised pre-training is cheap and that the cost of annotating facial datasets is often significant, some of our findings could be particularly important for researchers when collecting new facial datasets is under consideration. Finally, we will release code and pretrained models to facilitate future research.

Related Work
Facial transfer learning: Transfer learning in Computer Vision typically consists of ImageNet pre-training followed by fine-tuning on the downstream task [57,16,11]. Because most recent face-related works are based on the collection of larger and larger facial datasets [25,4,47], the importance of transfer learning has been overlooked in face analysis and, especially, the face recognition literature. ImageNet pre-training has been applied to face analysis when training on small datasets is required, for example for emotion recognition [48], face anti-spoofing [51] and facial landmark localization [76]. Furthermore, the VGG-Face [50] or other large face datasets (e.g. [47]) have been identified as better alternatives by several works, see for example [20,31,83,33,56,55,51,35,39]. To our knowledge, we are the first to systematically evaluate supervised network pre-training using both ImageNet and VGG-Face datasets on several face analysis tasks. Facial datasets: The general trend is to collect larger and larger facial datasets for the face-related task in hand [25,4,47]. Also it is known that label noise can severely impact accuracy (e.g. see Table 6 of [17]). Beyond faces, the work of [43] presents a study which shows the benefit of weakly supervised pre-training on much larger datasets for general image classification and object detection. Similarly, we also investigate the impact of the size of facial datasets on unsupervised pre-training for facial representation learning. Furthermore, one of our main results is to show that a high-quality facial representation can be learned even when a completely uncurated face dataset is used.
Few-shot face analysis: Few-shot refers to both low data and label regime. There is very little work in this area. To our knowledge, there is no prior work on few-shot face recognition where the trend is to collect large-scale datasets with millions of samples (e.g. [25]). There is no systematic study for the task of emotion recognition, too. There is only one work on few-shot learning for facial landmark localization, namely that of [2] which, different to our approach, proposes an auto-encoder approach for network pre-training. To our knowledge, our evaluation framework provides the very first comprehensive attempt to evaluate the transferability of facial representations for few-shot learning for several face analysis tasks. Semi-supervised face analysis: Semi-supervised learning has been applied to the domain of Action Unit recognition where data labelling is extremely laborious [90,92,91]. Although these methods work with few labels, they are domain specific (as opposed to our work), assuming also that extra annotations are available in terms of "peak" and "valley" frames which is also an expensive operation. Unsupervised learning: There is a very large number of recently proposed unsupervised/self-supervised learning methods, see for example [80,9,86,46,26,12,10,13,23]. To our knowledge, only very few attempts from this line of research have been applied to faces so far. The authors of [78] learn face embeddings in a selfsupervised manner by predicting the motion field between two facial images. The authors of [72] propose to combine several facial representations learned using an autoencoding framework. In this work, we explore learning facial representations in an unsupervised manner using the state-of-the-art method of [10] and show how to effectively fine-tune the learned representations to the various face analysis tasks of our benchmark.

Method
Supervised deep learning directly applied to large labelled datasets is the de facto approach to solving the most important face analysis tasks. In this section, we propose to take a different path to solving face analysis based on the following 2stage pipeline: (task agnostic) network pre-training followed by task adaptation. Importantly, we argue that network pre-training should be actually considered as part of the method and not just a simple initialization step. We explore two important aspects of network pre-training: (1) the method used, and (2) the dataset used. Likewise, we highlight hyper-parameter optimization for task adaptation as an absolutely crucial component of the proposed pipeline. Finally, we emphasize the importance of evaluating face analysis on low data regimes, too. We describe important aspects of the pipeline in the following sections.

Network Pre-training
Supervised pre-training of face networks on ImageNet or VGG datasets is not new. We use these networks as strong baselines. For the first time, we comprehensively evaluate their impact on the most important face analysis tasks.
Unsupervised pre-training: Inspired by [23,46,27,10], we explore, for the first time in literature, large-scale unsupervised learning on facial images to learn a universal, task-agnostic facial representation. To this end, we adopt the recently proposed SwAV [10] which simultaneously clusters the data while enforcing consistency between the cluster assignments produced for different augmentations of the same image. The pretext task is defined as a "swapped" prediction problem where the code of one view is predicted from the representation of another: L(z 0 , z 1 ) = ℓ(z 0 , q 1 ) + ℓ(z 1 , q 0 ), where z 0 , z 1 are the features produced by the network for two different views of the same image and q 0 , q 1 their corresponding codes computed by matching these feature using a set of prototypes. ℓ is a cross-entropy (with temperature) loss. See supplementary material for training details.

Pre-training Datasets
With pre-training being now an important part of the face analysis pipeline, it is important to investigate what datasets can be used to this end. We argue that supervised pre-training is sub-optimal due to two main reasons: (a) the resulting models may be overly specialized to the source domain and task (e.g. face recognition pre-training) or be too generic (e.g. ImageNet pre-training), and (b) the amount of labeled data may be limited and/or certain parts of the natural data distribution may not be covered. To alleviate this, for the first time, we propose to explore large scale unsupervised pre-training on 4 facial datasets of interest, under two settings: using curated and uncurated data. The later departs from the common paradigm that uses carefully collected data that already includes some forms of explicit annotations and post-processing. In contrast, in the later case, all acquired facial images are used.
Uncurated Datasets For a more realistic and practical scenario, we go beyond sanitized datasets, by creating a completely uncurated, in-the-wild, dataset, coined Flickr-Face, of ∼ 1.5M facial images by simply downloading images from Flickr (using standard search keywords like "faces", "humans", etc.) and filtering them with a face detector [18] (the dataset will be made available). In total we collected 1.793.119 facial images. For more details, see supp. material.

Facial Task Adaptation
End facial tasks: To draw as safe conclusions as possible, we used a large variety of face tasks (5 in total) including face recognition (classification), facial Action Unit intensity estimation (regression), emotion recognition in terms of valence and arousal (regression), 2D facial landmark localization (pixel-wise regression), and 3D face reconstruction (GCN regression). For these tasks, we used, in total, 10 datasets for evaluation purposes. Adaptation methods: We are given a pre-trained model on task m, composed of a backbone g(.) and a network head h m (.). The model follows the ResNet-50 [28] architecture. We considered two widely-used methods for task adaptation: (a) Network finetuning adapts the weights of g(.) to the new task m i . The previous head is replaced with a task-specific head h mi (.) that is trained from scratch. (b) Linear layer adaptation keeps the weights of g(.) fixed and trains only the new head h mi (.). Depending on the task, the structure of the head varies. This will be defined for each task in the corresponding section. See also Section 5.

Hyper-parameter optimization:
We find that, without a proper hyperparameters selection for each task and setting, the produced results are often misleading. In order to alleviate this and ensure a fair comparison, we search for the following optimal hyper-parameters: (a) learning rate, (b) scheduler duration and (c) backbone learning rate for the pre-trained ResNet-50. This search is repeated for each data point defined by the tuple (task, dataset, pre-training method and % of training data). In total, this yields in an extraordinary number of experiments for discovering the optimal hyperparameters. Fig. 2 shows the importance of hyperparameters on accuracy for the task of facial landmark localization. In particular, for 1 specific value of learning rate, about 40 different combinations of scheduler duration and backbone relative's learning rate are evaluated. 24 of those combinations are placed on the perimeter of the figure. The 3 closed curves represent the Normalized Mean Error (NME) for each hyperparameter combination for each pre-training method. We observe that accuracy greatly varies for different hyperparameters. We explore, for the first time, evaluating the face models using a varying percentage of training data for each face analysis task. Specifically, beyond the standard evaluation using 100% of training data, we emphasize the importance of the low data regime, in particular 10% and 2%, which has a clear impact when new datasets are to be collected and annotated. The purpose of the proposed evaluation is not only to show which method works the best for this setting but also to draw interesting conclusions about the redundancy of existing facial datasets. See also Section 6.

Self-distillation for Semi-supervised Learning
The low data regime of the previous section refers to having both few data and few labels. We further propose to investigate the case of semi-supervised learning [37, 82,81,13] where a full facial dataset has been collected but only few labels are provided. To this end, we propose a simple self-distillation technique which fully utilizes network pre-training: we use the fine-tuned network to generate in an online manner new labels for training an identically sized student model on unlabeled data. The student is initialized from a pre-trained model trained in a fully unsupervised manner. The self-distillation process is repeated iteratively for T steps, where, at each step, the previously trained model becomes the teacher. Formally, the knowledge transfer is defined as argmin θt L((f (x, θ t−1 ), f (x, θ t ))), where x is the input sample, θ t−1 and θ t are the parameters of the teacher and the student, respectively, and L is the task loss (e.g. pixel-wise ℓ 2 loss for facial landmark localization).

Ablation Studies
In this section, we study and answer key questions related to our approach. Fine-tuning vs. linear adaptation: Our results, provided in Table 7, show that linear adaptation results in significant performance degradation. As our ultimate goal is high accuracy for the end facial task, linear adaptation is not considered for the rest of our experiments. How much facial data is required? Unlike supervised, unsupervised pretraining does not require labels and hence it can be applied easily to all types of combinations of facial datasets. Then, a natural question arising is how much data is needed to learn a high-quality representation. To this end, we used 3 datasets of varying size. The first one, comprising ∼ 3.3M images, is the original VGG-Face dataset (VGG-Face). The second comprises ∼ 1M images randomly selected from VGGFace2 (VGG-Face-small). The last one, coined as Large-Scale-Face, comprises over 5M images, and is obtained by combining VGG-Face, 300W-LP [93], IMDb-face [73], AffectNet [47] and WiderFace [85]. For more details regarding the datasets see Section 3.2. We trained 3 models on these datasets and evaluated them for the tasks of facial landmark localization, AU intensity estimation and face recognition. As the results from Table 2 show, VGG-Face vs. VGG-Face-small yields small yet noticeable improvements especially for the case of 2% of labelled data. We did not observe further gains by training on Large-Scale-Face. While the previous section investigated the quantity of data required, it did not explore the question of data quality. While we did not use any labels during the unsupervised pretraining phase, one may argue that all datasets considered are sanitized as they were collected by human annotators with a specific task in mind.
In this section, we go beyond sanitized datasets, by experimenting with the newly completely uncurated, inthe-wild, dataset, coined Flickr-Face, introduced in Section 3.2. We trained a model on it and evaluated it on the same tasks/datasets of the previous section. Table 2 shows some remarkable results: the resulting model is on par with the one trained on the full VGG-Face dataset (Section 5 shows that it outperforms all other pre-training methods, too). We believe that this result can pave a whole new way to how practitioners, both in industry and academia, collect and label facial datasets for new tasks and applications. Pre-training task or data? In order to fully understand whether the aforementioned gains are coming from the unsupervised task alone, the data, or both, we pre-trained a model on ImageNet dataset using both supervised and unsupervised pre-training. Our experiments showed that both models performed similarly (e.g. 4.97% vs 5.1% on 300W@2% of data) and significantly more poorly than models trained on face datasets. We conclude that both unsupervised pre-training and data are required for high accuracy. Effect of unsupervised method: Herein, we compare the results obtained by changing the unsupervised pre-training method from SwAV to Moco-v2 [27]. Table 1 shows that SwAV largely outperforms Moco-v2, emphasizing the importance of utilizing the most powerful available unsupervised method. Note, that better representation learning as measured on imagenet, doesn't equate with better representation in general [14], hence way it's important to validate the performance of different methods for faces too. Furthermore, we evaluated SwAV models using different batch-sizes which is shown to be an important hyper-parameter. We found both models to perform similarly. See SwAV (256) in Table 1 for the model trained with batch-size 256. With small batch-size training requires less resources, yet we found that it was prolonged by 2×. Self-distillation for semi-supervised learning: Herein, we evaluate the effectiveness of network pre-training on self-distillation (see Section 3.5) for the task of semi-supervised facial landmark localization (300W).
We compare unsupervised vs. supervised pre-training on VGG-Face as well as training from scratch. These networks are fine-tuned on 300W using 100% and, the most interesting, 10% and 2% of the data. Then, they are used as students for self-distillation. Fig. 4 clearly shows the effectiveness of unsupervised student pre-training. Furthermore, a large pool of unlabelled data was formed by 300W, AFLW [34], WFLW [79] and COFW [5,21]), and then used for self-distillation. Fig. 3 (left) shows the impact on the accuracy of the final model by adding more and more unlabelled data to the self-distillation process. Clearly, self-distillation based on network pretraining is capable of effectively utilizing a large amount of unlabelled data. Finally, Fig. 3 (right) shows the impact of the number of self-distillation steps on accuracy.
Other supervised pre-training: Our best supervised pre-trained network is that based on training CosFace [75] on VGG-Face. Herein, for completeness, we compare this to supervised pre-training on another task/dataset, namely facial landmark localization. As Table 3 shows, the supervised pre-trained model on VGG-Face outperforms it by large margin. This is expected due to the massive size of VGG-Face.

Main Results
In this section, we thoroughly test the generalizability of the universal facial representations by adapting the resulting models to the most important facial analysis tasks. The full training and implementation details for each of this tasks is detailed in the corresponding sub-section. Training code will be made available.
Data & label regime: For all datasets and tasks, we used fine-tuning for network adaptation using 3 data and label regimes: full (100%), low (10%) and very low (2% or less). For all low data scenarios, we randomly sub-sampled a set of annotated images without accounting for the labels (i.e. we don't attempt to balance the classes). Once formed, the same subset is used for all subsequent experiments to avoid noise induced by different sets of images. For face recognition, we deviated slightly from the above setting by enforcing that at least 1/4 of the identities are preserved for the very low data regime of 2%. This is a consequence of the training objective used for face recognition that is sensitive to both the number of identities and samples per identity. Models compared: For unsupervised network pre-training, we report the results of two models, one trained on the full VGG-Face and one on Flickr-Face. These models are denoted as Ours (VGG-F) and Ours (Flickr-F). These models are compared with supervised pre-training on ImageNet and VGG-Face (denoted as VGG-F), as well as the model trained from scratch. Comparison with SOTA: Where possible, we also present the results reported by state-of-the-art methods for each task on the few-shot setting. Finally, for each task, and, to put our results into perspective, we report the accuracy of a stateof-the-art method for the given task. We note however, that the results are not directly comparable, due to different networks, losses, training procedure, and even training datasets.

Face Recognition
For face recognition, we fine-tuned the models on the VGGFace [8] and tested them on the IJB-B [77] and IJB-C [45] datasets. The task specific head h(.) Results are shown in Table 4. Both Ours (VGG-F) and Ours (Flickr-F) perform similarly and both they outperform the other baselines by large margin for the low (10%) and very low (2%) data regimes. For the latter case, the accuracy drops significantly for all cases. We fine-tuned the pre-trained models for facial landmark localization on 300W [60], AFLW-19 [34], WFLW [79] and COFW-68 [5,21] reporting results in terms of NME i-o [60] or NME diag [34]. We followed the current best practices based on heatmap regression [4]. In order to accommodate for the pixel-wise nature of the task, the task specific head h(.) is defined as a set of 3 1 × 1 conv. layers with 256 channels, each interleaved with bilinear upsampling operations for recovering part of the lost resolution. Additional high resolution information is brought up via skip connections and summation from the lower part of the network. Despite the simple and un-optimized architecture we found that the network performs very well, thanks to the strong facial representation learned. All models were trained using a pixel-wise MSE loss. For full training details, see supp. material. Results are shown in Table 6: unsupervised pre-training (both models) outperform the other baselines for all data regimes, especially for the low and very low cases. For the latter case, Ours (VGG-F) outperforms Ours (Flickr-F) probably because Ours (VGG-F) contains a more balanced distribution of facial poses. The best supervised pre-training method is VGG-F showing the importance of pre-training on facial datasets. Furthermore, Table 5 shows comparison with few very recent works on fewshot face alignment. Our method scores significantly higher across all data regimes and datasets tested setting a new state-of-the-art despite the straightforward network architecture and the generic nature of our method.

Action Unit (AU) Intensity Estimation
We fine-tuned and evaluated the pre-trained models for AU intensity estimation on the corresponding partitions of BP4D [71,89] and DISFA [44] datasets. The network head h(.) is implemented using a linear layer. The whole network is trained to regress the intensity value of each AU using an ℓ 2 loss. We report results in terms of intra-class correlation (ICC) [64]. For training details, see supplementary material. Results are shown in Table 7: unsupervised pre-training (both models) outperform the other baselines for all data regimes. Notably, our models achieve very high accuracy even for the case when 2% of data was used. Supervised pre-training on VGG-F also works well.
Furthermore, Table 8 shows comparison with very recent works on semisupervised AU intensity estimation. We note that these methods had access to all training data; only the amount of labels was varied. Our methods, although trained under both very low data and label regimes, outperformed them by a significant margin.

Emotion Recognition
We observe similar behaviour on the well-established AffectNet [47] for emotion recognition. For details and results, see supplementary material.

3D Face Reconstruction
We fine-tuned all models on the 300W-LP [93] dataset and tested them on AFLW2000-3D [93]. Our task specific head is implemented with a GCN based on spiral convolutions [40]. The network was trained to minimise the ℓ 1 distance between the predicted and the ground truth vertices.
Training details: Since 300W-LP has a small number of identities, during training we randomly augment the data using the following transformations: scaling(0.85 × −1.15×), in-plane rotation (±45 o ), and random 10% translation w.r.t image width and height. Depending on the setting, we trained the model between 120 and 360 epochs using a learning rate of 0.05, a weight decay of 10 −4 and SGD with momentum (set to 0.9). All models were trained using 2 GPUs.
Results are shown in Table 9: it can be seen that, for all data regimes, our unsupervised models outperform the supervised baselines. Supervised pre-training on VGG-F also works well. For more results, see supplementary material.

Discussion and Conclusions
Several conclusions can be drawn from our results: Unsupervised pre-training followed by task-specific fine-tuning provides very strong baselines for face analysis. For example, we showed that such generically built baselines outperformed recently proposed methods for few-shot/semi-supervised learning (e.g. for facial landmark localization and AU intensity estimation) some of which are based on quite sophisticated techniques. Moreover, we showed that unsupervised pretraining largely boosts self-distillation. Hence, it might be useful for newlyproposed task-specific methods to consider such a pipeline for both development and evaluation especially when newly-achieved accuracy improvements are to be reported. Furthermore, these results can be achieved even by simply training on uncurated facial datasets that can be readily downloaded from image repositories. The excellent results obtained by pre-training on Flickr-Face are particularly encouraging. Note that we could have probably created a better and more balanced dataset in terms of facial pose by running a method for facial pose estimation.
When new datasets are to be collected, such powerful pre-trained networks can be potentially used for minimizing data collection and label annotation labour. Our results show that many existing datasets (e.g. AFLW, DISFA, BP4D, even AffectNet) seem to have a large amount of redundancy. This is more evident for video datasets (e.g. DISFA, BP4D).
Note that by no means our results imply or suggest that all face analysis can be solved with small labelled datasets. For example, for face recognition, it was absolutely necessary to fine-tune on the whole VGG-Face in order to get high accuracy. A Implementation details

A.1 Unsupervised pretraining
For the unsupervised pretraining, similarly with [10] we trained our model on 64 GPUs using a batch size of 4096 and Synchronized Batch Normalization. The network was trained for 200 epochs using a weight decay of 10 −6 and learning rate of 4.8 that was decayed toward 0.045 using a Cosine Scheduler [42]. During the first 10 epochs the learning rate is increased toward the target value using a linear scheduler. In all experiments, unless otherwise specified, we kept the temperature parameter to 0.1 and the Sinkhorn regularization parameters to 0.05. Each input sample was augmented into 2 views at a resolution of 224×224px and 6 at a resolution of 96 × 96px. The model was trained using the LARS [87] optimizer and was implemented in PyTorch [52]. Datasets and data preparation: All images are detected using [18] and then cropped based on the produced bounding-box so that the face will take approx. 190px on a 256 × 256px image. Unless otherwise specified all the data used for unsupervised pre-training were processed in the same manner.

A.2 Downstream task implementation details
Herein, we present the implementation details for each downstream task used in the main body to evaluate the efficacy of the facial representation learned. We note that in all cases the images were normalized in accordance with the training procedure of the pre-trained backbone model used as initialization.
Face recognition Following the best practices [75,17], all images were normalized and aligned using the provided 5 landmarks. During training, the only augmentation applied was random horizontal flipping. Depending on the data regime, the models were trained between 18 and 54 epochs using a batch size of 512 and learning rate of 0.1. The weight decay was set to 0.0005 and the models were optimized using SGD with momentum (set to 0.9). For the cosface loss, the margin was set to 0.35. All models were trained on 8 GPUs.
Facial Landmark Localization The facial landmark localization pipeline was implemented following [4,67]. During training, we applied the following augmentations randomly: rotation (between ±30 o ), horizontal flipping, scaling (0.85 × −1.15×) and color jittering. Depending on the data regime, dataset and pretrained model, as detailed in the main body of the work, we trained the models between 60 and 480 epochs using a learning rate of 0.0001, a batch size of 24, a weight decay of 10 −5 and Adam optimizer [32] (β 1 = 0.5, β 2 = 0.99). All the models were trained using a pixel-wise ℓ 2 on a single GPU.
Action Unit (AU) Intensity Estimation For AU intensity estimation, we adopted a similar augmentation strategy with the one used for face alignment, mainly we applied random rotation (±30 o ), random horizontal flipping and scale jittering (0.85 × −1.15×), Gaussian blurring with a kernel size between 5 and 10px and a probability of 0.4 and colour jittering. Depending on the setting, the models were trained between 60 and 320 epochs. The learning rate was typically set to 0.0001, the weight decay to 0.000005 and the batch size to 48. The models were optimized using Adam (β 1 = 0.5, β 2 = 0.99) and trained on 2 GPUs.
Emotion recognition For valence and arousal estimation, we applied the same augmentation strategies as for AU Intensity Estimation with the exception of Gaussian blurring. Depending on the setting, the models were trained between 60 and 240 epochs using a batch size of 32, a learning rate of 0.1, weight decay of 10 −4 and Adam optimizer(β 1 = 0.5, β 2 = 0.99). All models were trained on a single GPU.
3D Face reconstruction Since 300W-LP has a small number of identities, during training we randomly augment the data using the following transformations: scaling(0.85 × −1.15×), in-plane rotation (±45 o ), and random 10% translation w.r.t image width and height. Depending on the setting, we trained the model between 120 and 360 epochs using a learning rate of 0.05, a weight decay of 10 −4 and SGD with momentum (set to 0.9). All models were trained using 2 GPUs.

A.3 Data sampling
For all low data scenarios, we randomly subsampled a set of annotated images without accounting for the labels (i.e. we don't attempt to balance the classes).
Once formed, the same subset is used for all subsequent experiments to avoid noise induced by different sets of images. For face recognition where the loss attempts to minimize the intra-class while maximising the inter-class distance and its sensitivity to both the number of identities and samples per identity, we deviated slightly from the above setting by enforcing that at least 1/4 of the identities are preserved for the very low data regime of 2%.  [85]. Therefore, the dataset combines a set of datasets originally collected for facial recognition, face alignment, emotion recognition and face detection:

B Curated Datasets
300W-LP [93] is a face alignment dataset constructed by warping into large poses, from −90 o to 90 o , the ∼ 4000 near-frontal images from the 300W [61] dataset. IMDb-face [73] is a large-scale noise-controlled dataset for face recognition, originally containing 1.7M faces with 59,000 identities which were manually cleaned by the authors from 2.0M raw images. All images were obtained by downloading data from the IMDb website. AffectNet [47] is a in-the-wild facial expression dataset consisting of more than 1M images collected by queering results from the internet using 1250 emotion related keywords. Out of this, 440,000 images were manually annotated with 7 discrete facial expressions and the intensity of valence and arousal. WiderFace [85] is a face detection benchmarking dataset consisting of 393,703 faces sourced from 32,203 images. The faces exhibit a high degree of variability in terms of scale, pose and occlusion.
In total we collected 1.793.119 facial images with a bounding box size that follows the distribution shown in Fig. 5. We release the code used to download the images from Flickr thus allowing reproducing the dataset.

D Additional results
Herein, we report results for AU intensity estimation and emotion recognition (see Section D.1 and Tables 10, 11 and 12).

D.1 Emotion Recognition
We fine-tuned the models for valence and arousal estimation on the well-established AffectNet [47]. We report results in terms of RMSE and CCC [58], SAGR and PCC. The task specific head h(.) is a linear layer that regresses the valence and arousal values and also predicts the basic emotion classes. The network was trained to jointly minimise the RMSE and CCC losses for valence and arousal, and the cross-entropy loss for classification.
Results are shown in Table 12 again, for all data regimes, our unsupervised models outperform the supervised baselines.

D.2 Additional 3D Face Reconstruction results
Furthermore, in Fig. 6 we report results on the Florence dataset for the task of 3D face reconstruction.
(a) Trained on 100% of the data.
(b) Trained on 10% of the data.
(c) Trained on 2% of the data.