Skip to content
/ facenet Public

[CVPR 2015] FaceNet: A Unified Embedding for Face Recognition and Clustering

License

Notifications You must be signed in to change notification settings

ZJCV/facenet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Language: 🇺🇸 🇨🇳

«facenet» re-implements the paper FaceNet: A Unified Embedding for Face Recognition and Clustering


Based on the similarity implementation, the following functions have been added:

  1. Add configuration file module to support configurable training parameters;
  2. Support Multi-GPU training and Mixed-Precision training;
  3. Add a variety of preprocessing functions and training configuration.

About training results for FMNIST/CIFAR/LFW, see details

Table of Contents

Background

facenet is an excellent face recognition paper, which innovatively puts forward a new training paradigm - triplet loss training. The core idea of triple loss is to reduce the Euclidean distance between similar faces and expand the distance between different classes as much as possible. Every training needs to collect training images (anchor points), positive samples of the same class and negative samples of different classes.

similarity provides an excellent facenet' training project. Before each round of training, distribute the data through the sampler to ensure that each batch of data contains p categories and each category has k training samples; After the forward calculation is completed, pairwise calculation is carried out on the same batch of data, and the positive and negative sample pairs that meet the definition of semi-hard (the negative sample is not closer to the anchor point than the positive sample, but its distance is still within the boundary range) are collected to participate in the loss function calculation.

The deficiency of the above project lies in that it does not support multi-GPU training, mixed precision training and no good modular design, which leads to weak scalability and can not be directly applied to practical applications. In order to better train facenet, this warehouse has enhanced the operation based on similarity, providing a more friendly training implementation.

Installation

$ pip install -r requirements.txt

Usage

  1. Get data file. See how to get data
  2. Training
    1. Single GPU training
      $ CUDA_VISIBLE_DEVICES=0 python tools/train.py -cfg=configs/lfw/r18_lfw_224_e2_adam_g1.yaml
      
    2. Multi GPU training
      $ CUDA_VISIBLE_DEVICES=0,1,2,3 python tools/train.py -cfg=configs/lfw/r18_lfw_224_e2_adam_g4.yaml
      

Maintainers

  • zhujian - Initial work - zjykzj

Thanks

@article{2015,
   title={FaceNet: A unified embedding for face recognition and clustering},
   url={http://dx.doi.org/10.1109/CVPR.2015.7298682},
   DOI={10.1109/cvpr.2015.7298682},
   journal={2015 IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
   publisher={IEEE},
   author={Schroff, Florian and Kalenichenko, Dmitry and Philbin, James},
   year={2015},
   month={Jun}
}

Contributing

Anyone's participation is welcome! Open an issue or submit PRs.

Small note:

License

Apache License 2.0 © 2021 zjykzj

About

[CVPR 2015] FaceNet: A Unified Embedding for Face Recognition and Clustering

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages