Fizza-Rubab/face-embedding-compatibility

Python

0

13 commits

updated Aug 15, 2026

See the code

README

Compatibility of Face Embeddings Across Deep Neural Networks

Official code for the IJCB 2026 paper "Compatibility of Face Embeddings Across Deep Neural Networks" Fizza Rubab, Yiying Tong, Arun Ross (Michigan State University).

We learn simple linear maps (Procrustes, least-squares, Ridge) between the embedding spaces of independently trained face and foundation models, and show that these low-capacity maps recover cross-model identification and verification.

Repository structure

cfe/               importable library (pip install -e .): config, alignment methods,
                   embedders, model loaders
extraction/        embed_{cfp,lfw,webface}.py, crop_lfw.py
experiments/       identification / verification, within- and cross-dataset
analysis/          hierarchy, data efficiency, rsa/cka, quadratic maps, ridge alpha

Installation

conda create -n cfe python=3.11 -y
conda activate cfe
pip install -e .
pip install torch==2.9.1 torchvision==0.24.1 --index-url https://download.pytorch.org/whl/cu126
pip install -r requirements.txt

pip install -e . alone is enough to run the alignment and analysis on existing embeddings.

Datasets

DatasetKeyDefault pathEnv override
CFPcfpdata/cfp/Data/ImagesCFE_CFP_DIR
LFWlfwdata/lfw_croppedCFE_LFW_DIR
CASIA-WebFacewebfacedata/webface/casia-webface-5CFE_WEBFACE_DIR

CFP uses the 10 frontal images per identity; LFW is center-cropped by extraction/crop_lfw.py; CASIA-WebFace is subsampled with --max-images-per-id 5. Paths live in cfe/config.py.

Models

Fourteen models across two families (paper Table 1), defined in cfe/config.py. Face weights come from CVLface (gated: export HF_TOKEN=...) and MagFace; foundation models load from Hugging Face transformers.

Face: ArcFace, AdaFace, MagFace, KPRPE. Foundation: CLIP, ALIGN, DINOv2, SAM, BLIP-2, LLaVA, Kosmos-2, InternVL3, Florence-2, ViT.

Pipeline

Run from the repository root.

export HF_TOKEN=...
python extraction/embed_cfp.py
python extraction/embed_lfw.py
python extraction/embed_webface.py --max-images-per-id 5

python experiments/identification_within_cfp.py
python experiments/verification_within_cfp.py
python experiments/identification_cross.py
python experiments/verification_cross.py

python analysis/hierarchy.py
python analysis/data_efficiency.py
python analysis/rsa_cka.py
python analysis/quadratic_maps.py
python analysis/ridge_alpha.py

Alignment API

from cfe.methods import ProcrustesAlignment, LinearAlignment, RidgeAlignment

algo = LinearAlignment()
algo.fit(A_train, B_train)
B_hat = algo.transform(A_test)

Scripts and analysis

Paper artifactScript(s)
Table 2: intra-datasetexperiments/identification_within_*.py, experiments/verification_within_*.py
Table 3: cross-dataset (CFP→LFW)experiments/identification_cross.py, experiments/verification_cross.py
Performance vs. training dataanalysis/data_efficiency.py
Dendrogram + source/sink asymmetryanalysis/hierarchy.py
RSA/CKA, non-linear maps, Ridge-αanalysis/rsa_cka.py, analysis/quadratic_maps.py, analysis/ridge_alpha.py

Citation

@inproceedings{rubab2026compatibility,
  title     = {Compatibility of Face Embeddings Across Deep Neural Networks},
  author    = {Rubab, Fizza and Tong, Yiying and Ross, Arun},
  booktitle = {IEEE International Joint Conference on Biometrics (IJCB)},
  year      = {2026}
}

License

Released under the MIT License (see LICENSE).

Fizza-Rubab/face-embedding-compatibility

Python

0

13 commits

updated Aug 15, 2026

See the code

README

Compatibility of Face Embeddings Across Deep Neural Networks

Official code for the IJCB 2026 paper "Compatibility of Face Embeddings Across Deep Neural Networks" Fizza Rubab, Yiying Tong, Arun Ross (Michigan State University).

We learn simple linear maps (Procrustes, least-squares, Ridge) between the embedding spaces of independently trained face and foundation models, and show that these low-capacity maps recover cross-model identification and verification.

Repository structure

cfe/               importable library (pip install -e .): config, alignment methods,
                   embedders, model loaders
extraction/        embed_{cfp,lfw,webface}.py, crop_lfw.py
experiments/       identification / verification, within- and cross-dataset
analysis/          hierarchy, data efficiency, rsa/cka, quadratic maps, ridge alpha

Installation

conda create -n cfe python=3.11 -y
conda activate cfe
pip install -e .
pip install torch==2.9.1 torchvision==0.24.1 --index-url https://download.pytorch.org/whl/cu126
pip install -r requirements.txt

pip install -e . alone is enough to run the alignment and analysis on existing embeddings.

Datasets

DatasetKeyDefault pathEnv override
CFPcfpdata/cfp/Data/ImagesCFE_CFP_DIR
LFWlfwdata/lfw_croppedCFE_LFW_DIR
CASIA-WebFacewebfacedata/webface/casia-webface-5CFE_WEBFACE_DIR

CFP uses the 10 frontal images per identity; LFW is center-cropped by extraction/crop_lfw.py; CASIA-WebFace is subsampled with --max-images-per-id 5. Paths live in cfe/config.py.

Models

Fourteen models across two families (paper Table 1), defined in cfe/config.py. Face weights come from CVLface (gated: export HF_TOKEN=...) and MagFace; foundation models load from Hugging Face transformers.

Face: ArcFace, AdaFace, MagFace, KPRPE. Foundation: CLIP, ALIGN, DINOv2, SAM, BLIP-2, LLaVA, Kosmos-2, InternVL3, Florence-2, ViT.

Pipeline

Run from the repository root.

export HF_TOKEN=...
python extraction/embed_cfp.py
python extraction/embed_lfw.py
python extraction/embed_webface.py --max-images-per-id 5

python experiments/identification_within_cfp.py
python experiments/verification_within_cfp.py
python experiments/identification_cross.py
python experiments/verification_cross.py

python analysis/hierarchy.py
python analysis/data_efficiency.py
python analysis/rsa_cka.py
python analysis/quadratic_maps.py
python analysis/ridge_alpha.py

Alignment API

from cfe.methods import ProcrustesAlignment, LinearAlignment, RidgeAlignment

algo = LinearAlignment()
algo.fit(A_train, B_train)
B_hat = algo.transform(A_test)

Scripts and analysis

Paper artifactScript(s)
Table 2: intra-datasetexperiments/identification_within_*.py, experiments/verification_within_*.py
Table 3: cross-dataset (CFP→LFW)experiments/identification_cross.py, experiments/verification_cross.py
Performance vs. training dataanalysis/data_efficiency.py
Dendrogram + source/sink asymmetryanalysis/hierarchy.py
RSA/CKA, non-linear maps, Ridge-αanalysis/rsa_cka.py, analysis/quadratic_maps.py, analysis/ridge_alpha.py

Citation

@inproceedings{rubab2026compatibility,
  title     = {Compatibility of Face Embeddings Across Deep Neural Networks},
  author    = {Rubab, Fizza and Tong, Yiying and Ross, Arun},
  booktitle = {IEEE International Joint Conference on Biometrics (IJCB)},
  year      = {2026}
}

License

Released under the MIT License (see LICENSE).