Python Face Recognition (Beginner Tutorial)

  Рет қаралды 38,097

Matthew Berman

Matthew Berman

4 ай бұрын

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.
Get $400 in free credits for Aiven using this link: bit.ly/48jMVZ6
Enjoy :)
Join My Newsletter for Regular AI Updates 👇🏼
www.matthewberman.com
Need AI Consulting? ✅
forwardfuture.ai/
Rent a GPU (MassedCompute) 🚀
bit.ly/matthew-berman-youtube
USE CODE "MatthewBerman" for 50% discount
My Links 🔗
👉🏻 Subscribe: / @matthew_berman
👉🏻 Twitter: / matthewberman
👉🏻 Discord: / discord
👉🏻 Patreon: / matthewberman
Media/Sponsorship Inquiries 📈
bit.ly/44TC45V
Links:
Google Colab Code - colab.research.google.com/dri...
Aiven Tutorial - bit.ly/428UyQ8
Face Recognition Dataset - github.com/kipr/opencv/blob/m...

Пікірлер: 45
@salehmir9205
@salehmir9205 4 ай бұрын
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.
@aimademerich
@aimademerich 4 ай бұрын
Really loving the latest content (in my best Matthew Berman voice) “Bravo” 👏 😁 this is phenomenal thank you 🙏🏽
@warezit
@warezit 4 ай бұрын
🎯 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
@RicusNortje
@RicusNortje 4 ай бұрын
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
@IntentStore
@IntentStore 4 ай бұрын
Have you thought about just putting an rfid tag or something on their collars? It looks like every band above a few MHz should have a good detection distance for a raspberry pi inside your house to sense and not super power demanding.
@RicusNortje
@RicusNortje 4 ай бұрын
@IntentStore that's a good idea but they don't wear collars when they are in the house. (Don't worry, they are chipped).
@redfoothedude
@redfoothedude 3 ай бұрын
you can do it... just say something like if "dogs_name" == "your_dogs_name" then call the open door function
@DeonBands
@DeonBands 4 ай бұрын
In previous video you asked what we would like to see with autogenstudio. How about adding this as a skill to the agents.
@AI_Robotics
@AI_Robotics 4 ай бұрын
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.
@g.s.3389
@g.s.3389 4 ай бұрын
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!
@RonLWilson
@RonLWilson 4 ай бұрын
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.
@mshonle
@mshonle 4 ай бұрын
I think this is a good demonstration for how these 700-1000 dimensional vectors are small and relatively *low* dimensional. A naive word co-occurrence matrix would have 200,000 squared entries (and 200,000 element vectors) for a 200,000 word vocabulary. Expanding that notion to sentences or tweets makes the combinations explode to intractable levels. Embeddings are lower dimensional approximations of these kinds of representations and it’s quite impressive how well they perform
@hqcart1
@hqcart1 4 ай бұрын
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.
@StephenRayner
@StephenRayner 4 ай бұрын
Gratz on sponsor
@themax2go
@themax2go 4 ай бұрын
what's the benefit of using postgreSql vectorDb vs chromadb?
@renierdelacruz4652
@renierdelacruz4652 4 ай бұрын
Great Video
@nicolaswebful
@nicolaswebful 2 ай бұрын
hi, instead of vector in postgres what datatype to use in mysql ?
@ClaudioNarra
@ClaudioNarra 2 ай бұрын
Super ! Thx
@abidansari-qq4wd
@abidansari-qq4wd 2 ай бұрын
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
@___x__x_r___xa__x_____f______
@___x__x_r___xa__x_____f______ 4 ай бұрын
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?
@chrisbraeuer9476
@chrisbraeuer9476 4 ай бұрын
"Easy" they said... 😅
@BryanHawkshaw
@BryanHawkshaw 9 күн бұрын
kinda stuck. Whenever I run the first block of code, it only detects one face in the image. Not multiple.
@themax2go
@themax2go 4 ай бұрын
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.
@trezero
@trezero 4 ай бұрын
How would I run this locally? I have postgres installed on ubuntu 22 but I can not find any postgres extension named vector.
@trezero
@trezero 4 ай бұрын
I got it all working locally on Ubuntu 22 with postgres. Only extra step was that I needed to install the pgvector plugin for postgres first. I'd love to see how you would extend this to work with video
@wijayaeka9638
@wijayaeka9638 4 ай бұрын
Most problem is lagging video in webcam, rtmp when face recognition running in opencv. u got idea?
@redfoothedude
@redfoothedude 3 ай бұрын
use NDI it's almost real time
@fishnchips6627
@fishnchips6627 2 ай бұрын
The way croissant was pronounced triggered me a bit. But interesting tutorial, keep it up
@kyubijoninify
@kyubijoninify Ай бұрын
File "c:\Users\kyubi\Programming\embedding.py", line 15, in img = Image.open("stored-faces/" + filename) ^^^^^^^^^^ AttributeError: type object 'Image' has no attribute 'open' Does anyone know how to fix this error?
@Legi0n13
@Legi0n13 2 ай бұрын
Да и каскады хаар очень старая и неточная
@BlayneOliver
@BlayneOliver 4 ай бұрын
Do you know about ways to plug this in to CCTV cameras? I’d like to use it to create logs of arrivals and departures of my staff
@noneofyourbusiness8625
@noneofyourbusiness8625 4 ай бұрын
Is that legal? 😂
@MetaphoricMinds
@MetaphoricMinds 4 ай бұрын
Many CCTV systems have this built in now. But yes, you could write some python that connects to your stream and catalogs faces. Same can be done for lic. plate logging.
@fullcrum2089
@fullcrum2089 4 ай бұрын
try frigate
@fullcrum2089
@fullcrum2089 4 ай бұрын
i also want build something like this, including with multimodal LLMs.
@mirek190
@mirek190 4 ай бұрын
...again the code which is not working offline. Works until provider close or change server . No thanks ...
@themax2go
@themax2go 4 ай бұрын
that, plus it's a hook to get you spending money eventually. is fairly easily to adapt locally w/ almost the same code, or change to another db implementation such as chromadb. thing is, doesn't really matter cuz it's highly narrow application scenario (searched face / head can't be tilted, turned to the side, has to have same facial characteristics ie beard, glasses, ..., and the list goes on). this vid was just made to get the YTer a paycheck.
@jpmottin
@jpmottin 4 ай бұрын
You Forget to test with a wrong face (an unknown person)
@PietroSperonidiFenizio
@PietroSperonidiFenizio 4 ай бұрын
But if I program facial recognition software and put it in the countryside, will it recognize the wild boars one by one? 🐗🤔
@synchro-dentally1965
@synchro-dentally1965 4 ай бұрын
It may have trouble recognizing faces that are not mostly vertical.
@MetaphoricMinds
@MetaphoricMinds 4 ай бұрын
Society is taking a huge step into the future. AGI and people with "ANY SOFTWARE" capabilities. AGI will be here this year.
@mooonatyeah5308
@mooonatyeah5308 4 ай бұрын
Not close. AGI is way beyond anything we have currently. Maybe in 5 years.
@MetaphoricMinds
@MetaphoricMinds 4 ай бұрын
@mooonatyeah5308 chain / tree of thought, mixed with multiple agents, gets us pretty close already. What do you see as a hindrance to achieving it sooner as opposed to later?
@themax2go
@themax2go 4 ай бұрын
not according to meta and the immense (600k+) Nvidia H100 (includes equivalent) by end of this year 2024 for approx US$ 18b (at least)... 5 years, no way, at most 1 year from now: by end of this year cloud infrastructure completed, training model in 6 months or less completed, perfecting the transformer tech aka "the engine" 6 months or less = gen 1 AGI@@mooonatyeah5308
Open Source Face Analysis with Python
15:07
Rob Mulla
Рет қаралды 45 М.
How I'd Learn AI (If I Had to Start Over)
15:04
Thu Vu data analytics
Рет қаралды 679 М.
New Gadgets! Bycycle 4.0 🚲 #shorts
00:14
BongBee Family
Рет қаралды 11 МЛН
100😭🎉 #thankyou
00:28
はじめしゃちょー(hajime)
Рет қаралды 47 МЛН
Live Face Recognition in Python
16:16
NeuralNine
Рет қаралды 137 М.
Multi person Real time Action Recognition Based on Human Skeleton
1:28
RAG from the Ground Up with Python and Ollama
15:32
Decoder
Рет қаралды 21 М.
How I Made AI Assistants Do My Work For Me: CrewAI
19:21
Maya Akim
Рет қаралды 691 М.
Modern Graphical User Interfaces in Python
11:12
NeuralNine
Рет қаралды 1,4 МЛН
How does facial recognition work?
6:43
Interesting Engineering
Рет қаралды 187 М.
Python Face Recognition Tutorial
31:18
Traversy Media
Рет қаралды 623 М.
Face recognition in real-time | with Opencv and Python
28:19
Pysource
Рет қаралды 247 М.
Asyncio in Python - Full Tutorial
24:59
Tech With Tim
Рет қаралды 43 М.
How To Unlock Your iphone With Your Voice
0:34
요루퐁 yorupong
Рет қаралды 17 МЛН
How much charging is in your phone right now? 📱➡️ 🔋VS 🪫
0:11
Samsung or iPhone
0:19
rishton vines😇
Рет қаралды 9 МЛН
Power up all cell phones.
0:17
JL FUNNY SHORTS
Рет қаралды 49 МЛН
cool watercooled mobile phone radiator #tech #cooler #ytfeed
0:14
Stark Edition
Рет қаралды 7 МЛН