Giter VIP home page Giter VIP logo

facenet-keras's Introduction

Facenet:人脸识别模型在Keras当中的实现


目录

  1. 性能情况 Performance
  2. 所需环境 Environment
  3. 注意事项 Attention
  4. 文件下载 Download
  5. 预测步骤 How2predict
  6. 训练步骤 How2train
  7. 参考资料 Reference

性能情况

训练数据集 权值文件名称 测试数据集 输入图片大小 accuracy
CASIA-WebFace facenet_mobilenet.h5 LFW 160x160 97.86%
CASIA-WebFace facenet_inception_resnetv1.h5 LFW 160x160 99.02%

所需环境

tensorflow-gpu==1.13.1
keras==2.1.5

文件下载

已经训练好的facenet_mobilenet.h5和facenet_inception_resnetv1.h5可以在百度网盘下载。
链接: https://pan.baidu.com/s/19tUjcBtC_5VlBqktFG_z0w 提取码: iq26

训练用的CASIA-WebFaces数据集以及评估用的LFW数据集可以在百度网盘下载。
链接: https://pan.baidu.com/s/1fhiHlylAFVoR43yfDbi4Ag 提取码: gkch

预测步骤

a、使用预训练权重

  1. 下载完库后解压,在model_data文件夹里已经有了facenet_mobilenet.h5,可直接运行predict.py输入:
img\1_001.jpg
img\1_002.jpg
  1. 也可以在百度网盘下载facenet_inception_resnetv1.h5,放入model_data,修改facenet.py文件的model_path后,输入:
img\1_001.jpg
img\1_002.jpg

b、使用自己训练的权重

  1. 按照训练步骤训练。
  2. 在facenet.py文件里面,在如下部分修改model_path和backbone使其对应训练好的文件;model_path对应logs文件夹下面的权值文件,backbone对应主干特征提取网络
_defaults = {
    "model_path"    : "model_data/facenet_mobilenet.h5",
    "input_shape"   : [160,160,3],
    "backbone"      : "mobilenet"
}
  1. 运行predict.py,输入
img\1_001.jpg
img\1_002.jpg

训练步骤

  1. 本文使用如下格式进行训练。
|-datasets
    |-people0
        |-123.jpg
        |-234.jpg
    |-people1
        |-345.jpg
        |-456.jpg
    |-...
  1. 下载好数据集,将训练用的CASIA-WebFaces数据集以及评估用的LFW数据集,解压后放在根目录。
  2. 在训练前利用txt_annotation.py文件生成对应的cls_train.txt。
  3. 利用train.py训练facenet模型,训练前,根据自己的需要选择backbone,model_path和backbone一定要对应。
  4. 运行train.py即可开始训练。

评估步骤

  1. 下载好评估数据集,将评估用的LFW数据集,解压后放在根目录
  2. 在eval_LFW.py设置使用的主干特征提取网络和网络权值。
  3. 运行eval_LFW.py来进行模型准确率评估。

Reference

https://github.com/davidsandberg/facenet
https://github.com/timesler/facenet-pytorch

facenet-keras's People

Contributors

bubbliiiing avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.