Advanced Python Technologies II
Face Recognition w/ Jupyter Notebook & Ubuntu #PurePythonSeries — Episode #13
Hi, Let’s play with face recognition in Linux Ubuntu and Anaconda Jupyter?
We will use https://pypi.org/project/face-recognition/ library.
Please visit ageitgey / face_recognition Public Github. It is awesome!
Let’s get started!
00#step — HARDWARE
Laptop: Dell Inc. G3 3590 8,0 GiB RAM
Processor : Intel® Core™ i7-9750H CPU @ 2.60GHz × 12
OS: Ubuntu 22.04.1 LTS (Jammy Jellyfish)
GPU: GeForce GTX 1660 Ti Mobile (NVIDIA TU1166M) Note: GPU acceleration (via nvidia’s CUDA library) is required for good performance with this model. You’ll also want to enable CUDA support when compiling dlib.
01#step —Installing Anaconda
Anaconda DistributionDownloadFor Linux
Python 3.9 • 64-Bit (x86) Installer • 737 MBanaconda --version
anaconda Command line client (version 1.7.2)02#step — Go To Terminal and confirm your Python version
python --version
Python 3.7.6Note: see History — 1.2.3 (2018–08–21): Officially supporting Python 3.7
If your version is not that…try:
sudo apt-get install python3.7or sudo python3.7 setup.py install
03#step — Install CMake on Ubuntu Software store:

Note: CMake is an open-source, cross-platform tool that uses compiler and platform independent configuration files to generate native build tool files specific to your compiler and platform.
04#step — First Commands
sudo apt update
sudo apt install net-tools
sudo apt install curl gitNote: These are all my packages installed initially: conda list initial (339 packages installed)
05#step — On Terminal type
jupyter-labThis command will open a New Tab on your Browser (Mine is Firefox 106.0.1–64 bit)
...
[I 2022-10-22 16:30:20.564 ServerApp] jupyterlab | extension was successfully loaded.
[I 2022-10-22 16:30:20.567 ServerApp] nbclassic | extension was successfully loaded.
[I 2022-10-22 16:30:20.568 ServerApp] Serving notebooks from local directory: /home/j3
[I 2022-10-22 16:30:20.568 ServerApp] Jupyter Server 1.21.0 is running at:
[I 2022-10-22 16:30:20.568 ServerApp] http://localhost:8888/lab?token=b059e1c29e838805a0b94eabbe16626e1a705f509b8490ee
[I 2022-10-22 16:30:20.568 ServerApp] or http://127.0.0.1:8888/lab?token=b059e1c29e838805a0b94eabbe16626e1a705f509b8490ee
[I 2022-10-22 16:30:20.568 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2022-10-22 16:30:20.609 ServerApp]
To access the server, open this file in a browser:
file:///home/j3/.local/share/jupyter/runtime/jpserver-3621-open.html
Or copy and paste one of these URLs:
http://localhost:8888/lab?token=b059e1c29e838805a0b94eabbe16626e1a705f509b8490ee
or http://127.0.0.1:8888/lab?token=b059e1c29e838805a0b94eabbe16626e1a705f509b8490ee
...06#step — Install dlib inside Jupyter notebook :)
!pip install dlibRequirement already satisfied: dlib in /home/j3/anaconda3/lib/python3.7/site-packages (19.24.0)Note: Many, many thanks to Davis King (@nulhom) for creating dlib and for providing the trained facial feature detection and face encoding models used in this library. For more information on the ResNet that powers the face encodings, check out his blog post.
07#step — Install cmake
!pip install cmakeRequirement already satisfied: cmake in /home/j3/anaconda3/lib/python3.7/site-packages (3.24.1.1)08#step — Install Open CV
!pip install opencv-pythonRequirement already satisfied: opencv-python in /home/j3/anaconda3/lib/python3.7/site-packages (4.6.0.66)
Requirement already satisfied: numpy>=1.14.5; python_version >= "3.7" in /home/j3/anaconda3/lib/python3.7/site-packages (from opencv-python) (1.18.1)Note: OpenCV is a library of programming functions mainly aimed at real-time computer vision.
09#step — Install Face Recognition package
!pip install face_recognitionRequirement already satisfied: face_recognition in /home/j3/anaconda3/lib/python3.7/site-packages (1.3.0)
Requirement already satisfied: dlib>=19.7 in /home/j3/anaconda3/lib/python3.7/site-packages (from face_recognition) (19.24.0)
Requirement already satisfied: Pillow in /home/j3/anaconda3/lib/python3.7/site-packages (from face_recognition) (7.0.0)
Requirement already satisfied: face-recognition-models>=0.3.0 in /home/j3/anaconda3/lib/python3.7/site-packages (from face_recognition) (0.3.0)
Requirement already satisfied: numpy in /home/j3/anaconda3/lib/python3.7/site-packages (from face_recognition) (1.18.1)
Requirement already satisfied: Click>=6.0 in /home/j3/anaconda3/lib/python3.7/site-packages (from face_recognition) (7.0)10#step — Dealing With GLIBCXX_3.4.29 in anaconda issue :/
wget -O - -q 'https://gist.githubusercontent.com/dte/8954e405590a360614dcc6acdb7baa74/raw/d1b5a01ed0b9252654016d2a9a435dc8b4c045e7/install-CUDA-docker-nvidia-docker.sh' | sudo bashAnd
conda install -c conda-forge gxx_linux-64==11.1.0Note: These are all my packages at the final: conda list final (359 packages 21 more :)










