Sitemap
Jungletronics

Education & STEAM Learning by building. Practical explorations in AI, programming, electronics, robotics, IoT, and other STEAM topics — from ideas and experiments to working products. Follow and build with us.

Advanced Python Technologies III

Face Recognition w/ Colab #PurePythonSeries — Episode #14

3 min readOct 23, 2022

--

Hi, this time let’s use Google Colaboratory.

Face recognition library works well here, but there’s a secret that I’ll tell you right away:

Go to Runtime > Change runtime type > Choose GPU and hit save and you are ready to go \o/

Here is the result for code below:

All faces were detected and blurred
Press enter or click to view image in full size

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: Forget It All: Let's Use Google Resources \o/

01#step — Access Google colab and get a Jupyter Notebook to work with.

02#step — Importing face recognition right away !

pip install face-recognition

03#step — Import cmake

pip install cmake

04#step — Import OpenCV

pip install opencv-python

05#step — Testing face recognition

import face_recognition

If you pass, paradise is ahead!

06#step —First let’s detect all the faces. Please download to the Jupyter Notebook directory this image:

The code bellow will detect all the 16 faces in this photo
oficce.jpg

07#step — Paste this code in the next cell

It results:

16 faces detected \o/

08#step — Now Now the code show: blur all faces just in case of image rights’ claiming

Get J3’s stories in your inbox

Join Medium for free to get updates from this writer.

Paste this code:

The code is all commented, if you want, check it out!
Press enter or click to view image in full size
Here is the result again \o/ This technique can be used for filming children for example.

One single note, replace cv2.imshow() with this:

from google.colab.patches import cv2_imshow(...)cv2_imshow()

09#step — print(Thank you very much!”)

That’s it!

print("That's it! Thank you very much")That's it! Thank you very much

👉Github (PPY-14)

👉Google Colab Jupyter Notebook

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

14#Episode#PurePythonSeries — Advanced Python Technologies III — Face Recognition w/ Colab #PurePythonSeries (this one)

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 (this one)

17#Episode#PurePythonSeries — Python — Basics — Functions, OOP, file handling, calculator, loops (this one)

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/

--

J3
J3

Written by J3

Computer Engineer | AI & Data Systems | IoT & Embedded Systems | Product Creator — From Idea to Product | Founder @ Jungletronics & Kidstronics

Jungletronics
Jungletronics

Published in Jungletronics

Education & STEAM Learning by building. Practical explorations in AI, programming, electronics, robotics, IoT, and other STEAM topics — from ideas and experiments to working products. Follow and build with us.