wikillm

Paper · 2021-12-06 · cs.CV, cs.CL

General Facial Representation Learning in a Visual-Linguistic Manner

FaRL pre-trains a ViT-B/16 image encoder on 20M face image-text pairs (LAION-FACE) with an image-text contrastive loss and a masked-image token loss, then reuses it for face parsing, alignment and attributes. Author-reported: the frozen encoder beats compared backbones on LaPa, AFLW-19 and CelebA; fine-tuned models set new results on LaPa, CelebAMask-HQ, AFLW-19 and WFLW.

Contrastive learningMasked image modelingVision-language pre-trainingVision Transformer (ViT) backbonespretrainingface-analysisvision-languagemasked-image-modeling

arXivPDFCodeMarkdown18 min read

AI-compiled by claude-haiku-5-5 on 2026-11-05, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.

In plain words

Face tasks such as parsing and landmark placement are usually trained separately, each with its own hand-labelled data, which is expensive to make. This paper asks whether one general "face understanding" model, trained once, can serve all these jobs.

The authors collect about 20 million face photos that have web captions. They train an image model with two goals. The first matches each photo to its own caption and pushes it away from the captions of other photos, which teaches the model what the face shows in words. The second hides some small patches of the photo and asks the model to guess what was hidden, which keeps finer detail in the representation. After this training, the image model is reused: a small extra head is added for each task, and the model is either left frozen or fine-tuned.

The reported result is that this face-specific model transfers better than general-purpose pre-trained models on most of the tasks tested, and that it reaches new best numbers on several face parsing and landmark benchmarks.

TL;DR

  • FaRL is a visual-linguistic pre-training recipe for face images: an image-text contrastive loss plus masked image modeling, on LAION-FACE (20M face image-text pairs) §3.1 §3.2 §3.3.
  • The backbone is a ViT-B/16 image encoder; downstream heads are UPerNet-style for parsing and alignment and a small linear-combination head for attributes §3.4 §4.1.
  • Author-reported: the frozen backbone beats ImageNet, web-image and CLIP-style baselines on LaPa, AFLW-19 and CelebA tab. 1. Fine-tuned FaRL at 448 px sets new results on LaPa, CelebAMask-HQ, AFLW-19 and WFLW tab. 4 tab. 5 tab. 6 tab. 7.
  • Code is public (MIT) but contains only the downstream and model code, not the pre-training loop, so the pre-training recipe cannot be checked against code.

Problem

Face analysis tasks such as parsing, alignment and attribute recognition are usually solved by supervised training on manually labelled data, which is costly, especially for parsing and alignment §1. Pre-training on large general image sets (ImageNet, and later image-text pairs) had been shown to help transfer, but its effect on face tasks had been little studied §1 §2.2. The paper also assumes that web image-text pairs are a usable, if noisy, source of supervision §1 fig. 1. A face-specific subset is needed for this, since general image-text data contains many non-face images §4.3; the authors build one by face detection and filtering §3.1.

Method

Data (LAION-FACE). Start from LAION-400M image-text pairs. Run the RetinaFace face detector and keep images whose detection score is above 0.9. Randomly sample 20 million pairs from those; the result is LAION-FACE §3.1. The distribution of face counts per image is shown in fig. 2. Captions are noisy: the authors note that web texts are not always accurate fig. 1.

Image-text contrastive learning (ITC). For a batch of B pairs, the image encoder E_I gives a class-token feature and the text encoder E_T gives an end-of-sequence feature. Each goes through a small projection head into a metric embedding. The loss is an InfoNCE softmax in both directions, image to text (L_I) and text to image (L_T), averaged over the batch, with temperature sigma that is learned §3.2 eq. 1.

Masked image modeling (MIM). A second copy of each image has some patches replaced by one learnable mask vector §3.3 eq. 2. The masked image goes through E_I and then a one-layer Transformer E_MIM. For each masked position, a classifier predicts the index of the discrete visual token that a discrete VAE assigns to the original patch. The loss sums the negative log-likelihood over masked positions §3.3 eq. 3. The discrete VAE is the publicly available one of [ramesh2021zero]; the vocabulary size |V| is not stated §3.3.

Architecture. The image encoder is a 12-layer, 768-width ViT-B/16 with 224x224 input, 196 patches plus a class token, and 87M parameters. The text encoder follows CLIP: 12 layers, width 512, 8 heads, 77 tokens, 63M parameters. Both features are projected to 512 dimensions for the contrastive loss §3.4.

Input alignment. Each face is aligned to a mean face and cropped to 224 px §3.4 §4.3. If an image has several faces, one is chosen at random §3.4. The paper does not give the landmark method for this pre-training alignment; its appendix describes five-landmark mean-face alignment for LaPa parsing app. G.

One step, two passes. Every image is encoded twice: once unmasked for ITC, and once with up to 75 randomly masked patches for MIM §3.4 fig. 3.

Downstream use. For every task the heads read features from blocks 4, 6, 8 and 12 of E_I §4.1. Face parsing and landmark alignment use UPerNet on multi-scale feature maps §4.1. Landmarks are predicted as Gaussian heatmaps of 128x128 §4.1. Attribute recognition pools each selected layer (class token, mean and max over patch tokens), mixes them with learned weights, and applies a fully connected layer for multi-label binary classification §4.1. Two regimes are reported: a frozen backbone (the "FaRL" rows) and a fully fine-tuned backbone (the "FaRL_ft" rows). A 448 px variant is obtained by bicubic up-sampling of the position embeddings §4.4.

Pseudocode
# FaRL pre-training step  [§3.2] [§3.3] [eq. 1] [eq. 2] [eq. 3]
# Input:  faces (B, 3, 224, 224), captions (B, 77) token ids
# Output: scalar loss; the weighting of the two terms is not stated

def pretrain_step(faces, captions):
    # Contrastive branch on the unmasked pair  [§3.2] [§3.4]
    image_emb = project_image(image_encoder(faces))  # (B, 512)
    text_emb = project_text(text_encoder(captions))  # (B, 512)
    # Raw dot products scaled by the learned temperature  [eq. 1]
    # Whether the embeddings are L2-normalised is not stated
    logits = image_emb @ text_emb.T / temperature  # (B, B)
    targets = arange(B)
    # L_I and L_T, each averaged over the batch  [eq. 1]
    loss_itc = cross_entropy(logits, targets)
    loss_itc = loss_itc + cross_entropy(logits.T, targets)

    # Masked branch: a second pass over the same images  [§3.3] [§3.4]
    # Up to 75 of the 196 patches are replaced by the mask vector
    masked_faces = mask_patches(faces, max_masked=75)
    hidden = mim_head(image_encoder(masked_faces))  # (B, 196, width)
    # Target: index of each patch's discrete token from the dVAE  [§3.3]
    tokens = dvae_encode(faces)  # (B, 196) integer ids
    # Negative log-likelihood summed over masked positions only  [eq. 3]
    logp = log_softmax(classifier(hidden[masked]))
    loss_mim = -logp[tokens[masked]].sum()

    return loss_itc + loss_mim  # how these two are weighted is not stated
Pseudocode
# Face parsing forward pass, FaRL^448  [§3.5] [§4.1] [§4.4]
# Input:  image (B, 3, 448, 448), values in [0, 1]
# Output: class logits (B, 11, 512, 512) for LaPa

def parse_faces(image):
    # Normalise with the CLIP mean and std
    # [code: farl/network/transformers.py#L106-L109]
    image = (image - clip_mean) / clip_std
    # Patch-token maps after blocks 4, 6, 8 and 12  [§4.1]
    # [code: farl/network/transformers.py#L128]
    maps = [patch_tokens(block_k(image)) for k in (4, 6, 8, 12)]
    # Learned deconvolutions (x4, x2), identity, max-pool (x0.5)
    # [code: farl/network/transformers.py#L19-L41]
    maps = resample_fpn(maps)
    # UPerNet-style fusion, 768 channels, 1x1 conv to logits  [§4.1]
    # [code: farl/network/mmseg.py#L11-L26]
    logits = uper_head(maps)
    # Bilinear up-sampling to 512 x 512
    # [code: farl/experiments/face_parsing/network.py#L31]
    return upsample(logits, size=512)

Hyperparameters

Pre-training (from the paper; not verifiable in code, see Paper vs code):

NameValueWhereNotes
pre-training dataLAION-FACE, 20M image-text pairs§3.1from LAION-400M, RetinaFace score > 0.9
image encoderViT-B/16, 12 layers, width 768, 224 px, 87M§3.4196 patches + cls token
text encoder12 layers, width 512, 8 heads, 77 tokens, 63M§3.4follows CLIP
projection dim512§3.4image cls and text eos
MIM headone-layer Transformer§3.4width not stated
masked patchesat most 75 per image§3.4sampling rule not stated
dVAE vocabularyVnot stated
batch size5120§3.4
epochs16§3.4
hardware32 NVIDIA V100§3.4
optimizerAdamW, weight decay 0.05§3.4
learning ratestart 1e-6, warm up to 1e-3 in epoch 1, cosine decay to 9e-4 by epoch 15§3.4value after epoch 15 and end of run not stated
temperature sigmainit 0.07, learned§3.2 §3.4
gradient clippingmax norm 1.0app. G
precisionmixed precision; gradient checkpointing; ZeROapp. G
negatives for ITClogits gathered from all GPUs (CLIP uses the local batch)app. G
relative weight ITC : MIMnot statedthe combined loss is not given
parsing optimizerAdamW, lr 1e-3, weight decay 1e-5§4.1stated for the parsing head
parsing input224 (FaRL, FaRL_ft) or 448 (FaRL_ft^448)§4.4448 by bicubic position-embedding resize
tanh-warping alpha0.8 (default)app. G tab. 14tab. 14 sweeps alpha
parsing augmentationrotation +-18 deg, scale 0.9-1.1, shift 0.01 x sapp. GLaPa
CelebAMask-HQ augmentationno tanh-warping (alpha 0)app. Grescaling instead of alignment
alignment heatmap128 x 128, one-pixel sigma§4.1Gaussian heatmaps
alignment head optimizerAdamW, lr 0.01§4.1head
alignment augmentationrotation +-10 deg, scale 0.9-1.1, shift 0.01 x s, blur, noise, occlusionapp. G
attribute head optimizerAdamW, lr 0.3, cosine to zero over 100 epochs§4.1value unusually high; no code in repo
attribute lossbinary cross-entropy, multi-label§4.1
attribute layers{4, 6, 8, 12}§4.1
UPerNet layers{4, 6, 8, 12}§4.1BEiT convention
CelebA split162,770 train, 19,962 test§3.540 attributes
LFWA split6,263 train, rest test§3.540 attributes
LaPa split18,176 train, 2K test§3.511 classes
CelebAMask-HQ split24,183 train, 2,824 test§3.519 classes
AFLW-19 split20K train, 4,386 test§3.519 landmarks
300W split3,837 train, 600 test (common and challenge)§3.568 landmarks
WFLW split7,500 train, 2,500 test§3.598 landmarks

Downstream values from the released code (farl/experiments/). They are the official configs, not the paper's text; where they differ, see Paper vs code.

NameValueWhereNotes
parsing batch size5 per GPUREADME.mdREADME example; 8 GPUs README.md
parsing head LR (refine)head and FPN 1e-3; backbone 1e-4refine_backbone.yamlbackbone is fine-tuned
parsing head LR (frozen)head and FPN 1e-3freeze_backbone.yaml
parsing schedule300 epochs, LR x0.1 at epoch 200lapa_farl.yaml refine_backbone.yaml
parsing EMAdecay 0.999; evaluation uses EMAlapa_farl.yaml lapa_farl.yaml
parsing warp factor0.8 (train and test)lapa_farl.yaml
parsing augmentationshift sigma 0.01; rotation sigma 0.314 rad; scale sigma 0.1train.yamlsampler lives in external blueprint package
CelebAMask-HQ warp0.0train.yaml
alignment losscoordinate term (weight 1.0) + heatmap BCE (weight 1.0)aflw19_farl.yaml
alignment heatmap128 px; kernel radius 5.0aflw19_farl.yamlclass default is 16.0 task.py
alignment heatmap activationsigmoidfarl.yaml
alignment head LR (refine)heads 1e-2; backbone 1e-4refine_backbone.yaml
alignment head LR (frozen)heads 1e-2freeze_backbone.yaml
alignment scheduleAFLW-19 150 epochs; 300W 250; WFLW 150; LR x0.1 at epoch 200aflw19_farl.yaml ibug300w_farl.yaml wflw_farl.yamldecay never reached on AFLW-19 and WFLW
alignment augmentationshift sigma 0.05; rotation sigma 0.174; scale sigma 0.1; scale mean 1.0 (AFLW-19) or 0.8 (300W, WFLW)aflw19_farl.yaml ibug300w_farl.yaml
alignment noise and occlusionocclusion; noise with p 0.5; gray; gamma; blurtrain.yaml
pre-trained checkpointFaRL-Base-Patch16-LAIONFace20M-ep16 (used in paper); ep64 also releasedREADME.md README.mdno license stated for the weights

Results

Author-reported. Setup: pre-training on LAION-FACE (20M). Downstream heads on a ViT-B/16 backbone at 224 px unless marked. Frozen rows train only heads; FaRL_ft rows fine-tune the whole backbone; 448 uses 448 px input.

Table 1: frozen backbones, LaPa, AFLW-19, CelebA tab. 1. Face Transformer uses patch size 8 and 20 layers §4.2 footnote.

DatasetScaleSupervision sourceMethodLaPa F1-mean (up)AFLW-19 NME_diag (down)CelebA mAcc (up)
ImageNet-1K1.3MimagesMoCo v391.861.00790.23
ImageNet-22K14MimagesBEiT91.291.07689.71
ImageNet-22K14Mimages + human labelsViT91.611.00490.77
ImageNet-1K1.3Mimages + human labelsDeiT92.001.00389.79
WIT400Mimages + web textCLIP92.210.99590.86
MS1MV35.1Mface images + human labelsFace Transformer91.091.03190.77
LAION-FACE20Mface images + web textFaRL (ours)92.320.99191.39

Table 2: few-shot, frozen backbones tab. 2. Percent of downstream training data used. LaPa is F1-mean, AFLW-19 is NME_diag, CelebA is mAcc.

ModelLaPa 1%LaPa 10%LaPa 100%AFLW 1%AFLW 10%AFLW 100%CelebA 1%CelebA 10%CelebA 100%
MoCo v386.4790.1891.861.411.191.00787.8589.7690.23
BEiT85.0189.2191.291.941.371.07685.6488.7489.71
ViT86.6489.9791.611.371.161.00489.2090.2190.77
DeiT87.2490.4592.001.411.171.00386.7389.0089.79
CLIP88.1390.9192.211.301.110.99589.0990.4790.86
Face Transformer86.4289.5491.091.411.211.03187.4290.3290.77
FaRL88.2190.9192.321.351.150.99189.6690.9991.39

FaRL is best on LaPa at 1% and tied with CLIP at 10%, and best on CelebA at 1% and 10%. CLIP is better on AFLW-19 at 1% and 10% (1.30 and 1.11, against FaRL's 1.35 and 1.15) §4.2.

Table 3: ablation of pre-training components tab. 3. Frozen backbone. ITC: image-text contrastive. MIM_k: a k-layer MIM head. ALIGN: face alignment during pre-training. LAION-RANDOM: a random LAION subset of the same size.

Pre-trainingLaPa F1-meanAFLW-19 NME_diagCelebA mAcc
ITC91.751.00991.31
ITC + MIM_191.821.00491.22
ITC + MIM_1 + ALIGN (FaRL default)92.320.99191.39
ITC + MIM_6 + ALIGN92.191.00291.38
ITC + MIM_691.990.99291.20
ITC + ALIGN91.881.01291.40
ITC (LAION-RANDOM)91.681.01090.76

Table 4: LaPa, fine-tuned, mean F1 tab. 4. Per-class F1 is in the table.

MethodMean F1
BASS89.8
EHANet89.2
Wei et al.89.4
EAGR91.1
AGRNet92.3
Scratch (same architecture)91.62
FaRL (frozen)92.32
FaRL_ft92.70
FaRL_ft^44893.88

Table 5: CelebAMask-HQ, mean F1 tab. 5. Per-class F1 is in the table.

MethodMean F1
Lee et al. (as labelled in the paper)80.3
EHANet84.0
Wei et al.82.1
EAGR85.1
AGRNet85.5
Scratch84.74
FaRL (frozen)86.72
FaRL_ft87.55
FaRL_ft^44889.56

Table 6: AFLW-19 tab. 6. NME_diag on the Full and Frontal sets; NME_box and AUC_box^7 on Full.

MethodNME_diag FullNME_diag FrontalNME_box FullAUC_box^7 Full
LAB (w/ B)1.251.14--
LUVLi1.391.192.2868.0
Scratch1.0470.8841.48179.3
FaRL (frozen)0.9910.8511.40280.4
FaRL_ft0.9690.8361.37180.8
FaRL_ft^4480.9430.8211.33481.3

Table 7: WFLW tab. 7. NME_io on Full and on six subsets; FR^10 and AUC^10 on Full.

MethodFullPoseExpr.Illum.MakeUpOccl.BlurFR^10AUC^10
AWing4.367.384.584.324.275.194.962.8457.19
ADNet4.146.964.384.094.055.064.792.7260.22
LUVLi4.37------3.1257.70
Scratch4.808.785.094.744.996.015.355.7254.54
FaRL (frozen)4.387.604.664.194.305.444.983.3257.54
FaRL_ft4.036.814.323.923.874.704.541.7660.23
FaRL_ft^4483.966.914.213.973.804.714.571.7661.16

Table 8: 300W tab. 8. NME_io.

MethodCommonChallengeFull
AWing2.724.523.07
ADNet2.534.582.93
LUVLi2.765.163.23
Scratch2.905.193.35
FaRL (frozen)2.694.853.12
FaRL_ft2.704.643.08
FaRL_ft^4482.564.452.93

Table 9: attribute recognition, few-shot and full-shot tab. 9. Mean accuracy. CelebA columns are training proportions; LFWA columns likewise.

MethodCelebA 0.2%CelebA 0.5%CelebA 1%CelebA 2%CelebA 100%LFWA 5%LFWA 10%LFWA 20%LFWA 50%LFWA 100%
PS-MCNN----92.98----87.36
SSPL86.6788.0588.8489.5891.7778.6881.6583.4585.4386.53
FaRL (frozen)87.6388.5889.6690.2691.3980.9482.4283.9485.3885.94
FaRL_ft88.5189.1290.2490.5591.8882.5783.5884.8085.9586.69

At full shot on CelebA, FaRL_ft ranks second. The paper attributes the top result to a method that uses extra identity and attribute-relation information from the downstream data §4.4.

Table 10: FairFace race-group gaps tab. 10. Accuracy in percent, frozen backbone. The discrepancy is the difference between the non-white and white groups. The paper reads the gaps as "relatively moderate" compared with others §5.

AttributeModelWhiteNon-WhiteAverageDiscrepancy
AgeFairFace baseline60.0560.6360.52+0.58
AgeCLIP62.2561.9562.00-0.30
AgeFaRL61.4961.8461.78+0.35
GenderFairFace baseline94.1594.4194.36+0.26
GenderCLIP94.8795.7895.61+0.91
GenderFaRL95.1695.7795.65+0.61

Table 11: share of face images in pre-training tab. 11 app. D. Only ITC.

Share of face imagesLaPa F1-meanAFLW-19 NME_diagCelebA mAcc
0%91.681.01789.73
12.5%91.681.01090.76
50%91.771.00991.17
100%91.751.00991.31

Table 12: comparison with other self-supervised face pre-training tab. 12 app. E. Same architecture and fine-tuning as FaRL.

Pre-trainingLaPa F1-meanAFLW-19 NME_diagCelebA mAcc
SwAV + ALIGN (Bulat et al.)90.551.05989.65
SimCLR + ALIGN91.720.99591.08
ITC + MIM_1 + ALIGN (FaRL)92.320.99191.39

Table 13: longer pre-training, fine-tuned at 448 tab. 13 app. F.

Pre-training epochsLaPa F1-meanCelebAMask-HQ F1-meanAFLW-19 NME_diagWFLW NME_io300W NME_io
1693.8889.560.9433.962.93
6494.0489.570.9383.882.88

Table 14: tanh-warping factor alpha on LaPa tab. 14 app. G. Default is 0.8.

alphaMean F1Mean F1 without hairHair F1
0.091.5191.9387.74
0.292.0892.0492.52
0.492.2792.0794.09
0.692.3192.0794.54
0.892.3292.0894.53
1.092.1191.8494.49

Other results, in words. A per-layer study finds that the best layer differs by task: the deepest layers serve attribute recognition, while layer 5 serves face parsing best fig. 6 app. C. The fused multi-layer features beat each single layer on LaPa and CelebA app. C. Text-driven face editing with FaRL in place of CLIP is shown qualitatively fig. 4 app. A. Grad-CAM maps localize regions for text queries fig. 5 app. B.

Paper vs code

The official repository is https://github.com/faceperceiver/farl at commit 3fb46941cb4444183442eb09748c310114bcb846, linked in the paper's author block. The code is MIT-licensed, Microsoft LICENSE. The README says the released backbone is "used in paper" README.md.

  • Pre-training code is absent. The repository contains the model class with an optional MIM branch and a forward_mim method model.py model.py, but no contrastive loss, mask sampler, dVAE, data loader or pre-training config. The ITC and MIM hyperparameters in §3.4 therefore cannot be checked, and the code does not show how the two losses are weighted.
  • Released weights are the paper's model. README gives two checkpoints, ep16 "used in paper" and ep64, with no license stated for either README.md README.md. The longer-training results in tab. 13 match the README's reproduced ep64 scores.
  • Reproduced scores differ slightly. The README reports paper and reproduced values: LaPa 93.88 / 93.86; CelebAMask-HQ 89.56 / 89.65; AFLW-19 0.943 / 0.943; 300W 2.93 / 2.92; WFLW 3.96 / 3.98 README.md. It attributes the gaps to code refactoring README.md.
  • Head loss is not as described. The paper uses a "soft-label cross-entropy" for landmarks §4.1. The code uses a per-pixel binary cross-entropy on the Gaussian heatmaps task.py plus a coordinate term with weight 1.0 aflw19_farl.yaml. The paper mentions no coordinate loss.
  • Coordinate term is a distance, not L1. The term named coord_l1_loss computes the Euclidean norm per point task.py.
  • Heatmap width. The paper says "one-pixel sigma" §4.1. The code renders heatmaps with a Gaussian-like kernel exp(-8 r^2 / R^2) and radius R = 5.0 p2i_max.h aflw19_farl.yaml. By our reading of that formula, sigma is R/4 = 1.25 px. The code's own default radius is 16.0 task.py.
  • Alignment shift and augmentation. The paper gives translation 0.01 x s for alignment app. G. The configs use shift sigma 0.05 aflw19_farl.yaml. The configs also use mean scale 0.8 for 300W and WFLW ibug300w_farl.yaml wflw_farl.yaml; the paper does not state this. The code adds gray and gamma jitter and noise with p 0.5 train.yaml.
  • Alignment schedule. The paper states no schedule. AFLW-19 and WFLW train 150 epochs and 300W trains 250, but the LR drop is at epoch 200 aflw19_farl.yaml ibug300w_farl.yaml wflw_farl.yaml refine_backbone.yaml. So AFLW-19 and WFLW never decay.
  • Backbone learning rate. The paper uses one rate per task: 1e-3 for parsing and 0.01 for alignment heads §4.1. The configs fine-tune the backbone at 1e-4 with heads at 1e-3 (parsing) or 1e-2 (alignment) refine_backbone.yaml refine_backbone.yaml. The frozen configs match the paper's head rates freeze_backbone.yaml freeze_backbone.yaml.
  • Parsing training length and EMA. The paper gives no epoch count or EMA. The config trains 300 epochs with an LR drop at 200 lapa_farl.yaml refine_backbone.yaml, and evaluates an EMA copy with decay 0.999 lapa_farl.yaml lapa_farl.yaml.
  • Feature head. The paper describes UPerNet on the four layers §4.1. The code adds a learned multi-scale resampling before UPerNet (x4, x2, identity, max-pool x0.5) transformers.py transformers.py. The head uses 768 channels, pool scales 1, 2, 3, 6, dropout 0.1 and SyncBN mmseg.py. None of these are stated in the paper.
  • Input normalization. The code uses CLIP's mean and std transformers.py. The paper does not state it.
  • Resolution change. Position embeddings are bicubic-resized and images bilinearly resized to 448 transformers.py transformers.py. This matches §4.4.
  • Parsing augmentation. The paper's ranges (+-18 deg, scale 0.9-1.1, shift 0.01 x s) match the configs' sigmas (rotation 0.314 rad, scale 0.1, shift 0.01) train.yaml. The sampler is in the external blueprint package, so whether the sigmas are uniform half-widths cannot be checked here.
  • Tanh-warping. Default alpha 0.8 on LaPa matches app. G lapa_farl.yaml. CelebAMask-HQ uses no warping train.yaml. The warp itself is implemented in the external blueprint package.
  • Input resolution. The README example and every shipped config use 448 README.md. The 224 px frozen rows need the trainer run with input_resolution=224 and the frozen optimizer; no such config is shipped.
  • Attribute recognition. No attribute code is in the repository. The head, its LR of 0.3 and the 100-epoch schedule §4.1 cannot be checked.
  • Contrastive gather. The paper says ITC gathers logits across GPUs app. G. No training code is present.
  • Dataset licenses. The paper's Data Usage section lists non-commercial or research-only terms for LaPa, CelebAMask-HQ, the original AFLW, CelebA and 300W app. H. The repository's DS_DATA.md gives download sources for LaPa, CelebAMask-HQ, AFLW-19, 300W and WFLW, without license terms DS_DATA.md. No data is redistributed by this card.
  • Latent bug, no effect in this code path. The backward pass of the point-to-image (p2i) op writes dy+dy where dy*dy is meant p2i_max.h. It only affects the gradient with respect to point coordinates. Ground-truth heatmaps are rendered under torch.no_grad() task.py, so training here never uses that gradient.

Pitfalls

  • The pre-training recipe is partly unstated. The paper gives no weight between the ITC and MIM losses, no vocabulary size |V| for the dVAE, and no rule for how many patches are masked within "at most 75". Its learning-rate description ("warmed up to 1e-3 in one epoch and then cosine decay to 9e-4 in 15 epochs") does not say the rate after epoch 15. An implementer needs these choices, and the code does not supply them.
  • Reproduced numbers. The repository's reproduced scores differ from the paper's by up to about 0.1 points on some metrics README.md. Use these as the expected spread when re-running the released configs.
  • Frozen and fine-tuned rows answer different questions. Tables 1 to 3 are frozen-backbone comparisons. Tables 4 to 9 mix frozen (FaRL) and fine-tuned (FaRL_ft) rows, and the 448 rows also change input resolution. Do not read them as one comparison.
  • The class default of the alignment heatmap radius is 16.0, but every shipped config uses 5.0 task.py aflw19_farl.yaml.
  • Coordinate convention. Points are normalised with a +0.5 pixel offset geometry.py and denormalised with -0.5 geometry.py. Any conversion to or from another toolkit's pixel coordinates must match this offset.
  • Attribute LR of 0.3. The paper states an AdamW learning rate of 0.3 with cosine decay over 100 epochs §4.1. This is unusually large for AdamW and no code is available to confirm it. Treat it as unverified.
  • Cost of pre-training. Pre-training uses 32 V100s for 16 epochs §3.4, and the authors report that the ITC-plus-MIM setup needs roughly double the compute of CLIP-style training app. G. The downstream models have the same cost as other ViT-B/16 models at inference app. G.
  • Data for commercial use. LaPa, CelebAMask-HQ, CelebA, the original AFLW and 300W carry non-commercial or research-only terms app. H. The LAION-FACE subset is derived from LAION-400M, which the paper says is CC BY 4.0 app. H. Neither the paper nor the repository states a license for the LAION-FACE subset itself. Before commercial fine-tuning, check each dataset's own terms.
  • Face attributes are only partly verified. The attribute head, its training recipe and its 100-epoch schedule have no code here.

Lineage

  • Builds on: image-text contrastive pre-training as in CLIP and ALIGN §2.1 §3.2; masked image modeling inspired by BEiT §1 §3.3; the discrete VAE of Ramesh et al. for MIM targets §3.3; UPerNet heads and the BEiT-style layer selection {4, 6, 8, 12} §4.1. The face-specific features are compared against Face Transformer (Zhong et al.) and against self-supervised face pre-training (SwAV, SimCLR) app. E.
  • Compared against: MoCo v3, BEiT, ViT, DeiT, CLIP, Face Transformer (frozen) §4.2; AGRNet, EAGR, EHANet, BASS, Wei et al. (face parsing) §4.4; LAB, LUVLi, AWing, ADNet (alignment) §4.4; PS-MCNN, SSPL (attributes) §4.4.
  • Superseded by: not stated in this wiki.

Source and license

Adapted from “General Facial Representation Learning in a Visual-Linguistic Manner” by Yinglin Zheng, Hao Yang, Ting Zhang, Jianmin Bao, Dongdong Chen, Yangyu Huang, Lu Yuan, Dong Chen, Ming Zeng, Fang Wen (arXiv:2112.03109), used under CC BY 4.0. Changes: condensed and restructured for implementation, with tables, equations and algorithms taken from the paper and its code, each cited to its source. Not affiliated with or endorsed by the authors. Code citations refer to https://github.com/faceperceiver/farl at commit 3fb46941cb44 (MIT). Any quoted code is shown under that license.