Advanced Python Technologies II

Face Recognition w/ Jupyter Notebook & Ubuntu #PurePythonSeries — Episode #13

J3
Jungletronics
5 min readOct 23, 2022

--

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

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

02#step — Go To Terminal and confirm your Python version

Note: see History — 1.2.3 (2018–08–21): Officially supporting Python 3.7

If your version is not that…try:

Now Go to here :)

03#step — Install CMake on Ubuntu Software store:

Open Terminal and first Reboot your system by typing reboot -n and Type: $ cmake — version
cmake version 3.24.1

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

Note: These are all my packages installed initially: conda list initial (339 packages installed)

05#step — On Terminal type

This command will open a New Tab on your Browser (Mine is Firefox 106.0.1–64 bit)

06#step — Install dlib inside Jupyter notebook :)

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

08#step — Install Open CV

Note: OpenCV is a library of programming functions mainly aimed at real-time computer vision.

09#step — Install Face Recognition package

10#step — Dealing With GLIBCXX_3.4.29 in anaconda issue :/

And

Note: These are all my packages at the final: conda list final (359 packages 21 more :)

Added packs for Jupyter Notebook —the main packages are related to the c compiler gcc e gxx, I think…

11#step — Let’s code: detect all the faces. Please download for the Jupyter Notebook directory these images:

The code bellow will detect all the 16 faces in this photo
16 faces detected \o/

12#step — Let’s Recognize faces in images and identify who he are:

Download Toby mugshot:

Toby mugshot
Toby was detected right there behind many faces. How fantastic and simple to use is this lib API! \o/

👉Github (PPY-13)

👉Google Drive (PPY-13)

Related Posts

00#Episode#PurePythonSeries — Lambda in Python — Python Lambda Desmistification

01#Episode#PurePythonSeries — Send Email in Python — Using Jupyter Notebook — How To Send Gmail In Python

02#Episode#PurePythonSeries — Automate Your Email With Python & Outlook — How To Create An Email Trigger System in Python

03#Episode#PurePythonSeries — Manipulating Files With Python — Manage Your Lovely Photos With Python!

04#Episode#PurePythonSeries — Pandas DataFrame Advanced — A Complete Notebook Review

05#Episode#PurePythonSeries — Is This Leap Year? Python Calendar — How To Calculate If The Year Is Leap Year and How Many Days Are In The Month

06#Episode#PurePythonSeries — List Comprehension In Python — Locked-in Secrets About List Comprehension

07#Episode#PurePythonSeries — Graphs — In Python — Extremely Simple Algorithms in Python

08#Episode#PurePythonSeries — Decorator in Python — How To Simplifying Your Code And Boost Your Function

12#Episode#PurePythonSeries — Advanced Python Technologies qrcode, Speech Recognition in Python, Google Speech Recognition #PurePythonSeries

13#Episode#PurePythonSeries — Advanced Python Technologies II— qFace Recognition w/ Jupyter Notebook & Ubuntu#PurePythonSeries (this one)

14#Episode#PurePythonSeries — Advanced Python Technologies III — Face Recognition w/ Colab

15#Episode#PurePythonSeries — ISS Tracking Project — Get an Email alert when International Space Station (ISS) is above of us in the sky, at night

16#Episode#PurePythonSeries — Using Gemini Chat on Collab — Random Number Generation, List Manipulation & Rock-Paper-Scissors Game Implementations

17#Episode#PurePythonSeries — Python — Basics — Functions, OOP, file handling, calculator, loops

18#Episode#PurePythonSeries — Python — Efficient File Handling in Python — Best Practices and Common Methods

19#Episode#PurePythonSeries — Python — How To Securely Save Credentials in Python — Like API tokens, passwords, or other sensitive data

Credits & References

HARVARD CS50— lecture 6 —Python — DAVID MALAN https://cs50.harvard.edu/x/2021/weeks/6/
https://you.com/search?q=libstdc%2B%2B.so.6%3A%20version%20%60glibcxx_3.4.29%27

face-recognition https://pypi.org/project/face-recognition/

Anaconda https://www.digitalocean.com/community/tutorials/how-to-

Ubuntu — install-the-anaconda-python-distribution-on-ubuntu-20-04

CMake https://vitux.com/how-to-install-cmake-on-ubuntu/

make-cxx-compiler-notfound https://askubuntu.com/questions/152653/cmake-fails-with-cmake-error-your-cxx-compiler-cmake-cxx-compiler-notfound

anaconda gcc is 4.8.5.https://stackoverflow.com/questions/44773296/libstdc-so-6-version-glibcxx-3-4-20-not-found

Install GLIBCXX_3.4.29 in anaconda https://stackoverflow.com/questions/68205760/install-glibcxx-3-4-29-in-anaconda

Install GitHub Desktophttps://gist.github.com/berkorbay/6feda478a00b0432d13f1fc0a50467f1

https://gist.github.com/berkorbay/6feda478a00b0432d13f1fc0a50467f1

--

--

J3
Jungletronics

😎 Gilberto Oliveira Jr | 🖥️ Computer Engineer | 🐍 Python | 🧩 C | 💎 Rails | 🤖 AI & IoT | ✍️