Laplace Landmark Localization
Joseph P Robinson, Yuncheng Li, Ning Zhang, Yun Fu, and Sergey Tulyakov
Introduction
To localize landmarks is to find pixel locations in visual media corresponding to points of interest. In face alignment, these points correspond to face parts. For bodies and hands, landmarks correspond to projections of joints on to the camera plane . Historically, landmark detection and shape analysis tasks date back decades: from Active Shape Models to Active Appearance Models , with the latter proposed to analyze and detect facial landmarks.
There are two critical shortcomings of the methodology discussed above. (1) These losses only penalize for differences in mean values in coordinate space, and with no explicit penalty for the variance of heatmaps. Thus, the generated heatmaps are highly scattered: high variance means low confidence. (2) This family of objectives is entirely dependent on paired training samples (i.e. ). However, obtaining high-quality data for this is expensive and challenging. Not only does each sample require several marks, but unintentional, and often unavoidable, labels are of pixel-level marks subject to human error (i.e. inaccurate and imprecise ground-truth labels). All the while, plenty of unlabeled face data are available for free.
In this paper, we propose a practical framework to satisfy the two shortcomings. Thus, our first contribution alleviates the first issue. For this, we introduce a new loss function that penalizes for the difference in distribution defined by location and scatter (Fig. 1). Independently, we treat landmarks as random variables with distributions, from which the KL-divergence between the predicted and ground-truth distributions defines the loss. Hence, the goal is to match distributions, parameterized by both a mean and variance, to yield heatmaps of less scatter (i.e. higher confidence). We call this objective the LaplaceKL loss.
Our second contribution is an adversarial training framework for landmark localization. We propose this to tackle the problem of paired data requirements by leveraging unlabeled data for free. We treat our landmark detection network as a generator () of normalized heatmaps (i.e. probability maps) that pass to the discriminator () to learn to distinguish between the true and generated heatmaps. This allows for large amounts of unlabeled data to further boost the performance of our LaplaceKL-based models. In the end, proves to improve the predictive power of the LaplaceKL-based model by injecting unlabeled data into the pipeline during training. As supported by experiments, the adversarial training framework complements the proposed LaplaceKL loss (i.e. an increase in unlabeled data results in a decrease in error). To demonstrate this, we first show the effectiveness of the proposed loss by claiming state-of-the-art without adversarial training– to then further improve with more unlabeled data added during training!
Furthermore, we reduced the size of the model by using , , , and the original number of convolution filters, with the smallest costing only 79 Kb on disk. We show an accuracy drop for models trained with the proposed LaplaceKL as far less than the others trained with a softargmax-based loss. So again, it is the case that more unlabeled training data results in less of a performance drop at reduced sizes. It is essential to highlight that variants of our model at or of larger size than the original size compare well to the existing state-of-the-art. We claim that the proposed contributions are instrumental for landmark detection models used in real-time production, mobile devices, and other practical purposes.
Our contributions are three-fold: (1) A novel Laplace KL-divergence objective to train landmark localization models that are more certain about predictions; (2) An adversarial training framework that leverages large amounts of unlabeled data during training; (3) Experiments that show our model outperforms recent works in face landmark detection, along with ablation studies that, most notably, reveal our model compares well to state-of-the-art at its original size (i.e. 160 Kb) and in real-time (i.e. 20 fps).
Related work
In this section, we review relevant works on landmark localization and generative adversarial network (GAN).
Landmark localization has been of interest to researchers for decades. At first, most methods were based on Active Shape Models and Active Appearance Models . Then, Cascaded Regression Methods (CRMs) were introduced, which operate sequentially; starting with the average shape, then incrementally shifting the shape closer to the target shape. CRMs offer high speed and accuracy (i.e. 1,000 fps on CPU ).
More recently, deep-learning-based approaches have prevailed in the community due to end-to-end learning and improved accuracy. Initial works mimicked the iterative nature of cascaded methods using recurrent convolutional neural networks . Besides, several have been several methods for dense landmark localization and 3D face alignment proposed: all of which are fully-supervised and, thus, require labels for each image.
Nowadays, there is an increasing interest in semi-supervised methods for landmark localization. Recent work used a sequential multitasking method which was capable of injecting labels of two types into the training pipeline, with one type constituting the annotated landmarks and the other type consisting of facial expressions (or hand-gestures) . The authors argued that the latter label type was more easily obtainable, and showed the benefits of using both types of annotations by claiming state-of-the-art on several tasks. Additionally, they explore other semi-supervised techniques (e.g. equivariance loss). In , a supervision-by-registration method was proposed, which significantly utilized unlabeled videos for training a landmark detector. The fundamental assumption was that the neighboring frames of the detected landmarks should be consistent with the optical flow computed between the frames. This approach demonstrated a more stable detector for videos, and improved accuracy on public benchmarks.
Landmark localization data resources have significantly evolved as well, with the 68-point mark-up scheme of the MultiPIE dataset widely adopted. Despite the initial excitement for MultiPIE throughout the landmark localization community , it is now considered one of the easy datasets captured entirely in a controlled lab setting. A more challenging dataset, Annotated Facial Landmarks in the Wild (AFLW) , was then released with up to 21 facial landmarks per face (i.e. occluded or “invisible” landmarks were not marked). Finally, came the 300W dataset made-up of face images from the internet, labeled with the same 68-point mark-up scheme as MultiPIE, and promoted as a data challenge . Currently, 300W is among the most widely used benchmarks for facial landmark localization. In addition to 2D datasets, the community created several datasets annotated with 3D keypoints .
GANs were recently introduced , quickly becoming popular in research and practice. GANs have been used to generate images and videos , and to do image manipulation , text-to-image, image-to-image , video-to-video translation and re-targeting .
An exciting feature of GANs are the ability to transfer visual media across different domains. Thus, various semi-supervised and domain-adaptation tasks adopted GANs . Many have leveraged synthetic data to improve model performance on real data. For example, a GAN transferred images of human eyes from the real domain to bootstrap training data . Other researchers used them to synthetically generate photo-realistic images of outdoor scenes, which also aided in bettering performance in image segmentation . Sometimes, labeling images captured in a controlled setting is manageable (i.e. versus an uncontrolled setting). For instance, 2D body pose annotations were available in-the-wild, while 3D annotations mostly were for images captured in a lab setting. Therefore, images with 3D annotations were used in adversarial training to predict 3D human body poses as seen in-the-wild . formulated one-shot recognition as a problem data imbalance and augmented additional samples in the form of synthetically generated face embeddings.
Our work differs from these others in several ways. Firstly, a majority, if not all, used a training objective that only accounts for the location of landmarks , i.e. no consideration for variance (i.e. confidence). Thus, landmarks distributions have been assumed to be describable with a single parameter (i.e. a mean). Networks trained this way yield an uncertainty about the prediction, while still providing a reasonable location estimate. To mitigate this, we explicitly parametrize the distribution of landmarks using location and scale. For this, we propose a KL-divergence based loss to train the network end-to-end. Secondly, previous works used GANs for domain adaptation in some fashion. In this work, we do not perform any adaptation between domains as in , nor do we use any additional training labels as in . Specifically, we have do the quality assessment on the predicted heatmaps for a given image. The resulting gradients are used to improve the ability of the generator to detect landmarks. We show that both contributions improve accuracy when used separately. Then, the two contributions are combined to further boost state-of-the-art results.
Method
Our training framework utilizes both labeled and unlabeled data during training. Shown in Fig. 2 are the high-level graphical depiction of cases where labels are available (blue arrows) and unavailable (red arrows). Notice the framework has two branches, supervised (Eq. 3) and unsupervised (Eq. 7), where only the supervised (blue arrow)uses labels to train. Next, are details for both branches.
A differentiable variant of argmax (i.e. softargmax ) was recently used to localize landmarks . For the 1D case, the softargmax operation is expressed
Essentially, the softargmax operation is the expectation of the pixel coordinate over the selected dimension. Hence, the softargmax-based loss assumes the underlying distribution is describable by just its mean (i.e. location), regardless of how sure a prediction, the objective then is to match mean values. To avoid cases in which the trained model is uncertain about the predicted mean, while still yielding a low error, we parametrize the distribution using , where is the mean or the location and is the variance or the scale, respectfully, for the selected distribution.
Denoting the true conditional distribution of the landmarks as we define the objective as follows:
Statistically speaking, given two estimators with different variances, we would prefer one that has a smaller variance (see for an analysis of the bias-variance trade-off). A lower variance implies higher confidence in the prediction. To this end, we found an objective measuring distance between distributions is accurate and robust. The neural network must satisfy an extra constraint on variance and, thus, yields predictions of higher certainty. See higher confident heatmaps in Fig. 1 and Fig. 3. The experimental evaluation further validates this (Table 2 and Table 3). Also, Fig. 5 shows sample results.
2 Unsupervised Branch
In this setting, provided an input image, the goal of is to learn to decipher between the real and fake heatmaps from appearance. Thus, the goal of is to produce fake heatmaps that closely resemble the real. Within this framework, intends to provide additional guidance for by learning from both labeled and unlabeled data. The objective in Eq. 4 is solved using alternating updates.
3 Training
We fused the softargmax-based and adversarial losses as
with the KL-divergence version of the objective defined as:
with the weight for the adversarial loss . This training objective includes both labeled and unlabeled data in the formulation. In the experiments, we show that this combination significantly improves the accuracy of our approach. We also argue that the softargmax-based version cannot fully utilize the unlabeled data since the predicted heatmaps differ too much from the real heatmaps. See Algorithm 1 for the training procedure for steps of the proposed model. We show the unlabeled branch of the framework is shown graphically in red arrows (Fig. 2).
4 Implementation
We follow the ReCombinator network (RCN) initially proposed in . Specifically, we use a 4-branch RCN as our base model, with input images and output heatmaps of size 8080. Convolutional layers of the encoder consist of 64 channels, while the convolutional layers of the decoder output 64 channels out of the 128 channels at its input (i.e. 64 channels from the previous layer concatenated with the 64 channels skipped over the bottleneck via branching). We applied Leaky-ReLU, with a negative slope of 0.2, on all but the last convolution layer. See Table 1 for details on the generator architecture. Drop-out followed this, after all but the first and last activation. We use Adam optimizer with a learning rate of 0.001 and weight decay of . In all cases, networks were trained from scratch, using no data augmentation nor any other ’training tricks.’
was a 4-layered PatchGAN . Before each convolution layer Gaussian noise () was added , and then batch-normalization (all but the top and bottom layers) and Leaky-ReLU with a negative slope of 0.2 (all but the top layer). The original RGB image was stacked on top of the heatmaps from and fed as the input of (Fig. 2). Thus, takes in ( + 3) channels. We set for 2. Pytorch was used to implement the entire framework. An important note to make is that models optimized with Laplace distribution consistently outperformed the Gaussian-based. For instance, our LaplaceKL baseline had a Normalized Mean Square Error (NMSE) of 4.01 on 300W, while Gaussian-based got 4.71. Thus, the sharper,“peakier” Laplace distribution proved to be more numerically stable under current network configuration, as Gaussian required a learning rate a magnitude smaller to avoid vanishing gradients. Indeed, we used Laplace.
Experiments
We evaluated the proposed on two widely used benchmark datasets for face alignment. No data augmentation techniques used when training our models nor was the learning rate dropped: this leaves no ambiguity into whether or not the improved performance came from training tricks or the learning component itself. All results for the proposed were from models trained for 200 epochs.
We next discuss the metric used to evaluate performance, NMSE, with differences between datasets in the normalization factor. Then, the experimental settings, results, and analysis for each dataset are covered separately. Finally, ablation studies show characterizations of critical hyper-parameters and, furthermore, the robustness of the proposed LaplaceKL+D(70K) with a comparable performance with just the number of feature channels and 20 fps.
Per convention , NMSE, a normalized average of euclidean distances, was used. Mathematically speaking:
2 300W + MegaFace
The 300W dataset is amongst the most popular datasets for face alignment. It has 68 visible landmarks (i.e. ) for 3,837 images (i.e. 3,148 training and 689 test). We followed the protocol of the 300W challenge and evaluated using NMSE (Eq. 8), where is set as the inter-ocular distance (i.e. distance between outer corners of the eyes). Per convention, we evaluated different subsets of 300W (i.e. common and challenge, which together form full).
We compared the performance of the proposed objective trained in a semi-supervised fashion. During training, 300W dataset made-up the labeled data (i.e. real), and a random selection from MegaFace provided the unlabeled data (i.e. fake) . MTCNNhttps://github.com/davidsandberg/facenet was used to detect five landmarks (i.e. eye pupils, corners of the mouth, and middle of nose and chin) , which allowed for similar face crops from either dataset. Specifically, we extended the square hull that enclosed the five landmarks by 2 the radii in each direction. In other words, the smallest bounding box spanning the 5 points (i.e. the outermost points lied on the parameter), and then transformed from rectangles-to-squares with sides of length 2. Note that the midpoint of the original rectangle was held constant to avoid shift translations (i.e. rounded up a pixel if the radius was even and extended in all directions).
The LaplaceKL+D(70K) model obtained state-of-the-art on 300W, yielding the lowest error on 300W (Table 2 (300W columns)). LaplaceKL+D() and softargmax+D() denote the models trained with unlabeled data, where representing the number of unlabeled images added from MegaFace.
First, notice that LaplaceKL trained without unlabeled data still achieved state-of-the-art. The LaplaceKL-based models then showed relative improvements with more unlabeled data added. The softargmax-based models cannot fully take advantage of the unlabeled data without minimizing for variance (i.e. generates heatmaps of less confidence and, thus, more spread). Our LaplaceKL, on the other hand, penalizes for spread (i.e. scale), making the job of more challenging. As such, LaplaceKL-based models benefit from increasing amounts of unlabeled data.
Also, notice the largest gap between the baseline models and our best LaplaceKL+D(70K) model on the different sets of 300W. Adding more unlabeled helps more (i.e. LaplaceKL vs. LaplaceKL+D(70K) improvement is about 2.53%). However, it is essential to use samples not covered in the labeled set. To demonstrate this, we set the real and fake sets to 300W (i.e. in the second term of Eq. 7). NMSE results for this experiment are listed as follows: LaplaceKL+D(300W) 4.06 (baseline– 4.01) and softargmax+D(300W) 4.26 (baseline– 4.24). As hypothesized, all the information from the labeled set had already been extracted in the supervised branch, leaving no benefit of using the same set in the unsupervised branch. Therefore, more unlabeled data yields more hard negatives to train with, which improves the accuracy of the rarely seen samples (Table 2 (300W challenge set)). Our best model was 2.7% better than on easier samples (i.e. common), 4.7% better on average (i.e. full), and, moreover, 9.8% better on the more difficult (i.e. challenge), 4.7% better on average (full), and, moreover, 9.8% better on the more difficult (challenge). These results further highlight the advantages of training with the proposed LaplaceKL loss, along with the adversarial training framework.
Additionally, the adversarial framework further boosted our 300W baseline was further boosted by (i.e. more unlabeled data yields a lower NMSE). Specifically, we demonstrated this by pushing state-of-the-art of the proposed on 300W from a NMSE of 4.01 to 3.91 (i.e. no unlabeled data to 70K unlabeled pairs, respectfully). There were boosts at each step size of full (i.e. larger NMSE).
We randomly selected unlabeled samples for LaplaceKL+D(70K) and softargmax+D(70K) to visualize predicted heatmaps (Fig. 3). In each case, the heatmaps produced by the softargmax-based models spread wider, explaining the worsened quantitative scores (Table 2). The models trained with the proposed contributions tend to yield higher probable pixel location (i.e. a more concentrated predicted heatmaps). For most images, the heatmaps generated by models trained with the LaplaceKL loss have distributions for landmarks that were more confident and properly distributed: our LaplaceKL+D(70K) yielded heatmaps that vary 1.02 pixels from the mean, while softargmax+D(70K) has a variation of 2.59. Learning the landmark distributions with our LaplaceKL loss is conceptually and theoretically intuitive (Fig. 1). Moreover, it is experimentally proven (Table 2).
3 The AFLW dataset
We evaluated the LaplaceKL loss on the AFLW dataset . AFLW contains 24,386 faces with up to 21 landmarks annotations and 3D head pose labels. Following , 20,000 faces were used for training with the other 4,386 for testing. We ignored the two landmarks for the left and right earlobes, leaving up to 19 landmarks per face .
Since faces of AFLW have such variety head poses, most faces have landmarks out of view (i.e. missing). Thus, most samples were not annotated with the complete 19 landmarks, meaning that it does not allow for a constant sized tensor (i.e. real heatmaps) for the adversarial training. Therefore, we compared the softargmax and KL-based objectives with existing state-of-the-art. The face size for the NMSE was the square root of the bounding box hull .
Our LaplaceKL-based model scored results comparable to existing state-of-the-art (i.e. RCN+ (LELT) ) on the larger, more challenging AFLW dataset while outperforming all others. It is essential to highlight here that puts great emphasis on data augmentation, while we do not apply any. Also, since landmarks are missing in some samples (i.e. no common reference points exist across all samples), we were unable to prepare faces for our semi-supervised component– a subject for future work.
4 Ablation Study
The error is next measured as a function of model size (Table 3), along with different values (Eq. 2) and scales used to parameterize the Laplacian (Fig. 4). The latter characterizes the baseline and supports the values used for these hyper-parameters, while the former reveals a critical characteristic for the practicality of the proposed.
Specifically, we decreased the model size by reducing the number of channels at each convolutional layer by factors of 2. The softargmax-based model worsened by about 47% and 79% in NMSE at an and the channel count, respectfully (i.e. 4.25 6.86 and 9.79). LaplaceKL, on the other hand, decreased by about 24% with an and 59% with a the number of channels (i.e. 4.01 5.09 and 7.38, respectfully). Our model trained with unlabeled data (i.e. LaplaceKL+D(70K)) dropped just about 21% and 57% at factors of 8 and 16, respectfully (i.e. 3.91 4.85 and 7.01). In the end, LaplaceKL+D(70K) proved best with reduced sizes: with 0.040M parameters, it still compares to previous state-of-the-art , which is a clear advantage. For instance, SDM , requires 1.693M parameters (25.17MB) for 7.52 in NMSE (300W full).https://github.com/tntrung/sdm_face_alignment Yet our smallest and next-to-smallest get 7.01 and 4.85 with only 0.174M (0.076 MB) and 0.340M (0.166 MB) parameters.
The processing speed also boosts with fewer channels (i.e. to train and at inference). For instance, the model reduced by a factor of 16 processes 26.51 frames per second (fps) on a CPU of Macbook Pro (i.e. 2.8GHz Intel Core i7), with the original running at 4.92 fps. Our best LaplaceKL-based model proved robust to size reduction, obtaining 4.85 NMSE at 21.38 fps when reduced by .
Conclusions
We demonstrated the benefits of the proposed LaplaceKL loss and leveraging unlabeled data in an adversarial training framework. Hypothetically and empirically, we showed the importance of penalizing a landmark predictor’s uncertainty. Thus, training with the proposed objective yields predictions of higher confidence, outperforming previous state-of-the-art methods. We also revealed the benefits of adding unlabeled training data to boost performance via adversarial training. In the end, our model performs state-of-the-art on all three splits of the renown 300W (i.e. common, challenge, and full), and second-to-best on the AFLW benchmark. Also, we demonstrate the robustness of the proposed by significantly reducing the number of parameters. Specifically, with the number of channels (i.e. 170Kb on disk), the proposed still yields an accuracy comparable to the previous state-of-the-art in real-time (i.e. 21.38 fps). Thus, the contributions of the proposed framework are instrumental for models intended for use in real-world production.