8,367
edits
Changes
→Manually install face_recognition
<ol style="list-style-type: decimal;">
<li><p>First create a new '''~/.pip''' directory, then add the '''pip.conf''' configuration file, and set the mirror source of pip to Tsinghua source in it, the commands to be executed are as follows:</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''mkdir -p ~/.pip'''</p>
<p>orangepi@orangepi:~$ '''cat <<EOF > ~/.pip/pip.conf'''</p>
<p>'''index-url = https://pypi.tuna.tsinghua.edu.cn/simple'''</p>
<p>'''trusted-host = pypi.tuna.tsinghua.edu.cn'''</p>
<p>'''EOF'''</p>|}</li>
<li><p>Then install dependencies</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo apt update'''</p>
<p>orangepi@orangepi:~$ '''sudo apt install -y python3-pip libopencv-dev \'''</p>
<p>'''python3-opencv imagemagick python3-scipy python3-setuptools python3-wheel \'''</p>
<p>'''python3-dev cmake python3-testresources'''</p>|}</li>
<li><p>Then update pip3</p>
{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 -m pip install -U pip setuptools wheel'''</p>|}</li>
<li><p>Before installing '''face_recognition''', you first need to install the '''dlib''' library. Since the compilation and installation of the dlib library on the development board is relatively slow, I saved a compiled dlib whl file on '''gitee''', and you can install it directly after downloading. The download address of the dlib whl file is as follows:</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>'''https://gitee.com/leeboby/python_whl'''</p>
|}
<ol style="list-style-type: lower-alpha;">
<li><p>First download the python_whl warehouse to the Linux system of > the development board</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''git clone --depth=1 https://gitee.com/leeboby/python_whl'''</p>|}</li><li><p>In the python_whl folder, you can see that there are multiple > versions of dlib installation packages. The Linux systems > corresponding to different versions of dlib are as follows:</p></li></ol></li></ol>
{| class="wikitable" style="width:800px;"
|-
| style="text-align: left;"| '''Ubuntu20.04'''
| style="text-align: left;"| '''dlib-19.24.0-cp39-cp39-linux_aarch64.whl'''
|}
</li></ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li><p>Then you can start installing dlib, the command is as follows</p>
<ol style="list-style-type: lower-alphanone;"><li><p>a) Ubuntu20.04</p>{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepi:~$ '''cd python_whl'''</p>
<p>orangepi@orangepi:~/python_whl$ '''python3 -m pip install dlib-19.24.0-cp38-cp38-linux_aarch64.whl'''</p>|}</li><li><p>b) Ubuntu22.04</p>{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepi:~$ '''cd python_whl'''</p>
<p>orangepi@orangepi:~/python_whl$ '''python3 -m pip install dlib-19.24.0-cp310-cp310-linux_aarch64.whl'''</p>|}</li><li><p>c) Debian11</p>{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepi:~$ '''cd python_whl'''</p>
<p>orangepi@orangepi:~/python_whl$ '''python3 -m pip install dlib-19.24.0-cp39-cp39-linux_aarch64.whl'''</p>|}</li></ol>
</li>
<li><p>After installation, if the version number of dlib can be printed > normally by using the following command, it means that dlib is > installed correctly</p>{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepi:~/python_whl$ '''python3 -c "import dlib; print(dlib.__version__)"'''</p>
<p>'''19.24.0'''</p>|}</li></ol></li></ol>
<!-- -->
<ol start="5" style="list-style-type: decimal;">
<li><p>Then install '''face_recognition_models-0.3.0-py2.py3-none-any.whl'''</p>
{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~/python_whl$ '''python3 -m pip install face_recognition_models-0.3.0-py2.py3-none-any.whl'''</p>|}</li>
<li><p>Then install '''face_recognition'''</p>
{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 -m pip install face_recognition'''</p>|}</li><li><p>Then you need to '''<span style="color:#FF0000">reopen a terminal</span>''' to find and run the two commands '''face_detection''' and '''face_recognition'''</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The face_recognition command is used to recognize whose face is > in a single image or a folder of images.</p></li><li><p>The face_detection command is used to locate the face in a > single picture or a picture folder</p>{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepi:~$ '''which face_detection'''</p>
<p>/usr/local/bin/face_detection</p>
<p>orangepi@orangepi:~$ '''which face_recognition'''</p>
<p>/usr/local/bin/face_recognition</p></li></ol>|}
</li></ol>
If you can't find the above two commands after reopening the terminal, please try to manually import environment variables, and then test again
{| class="wikitable" style="width:800px;"
|-
|
orangepi@orangepi:~$ '''export PATH=/home/orangepi/.local/bin:$PATH'''
|}
</li></ol>
<span id="the-test-method-of-face_recognition"></span>
=== The test method of face_recognition ===