# deepface
[![Downloads](https://pepy.tech/badge/deepface)](https://pepy.tech/project/deepface)
[![License](http://img.shields.io/:license-MIT-blue.svg?style=flat)](https://github.com/serengil/deepface/blob/master/LICENSE)
<p align="center"><img src="https://raw.githubusercontent.com/serengil/deepface/master/icon/deepface-icon-labeled.png" width="200" height="240"></p>
Deepface is a lightweight [face recognition](https://sefiks.com/2018/08/06/deep-face-recognition-with-keras/) and facial attribute analysis ([age](https://sefiks.com/2019/02/13/apparent-age-and-gender-prediction-in-keras/), [gender](https://sefiks.com/2019/02/13/apparent-age-and-gender-prediction-in-keras/), [emotion](https://sefiks.com/2018/01/01/facial-expression-recognition-with-keras/) and [race](https://sefiks.com/2019/11/11/race-and-ethnicity-prediction-in-keras/)) framework for python. It is a hybrid face recognition framework wrapping **state-of-the-art** models: [`VGG-Face`](https://sefiks.com/2018/08/06/deep-face-recognition-with-keras/), [`Google FaceNet`](https://sefiks.com/2018/09/03/face-recognition-with-facenet-in-keras/), [`OpenFace`](https://sefiks.com/2019/07/21/face-recognition-with-openface-in-keras/), [`Facebook DeepFace`](https://sefiks.com/2020/02/17/face-recognition-with-facebook-deepface-in-keras/), [`DeepID`](https://sefiks.com/2020/06/16/face-recognition-with-deepid-in-keras/), [`ArcFace`](https://sefiks.com/2020/12/14/deep-face-recognition-with-arcface-in-keras-and-python/) and [`Dlib`](https://sefiks.com/2020/07/11/face-recognition-with-dlib-in-python/). The library is mainly based on Keras and TensorFlow.
## Installation
The easiest way to install deepface is to download it from [`PyPI`](https://pypi.org/project/deepface/).
```python
pip install deepface
```
## Face Recognition
A modern [**face recognition pipeline**](https://sefiks.com/2020/05/01/a-gentle-introduction-to-face-recognition-in-deep-learning/) consists of 4 common stages: [detect](https://sefiks.com/2020/08/25/deep-face-detection-with-opencv-in-python/), [align](https://sefiks.com/2020/02/23/face-alignment-for-face-recognition-in-python-within-opencv/), [represent](https://sefiks.com/2018/08/06/deep-face-recognition-with-keras/) and [verify](https://sefiks.com/2020/05/22/fine-tuning-the-threshold-in-face-recognition/). Deepface handles all these common stages in the background. You can just call its verification, find or analysis function in its interface with a single line of code.
**Face Verification** - [`Demo`](https://youtu.be/KRCvkNCOphE)
Verification function under the deepface interface offers to verify face pairs as same person or different persons. You should pass face pairs as array instead of calling verify function in a for loop for the best practice. This will speed the function up dramatically and reduce the allocated memory.
```python
from deepface import DeepFace
result = DeepFace.verify("img1.jpg", "img2.jpg")
#results = DeepFace.verify([['img1.jpg', 'img2.jpg'], ['img1.jpg', 'img3.jpg']])
print("Is verified: ", result["verified"])
```
<p align="center"><img src="https://raw.githubusercontent.com/serengil/deepface/master/icon/stock-1.jpg" width="95%" height="95%"></p>
Herein, face pairs could be exact image paths, numpy array or base64 encoded images.
**Face recognition** - [`Demo`](https://youtu.be/Hrjp-EStM_s)
Face recognition requires to apply face verification several times. Herein, deepface offers an out-of-the-box find function to handle this action. It stores the representations of your facial database and you don't have to find it again and again. In this way, you can apply [face recognition](https://sefiks.com/2020/05/25/large-scale-face-recognition-for-deep-learning/) data set as well. The find function returns pandas data frame if a single image path is passed, and it returns list of pandas data frames if list of image paths are passed.
```python
from deepface import DeepFace
import pandas as pd
df = DeepFace.find(img_path = "img1.jpg", db_path = "C:/workspace/my_db")
#dfs = DeepFace.find(img_path = ["img1.jpg", "img2.jpg"], db_path = "C:/workspace/my_db")
```
<p align="center"><img src="https://raw.githubusercontent.com/serengil/deepface/master/icon/stock-6-v2.jpg" width="95%" height="95%"></p>
Herein, image path argument could be exact image path, numpy array or base64 encoded image. Also, you are expected to store your facial image data base in the folder that you passed to the db_path argument with .jpg or .png extension.
**Large Scale Face Recognition** - [`Demo with Elasticsearch`](https://youtu.be/i4GvuOmzKzo), [`Demo with Spotify Annoy`](https://youtu.be/Jpxm914o2xk)
You can store facial embeddings in nosql databases. In this way, you can have the power of the map reduce technology. Here, you can find some implementation experiments with [mongoDb](https://sefiks.com/2021/01/22/deep-face-recognition-with-mongodb/), [Cassandra](https://sefiks.com/2021/01/24/deep-face-recognition-with-cassandra/) and [Hadoop](https://sefiks.com/2021/01/31/deep-face-recognition-with-hadoop-and-spark/).
Notice that face recognition has O(n) time complexity and this would be problematic for millions level data and limited hardware. Herein, approximate nearest neighbor (a-nn) algorithm reduces the time complexity dramatically. [Spotify Annoy](https://sefiks.com/2020/09/16/large-scale-face-recognition-with-spotify-annoy/), [Facebook Faiss](https://sefiks.com/2020/09/17/large-scale-face-recognition-with-facebook-faiss/) and [NMSLIB](https://sefiks.com/2020/09/19/large-scale-face-recognition-with-nmslib/) are amazing a-nn libraries. Besides, [Elasticsearch](https://sefiks.com/2020/11/27/large-scale-face-recognition-with-elasticsearch/) wraps an a-nn algorithm and it offers highly scalability feature. You should run deepface within those a-nn frameworks if you have really large scale data sets.
**Face recognition models** - [`Demo`](https://youtu.be/i_MOwvhbLdI)
Deepface is a **hybrid** face recognition package. It currently wraps the **state-of-the-art** face recognition models: [`VGG-Face`](https://sefiks.com/2018/08/06/deep-face-recognition-with-keras/) , [`Google FaceNet`](https://sefiks.com/2018/09/03/face-recognition-with-facenet-in-keras/), [`OpenFace`](https://sefiks.com/2019/07/21/face-recognition-with-openface-in-keras/), [`Facebook DeepFace`](https://sefiks.com/2020/02/17/face-recognition-with-facebook-deepface-in-keras/), [`DeepID`](https://sefiks.com/2020/06/16/face-recognition-with-deepid-in-keras/), [`ArcFace`](https://sefiks.com/2020/12/14/deep-face-recognition-with-arcface-in-keras-and-python/) and [`Dlib`](https://sefiks.com/2020/07/11/face-recognition-with-dlib-in-python/). The default configuration verifies faces with VGG-Face model. You can set the base model while verification as illustared below.
```python
models = ["VGG-Face", "Facenet", "OpenFace", "DeepFace", "DeepID", "ArcFace", "Dlib"]
for model in models:
result = DeepFace.verify("img1.jpg", "img2.jpg", model_name = model)
df = DeepFace.find(img_path = "img1.jpg", db_path = "C:/workspace/my_db", model_name = model)
```
FaceNet, VGG-Face, ArcFace and Dlib [overperforms](https://youtu.be/i_MOwvhbLdI) than OpenFace, DeepFace and DeepID based on experiments. Supportively, FaceNet got 99.65%; ArcFace got 99.40%; Dlib got 99.38%; VGG-Face got 98.78%; OpenFace got 93.80% accuracy scores on [LFW data set](https://sefiks.com/2020/08/27/labeled-faces-in-the-wild-for-face-recognition/) whereas human beings could have just 97.53%.
**Similarity**
Face recognition models are regular [convolutional neural networks](https://sefiks.com/2018/03/23/convolutional-autoencoder-clustering-images-with-neural-networks/) and they are responsible to represent faces as vectors. Decision of verification is based on the distance between vectors. We can classify pairs if its distance is less than a [threshold](https://sefiks.com/2020/05/22/fine-tuning-the-threshold-in-face-recognition/).
Distance
没有合适的资源?快使用搜索试试~ 我知道了~
deepface:适用于Python的轻量级深脸识别和面部属性分析(年龄,性别,情感和种族)框架
共105个文件
jpg:66个
py:27个
txt:2个
5星 · 超过95%的资源 需积分: 48 24 下载量 19 浏览量
2021-02-03
04:39:33
上传
评论 2
收藏 26.16MB ZIP 举报
温馨提示
深脸 Deepface是python的轻量级和面部属性分析(,,和)框架。 它是一个混合的人脸识别框架,其中包含了最先进的模型: , , , , , 和 。 该库主要基于Keras和TensorFlow。 安装 安装deepface的最简单方法是从下载。 pip install deepface 人脸识别 现代包括四个常见阶段: , ,和。 Deepface在后台处理所有这些常见阶段。 您只需使用一行代码即可在其界面中调用其验证,查找或分析功能。 人脸验证- deepface界面下的验证功能可验证同一个人或不同个人的面部对。 您应将面对作为数组传递,而不是为了最佳实践而在for循环中调用verify函数。 这将大大加快该功能,并减少分配的内存。 from deepface import DeepFace result = DeepFace . verify ( "img1.jpg" , "img2.jpg" ) #results = DeepFace.verify([['img1.jpg', 'img2.jpg'], ['img1.jpg', 'img3.jpg'
资源详情
资源评论
资源推荐
收起资源包目录
deepface:适用于Python的轻量级深脸识别和面部属性分析(年龄,性别,情感和种族)框架 (105个子文件)
face-recognition-pivot.csv 40KB
master.csv 7KB
.gitignore 335B
Fine-Tuning-Threshold.ipynb 34KB
img26.jpg 2.36MB
img1.jpg 2.18MB
img33.jpg 2.07MB
img35.jpg 1.3MB
img40.jpg 1.13MB
img58.jpg 973KB
img39.jpg 776KB
img54.jpg 685KB
img49.jpg 676KB
img3.jpg 647KB
img23.jpg 536KB
img7.jpg 516KB
img13.jpg 511KB
img4.jpg 463KB
img47.jpg 425KB
img41.jpg 416KB
img19.jpg 396KB
img2.jpg 339KB
img31.jpg 316KB
img9.jpg 265KB
img48.jpg 265KB
img24.jpg 261KB
stock-4.jpg 255KB
img30.jpg 251KB
stock-2.jpg 241KB
img32.jpg 239KB
img20.jpg 222KB
stock-1.jpg 219KB
stock-3.jpg 201KB
img14.jpg 172KB
stock-6-v2.jpg 170KB
img59.jpg 168KB
img36.jpg 167KB
img15.jpg 158KB
img8.jpg 154KB
img28.jpg 154KB
img27.jpg 152KB
img18.jpg 148KB
img57.jpg 146KB
img10.jpg 135KB
img56.jpg 125KB
img42.jpg 118KB
img37.jpg 116KB
img45.jpg 104KB
img53.jpg 93KB
img34.jpg 82KB
img6.jpg 77KB
img29.jpg 75KB
img55.jpg 75KB
img38.jpg 74KB
img67.jpg 68KB
deepface-api.jpg 62KB
img43.jpg 60KB
img11.jpg 55KB
img21.jpg 53KB
img61.jpg 50KB
img17.jpg 50KB
img44.jpg 45KB
img46.jpg 38KB
img50.jpg 37KB
img16.jpg 36KB
img5.jpg 34KB
img62.jpg 22KB
img25.jpg 21KB
img51.jpg 20KB
img12.jpg 19KB
deepface.postman_collection.json 5.95MB
LICENSE 1KB
README.md 18KB
deepface-icon-labeled.png 47KB
deepface-icon.png 20KB
Facenet.py 48KB
DeepFace.py 24KB
realtime.py 16KB
OpenFace.py 14KB
functions.py 14KB
unit_tests.py 8KB
Ensemble-Face-Recognition.py 7KB
api.py 7KB
ArcFace.py 4KB
VGGFace.py 3KB
face-recognition-how.py 2KB
Emotion.py 2KB
Boosting.py 2KB
FbDeepFace.py 2KB
DlibResNet.py 2KB
Age.py 2KB
DeepID.py 2KB
Race.py 2KB
distance.py 1KB
Gender.py 1KB
setup.py 1021B
DlibWrapper.py 92B
__init__.py 0B
__init__.py 0B
__init__.py 0B
共 105 条
- 1
- 2
真好玩主人
- 粉丝: 17
- 资源: 4632
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1