Face Recognition in Python using face_recognition Library (in Google Colab)

  Рет қаралды 52,201

Adarsh Menon

Adarsh Menon

Күн бұрын

We use the popular face_recognition library to recognize faces in new images. I explain about how it works briefly and write implement using Google Colaboratory, which provides GPU support. This video is for beginners who are looking to get started with face recognition. You can find many more examples in the official github repository of face_recognition.
GitHub Repository: github.com/age...
Explanation post by Adam Geitgey: / machine-learning-is-fu...
Subscribe to my Newsletter !
adarsh1021.git...
Having trouble ? Need help ? Connect with me !
Email: adarsh1021@gmail.com
Twitter : / adarsh_menon_
LinkedIn: / adarsh-me. .
Github : github.com/ada...
#face_recogniton #opencv #python

Пікірлер: 98
@AdarshMenon
@AdarshMenon 3 жыл бұрын
Here is the original Colab - colab.research.google.com/drive/15_yQKwhVsmfN2p7geco_VFGKLYqBah04?usp=sharing
@siddhipandare3882
@siddhipandare3882 4 жыл бұрын
This is the best video for face recognition! Very well explained :)
@thenotsomebody
@thenotsomebody 4 жыл бұрын
this is the best face recognition video
@anefuoche1053
@anefuoche1053 4 жыл бұрын
i get an IndexError: list index out of range, that points to the for loop for known_dir; img_enc = face_recognition.face_encodings(img)[0]... but it works fine when i omit the index [0]. also in the for loop for unknown_dir i get a ValueError: operands could not be broadcast together with shapes (41,) (128,) that points to results = face_recognition.compare_faces(known_encodings, img_enc)...please what should I do?
@iputubastianadiputra5816
@iputubastianadiputra5816 2 жыл бұрын
great explination ma brother
@jaisonjose8256
@jaisonjose8256 4 жыл бұрын
from my experience, for personal use. Training the data using keras by our images is more efficient
@AdarshMenon
@AdarshMenon 4 жыл бұрын
I agree, this was more of a getting started type of video because many people were requesting for face rec after face detection
@jaykaran2278
@jaykaran2278 4 жыл бұрын
It becomes tedious to train for every new face the system detect. Don't you think?
@jaisonjose8256
@jaisonjose8256 4 жыл бұрын
I specified 'personal'
@chittiprolusunilkumar3975
@chittiprolusunilkumar3975 3 жыл бұрын
good work and it help for learn to kick start thank you and well explained
@AdarshMenon
@AdarshMenon 3 жыл бұрын
Awesome !
@ruqiyaarshad3745
@ruqiyaarshad3745 3 жыл бұрын
Is it im.shape or img shape for resizing image in your code sir?
@gplgomes
@gplgomes 3 жыл бұрын
Does it allow to recognize my relatives names ? I tried but it only recognize famous persons.
@yilberrojas8306
@yilberrojas8306 3 жыл бұрын
good video, to process it into a video as input
@다룸다림다-t8j
@다룸다림다-t8j 2 ай бұрын
Hello, thank you for making this video. Your video was so great that I subscribed to it. But I keep getting the same error. 'NoneType' object has no attribute 'shape' Even though I changed the picture, this happens, what should I do? Please give me answer🥲🥲🥲
@임도연-b3i
@임도연-b3i 2 ай бұрын
hello! we are teammate of this monkey and we had just figured it out thank u so much of your fascinating video u r sooooooooooo adorable I luv u!!!!!!!!!!!!!!!!!
@shrikarpatil6014
@shrikarpatil6014 2 жыл бұрын
Hi , I tried this code and it is working perfectly for known faces . But I'am getting an error "'NoneType' object has no attribute 'shape' " for non matching faces , can you please help?
@ינירעטון-ב8ג
@ינירעטון-ב8ג 2 жыл бұрын
hi have the same problem too did you fix it?
@muwnhius
@muwnhius 2 жыл бұрын
bill.jpg is broken
@TechnicalGigs
@TechnicalGigs Жыл бұрын
i have the same problem too did you fix it?
@jayasmitamahapatra8140
@jayasmitamahapatra8140 4 жыл бұрын
Very nicely explained.Can u share the link from where we can download the images
@AdarshMenon
@AdarshMenon 4 жыл бұрын
colab.research.google.com/drive/15_yQKwhVsmfN2p7geco_VFGKLYqBah04?usp=sharing
@jimmyaghera1897
@jimmyaghera1897 3 жыл бұрын
very nice work. I learned a lot from this video.
@aqibmukhtar5217
@aqibmukhtar5217 2 жыл бұрын
Bro (h, w) = img.shape[:2] pr error araha "AttributeError: 'NoneType' object has no attribute 'shape'"
@manasisingh294
@manasisingh294 2 жыл бұрын
were you able to get this fixed?
@borisvybornykh614
@borisvybornykh614 3 жыл бұрын
You are the best, you've helped me pass my hw
@harshitamaurya2255
@harshitamaurya2255 4 жыл бұрын
Hey, I am getting an error 'NoneType' object has no attribute 'shape'. Please tell me how should I resolve it
@AdarshMenon
@AdarshMenon 4 жыл бұрын
probably because the image was not loaded, please check if your image is in the same folder as the code / you have given the names correctly. Another reason could be there were no images detected - in this case try with a larger image or another image
@harshitamaurya2255
@harshitamaurya2255 4 жыл бұрын
Got it...thankyou so much
@HariHaran-qp2mw
@HariHaran-qp2mw 3 жыл бұрын
Know image and unknown image must be in. jpg extension
@tommystallion7734
@tommystallion7734 3 жыл бұрын
@@AdarshMenon I ran your notebook without changing any code and got the same error
@manasisingh294
@manasisingh294 2 жыл бұрын
@@harshitamaurya2255 hey, how did you solve this error? Could you please share?
@kushalappaca5324
@kushalappaca5324 2 жыл бұрын
Can you tell what is the maximum no of classes we can consider..I'm thinking of running this for 100 masked faces????
@haytamelbakkal825
@haytamelbakkal825 3 жыл бұрын
This is a very good video. I have a question please how can I measure the accuracy if I have a large dataset?
@AdarshMenon
@AdarshMenon 3 жыл бұрын
Once you have the dataset for the correct faces to person mapping - you can count the number of correct predictions made by the face_recognition library divided by the total number of faces will be your accuracy
@Tudismas
@Tudismas 2 жыл бұрын
why is it that the accuracy is very low for new images especially those it has no see?
@co3mo24
@co3mo24 3 жыл бұрын
Design of Machine Learning Solution for Biometric Recognition Task with google colab do u have any idea
@rryann088
@rryann088 3 жыл бұрын
Thank you so much !! that Really helped understand the code ! Awesome video
@entertainment_channel_07
@entertainment_channel_07 Жыл бұрын
Sir can we ur own images in known and unknown folders
@shreenejatandon32
@shreenejatandon32 2 жыл бұрын
Code is giving error as these images are not available not and if we are giving other image's link it's not being displayed
@gokulsai901
@gokulsai901 3 жыл бұрын
Is there a way to train a haar cascade on Google colab??
@gauravgupta4847
@gauravgupta4847 3 жыл бұрын
Which face recognition algorithm we used in this project????
@AdarshMenon
@AdarshMenon 3 жыл бұрын
based on this medium.com/@ageitgey/machine-learning-is-fun-part-4-modern-face-recognition-with-deep-learning-c3cffc121d78
@user-rx5kq6oo9y
@user-rx5kq6oo9y 3 жыл бұрын
@@AdarshMenon sir , in this article it is mentioned we use svm fir classifier but in implementation we dont use svm anywhere.
@user-rx5kq6oo9y
@user-rx5kq6oo9y 3 жыл бұрын
@@AdarshMenon does compare face uses svm at backened?
@AdarshMenon
@AdarshMenon 3 жыл бұрын
@@user-rx5kq6oo9y in implementation we are using the face_recognition library which is based on the article shared
@meghasharma154
@meghasharma154 3 жыл бұрын
SIR THAT TWO KNOWN AND UNKNOWN DIRECTORY IS NOT CREATED AFTER RUN THAT DIRECTORY CAN U PLEASE TELL WHAT WE HV TO DO THIS
@wildgoose4179
@wildgoose4179 4 жыл бұрын
Yea I can't get anywhere with this. I followed everything step by step and i keep getting this syntax error " File "", line 15 known_encodings = [] ^ SyntaxError: invalid syntax"
@AdarshMenon
@AdarshMenon 4 жыл бұрын
Not sure what is wrong, here is the original code - colab.research.google.com/drive/15_yQKwhVsmfN2p7geco_VFGKLYqBah04?usp=sharing
@gokulreddy2066
@gokulreddy2066 4 жыл бұрын
Bro you are god !...You are explaining everything clearly I want to talk with you personally. Share me your linkedin in profile and let's get connected
@AdarshMenon
@AdarshMenon 4 жыл бұрын
Check description
@paramecium_sp762
@paramecium_sp762 3 жыл бұрын
Help, i followed the video step by step but i get this error TypeError: read_img() takes 0 positional arguments but 1 was given Do you have any idea how to fix?
@AdarshMenon
@AdarshMenon 3 жыл бұрын
Please check the code here - colab.research.google.com/drive/15_yQKwhVsmfN2p7geco_VFGKLYqBah04?usp=sharing read_img is a function I wrote and it takes the argument path, you probably missed it
@paramecium_sp762
@paramecium_sp762 3 жыл бұрын
@@AdarshMenon Thanks friend, but when i tried to run the last cell (h, w) = img.shape[:2] made an error saying AttributeError: 'NoneType' object has no attribute 'shape'
@jacobsmith7877
@jacobsmith7877 3 жыл бұрын
@@paramecium_sp762 Were you able to solve this?
@ashwithathumula3283
@ashwithathumula3283 2 жыл бұрын
@@paramecium_sp762 hey did u solve this?
@sayantandas2429
@sayantandas2429 2 жыл бұрын
How can I import the images in the Google collab?
@shivendradubey4239
@shivendradubey4239 4 жыл бұрын
Can you make a video how to do face recognition from any KZbin video
@AdarshMenon
@AdarshMenon 4 жыл бұрын
I have put it on my list of videos to make. What you need to do is, download the video first (there are python libraries that take in a link and download the video), then use opencv to read the video frame by frame, then you can apply this same code on each frame, and save the output. Each frame in a video is an image
@terrencejeffersoncimafranc100
@terrencejeffersoncimafranc100 2 жыл бұрын
dude your machine is roaring. xD
@jvsccssfdsg4500
@jvsccssfdsg4500 2 жыл бұрын
AttributeError Traceback (most recent call last) in () 18 19 for file in os.listdir(known_dir): ---> 20 img = read_img(known_dir + '/' + file) 21 img_enc = face_recognition.face_encodings(img)[0] 22 known_encodings.append(img_enc) in read_img(path) 6 def read_img(path): 7 img = cv2.imread(path) ----> 8 (h, w) = img.shape[:2] 9 width = 500 10 ratio = width / float(w) AttributeError: 'NoneType' object has no attribute 'shape' how to solve
@pr0fess0rop18
@pr0fess0rop18 2 жыл бұрын
Aah yes same problem faced today morning and got a solution later now....check the file bill.jpg....its broken its infected thats why the error delete the file or get another bill photo link
@pr0fess0rop18
@pr0fess0rop18 2 жыл бұрын
Change the Bill img address to this drive.google.com/file/d/1GuvXGjWQRe6j_Xi85kfHW67vpVk8YxQa/view?usp=sharing Also delete the 0 bytes pic from unknown
@roshinipriyajami611
@roshinipriyajami611 2 жыл бұрын
AttributeError: 'NoneType' object has no attribute 'shape' plz help me out
@doall321
@doall321 4 жыл бұрын
it is not working at import face_recognition even i install face_recognition
@AdarshMenon
@AdarshMenon 3 жыл бұрын
It requires some setup to work, and so I highly recommend to use google colab
@letsseeproductions7500
@letsseeproductions7500 3 жыл бұрын
import face_recognition line is not working in google collab
@successlearners
@successlearners 4 жыл бұрын
Any other libraries for face recognizing
@kushalbhavsar3454
@kushalbhavsar3454 4 жыл бұрын
You can use LBph algo from cv2
@wallelignworkie8749
@wallelignworkie8749 3 жыл бұрын
how to change the photo, please brother this is project to present tomorrow
@ESWARAJAYASIMHAAJAYVEMPA-yz2xo
@ESWARAJAYASIMHAAJAYVEMPA-yz2xo Жыл бұрын
can we replace our images to detect
@kushalappaca5324
@kushalappaca5324 2 жыл бұрын
can we train multiple images using this algorithm??
@fahrulthariq4226
@fahrulthariq4226 Жыл бұрын
u got the answer yet?
@puneetkaur7725
@puneetkaur7725 2 жыл бұрын
It shows error while importing face_recognition. It says no module named face_recognition
@pr0fess0rop18
@pr0fess0rop18 2 жыл бұрын
Pip install nahi hua hoga check it
@mckoy1007
@mckoy1007 2 жыл бұрын
why there is an error on me? AttributeError: 'NoneType' object has no attribute 'shape'
@mckoy1007
@mckoy1007 2 жыл бұрын
can someone help me?//
@fmxy
@fmxy 4 жыл бұрын
get a good mic, it'll dramatically improve the quality of your videos! espescially when having these screen recording type videos. blue snowball mic should be fine for the start.
@AdarshMenon
@AdarshMenon 4 жыл бұрын
yeah will do
@aietisreekar2425
@aietisreekar2425 4 жыл бұрын
why the package is not getting installed in windows can u solve that
@AdarshMenon
@AdarshMenon 4 жыл бұрын
As I have mentioned in the video, dlib and face_recognition is difficult to set up normally, and that is why I have used google colab. Check out this guide on the official repo - github.com/ageitgey/face_recognition#installing-on-windows if you want to try the setup on windows.
@majidkhan6670
@majidkhan6670 4 жыл бұрын
from webcam it is possibe?
@AdarshMenon
@AdarshMenon 4 жыл бұрын
technically yes, but for that you would need to set up dlib and install face_recognition library on your computer, which is not as easy as colab. See github.com/ageitgey/face_recognition
@majidkhan6670
@majidkhan6670 4 жыл бұрын
@@AdarshMenon i already installed both lib...
@AdarshMenon
@AdarshMenon 4 жыл бұрын
then you can try and run it
@majidkhan6670
@majidkhan6670 4 жыл бұрын
@@AdarshMenon ok...but bro i need your help in my other code... i want to save a screenshot or jpg image with current time and date....iM getting error .....can u help me with tht.
@jaisonjose8256
@jaisonjose8256 4 жыл бұрын
macha malayali da
@rohitkumar-nk6sd
@rohitkumar-nk6sd 4 жыл бұрын
How to recognize images from local C drive?
@AdarshMenon
@AdarshMenon 4 жыл бұрын
So since this project is on google colab, you will need to upload those images to this colab. You can find the option to do that on the top of the left side panel. Or you can also upload the images to google drive and access those files directly from colab.
@rohitkumar-nk6sd
@rohitkumar-nk6sd 4 жыл бұрын
@@AdarshMenon iam getting true for 2 Inputs in Boolean array what should I do please help me out
@AdarshMenon
@AdarshMenon 4 жыл бұрын
@@rohitkumar-nk6sd can you share the output / more details ?
@rohitkumar-nk6sd
@rohitkumar-nk6sd 4 жыл бұрын
@@AdarshMenon please check your mail
@AdarshMenon
@AdarshMenon 4 жыл бұрын
@@rohitkumar-nk6sd adarsh1021@gmail.com
@warrior444ff7
@warrior444ff7 2 жыл бұрын
Sir
@himabinduu
@himabinduu 3 жыл бұрын
Hi
Live Face Recognition in Python
16:16
NeuralNine
Рет қаралды 169 М.
OpenCV Python TUTORIAL #4 for Face Recognition and Identification
1:06:24
CodingEntrepreneurs
Рет қаралды 809 М.
Стойкость Фёдора поразила всех!
00:58
МИНУС БАЛЛ
Рет қаралды 7 МЛН
Running With Bigger And Bigger Lunchlys
00:18
MrBeast
Рет қаралды 134 МЛН
How I Turned a Lolipop Into A New One 🤯🍭
00:19
Wian
Рет қаралды 10 МЛН
What does '__init__.py' do in Python?
6:50
Indently
Рет қаралды 17 М.
Want to Build Apps in MINUTES?  Coding with Cursor AI and Python
13:57
Facial Recognition attendance system using python
19:44
I know python
Рет қаралды 641 М.
Face recognition in real-time | with Opencv and Python
28:19
Pysource
Рет қаралды 282 М.
Face Recognition Attendance Based Project In Machine Learning
10:00
Face Recognition With Python 3.10 Tutorial (Webcam)
18:59
Indently
Рет қаралды 112 М.
Image Recognition with LLaVa in Python
10:56
NeuralNine
Рет қаралды 12 М.
Стойкость Фёдора поразила всех!
00:58
МИНУС БАЛЛ
Рет қаралды 7 МЛН