原始网站:https://github.com/ageitgey/face_recognition
需要安装dlib:
https://gist.github.com/ageitgey/629d75c1baac34dfa5ca2a1928a7aeaf
https://github.com/ageitgey/face_recognition
How to install dlib v19.9 or newer (w/ python bindings) from github on macOS and Ubuntu
Pre-reqs:
- Have Python 3 installed. On macOS, this could be installed from homebrew or even via standardPython 3.6 downloaded installer from https://www.python.org/download. On Linux, just use yourpackage manager.
- On macOS:
- Install XCode from the Mac App Store (or install the XCode command line utils).
- Have homebrew installed
- On Linux:
- For a full list of apt packages required, check out the example Dockerfile and copy what's installed there.
- These instructions assume you are using Ubuntu 16.04 or newer. If you are using 14.04, you can try these installation instructions instead to work around the old CMake version.
- These instructions assume you don't have an nVidia GPU and don't have Cuda and cuDNN installed and don't wantGPU acceleration (since none of the current Mac models support this).
Clone the code from github:
git clone https://github.com/davisking/dlib.git
Build the main dlib library (optional if you just want to use Python):
cd dlib
mkdir build; cd build; cmake .. -DDLIB_USE_CUDA=0 -DUSE_AVX_INSTRUCTIONS=1; cmake --build .
Build and install the Python extensions:
cd ..
python3 setup.py install --yes USE_AVX_INSTRUCTIONS --no DLIB_USE_CUDA
At this point, you should be able to run python3
and type import dlib
successfully.
最后一条命令,如果电脑是python2的版本,对应的要该一下,有时候会报错,权限不够,命令前加sudo。
#### Installing on Mac or Linux
First, make sure you have dlib already installed with Python bindings:
* [How to install dlib from source on macOS or Ubuntu](https://gist.github.com/ageitgey/629d75c1baac34dfa5ca2a1928a7aeaf)
Then, install this module from pypi using `pip3` (or `pip2` for Python 2):
```bash
pip3 install face_recognition
```
If you are having trouble with installation, you can also try out a
[pre-configured VM](https://medium.com/@ageitgey/try-deep-learning-in-python-now-with-a-fully-pre-configured-vm-1d97d4c3e9b).
#### Installing on Raspberry Pi 2+
* [Raspberry Pi 2+ installation instructions](https://gist.github.com/ageitgey/1ac8dbe8572f3f533df6269dab35df65)