CASIA-WebFace ArcFace Face Verification Models

This repository contains the best local checkpoints from the data_mining course project for face verification on the 6,000-pair LFW protocol.

The final model is an IR-ResNet18 embedding network trained on a CASIA-WebFace mirror and fine-tuned with hard-example self-distillation from a locally trained IR-ResNet18 teacher. The final inference model is a single backbone that outputs 512-dimensional face embeddings.

Included Checkpoints

Checkpoint Backbone Training setup LFW 10-fold accuracy ROC AUC
models/self_hsd_ir18_arcface/epoch_024.pth IR-ResNet18 ArcFace + hard-example self-distillation 94.7167% 0.974148
models/advanced_ir18_arcface/epoch_020.pth IR-ResNet18 ArcFace from scratch 94.1167% 0.971984
models/scratch_casia_arcface/epoch_021.pth InceptionResnetV1 ArcFace from scratch 86.4833% 0.930206

The reported results use MTCNN preprocessing with margin=16, image_size=112, and the provided design/lfw_test_pair.txt pair list.

Files

  • models/*/*.pth: PyTorch checkpoints.
  • models/*/best_lfw.json: best-checkpoint metadata.
  • models/*/training_config.json and history.json: training configuration and logs.
  • src/: training, evaluation, and backbone definition code.
  • results/*: selected LFW metrics, plots, and pair scores.
  • docs/PROJECT_README.md: original project README.
  • reports/: project reports.

Raw training and evaluation datasets are not included.

Checkpoint Format

Each .pth file is a PyTorch checkpoint dictionary. Important keys:

  • backbone: canonical backbone name.
  • backbone_state_dict: embedding backbone weights.
  • arcface_state_dict: ArcFace classification head weights used during training.
  • optimizer_state_dict and scheduler_state_dict: training resume state.
  • epoch, num_classes, and training metadata.

For inference, load only backbone_state_dict.

Quick Load

import sys

import torch
import torch.nn.functional as F

sys.path.append("src")
from face_backbones import build_backbone

checkpoint_path = "models/self_hsd_ir18_arcface/epoch_024.pth"
payload = torch.load(checkpoint_path, map_location="cpu")

model, _, _ = build_backbone(payload.get("backbone", "ir_resnet18"), pretrained_model=None)
model.load_state_dict(payload["backbone_state_dict"], strict=True)
model.eval()

# `batch` should be an aligned RGB face tensor of shape [N, 3, 112, 112],
# standardized with facenet_pytorch.fixed_image_standardization.
with torch.no_grad():
    embeddings = F.normalize(model(batch), p=2, dim=1)

Reproduce LFW Evaluation

python src/evaluate_lfw.py \
  --lfw-root data/raw/lfw-deepfunneled \
  --pairs-file design/lfw_test_pair.txt \
  --checkpoint models/self_hsd_ir18_arcface/epoch_024.pth \
  --preprocess mtcnn \
  --mtcnn-margin 16 \
  --image-size 112 \
  --batch-size 512 \
  --num-workers 0 \
  --device cuda \
  --output-dir results/self_hsd_ir18_lfw_epoch24_margin16

Install dependencies from requirements.txt or environment.yml. The project uses facenet-pytorch==2.6.0 --no-deps because its package metadata pins an older PyTorch version.

Intended Use and Limitations

These checkpoints are for coursework and face-verification research experiments. They should not be used for identity decisions in production or surveillance systems without consent, legal review, bias evaluation, security review, and additional validation on data that represents the deployment population.

LFW is a limited benchmark and does not establish broad demographic fairness, robustness to spoofing, or real-world reliability.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Datasets used to train Hnu-22-yudi/data_minning