这个功能是通过比对`db_path`下的人脸来进行识别的。实际测试代码如下:
from deepface import DeepFace
if name == “__main__”:
DeepFace.stream(“tests/dataset”)
测试截图如下,由于使用的是项目内的图片数据集,图片比对结果看看就好:
![realtime.jpg](https://img-blog.csdnimg.cn/img_convert/1345203d5a43994967f6093693b71119.jpeg)
### 2.11 API
DeepFace serves an API as well. You can clone `[/api](https://bbs.csdn.net/topics/618540462)` folder and run the api via gunicorn server. This will get a rest service up. In this way, you can call deepface from an external system such as mobile app or web.
cd scripts
./service.sh
Linux系统使用这个命令是前台启动,实际的启动用的是shell脚本,内容如下:
#!/bin/bash
nohup python -u ./api/api.py > ./deepfacelog.out 2>&1 &
Face recognition, facial attribute analysis and vector representation functions