made-with-python made-with-pytorch License: MIT

OpenSphere is a hyperspherical face recognition library based on PyTorch. See the project homepage.

Introduction

OpenSphere provides a consistent and unified training and evaluation framework for hyperspherical face recognition research. The framework decouples the loss function from the other varying components such as network architecture, optimizer, and data augmentation. It can fairly compare different loss functions in hyperspherical face recognition on popular benchmarks, serving as a transparaent platform to reproduce published results.

Supported Projects
  • SphereFace: Deep Hypersphere Embedding for Face Recognition, CVPR 2017

  • SphereFace2: Binary Classification is All You Need for Deep Face Recognition, ICLR 2022

  • SphereFace Revived: Unifying Hyperspherical Face Recognition, TPAMI 2022

Update

  • 2022.4.1: initial commit.

Setup (with Anaconda)

  1. Clone the OpenSphere repository. We’ll call the directory that you cloned OpenSphere as OPENSPHERE_ROOT.

    git clone https://github.com/ydwen/opensphere.git
  2. Construct virtual environment in Anaconda

    conda env create -f environment.yml

Getting started

Note: In this part, we assume you are in the directory $OPENSPHERE_ROOT After successfully completing the Setup, you are ready to run all the following experiments.

  1. Datasets

    Download the training set (VGGFace2), validation set (LFW, Age-DB, CA-LFW, CP-LFW), and test set (IJB-B and IJB-C) and place them in ../data/.

    tar xvf ../data/vggface2.tar -C ../data/ 
    tar xvf ../data/validation.tar -C ../data/ 
    tar xvf ../data/IJB.tar -C ../data/
  2. Training a model (see the training config file for detailed setup)

  • To train SphereFace2, run the following commend:

    CUDA_VISIBLE_DEVICES=0,1 python train.py --config config/papers/SphereFace2/sec41/vggface2_sfnet20_sphereface2.yml
  • To train SphereFace, run the following commend:

    CUDA_VISIBLE_DEVICES=0,1 python train.py --config config/papers/SphereFace2/sec41/vggface2_sfnet20_sphereface.yml
  1. Testing a model (see the testing config file for detailed setup)

    CUDA_VISIBLE_DEVICES=0,1 python test.py --config config/test/ijbb.yml

Citation

If you find OpenSphere useful in your research, please consider to cite:

For SphereFace:

@article{Liu2022SphereFaceR,
  title={SphereFace Revived: Unifying Hyperspherical Face Recognition},
  author={Liu, Weiyang and Wen, Yandong and Raj, Bhiksha and Singh, Rita and Weller, Adrian},
  journal = {IEEE Transactions on Pattern Analysis and Machine Intelligence},
  year={2022}
}

@InProceedings{Liu2017CVPR,
  title = {SphereFace: Deep Hypersphere Embedding for Face Recognition},
  author = {Liu, Weiyang and Wen, Yandong and Yu, Zhiding and Li, Ming and Raj, Bhiksha and Song, Le},
  booktitle = {CVPR},
  year = {2017}
}

For SphereFace2:

@article{wen2021sphereface2,
  title = {SphereFace2: Binary Classification is All You Need for Deep Face Recognition},
  author = {Wen, Yandong and Liu, Weiyang and Weller, Adrian and Raj, Bhiksha and Singh, Rita},
  booktitle = {arXiv preprint arXiv:2108.01513},
  year = {2021}
}

Contact

Yandong Wen and Weiyang Liu

Questions can also be left as issues in the repository. We will be happy to answer them.

GitHub

View Github