9:40 the reason you might not want to use f strings is because the os method is os independent. Not usually an issue, but your code is just slightly more robust using os.
Hello, great video! :D If anyone is having this error on Windows 10: NotADirectoryError: [WinError 267] The directory name is invalid: 'known_faces/9a7f3cd.png'. I got around this by using for filename in os.path.join(KNOWN_FACES_DIR, name): instead of for filename in os.listdir(f'{KNOWN_FACES_DIR}/{name}') This worked for me. Good luck.
while executing "encoding = face_recognition.api.face_encodings(image)[0] " line of code, IndexError: list index out of range occurs. That means that face was not recognized by the face_recognition package!! Thanks Sentdex ! Very awesome tutorials! Learning style is simply awesome 😃
Combine this with beautiful soup or selenium and you have built the same technology that scrapes suspect faces from social media. The use of libraries and API's have made it so easy to use artificial intelligence.
Andrew James does beautiful soup and selenium allow you to download all public data? Let’s say a radius that has 250k ppl? I was looking into this and read that clearview AI is getting sewed for it.. still want to do this on my own tho! I believe Facebooks graph API only allows you to get data from your own profile:/
@@sysadmin9396 It's possible you can do this by scrapping the data with selenium, puppeteer (JavaScript), and beautiful soup. You just need accounts for the Social Media to log in. There are a lot of videos online on how to approach web scrapping :) and happy hacking!
Andrew James thank you! Appreciate the response ! I’m currently getting the code together for the facial recognition part.. doing some shopping around for glasses that have an IP addressable camera . All that mixed with the scrapping and I might have myself some cool tech! Lol
You just defined my senior project, will be releasing it soon on git, scarped all the pics from FB and IG and used LBPH along with CNN to find the nasty buggers via input from my drone camera. All that done in a clean Pyqt5 UI with threads ;)
Thanks for the tutorial. Taken your script as a basefor my face recognition script. Main difference is that i don't display the image with a square around the face, but it moves it to another folder with the name of the person in front of it. THX again!
this happens because there are no images detected to encode, hence the array is empty and cant have a 0th position. This maybe due to bad pose/quality of image or something wrong with the model. A solution would be the following : temp_encoding = face_recognition.face_encodings(image) if len(temp_encoding) > 0 : encoding = temp_encoding[0] else: print("no face found") quit()
Sentdex you should try to get a sponsorship from kite as they have sponsored other youtubers and you just made the best advertisement overall imo. Also, you are edward snowdens doppleganger!!!
Finally got face recognition working on GPU. I think its worth mentioning to include Visual C++ Tools in the Visual Studio 2015 installation. Unlike TensorFlow GPU, face recognition needs them otherwise dlib installation will not use CUDA.
With a little more code you can save the known_faces numpy ndarry in something like an Excel file and the names in a file too so you aren't training the face recognition each time it runs, saves a lot of time.
great tutorial !! while using Png it is working fine with training data and test data but while working with jpeg images it is not working my error is encoding = face_recognition.face_encodings(image)[0] IndexError: list index out of range and images i am using are both same i had jpg images which i converted into Png images then it is working previously it wasn't
this library is good for face detection, for face recognition better use something like Facenet (you can find couple TensorFlow Keras implementation of Facenet)
heyyy, sentdex i was just curious, can u make videos on unsupervised deep learning techniques, like auto encoders (although it is self-supervised), GANs etc, it would be really helpful :'), Glad you're back.
Hi, did you use CUDA in this script? Or was this running on your CPU alone? I am running the face_recognition package with dlib on Windows and it's pretty damn slow.
Hello , hi your content is awesome man.......... you announced neural network from scratch series ............ still waiting for it ........ i have postponed my project just for that.. please tell us when it is coming?
f string is bad way for concating path because there might be cases where spaces left of double slashes ("//") appended because of forward slash added in prev strign at end and next string in first, say "known_dir/" "/name" human can miss pattern on a large scale project.
A valid reason not to use f-strings for paths? The pathlib library. It is built-in, it uses / for paths (overriding the division operator), it has the glob method available for any path, etc. By the way: love your Channel!
If you are getting IndexError in encoding try this, location = face_recognition.face_locations(image, number_of_times_to_upsample=2, model='cnn') encoding = face_recognition.face_encodings(image, known_face_locations=location)[0]
When running the code I came across error on the below line: encoding = face_recognition.face_encodings(image)[0] saying that: IndexError: list index out of range Removed [0] and it ran. but after print("Processing unknown faces") the system hangs and doesn't work
I got the same error on pictures that is not able get a face recognition (from hog), it mean the numpy array for encoding is empty. In my case was the faces in more than 45° degrees of inclination.
26.43 the answer = Ubuntu lmao... also, are you using python3/pip3 as i see you just typing "python" or "pip" and not "python3" or "pip3" other than that keep up the great work and thank you for your time and knowledge!
@@shobhitbishop Okay! How I install dlib and face-recognition. I think, why VS (visual studio)? I use VS 2017 community. VS '17 is for installing Cmake c++ library nothing much!! I type in the Pycharm's terminal 'pip install dlib', then my pc hanged out for 5 minutes. I got afraid! Then after 20 minutes, I see the successful message. Then just type 'pip install face-recognition' and boom!! Note : I installed cmake!
Hi to whoever is reading this comment. I wrote the english subtitles for this video. can you review them please. And btw sent dex didn't pay me or anything for subtitles. I have just done it with affection to sentdex. :) Hope sentdex will see this comment.
Hi Padmavathy, thank you for creating the English subtitles. They are very helpful of course. Would you please share the electronic (text) file separately? I'm trying to build a reference tutorial for my own personal use (as I do with all my machine learning exercises). It would save me a ton of time if I can leverage your work. Thank you in advance for your consideration.
has anyone tried running this on mac and pycharm my laptop starts lagging and the code isnt giving out an error but it stops working after the first for loop
Not saw your videos for quite a while. This was a great video. One question..... If i wanted to save the image, encodings and name in a database, what would be the best database to use (e.g, sqlite, postgres, etc). Many thanks in advance. :-)
9:48 f strings are good I'm suprised they aren't used as much in python scripts that I have read. there are people who still use % notation in strings.
RuntimeError: Error while calling cudaMalloc(&data, new_size*sizeof(float)) in file /tmp/pip-build-3ma07mx9/dlib/dlib/cuda/gpu_data.cpp:218. code: 2, reason: out of memory i have a 6gb 1660ti and 24x 4mb worth of unknown faces
Actually, not video, but this one where I get this error: Traceback (most recent call last): File "facial.py", line 39, in encoding = face_recognition.face_encodings(image)[0] IndexError: list index out of range
Hi Sir! I faced an error while running the code. Please help me to figure out this. encoding = face_recognition.face_encodings(image)[0] IndexError: list index out of range Thanks in advance!
Hey- I'm not sentdex, but I had the same problem as you- what I did was first check to see if the known images even detected a face in the first place by doing: if len(face_recognition.face_encodings(image)) > 0: and then indented the code after that in the loop. Hopefully that helps!
Could you also do a tutorial on 2d pose estimation using , perhaps pose detectors , like simpleHrnet instead of open pose. How can one train their own models. That could be very interesting , perhaps could be a pre cursor to 3D pose estimation ?
I get this error when I tested the code tho... return np.linalg.norm(face_encodings - face_to_compare, axis=1) ValueError: operands could not be broadcast together with shapes (6,) (128,)
this happens if there is no face found in known images, just add an if statement to see if encoding has any elements before appending it : ... encoding = face_recognition.face_encodings(face) if encoding : knownFaces.append(encoding) ...
operands could not be broadcast together with shapes (3973,) (128,) . This error is coming when I am using your code at line (results = face_recognition.compare_faces(known_faces, face_encoding, TOLERANCE)). I am fedup with this I am not able to understand what shape I used your code as it was.
i am getting this error while running the code : encodeing = face_recognition.face_encodeings(image)[0] AttributeError: module 'face_recognition' has no attribute 'face_encodeings' is there anyway to fix this.
The content of the video was good..but CNN model was not applied for getting the matches..can you please include the model as well in facial recognition video??
"If anyone knows why not to use f strings for paths" Pretty sure it's the same reason we didn't use concatenation before: it isn't operating system independent. os.path is.
All I’ll say is... no one has seen him and Snowden in the same room at the same time.
Gosh, asap I open I thought was him.
HE'S BACK! OH MY GOD, BUCKY IS BACK!!!!!!!!!!!!!!!!!
For a sec I thought maybe bucky was back. Sad.
@@sentdex At least on my feed. I hadn't seen you for a while, altjought I'm a subscriber. Guess it's RUclips's algorithm
lmao, I actually thought Bucky was back.
@@AccessCode101 but you know I'm not Bucky right
We miss Buck 😢
9:40 the reason you might not want to use f strings is because the os method is os independent. Not usually an issue, but your code is just slightly more robust using os.
Someone beat me to the response. I was going to say exactly the same thing as Damien.
Yep, for example Windows uses the '\' for join paths
Cool! I never expected python to be so powerful:D
It's been a while. Actually today I was thinking about you and where you might be this long! I'm glad to see you again.
Hello, great video! :D
If anyone is having this error on Windows 10:
NotADirectoryError: [WinError 267] The directory name is invalid: 'known_faces/9a7f3cd.png'. I got around this by using
for filename in os.path.join(KNOWN_FACES_DIR, name):
instead of
for filename in os.listdir(f'{KNOWN_FACES_DIR}/{name}')
This worked for me.
Good luck.
thanks
How to load files then?
Please tell the replaced command for this too
image = face_recognition.load_image_file(f'{Known_Faces_Dir}/{name}/{filename})
while executing "encoding = face_recognition.api.face_encodings(image)[0] " line of code, IndexError: list index out of range occurs. That means that face was not recognized by the face_recognition package!! Thanks Sentdex ! Very awesome tutorials! Learning style is simply awesome 😃
When is the "neural networks from scratch" series coming out? I am eagerly waiting for it. Really like your channel.
I think it's a book .. there was a kickstarter
its out check playlist
@@redefine-your-system8255 Yeah I know, my comment is a month old
Combine this with beautiful soup or selenium and you have built the same technology that scrapes suspect faces from social media. The use of libraries and API's have made it so easy to use artificial intelligence.
Andrew James does beautiful soup and selenium allow you to download all public data? Let’s say a radius that has 250k ppl? I was looking into this and read that clearview AI is getting sewed for it.. still want to do this on my own tho! I believe Facebooks graph API only allows you to get data from your own profile:/
@@sysadmin9396 It's possible you can do this by scrapping the data with selenium, puppeteer (JavaScript), and beautiful soup. You just need accounts for the Social Media to log in. There are a lot of videos online on how to approach web scrapping :) and happy hacking!
Andrew James thank you! Appreciate the response ! I’m currently getting the code together for the facial recognition part.. doing some shopping around for glasses that have an IP addressable camera . All that mixed with the scrapping and I might have myself some cool tech! Lol
You just defined my senior project, will be releasing it soon on git, scarped all the pics from FB and IG and used LBPH along with CNN to find the nasty buggers via input from my drone camera. All that done in a clean Pyqt5 UI with threads ;)
@@Killer-mx7tr I'd love to have a look, do update.
I was just writing a paper about this lib for my graduation great help + timing thx
You're like THE best programming channel on RUclips! Seriously like THANK YOU FOR EXISTING!
Literally watching this at 2.30 in the morning.
This is awesome! Please continue this series!
4:27 "my life" I know that feel bro
I am a huge fan of what you do! Thank you so much!
I hope that one day you make a serie about transfer learning.
I have a plan to cover it at some point. The main issue is it's a pretty general concept and it can vary depending on the task.
Thank you Bucky! Good to see you. You are always the reason for happiness. :)
Ok but you know I'm not *really* bucky right?
Just 4 minutes in, I thought I was on a tech tutorial turns out it's a nice comedy lol
I love your humour !!
Thanks for the tutorial. Taken your script as a basefor my face recognition script. Main difference is that i don't display the image with a square around the face, but it moves it to another folder with the name of the person in front of it. THX again!
It's great to see you're back!
OMG! Un video de Sentdex un domingo por la tarde? 👏👏👏 Ya mismo a verlo!!!
I am so used to see you on the left downside corner, watching this makes me feel disoriented!
Good, I wanna keep you on your toes!
@Tomer Horowitz I think the video was released to only members first
@sentdex
I am glad that you are back but I don’t want to see your back 🤣
@@sentdex If you put yourself in the top right, can you flip the image so that you look towards the rest of the screen and not away from it? :)
@@Tweakimp I agree
Awesome, could you please make a video about activity recognition in videos, it will be a great help for most of your fans.
That hamburger mug is...oh so beautiful.
Shows 'IndexError : list index out of range' at the following line : encoding = face_recognition.face_encodings(image)[0]
Any solution for this error?
this happens because there are no images detected to encode, hence the array is empty and cant have a 0th position. This maybe due to bad pose/quality of image or something wrong with the model. A solution would be the following :
temp_encoding = face_recognition.face_encodings(image)
if len(temp_encoding) > 0 :
encoding = temp_encoding[0]
else:
print("no face found")
quit()
Thank you so much. I am new in programming and trying to do this. It is great and very helpful.
Nobody:
Sentdex's door: *Knock~knock~bam
FBI (barge in) : Snowden! You are under arrest!
Sentdex you should try to get a sponsorship from kite as they have sponsored other youtubers and you just made the best advertisement overall imo.
Also, you are edward snowdens doppleganger!!!
You are such a great programming dude on youtube :) love to see there is a new video
Amazing thank you sir! Doing the same with video would be amazing!!!!
Please make another one on videos , that's so helpful
It's great to see you're back.
Finally got face recognition working on GPU. I think its worth mentioning to include Visual C++ Tools in the Visual Studio 2015 installation. Unlike TensorFlow GPU, face recognition needs them otherwise dlib installation will not use CUDA.
With a little more code you can save the known_faces numpy ndarry in something like an Excel file and the names in a file too so you aren't training the face recognition each time it runs, saves a lot of time.
Video recognition would be good to see, if you have time. Thanks for all of your terrific efforts here.
A beautiful mind. Nice hair cut too. I can't wait for more!
I found my next project! This looks sweet
great tutorial !! while using Png it is working fine with training data and test data
but while working with jpeg images it is not working my error is
encoding = face_recognition.face_encodings(image)[0]
IndexError: list index out of range
and images i am using are both same i had jpg images which i converted into Png images then it is working previously it wasn't
Please do the video one.
This was so helpful.
Thank you.
Nice Tutorial! Thank you :)
Our Snowden is back again, this time with face recognition.
this library is good for face detection, for face recognition better use something like Facenet (you can find couple TensorFlow Keras implementation of Facenet)
heyyy, sentdex i was just curious, can u make videos on unsupervised deep learning techniques, like auto encoders (although it is self-supervised), GANs etc, it would be really helpful :'), Glad you're back.
I would love to see you tackle the PennyLane library (Quantum Neural Networks). Since you are the bleeding edge of codetubers and all
I love your tutorials so much, thanks!
Hi, did you use CUDA in this script? Or was this running on your CPU alone? I am running the face_recognition package with dlib on Windows and it's pretty damn slow.
Hello , hi your content is awesome man.......... you announced neural network from scratch series ............ still waiting for it ........ i have postponed my project just for that.. please tell us when it is coming?
Python facial recognition: around 50 lines
C/cpp/c sharp calculator: 100 lines
You do realize a package is a group of modules, a module is a group of function, so without those packages the code would be like 2439834 lines
@@gabrielceolato2 that's the point. There are so many things already done
AttributeError: module 'dlib' has no attribute 'get_frontal_face_detector'
can any help me to solve this i am using python version 3.8
Bro where have you been?
Glad to have you back finally, wohoo
Working on neural networks from scratch book/series.
f string is bad way for concating path because there might be cases where spaces left of double slashes ("//") appended because of forward slash added in prev strign at end and next string in first, say "known_dir/" "/name" human can miss pattern on a large scale project.
I hope u can do another tutorial with video , Thank u anyway that was really helpful
Please do the video example, ur videos are great! Keep it up
A valid reason not to use f-strings for paths? The pathlib library. It is built-in, it uses / for paths (overriding the division operator), it has the glob method available for any path, etc. By the way: love your Channel!
If you are getting IndexError in encoding try this,
location = face_recognition.face_locations(image, number_of_times_to_upsample=2, model='cnn')
encoding = face_recognition.face_encodings(image, known_face_locations=location)[0]
This guy is my favourite 💯💯
I am eagerly waiting for Neural networks from scratch videos. Will it be coming anytime soon?
Ur videos r awesome. Thank u so much. U r really cool, when coding 😁
Great video tutorial. "I think we have survived" Lol Lol 😂😂 Well done.
When running the code I came across error on the below line:
encoding = face_recognition.face_encodings(image)[0]
saying that:
IndexError: list index out of range
Removed [0] and it ran.
but after print("Processing unknown faces")
the system hangs and doesn't work
I got the same error on pictures that is not able get a face recognition (from hog), it mean the numpy array for encoding is empty. In my case was the faces in more than 45° degrees of inclination.
@@martinsepulveda59 how'd you fix it ?
@@Gouled99 I had the same problem, just crop the photo to see the face more clear and without angle, use a normal selfie focusing in the face.
@@urzdvd thank so much
Great Video! Thank you!
How can we understand which CNN algorithm (model) used there?
In order to work properly, you need to download visual studio build tools, then install C++ Build Tools
Finally sir you are back
I need you to upload more please.
26.43 the answer = Ubuntu lmao... also, are you using python3/pip3 as i see you just typing "python" or "pip" and not "python3" or "pip3" other than that keep up the great work and thank you for your time and knowledge!
Thanks .Please make for real time face recognition
Thanks buddy waiting for neural networks
Very soon
@@sentdex Are you going to make videos for "Neural networks from the scratch" book?
Having problem installing dlib. Installed cmake first but still there's error. Stack overflow didn't help either
I faced the same issue, try using pip install dlib = 19.8.1
@@shobhitbishop Okay! How I install dlib and face-recognition. I think, why VS (visual studio)? I use VS 2017 community. VS '17 is for installing Cmake c++ library nothing much!!
I type in the Pycharm's terminal 'pip install dlib', then my pc hanged out for 5 minutes. I got afraid! Then after 20 minutes, I see the successful message. Then just type 'pip install face-recognition' and boom!!
Note : I installed cmake!
I Want Face recognition with Famous Face recognition algorithms:
1-PCA
2-LDA
3-SVM
4-SURF
5-LBPH
Hi to whoever is reading this comment. I wrote the english subtitles for this video. can you review them please.
And btw sent dex didn't pay me or anything for subtitles. I have just done it with affection to sentdex.
:) Hope sentdex will see this comment.
Hi Padmavathy, thank you for creating the English subtitles. They are very helpful of course. Would you please share the electronic (text) file separately? I'm trying to build a reference tutorial for my own personal use (as I do with all my machine learning exercises). It would save me a ton of time if I can leverage your work. Thank you in advance for your consideration.
@@anthonygonsalvis121 How to do that?
@@padmavathynarasareddygari1213 Would you please email it to me at solohaan1013@hotmail.com? Thank you in advance.
ValueError: operands could not be broadcast together with shapes (5603,0) (128,)
how can I over come this error
Sitting with the same problem. @
mani kumar donepudi @sentdex
Yes
same here
Welcome back legend 😍
Have you considered doing a video on facial recognition in video?
Yes. If there's enough interest, thatd be the subject of the next video.
@@sentdex there is definitely interest. So many interesting applications for it.
has anyone tried running this on mac and pycharm my laptop starts lagging and the code isnt giving out an error but it stops working after the first for loop
It due to the load of the program . I prefer u to use model="hog" instead of cnn .it may solve your issue
HOG ( Histogram of Oriented Gradients)
Not saw your videos for quite a while. This was a great video. One question..... If i wanted to save the image, encodings and name in a database, what would be the best database to use (e.g, sqlite, postgres, etc). Many thanks in advance. :-)
9:48 f strings are good I'm suprised they aren't used as much in python scripts that I have read. there are people who still use % notation in strings.
2:46 That has meme potential
New camera angle, "I am so cool" -sentdex
That's really great. Can you make the one with the video processing. Or can you please guide how to do with live video. 👍👍😊
Here we are using so many faces to have a reference point, what about the facial recognition in the Iphones and stuff?
RuntimeError: Error while calling cudaMalloc(&data, new_size*sizeof(float)) in file /tmp/pip-build-3ma07mx9/dlib/dlib/cuda/gpu_data.cpp:218. code: 2, reason: out of memory
i have a 6gb 1660ti and 24x 4mb worth of unknown faces
Thank you
Actually, not video, but this one where I get this error:
Traceback (most recent call last):
File "facial.py", line 39, in
encoding = face_recognition.face_encodings(image)[0]
IndexError: list index out of range
Hey nice tutorial. Will definitely check it out. Do you happen to know if it detects things like objects and animals, etc.?
Hi Sir! I faced an error while running the code. Please help me to figure out this.
encoding = face_recognition.face_encodings(image)[0]
IndexError: list index out of range
Thanks in advance!
Hey- I'm not sentdex, but I had the same problem as you- what I did was first check to see if the known images even detected a face in the first place by doing:
if len(face_recognition.face_encodings(image)) > 0:
and then indented the code after that in the loop. Hopefully that helps!
and he is back
Nice tutorial buddy
Could you also do a tutorial on 2d pose estimation using , perhaps pose detectors , like simpleHrnet instead of open pose. How can one train their own models. That could be very interesting , perhaps could be a pre cursor to 3D pose estimation ?
The sleepless nights this package gave me
Hope this helps :D
Finnaly a video! wuju!
I get this error when I tested the code tho...
return np.linalg.norm(face_encodings - face_to_compare, axis=1)
ValueError: operands could not be broadcast together with shapes (6,) (128,)
yes I'm getting the same error do let me know if you find fix
@sentdex I'm also getting this error
this happens if there is no face found in known images, just add an if statement to see if encoding has any elements before appending it :
...
encoding = face_recognition.face_encodings(face)
if encoding :
knownFaces.append(encoding)
...
operands could not be broadcast together with shapes (3973,) (128,) . This error is coming when I am using your code at line (results = face_recognition.compare_faces(known_faces, face_encoding, TOLERANCE)). I am fedup with this I am not able to understand what shape I used your code as it was.
28:36 hahahahhaha 🤣 , great video !!!
Sir, I didn't understand the part where you used location[0] and location[3] to represent the top left corner. Why 3?
i am getting this error while running the code : encodeing = face_recognition.face_encodeings(image)[0]
AttributeError: module 'face_recognition' has no attribute 'face_encodeings'
is there anyway to fix this.
The content of the video was good..but CNN model was not applied for getting the matches..can you please include the model as well in facial recognition video??
Guess who's back. back again.
"If anyone knows why not to use f strings for paths" Pretty sure it's the same reason we didn't use concatenation before: it isn't operating system independent. os.path is.
Nice sir
Hi , i got
CMake Error at CMakeLists.txt:3 (project):
No CMAKE_CXX_COMPILER could be found. even though cmake is installed
me too .. I tried adding compilers path to environment var but it didn't work