基于face-recognition的人脸识别web服务

Github开源人脸识别项目face_recognition

译者注:
本项目face_recognition是一个强大、简单、易上手的人脸识别开源项目,并且配备了完整的开发文档和应用案例,特别是兼容树莓派系统。为了便于中国开发者研究学习人脸识别、贡献代码,我将本项目README文件翻译成中文。向本项目的所有贡献者致敬。

face-recognition这个开源项目,大家可以去github上找找,有很多的demo可以拿来用,比如用knn或者调用webcam视频来进行识别。然后我这边用的是face_recognition_knn这个demo来进行的。

整个demo有训练,预测,以及结果展示三个部分:

首先是train

def train(train_dir, model_save_path=None, n_neighbors=None, knn_algo='ball_tree', verbose=False):
    """
    Trains a k-nearest neighbors classifier for face recognition.


    :param train_dir: directory that contains a sub-directory for each known person, with its name.


     (View in source code to see train_dir example tree structure)


     Structure:
        <train_dir>/
        ├── <person1>/
        │   ├── <somename1>.jpeg
        │   ├── <somename2>.jpeg
        │   ├── ...
        ├── <person2>/
        │   ├── <somename1>.jpeg
        │   └── <somename2>.jpeg
        └── ...


    :param model_save_path: (optional) path to save model on disk
    :param n_neighbors: (optional) number of neighbors to weigh in classification. Chosen automatically if not specified
    :param knn_algo: (optional) underlying data structure to support knn.default is ball_tree
    :param verbose: verbosity of training
    :return: returns knn classifier that was trained on the given data.
    """
    X = []
    y = []


    # Loop through each person in the training set
    for class_dir in o
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值