All Projects → louis-she → Center Loss.pytorch

louis-she / Center Loss.pytorch

center loss for face recognition

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Center Loss.pytorch

Face Classification
Face model to classify gender and race. Trained on LFWA+ Dataset.
Stars: ✭ 104 (-20.61%)
Mutual labels:  face-recognition
Maad Face
A face database with a large number of high-quality attribute annotations
Stars: ✭ 112 (-14.5%)
Mutual labels:  face-recognition
Robovision
AI and machine leaning-based computer vision for a robot
Stars: ✭ 126 (-3.82%)
Mutual labels:  face-recognition
Face2data
Face2Data: Extract meaningful information from a person face in less than a second. Powered by Keras and Flask.
Stars: ✭ 107 (-18.32%)
Mutual labels:  face-recognition
Whoiscomingto.party
Simple Face Recognition Attendance System
Stars: ✭ 111 (-15.27%)
Mutual labels:  face-recognition
Dlib Face Recognition Android
Android app to demo dlib face recognition
Stars: ✭ 115 (-12.21%)
Mutual labels:  face-recognition
Awslambdaface
Perform deep neural network based face detection and recognition in the cloud (via AWS lambda) with zero model configuration or tuning.
Stars: ✭ 98 (-25.19%)
Mutual labels:  face-recognition
Insightface Just Works
Insightface face detection and recognition model that just works out of the box.
Stars: ✭ 127 (-3.05%)
Mutual labels:  face-recognition
Deepface
Face analysis mainly based on Caffe. At this time, face analysis tasks like detection, alignment and recognition have been done.
Stars: ✭ 1,465 (+1018.32%)
Mutual labels:  face-recognition
Arcface Tf2
ArcFace unofficial Implemented in Tensorflow 2.0+ (ResNet50, MobileNetV2). "ArcFace: Additive Angular Margin Loss for Deep Face Recognition" Published in CVPR 2019. With Colab.
Stars: ✭ 124 (-5.34%)
Mutual labels:  face-recognition
Resnet Face Pytorch
Training a ResNet on UMDFaces for face recognition
Stars: ✭ 107 (-18.32%)
Mutual labels:  face-recognition
Sphereface
Implementation for <SphereFace: Deep Hypersphere Embedding for Face Recognition> in CVPR'17.
Stars: ✭ 1,483 (+1032.06%)
Mutual labels:  face-recognition
Deepstack
The World's Leading Cross Platform AI Engine for Edge Devices
Stars: ✭ 120 (-8.4%)
Mutual labels:  face-recognition
Awesome Face Detection
Compare with various detectors - s3fd, dlib, ocv, ocv-dnn, mtcnn-pytorch, face_recognition
Stars: ✭ 106 (-19.08%)
Mutual labels:  face-recognition
Mfr
Learning Meta Face Recognition in Unseen Domains, CVPR, Oral, 2020
Stars: ✭ 127 (-3.05%)
Mutual labels:  face-recognition
Repo 2016
R, Python and Mathematica Codes in Machine Learning, Deep Learning, Artificial Intelligence, NLP and Geolocation
Stars: ✭ 103 (-21.37%)
Mutual labels:  face-recognition
Deepface
Keras implementation of the renowned publication "DeepFace: Closing the Gap to Human-Level Performance in Face Verification" by Taigman et al. Pre-trained weights on VGGFace2 dataset.
Stars: ✭ 113 (-13.74%)
Mutual labels:  face-recognition
Paz
Hierarchical perception library in Python for pose estimation, object detection, instance segmentation, keypoint estimation, face recognition, etc.
Stars: ✭ 131 (+0%)
Mutual labels:  face-recognition
Tensorflow Facenet
人脸识别算法,结合facenet网络结构和center loss作为损失,基于tensorflow框架,含训练和测试代码,支持从头训练和摄像头测试
Stars: ✭ 127 (-3.05%)
Mutual labels:  face-recognition
Seqface
SeqFace : Making full use of sequence information for face recognition
Stars: ✭ 125 (-4.58%)
Mutual labels:  face-recognition

center-loss.pytorch

Center loss implementation for face recognition in pytorch. Paper at: A Discriminative Feature Learning Approach for Deep Face Recognition

Requirements

  • Python 3.6
  • Pytorch 0.4

Usage

Training No need to download anything. The following command will create directorys and download everything automatically.

# For quick reference and small GPU ram
python3 main.py --arch resnet18 --batch_size 64 --epochs 50

# For a more solid model
python3 main.py

# or
python3 main.py --arch resnet50 --batch_size 256 --epochs 150

Evaluation

python3 main.py --evaluate ./logs/models/epoch_xx.pth.tar

# Model accuracy is 0.961722195148468
# ROC curve generated at /home/louis/center-loss.pytorch/logs/roc.png

More Options

usage: main.py [-h] [--batch_size N] [--log_dir LOG_DIR] [--epochs N]
               [--lr LR] [--arch ARCH] [--resume RESUME]
               [--dataset_dir DATASET_DIR] [--weights WEIGHTS]
               [--evaluate EVALUATE] [--pairs PAIRS] [--roc ROC]
               [--verify-model VERIFY_MODEL] [--verify-images VERIFY_IMAGES]

center loss example

optional arguments:
  -h, --help            show this help message and exit
  --batch_size N        input batch size for training (default: 256)
  --log_dir LOG_DIR     log directory
  --epochs N            number of epochs to train (default: 100)
  --lr LR               learning rate (default: 0.001)
  --arch ARCH           network arch to use, support resnet18 and resnet50
                        (default: resnet50)
  --resume RESUME       model path to the resume training
  --dataset_dir DATASET_DIR
                        directory with lfw dataset (default:
                        $HOME/datasets/lfw)
  --weights WEIGHTS     pretrained weights to load default:
                        ($LOG_DIR/resnet18.pth)
  --evaluate EVALUATE   evaluate specified model on lfw dataset
  --pairs PAIRS         path of pairs.txt (default: $DATASET_DIR/pairs.txt)
  --roc ROC             path of roc.png to generated (default:
                        $DATASET_DIR/roc.png)
  --verify-model VERIFY_MODEL
                        verify 2 images of face belong to one person,the param
                        is the model to use
  --verify-images VERIFY_IMAGES
                        verify 2 images of face belong to one person,split
                        image pathes by comma

Experiments

Trained a model with default configuration(resnet50 for 100 epochs). The model can be downloaded from Baidu Yun or Google Drive.

Results shown as follows:

python main.py --evaluate logs/models/epoch_100.pth.tar --batch_size 128

Model accuracy is 0.9628332853317261
ROC curve generated at /home/louis/center-loss.pytorch/logs/roc.png

Experiments with MNIST dataset

softmax only

softmax + center loss

Random People Verification

2 images of Obama and 2 images of Trump. Verify 4 pairs together using the model.

➜ python main.py --verify-model logs/models/epoch_100.pth.tar --verify-images images/obama_a.png,images/obama_b.png
distance: 0.9222122430801392
➜ python main.py --verify-model logs/models/epoch_100.pth.tar --verify-images images/trump_a.png,images/trump_b.png
distance: 0.8140196800231934
➜ python main.py --verify-model logs/models/epoch_100.pth.tar --verify-images images/obama_a.png,images/trump_a.png
distance: 1.2879283428192139
➜ python main.py --verify-model logs/models/epoch_100.pth.tar --verify-images images/obama_b.png,images/trump_b.png
distance: 1.26639723777771

We can see that threshold of 1.1 will perfectly seperate them.

Due to the small dataset, this model is just for quick example reference. If one wants to use in production, change the feature extract network and train on a larger dataset.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].