Face Recognition with ArcFace
Training a Vision Transformer Small (ViT-S) backbone to learn 512-dimensional face embeddings using the ArcFace training pipeline from InsightFace. The training workflow runs on Google Vertex AI Pipelines with GPU acceleration.
Overview
This project explores training a face recognition model from scratch using the ViT-S architecture provided by InsightFace's ArcFace toolkit.
The model learns discriminative facial representations through ArcFace-based classification training. Each input face is transformed into a 512-dimensional embedding, which can subsequently be used for face verification through cosine similarity.
The trained model is evaluated on six face verification benchmarks to investigate its generalization across different ages, poses, and facial appearances.
Embedding Size
512D
Evaluation Benchmarks
6
Backbone
ViT-S
Training Platform
Vertex AI
Model Architecture
The project uses the ViT-S backbone from InsightFace's arcface_torch implementation. The backbone processes aligned 112 × 112 face images and produces normalized feature representations for face recognition.
Dataset
The dataset contains training files and six standard face verification benchmarks. Only the training split is used during model optimization. Benchmark files are reserved for evaluation.
Face Recognition Dataset
Google Drive · Training and evaluation data
Training Data
dataset/
├── train.rec
├── train.idx
├── train.lst
├── train.csv
└── train/
Evaluation Benchmarks
dataset/
├── agedb_30.bin
├── calfw.bin
├── cfp_ff.bin
├── cfp_fp.bin
├── cplfw.bin
└── lfw.bin
The evaluation datasets are kept separate from the training data to measure performance on unseen verification pairs.
Training Pipeline
Model training is orchestrated using Google Vertex AI Pipelines. The workflow separates dataset preparation from model training and configures dedicated compute resources for GPU-accelerated execution.
Download Dataset
Download the face recognition dataset and prepare the training and evaluation files.
Train Model
Load the training dataset, initialize the ViT-S backbone, and execute ArcFace training.
Evaluate Model
Evaluate the trained face embeddings against six standard face verification benchmarks.
Vertex AI Pipeline Configuration
The training component runs with the following compute configuration:
CPU
4 vCPUs
Memory
16 GiB
GPU
NVIDIA Tesla T4
GPU Count
1
@dsl.pipeline(name="arcface-training-pipeline")
def pipeline(train_config: str):
# Download dataset
data_task = download_data()
# Train model
train_task = train_model(
dataset=data_task.outputs["dataset"],
train_config=train_config,
)
# Configure compute resources
train_task.set_cpu_limit("4")
train_task.set_memory_limit("16Gi")
train_task.set_accelerator_type("NVIDIA_TESLA_T4")
train_task.set_accelerator_limit(1)This pipeline makes training execution reproducible and allows dataset downloading and model training to run as separate pipeline components.
Training Toolkit
The project integrates InsightFace's arcface_torch implementation for model architecture, dataset loading, ArcFace training, and verification evaluation.
INSTALLATION
git clone --depth 1 --filter=blob:none --sparse \
https://github.com/deepinsight/insightface.git
cd insightface
git sparse-checkout set recognition/arcface_torchEvaluation Results
The trained ViT-S backbone is evaluated using six face verification benchmarks. Accuracy measures overall verification performance, while VAL at FAR = 1e-3 measures verification rate under a strict false acceptance constraint.
Best Accuracy · LFW
94.72%
CFP-FF Accuracy
94.16%
| Benchmark | Accuracy | VAL @ FAR 1e-3 |
|---|---|---|
| AgeDB-30 | 75.77% | 3.20% |
| CALFW | 82.88% | 19.90% |
| CFP-FP | 73.56% | 3.83% |
| CFP-FF | 94.16% | 57.49% |
| CPLFW | 65.17% | 0.47% |
| LFW | 94.72% | 75.43% |
VAL values are reported as percentages. The original evaluation results also include standard deviations and observed FAR values.
Results Analysis
The model achieves relatively strong results on LFW and CFP-FF, but performance decreases on benchmarks involving more challenging age and pose variations.
Strong general face verification baseline.
Good performance on frontal-to-frontal verification.
Limited generalization across age variations.
Difficulty with frontal-to-profile verification.
Significant challenges with cross-pose verification.
Limitations & Future Improvements
These results establish an initial baseline rather than a fully optimized face recognition model. Further experiments could investigate:
Training Configuration
Experiment with training duration, learning rate, batch size, and optimizer settings.
ArcFace Loss
Investigate margin, scale, and classification head configurations.
Data Preprocessing
Verify face alignment, normalization, image quality, and color conventions.
Embedding Evaluation
Review feature normalization, cosine similarity, and verification thresholds.
Benchmark Analysis
Inspect false acceptance and false rejection cases across different variations.
Pretrained Initialization
Compare training from scratch against pretrained backbone initialization.
Conclusion
This project establishes a baseline for training a Vision Transformer Small backbone using InsightFace's ArcFace pipeline, producing 512-dimensional face embeddings through a GPU-accelerated Google Vertex AI training workflow.
While the model achieves promising results on LFW and CFP-FF, its performance on age- and pose-related benchmarks indicates that further optimization is necessary to improve the robustness of learned facial representations.
PROJECT REPOSITORY
arcface-train
Explore the notebooks, training scripts, dataset preparation, Vertex AI pipeline, and evaluation implementation.
Explore on GitHub ↗