Skip to content

javafa/faceid

Repository files navigation

Lightweight Face Recognition

  • Framework : Python 3.7 + , Pytorch 1.4.0, FastAPI 0.1.0

MobileFaceNet

The implementation of popular face recognition algorithms in pytorch framework, including arcface.
In this repository, we use a pre-trained MobliefaceNet model.

Requirements

for Face recognizer

PyQt5 pillow requests opencv-python bcolz matplotlib numpy pandas scikit-learn tensorboardX tqdm

for Rest API

fastapi uvicorn email_validator aiofiles sqlalchemy mysql-connector-python pyjwt passlib[bcrypt] python-multipart

Apis

Identify

POST /api/identify
{
   group_id: str
   threshold: float = None
   img : str # base64 bytes string
}

Adding a person

POST /api/person
{
   group_id : str
   person_id : str
   person_name : str = None
   img : str # base64 bytes string
}

References

wujiyang/Face_Pytorch
MuggleWang/CosFace_pytorch
foamliu/MobileFaceNet-PyTorch
Xiaoccer/MobileFaceNet_Pytorch
TreB1eN/InsightFace_Pytorch
deepinsight/insightface
KaiyangZhou/pytorch-center-loss
tengshaofeng/ResidualAttentionNetwork-pytorch

Install

  1. download and unzip or [git clone]
    download this project and unzip
    move the directory
    cd [project]

  2. install anaconda 3.x

  3. create virtual environment and activate
    conda create -n [project name] python=3.7
    conda activate [project name]

  4. download pre-trained model
    download latest model_mobilefacenet.pth to the [project] directory

  5. (additional) for GPU version
    install CUDA Toolkit
    install cuDNN

  6. install Pytorch and Cuda toolkit

    • GPU (nvidia product only)
      conda install pytorch torchvision cudatoolkit=10.1 -c pytorch
      (need to check your cuda version)
    • CPU
      conda install pytorch torchvision cpuonly -c pytorch
  7. (additional) for windows > before install requirements install "Microsoft Build Tools 2015 Update 3" for bcolz package
    (visualcppbuildtools_full.exe)

  8. install requirement packages
    pip install -r requirements.txt
    (could not install some packages by conda install)

Run server

cd [project] directory
python server.py

Test in web browser

About

Lightweight Face Recognition

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages