IEEE TBIOM 2025

Learning Multi-Scale Knowledge-Guided Features for Text-Guided Face Recognition

IEEE Transactions on Biometrics, Behavior, and Identity Science (TBIOM), Vol. 7, No. 2, pp. 195–209, April 2025

Md Mahedi Hasan, Shoaib Meraj Sami, Nasser Nasrabadi, and Jeremy Dawson

Lane Department of Computer Science and Electrical Engineering, West Virginia University

Abstract

Text-guided face recognition (TGFR) aims to improve the performance of state-of-the-art face recognition (FR) algorithms by incorporating auxiliary information, such as distinct facial marks and attributes, provided as natural language descriptions. Current TGFR algorithms have been proven to be highly effective in addressing performance drops in state-of-the-art FR models, particularly in scenarios involving sensor noise, low resolution, and turbulence effects. Although existing methods explore various algorithms using different cross-modal alignment and fusion techniques, they encounter practical limitations in real-world applications. For example, during inference, textual descriptions associated with face images may be missing, lacking crucial details, or incorrect. Furthermore, the presence of inherent modality heterogeneity poses a significant challenge in achieving effective cross-modal alignment. To address these challenges, we introduce CaptionFace, a TGFR framework that integrates GPTFace, a face image captioning model designed to generate context-rich natural language descriptions from low-resolution facial images. By leveraging GPTFace, we overcome the issue of missing textual descriptions, expanding the applicability of CaptionFace to single-modal FR datasets. Additionally, we introduce a multi-scale feature alignment (MSFA) module to ensure semantic alignment between face-caption pairs at different granularities. Furthermore, we introduce an attribute-aware loss and perform knowledge adaptation to specifically adapt textual knowledge from facial features. Extensive experiments on three face-caption datasets and various unconstrained single-modal benchmark datasets demonstrate that CaptionFace significantly outperforms state-of-the-art FR models and existing TGFR approaches.

Overview

CaptionFace extends our earlier WACV 2024 work, TGFR, with a deeper alignment module, a knowledge-distillation mechanism between modalities, an attribute-aware objective, and an end-to-end captioning model that removes the framework's dependence on having a caption available at inference time. It is evaluated on three face-caption datasets (Multi-Modal CelebA-HQ, Face2Text, CelebA-Dialog), on single-modal benchmark FR datasets (LFW, CALFW, AgeDB-30) using captions generated on the fly, and on a fine-grained image classification benchmark (CUB-200-2011) to show the alignment module generalizes beyond faces.

Face-caption information
Figure 2. Two subjects often share the same facial attributes, which degrades the discriminability of caption-specific features and prevents the model from learning discriminative multimodal features. Captions do not always cover every fine-grained attribute of a face, and may even contain inconsistent or incorrect attributes (e.g. "necklace"), further imbalancing the information in a face-caption pair and making cross-modal alignment harder.

Architecture

CaptionFace framework: GPTFace captioning, BLIP caption encoder, projection network, Multi-Scale Alignment Module with local and global semantic alignment losses, shared identity classifier with Caption Knowledge Adaptation, attribute-aware losses, and Cross-Modal Fusion Module.
Figure 3. Overview of the CaptionFace framework. It comprises an image captioning network, an image encoder, a text encoder, an alignment module, and a fusion module. The alignment module establishes cross-modal semantic associations using contrastive losses at both local and global scales while incorporating attribute information, helping the fusion module implement fine-grained visual-semantic interaction. A knowledge adaptation technique enriches the textual modality with image-specific information. The captioning network, GPTFace, uses facial images and associated captions during training; at inference it generates captions on the fly for single-modal face recognition datasets with no paired text.

Four components make up the framework:

  1. GPTFace

    A lightweight face-captioning model (frozen AdaFace image encoder + 12-block GPT-2 decoder) that generates a natural-language description directly from a low-resolution face image, so CaptionFace can be applied to single-modal FR datasets that have no associated text.

  2. Multi-Scale Alignment Module (MSAM)

    Aligns image and caption embeddings at both the global level (global semantic alignment loss) and the local, region-to-token level (local semantic alignment loss).

  3. Caption Knowledge Adaptation (CKA)

    A distillation mechanism that enriches the caption embedding with image-specific detail it might be missing, instead of forcing an identity loss directly onto noisy text features.

  4. Cross-Modal Fusion Module (CMFM)

    A transformer block with multi-head cross- and self-attention that fuses local image features with caption token embeddings for the final identity decision, trained with a focal loss.

An attribute-aware loss is applied on both modalities using a 40-attribute vector extracted from the caption with TextBlob, adding a modality-invariant, fine-grained supervisory signal on top of the identity loss.

Cross-Modal Fusion Module (CMFM)
Figure 4. Block diagram of the Cross-Modal Fusion Module (CMFM). A fusion transformer applies fine-grained interaction between local image features and caption token embeddings via multi-head cross-attention, followed by multi-head self-attention and a max-pooling and MLP head, trained with a focal loss.

Face image captioning: GPTFace

GPTFace pairs a frozen AdaFace image encoder with a 12-block GPT-2 language decoder. Since GPT-2 has no native mechanism for consuming encoder features, a cross-attention scheme is incorporated into every GPT-2 block. A projection network combines local and global image features extracted by AdaFace, with a self-attention layer added to capture long-range fine-grained dependencies before passing the combined representation into GPT-2's cross-attention.

GPTFace framework
Figure 5. Summary of the GPTFace framework. A pre-trained AdaFace encoder pairs with a GPT-2 language decoder. Local and global image features are extracted and fed into a projection network that uses self-attention to capture long-range fine-grained details. A cross-attention scheme integrates this contextual information into the GPT-2 decoder, enabling GPTFace to generate descriptive, context-rich captions for facial images.

GPTFace optimizes a language-modeling loss for next-token prediction, plus a multi-label classification loss (L_attr-text) that penalizes the decoder for missing or misrepresented facial attributes in the generated caption, judged against attributes extracted from the ground truth using TextBlob.

Results

1:1 verification on face-caption datasets

TPR (%) at FPR = 1e-6 / 1e-5 / 1e-4, both ArcFace and AdaFace as the image encoder, BLIP as the text encoder.

BackboneMethodMMCelebAFace2TextCelebA-Dialog
ArcFaceCGFR51.20 / 66.32 / 78.0551.50 / 63.50 / 65.9234.89 / 64.90 / 74.83
TGFR (WACV 2024)52.63 / 67.72 / 78.7352.26 / 64.28 / 67.0636.09 / 66.02 / 76.84
Baseline I (image only)36.31 / 49.47 / 55.7143.33 / 46.10 / 52.1421.58 / 59.09 / 66.46
Baseline II (BERT + fusion)47.32 / 63.89 / 72.8350.21 / 62.56 / 64.9631.60 / 63.77 / 70.23
CaptionFace (ours)54.45 / 68.52 / 79.7853.36 / 65.29 / 67.8137.09 / 66.48 / 78.90
AdaFaceCGFR60.20 / 65.80 / 81.057.76 / 61.60 / 65.041.90 / 63.36 / 74.88
TGFR (WACV 2024)61.0 / 68.20 / 81.059.06 / 64.29 / 67.8143.16 / 65.50 / 75.20
Baseline I (image only)36.21 / 56.78 / 70.7552.78 / 54.65 / 57.9028.26 / 59.39 / 68.67
Baseline II (BERT + fusion)57.68 / 65.50 / 78.056.27 / 58.60 / 62.038.56 / 61.78 / 72.51
CaptionFace (ours)62.56 / 69.38 / 81.060.85 / 65.29 / 68.8944.50 / 67.06 / 76.67

CaptionFace is the top-performing method on all three datasets with both image encoders. With AdaFace, it outperforms TGFR by 1.56 / 1.18 / 0 points on MMCelebA, 1.79 / 1.0 / 1.08 on Face2Text, and 1.34 / 1.56 / 1.47 on CelebA-Dialog at TAR@FAR = 1e-6 / 1e-5 / 1e-4.

Benchmark FR accuracy

Verification accuracy (%) on LFW / CALFW / AgeDB-30, captions generated on the fly by GPTFace (no ground-truth text at test time).

BackendMethodLFWCALFWAgeDB-30
iResNet50ArcFace*99.8095.4098.08
MagFace*99.8295.9898.0
AdaFace99.8296.0797.85
Ours (ArcFace)99.8595.7098.19
Ours (MagFace)99.8596.0798.14
Ours (AdaFace)99.8696.1398.02
iResNet101ArcFace99.8395.4598.28
MagFace99.8396.1598.17
AdaFace99.8296.0898.05
Ours (ArcFace)99.8695.6198.35
Ours (MagFace)99.8696.2298.28
Ours (AdaFace)99.8796.1598.19

*Our implementation. Backbones are kept frozen during CaptionFace training (paper Section IV.A.3). LFW and AgeDB-30 are near saturation, but CaptionFace still consistently improves over every corresponding FR model.

GPTFace vs. multimodal foundation models

Captioning quality on MMCelebA. GPTFace runs at 112×112 input, roughly a third the resolution of BLIP / BLIP-2.

MethodVisual backboneInputB@1B@2B@3B@4METEORROUGE-L
BLIPViT-B/16384²76.8466.5454.1344.5660.4160.68
BLIP-2ViT-g FT5384²84.5673.8566.057.3661.9461.12
OursArcFace112²90.0885.6478.2869.2459.6060.50
AdaFace112²91.1086.078.9669.9059.8060.74

GPTFace with AdaFace outperforms BLIP and BLIP-2 by 25.34% and 12.54% in B@4, while using a third the input resolution and far fewer trainable parameters (177M vs. 446M / 1.1B).

Fine-grained image classification (CUB-200-2011)

Rank-1 accuracy (%), caption supervision only — no bounding boxes or part annotations used.

MethodBBoxPartsCaptionRank-1 Acc.
ResNet1872.77
TGFR76.0
Ours (CaptionFace)78.0
ResNet5078.96
TGFR82.80
Ours (CaptionFace)84.84

CaptionFace improves 5.23 points over plain ResNet18 and 5.88 points over plain ResNet50, surpassing TGFR by roughly 2 points on both backbones — confirming the alignment module generalizes beyond faces.

Ablation studies

Objective function

TAR@FAR (%) on MMCelebA with AdaFace; identity loss and focal loss are present in every row as the baseline.

LGSALLLSALLCKALattr1e-61e-51e-4
53.4564.2675.35
57.6066.9078.0
58.0266.7078.89
54.8065.576.40
58.9165.3877.40
62.5669.3881.0

Every loss term contributes positively. Combined, the full objective surpasses the identity + fusion baseline by 9.11 / 5.12 / 5.65 points at TAR@FAR = 1e-6 / 1e-5 / 1e-4.

Robustness to atmospheric turbulence

EER and TAR@FAR (%) on MMCelebA as image quality degrades with simulated atmospheric turbulence (D/r₀ ratio).

MethodDegrad. levelEER ↓1e-51e-41e-3
AdaFace05.7756.7870.7582.17
TGFR3.8968.2081.087.46
Ours3.5069.3881.089.20
AdaFace17.6746.8458.1869.93
TGFR5.8259.1270.677.87
Ours5.3360.0872.079.24
AdaFace212.6832.1337.5548.31
TGFR9.7548.0551.1757.62
Ours9.2448.0554.2160.33
AdaFace320.4715.6121.2832.32
TGFR13.3928.3437.0649.19
Ours12.9630.7238.3452.32

At the most severe degradation level (3), CaptionFace improves 2.38 / 1.28 / 3.13 points over TGFR and 15.11 / 17.06 / 20.0 points over plain AdaFace. The performance gap widens as image quality worsens.

Degradation levels
Figure 7. Sample face images degraded by atmospheric turbulence, with strengths ranging from 0.5 to 3. Leftmost is the normal image; rightmost is the most heavily degraded version.

Qualitative analysis

Grad-CAM++ class activation maps show that CaptionFace's attention shifts toward the facial regions actually mentioned in the caption, rather than spreading uniformly across the face or background the way the plain AdaFace encoder does.

Grad-CAM++ visualizations
Figure 8. Grad-CAM++ visualizations. Each column shows the raw face image, the CAM from pre-trained AdaFace, and the CAM from CaptionFace. CaptionFace's attention is shaped by the input caption — e.g. in (a), it focuses on high cheekbones, earrings, and a big nose as described in the text; in (c), on big lips, lipstick, and the mouth.

Code

The repository includes CaptionFace training and evaluation, the standalone GPTFace captioning model, the fine-grained classification extension on CUB-200-2011, and the legacy BERT-encoder baseline used for comparison in the paper.

CaptionFace/ ├── cfg/ # YAML / Python configs, hyperparameter search space ├── data/ # dataset root ├── fgic/ # fine-grained classification on CUB-200-2011 ├── models/ # backbones, fusion nets, margin heads, GPTFace ├── src/ # train / test entry points ├── utils/ # dataloaders, attribute extraction ├── visualize/ # Grad-CAM++ visualizations ├── weights/ # pretrained / fine-tuned checkpoints └── requirements.txt

Train CaptionFace on CelebA with the AdaFace backbone and Cross-Modal Fusion Module:

python3 src/train_captionface.py \
    --dataset celeba \
    --model_type adaface \
    --fusion_type CMF_FR \
    --batch_size 8 \
    --max_epoch 18 \
    --is_itc --is_KD --is_attr_loss

Evaluate 1:1 verification on the held-out face-caption test split:

python3 src/test_captionface.py --model_type adaface --dataset celeba

Full installation steps, dataset layout, pretrained-weight paths, and the complete command reference for GPTFace training, benchmark FR evaluation, and the CUB-200-2011 extension are in the repository README.

View the GitHub repository →

Citation

If you use this code or build on this work, please cite:

@ARTICLE{Hasan_captionface_2025, author={Hasan, Md Mahedi and Sami, Shoaib Meraj and Nasrabadi, Nasser M. and Dawson, Jeremy}, journal={IEEE Transactions on Biometrics, Behavior, and Identity Science}, title={Learning Multi-Scale Knowledge-Guided Features for Text-Guided Face Recognition}, year={2025}, volume={7}, number={2}, pages={195-209}, doi={10.1109/TBIOM.2024.3466216} }

This paper extends two earlier works on text-guided face recognition:

@InProceedings{Hasan_TGFR_2024, author = {Hasan, Md Mahedi and Sami, Shoaib Meraj and Nasrabadi, Nasser}, title = {Text-Guided Face Recognition Using Multi-Granularity Cross-Modal Contrastive Learning}, booktitle = {Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision (WACV)}, month = {January}, year = {2024}, pages = {5784-5793} } @InProceedings{Hasan_CGFR_2023, author={Hasan, Md Mahedi and Nasrabadi, Nasser}, booktitle={2023 IEEE International Joint Conference on Biometrics (IJCB)}, title={Improving Face Recognition from Caption Supervision with Multi-Granular Contextual Feature Aggregation}, year={2023}, pages={1-10} }