Python Face Recognition (Beginner Tutorial)

preview_player
Показать описание
Let's walk through building facial recognition from completely scratch! We will learn about Python facial recognition libraries, embeddings and vectors, and more! All the code is in Google Colab so it'll be easy for you to recreate.

Aiven is the trusted open-source data platform.

Enjoy :)

Join My Newsletter for Regular AI Updates 👇🏼

Need AI Consulting? ✅

Rent a GPU (MassedCompute) 🚀
USE CODE "MatthewBerman" for 50% discount

My Links 🔗

Media/Sponsorship Inquiries 📈

Links:
Рекомендации по теме
Комментарии
Автор

I love that instead of making news about AI or other exciting things, you're actually putting time to create useful tutorials. I find this refreshing.

salehmir
Автор

Ngl your probably one of the best coding youtubers I have ever seen. Very specific, but you put it in very easy words and short sentences.

corbincodes
Автор

Really loving the latest content (in my best Matthew Berman voice) “Bravo” 👏 😁 this is phenomenal thank you 🙏🏽

aimademerich
Автор

I still want to hook up a camera to an actuator on my sliding door that will open and close it for my 2 dalmatians, but I want it to regocnise them and not just any dog etc. This is a good step in that direction

RicusNortje
Автор

🎯 Key Takeaways for quick navigation:

00:00 🏗️ *Building a Facial Recognition Script in Python*
- Overview of creating a facial recognition script with machine learning,
- Introduction to the tutorial and sponsorship by Aiven.
00:43 📸 *Image Recognition Process Explained*
- Outline of the facial recognition process using an initial photo,
- Details on detecting faces, calculating embeddings, and storing data in PostgreSQL.
02:48 💻 *Coding Facial Recognition*
- Steps to convert images into vector embeddings and match faces,
- Comparison between text and image vector embeddings for identifying similarity.
03:28 🧰 *Setting Up Libraries and Algorithms*
- Installing required Python libraries and loading algorithms for face detection in images,
- Importing and applying a pre-written algorithm to identify faces.
06:43 🗃️ *Extracting Faces and Converting to Embeddings*
- Explanation of extracting individual faces from the source image,
- Initial steps to convert those faces into vector embeddings for recognition.
07:10 ☁️ *Provisioning a Vector Database with Aiven*
- Using Aiven to create and host a vector database,
- Directions for setting up a Postgres service with Aiven platform.
08:47 🔧 *Creating and Connecting to the Database*
- Instructions for connecting to the Postgres database and creating essential database elements,
- Implementation of the Vector database extension and table.
09:28 🌐 *Converting Images to Embeddings for Database*
- Process for converting image files from the source to vectors,
- Inserting embedding data into the vector database for retrieval.
11:19 🔍 *Performing Similarity Search and Recognition*
- Comparing new images to existing database embeddings to find matches,
- Successful matching of a different image of the same person using vector similarity.
12:01 🚀 *Extending Code and Exploring Further Applications*
- Encouragement to extend the provided code for more sophisticated projects,
- Acknowledgment of Aiven's sponsorship and benefits offered for database services.

Made with HARPA AI

warezit
Автор

In previous video you asked what we would like to see with autogenstudio. How about adding this as a skill to the agents.

DeonBands
Автор

Matthew, can you make a video or point me to one you made on the conversion of image to embeddings? What does the data structure look like, what is algorithm.

AI_Robotics
Автор

what's the benefit of using postgreSql vectorDb vs chromadb?

themaxgo
Автор

imgbeddings has been trained on squared images only, I do not see in your code anything that create a square image from the face recognition output from cascade.
it is a nice idea to use imagebeddings with a vectorial DB.
nice job!

g.s.
Автор

hi, instead of vector in postgres what datatype to use in mysql ?

nicolaswebful
Автор

It would seem that one could employ more complex metric for computing those distances where the distance is a function of tree node distance of some sort of ontology tree.

Thus if one has a tree with two branches, say Sam (1.1) and John (1.2)
and another tree that has food and under that pizza (2.1) and pie (2.2)
and then another tree that has food (3.) and movies (3.2) and another tree loves(4.1.1), likes (4.1.2), eats (4.2.1), and cooks (4.2.2)

then we compare the sentences

1. Sam (1.1) loves (4.1.1) movies (4. 2.1),
2. Sam (1.1) loves (4.1.1) pizza (2.1)
3. John (1.2) likes (4.1.2) pie (2.2)
4. John (1.2) eats (4.2.1) pie (2.2)
5. John (1.2) cooks (4.2.2) pizza (2.1)

where the distances are the number of nodes between two nodes such that 1.1 is one away from 1.2 where 1.1 would be two away from 2.1 (1.0 to 2.1) etc.

One then can compute distances based on these and get more nuanced matches.

I imagine there is name for this type of distance metric but am not sure what that name might be. Also, that might be sort of what neural nets do with their weights is model such metrics.

RonLWilson
Автор

Hey I’m just wondering if i could get a rating of match probability, you know, to understand how much they look alike a face to another face?

___x__x_r___xa__x_____f______
Автор

well, it would be interristing if you do the search for the same dude, but without a beard, with hat, etc... i don't think by just simply creating embeddings this could be done anyways.
Actully this app has been around for decades, but with facial recognition technology (this is how the FBI and governments finds people), but their app works by measuring distances on the face and doing face recognitions techniques, it could find the person even if he has a different look.

hqcart
Автор

Hello!
If it's possible, could you explain how to extract faces to identify from a webcam in the final phase, instead of a given photo? Please reply

abidansari-qqwd
Автор

kinda stuck. Whenever I run the first block of code, it only detects one face in the image. Not multiple.

BryanHawkshaw
Автор

how do i deploy it and integrate with a website/mobile app?

MoneyWealthBusinessMastermind
Автор

How would I run this locally? I have postgres installed on ubuntu 22 but I can not find any postgres extension named vector.

trezero
Автор

yeah i rather just have my db locally... not a big deal if it's public faces, but for an actual application it's risky if i don't know where that data ends up at (which data center, which service there, who maintains it, ...) because data breaches are a thing - if that's customer faces (data) and that is associated with names and correlated demographics data, if the db(s) get hacked... can you say "lawsuit" and "jail time" possibly. i know i'm not taking the risk.

themaxgo
Автор

Most problem is lagging video in webcam, rtmp when face recognition running in opencv. u got idea?

wijayaeka
Автор

File "c:\Users\kyubi\Programming\embedding.py", line 15, in <module>
img = Image.open("stored-faces/" + filename)

AttributeError: type object 'Image' has no attribute 'open'


Does anyone know how to fix this error?

kyubijoninify