Firstly an excellent tutorial, very well presented. I had a couple of issues with the code and I offer solutions for these in case anyone has the same. Firstly I added the following line of code to remove the file extension for a nicer display: name = self.known_face_names[best_match_index] # remove the file extension for a neater display name = name.split('.')[0] I also found with more than one face it would call everyone by the same name. This is because the zip line repeats until the shortest tuple is completed then stops. If a single face is in frame for a while before a second face appears only the first will be annotated. To fix this I reversed the names and location lists to give a last in first out solution. Change line to: for (top, right, bottom, left), name in zip(reversed(self.face_location), reversed(self.face_names)): I hope this helps someone.
Lovely tutorial. I did have a bit of a problem at runtime with small_frame[:, :, ::-1]. I fixed it by calling this, instead: cv2.cvtColor(small_frame, cv2.COLOR_BGR2RGB)
Apparently the source code mentioned near 5:00 in video is well hidden. Otherwise, the video is informative. At 75, I like to follow along with the code. Sometimes I do try the code and sometimes not. The source code does make it handy for me when it isn't so well hidden.
thank you so much for such a huge effort, when trying recognition, it is lagging too much, do you have any idea about what is the problem? thanks in advance
Is it possible to dynamically add photos to the faces folder? For instance, if a face is detected that is not recognized, could the user possibly be promoted to take a screenshot and that picture will be saved to the faces folder and encoded like the others?
@@rileymchugh5316 you have to import cmake. Google it online if you need specifics on how to do it. I think I got it from some stack overflow page after a few minutes of searching.
I dont know why but it says that the face recognition module is not able to be found, Even when I try to import the Face Recongition again it still just wont work. And all I did was try the first part. Is this a version issue or is this something else. Please check out this comment if you have time. Thanks!
Hi Author Its a great article... with perfection... 1) If a show a pic consisting of multiple faces then it only detect just one face at a time...What is the reason for it? 2) Its quite slow as well... Can you guide on these two aspects. A great video.
I got this: cv2.error: OpenCV(4.7.0) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src esize.cpp:4062: error: (-215:Assertion failed) !ssize.empty() in function 'cv::resize' in line 51
sir, when i try to running that using my web cam, nothing happen, camera on but no windows show the face recognition, the pop up windows doesn't show image read well
Hi, i have been getting this error: RuntimeError: Unsupported image type, must be 8bit gray or RGB image. I cant find a way to fix it beacause if i use RGB format it tells me that it has to be jpg, png...
this because you don't have setuptools, to solve this open cmd and write this pip install setuptools , if this doesn't solve, then check your numpy version, to check it open cmd write pip list then check numpy version in the list, if it's greater than 1.26.4, then uninstall numpy like this, pip uninstall numpy and then open cmd write pip install numpy==1.26.4
Hi, I get an error when trying to run the script IndexError: list index out of range. The script finds 2 faces in the faces dir. What can I do solve this error? Thank you in advance
Great video, but I have a problem: my video crashes as soon as a face gets detected :( Im told that the line "self.face_encodings = face_recognition.face_encodings(rgb_small_frame, self.face_locations)" is the problem but i have no clue why please help because i really want this programm to work because its pretty cool
if you change "rgb_small_frame" to just "small_frame" on that line, it works. Not 100% sure why, maybe Python doesn't like the rgb_small_frame = small_frame[:, :, ::-1] bit at the end '::-1'
@@Loopyengineeringco you are right i had the same problem, i solved by changing "rgb_small_frame = small_frame[:, :, ::-1]" with "rgb_small_frame = cv2.cvtColor(small_frame, cv2.COLOR_BGR2RGB)" i hope it will solve your problem as well
Thank you very much for the tutorial! I have a question, is it still accurate for 50 faces? I am working on a project that needs to distinguish the unknown faces but I find it hard to do because of many encoded faces
hey there, i love your tutorial because it is simple and easily understandable.. one question? can we make this as an .exe file and then install it through setup.exe in other computer?
I'm on Windows, and the program runs very slowly and laggy when it detects my face. Is there a way to improve the performance? I notice that your Mac system is running very smoothly. Maybe it's an OS thing? I hope you can reply, thank you~!!
Any option how to recongnize only live faces. I want to make attendance management and dont want some one to show other person pic from mobile and mark attendance
I encountered some problems when using this system. If the people are captured in the dataset, face detection is correct. But when there is an unknown person who is not captured in the dataset, face detection is not detected unknow label, it show name of someone in dataset. Can you give me solution ?
hi i just want to ask how can fix this because im using window 10 "in run recognition small frame = cv2.resize(frame, (0, 0), fx=0.25, fy=0.25) cv2.error: OpenCV(4.8.1) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src esize.cpp:4062: error: (-215:Assertion failed) !ssize.empty() in function 'cv::resize'"
Great presentation - very much appreciated. I am a noob hack messing with python and esp32-cams. Any easy/quick suggestions/references for using this with multiple video streams?
why do i get "cannot find reference 'videocapture' in '__init__.py | __init__.py' " i had to downgrade opencv to get other references to cv2 operational. It didn't fix the video capture issue though. using windows 11, x64 if that makes a difference.
i have no idea what fixed this because i did a million things, but it works now. i downgraded opencv, numpy and imported cv2 as cv2 for starters. i also had to clear open cv cache with some pip command that i already forgot lmao
i had also gotten the same error, its because it can't locate the face from your database of photos. Try uploading a clear photo with a clear background.
Could I take more pictures of me, from different angles to make the detection better, also could I use this to detect or even Recognize my cats? Thanks in advance🎉
Hello, I followed your tutorial, but my camera is capturing my face with noticeable lag. Could this be due to my camera's high 1080-pixel resolution, also I'm using the "hog" model for the face.location function?
Hello. I found your video is very important. Thank you for the tutorial. Now my question is I don't want to recognize the static images like photo copy or something else that is static because any person can recognize the face by scanning the static photo copy. So, is there any way to recognize only the live face? Like in your case, obama's photo is recognized but it should not be because any person can get the photo of obama from internet and he/she can just scan it.I hope you understood my question.
Hey great video! I wrote it on my machine and it worked, just one question tho - I tried to convert the same program to do face detection on a video file instead of the camera stream, but the video plays extremely slowly when its running in the face detection program, like 1/50th the normal speed. Is there anyway you know of to fix this?
We’re sorry to hear that you’re facing trouble with this tutorial. We have some suggestions for you: 1. Try watching the tutorial again to check if you missed something (remember that programming languages are strict, and that uppercase & lowercase characters are completely different.) 2. If you’re facing an error, try copying and pasting it into the Google search engine, it’s the fastest way to find the best response for the issue you are facing. 3. If it’s still too confusing for you, try taking a step back and working on an easier project to try to improve your programming skills before tackling the project in this video. We wish you the best of luck with your project!
Mine worked fine in VS Code, only issue I ran into was that rgb_small_frame would crash my system whenever it detected a face. Fixed by rgb_small_frame = cv2.cvtColor(small_frame, cv2.COLOR_BGR2RGB)
There is no source code in description !!!
Firstly an excellent tutorial, very well presented. I had a couple of issues with the code and I offer solutions for these in case anyone has the same. Firstly I added the following line of code to remove the file extension for a nicer display:
name = self.known_face_names[best_match_index]
# remove the file extension for a neater display
name = name.split('.')[0]
I also found with more than one face it would call everyone by the same name. This is because the zip line repeats until the shortest tuple is completed then stops. If a single face is in frame for a while before a second face appears only the first will be annotated. To fix this I reversed the names and location lists to give a last in first out solution. Change line to: for (top, right, bottom, left), name in zip(reversed(self.face_location), reversed(self.face_names)):
I hope this helps someone.
can you provide us with the code , thanks :)
You said "firstly" twice and had no "secondly."
Lovely tutorial. I did have a bit of a problem at runtime with small_frame[:, :, ::-1]. I fixed it by calling this, instead: cv2.cvtColor(small_frame, cv2.COLOR_BGR2RGB)
I had the same problem, thanks!
Same 🤝
Thank you ! You saved me !
can u share the source code I m having trouble running in mine
Thanks a lot Becky. I wasn't getting any fix for this and I got it from you. Thanks a lot once again.
Hi! when run face_encodings in the while, my fps dorops to 3-4, can i imporove or optimize this function?
Apparently the source code mentioned near 5:00 in video is well hidden. Otherwise, the video is informative. At 75, I like to follow along with the code. Sometimes I do try the code and sometimes not. The source code does make it handy for me when it isn't so well hidden.
where is the code in the description?
such a fun and to-the-point tutorial, thanks so much!
thank you so much for such a huge effort, when trying recognition, it is lagging too much, do you have any idea about what is the problem? thanks in advance
Is it possible to dynamically add photos to the faces folder? For instance, if a face is detected that is not recognized, could the user possibly be promoted to take a screenshot and that picture will be saved to the faces folder and encoded like the others?
You're amazing. No one has ever described it so easily and so succinctly. Thank you.
Hello, I have an error I wanted to test line 41: for image in os.listdir('Faces')
SyntaxError: expected ':'
getting this error
error: subprocess-exited-with-error
× Building wheel for dlib (pyproject.toml) did not run successfully.
same error here...
@@rileymchugh5316 you have to import cmake. Google it online if you need specifics on how to do it. I think I got it from some stack overflow page after a few minutes of searching.
If you are using VS Code on Windows, you have to download dependencies
I dont know why but it says that the face recognition module is not able to be found, Even when I try to import the Face Recongition again it still just wont work. And all I did was try the first part. Is this a version issue or is this something else. Please check out this comment if you have time. Thanks!
Mine its saying dlib cannot be downloaded because there's no project.toml-based projects. Please help😢
hey, i got the same issue. Did yours get solved?
I changed the line and it worked for me
rgb_small_frame = small_frame[:, :, ::-1]
rgb_small_frame = cv2.cvtColor(small_frame, cv2.COLOR_BGR2RGB)
Hi Author Its a great article...
with perfection...
1) If a show a pic consisting of multiple faces then it only detect just one face at a time...What is the reason for it?
2) Its quite slow as well...
Can you guide on these two aspects.
A great video.
Instead of web cam I wants to use live desktop screen to detect objects, is it possible? And show in desktop rectangle itself?
I got this:
cv2.error: OpenCV(4.7.0) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src
esize.cpp:4062: error: (-215:Assertion failed) !ssize.empty() in function 'cv::resize'
in line 51
eu consegui resolver esse erro agorinha
@@askelardd What language is that...
sir, when i try to running that using my web cam, nothing happen, camera on but no windows show the face recognition, the pop up windows doesn't show image read well
Hi, i have been getting this error: RuntimeError: Unsupported image type, must be 8bit gray or RGB image. I cant find a way to fix it beacause if i use RGB format it tells me that it has to be jpg, png...
I had the same issue and I'm STUCK
this because you don't have setuptools, to solve this open cmd and write this pip install setuptools , if this doesn't solve, then check your numpy version, to check it open cmd write pip list then check numpy version in the list, if it's greater than 1.26.4, then uninstall numpy like this, pip uninstall numpy and then open cmd write pip install numpy==1.26.4
It's Awesome!! You are great Boss!! ❤❤
So can you only train it on one image per unique face? You can't give it multiple angles of the same face to help it recognize it better?
Hi, I get an error when trying to run the script IndexError: list index out of range. The script finds 2 faces in the faces dir. What can I do solve this error? Thank you in advance
Huge help, learned a lot, thank you.
thank you , i have a small problem the cam opens just for a second then disappear , any solution please :)
i have the same problem, did you see any solution?
same problem
@@dabeerahmed4802 any solution?
can i make it that when the program sees a new face it saves it and then when it sees it again it remembers it perhaps using a database i dont know?
Great video, but I have a problem: my video crashes as soon as a face gets detected :(
Im told that the line
"self.face_encodings = face_recognition.face_encodings(rgb_small_frame, self.face_locations)" is the problem but i have no clue why
please help because i really want this programm to work because its pretty cool
Same problem... 😢
if you change "rgb_small_frame" to just "small_frame" on that line, it works. Not 100% sure why, maybe Python doesn't like the rgb_small_frame = small_frame[:, :, ::-1] bit at the end '::-1'
@@Loopyengineeringco you are right i had the same problem, i solved by changing "rgb_small_frame = small_frame[:, :, ::-1]" with "rgb_small_frame = cv2.cvtColor(small_frame, cv2.COLOR_BGR2RGB)" i hope it will solve your problem as well
are there any specific version that we need to install Eg : Python , opencv?
great tutorial!!❤
Thank you very much for the tutorial! I have a question, is it still accurate for 50 faces? I am working on a project that needs to distinguish the unknown faces but I find it hard to do because of many encoded faces
Looks like it should run, but when I run the selection from a MacBook, the program doesn't launch, nor do I get an error message.
hey there, i love your tutorial because it is simple and easily understandable.. one question? can we make this as an .exe file and then install it through setup.exe in other computer?
Cool lesson. Thanks!
pls where is the source code i cant find it anywhere
What is cmake and why can't I install any of this without it?
thanks for the tutorial. it was very helpful.
self.faceEncodings = face_recognition.face_encodings(rgbSmallFrame, self.faceLocations) I keep getting a type error
small_frame = cv2.resize(frame, (1, 1), fx=0.35, fy=0.35)
how to fix this?
thanks dude it works perfectly
I'm on Windows, and the program runs very slowly and laggy when it detects my face. Is there a way to improve the performance? I notice that your Mac system is running very smoothly. Maybe it's an OS thing? I hope you can reply, thank you~!!
problem is your pc rams, to solve then increase your rams or use good perforce rams at least 8GB
There is no such thing in the tutorial like Training the model? what else if I Want to use it using a trained model?
kindly brief on this.
Start by learning machine learning
@@Indently Ok I will start to convert it to the machine learning model...thankx for your support.
Hello , where can I download this code?
same
Hi bro which algorithm you used?
hello, how can I add some checker in the form of a txt or csv file?
Any option how to recongnize only live faces. I want to make attendance management and dont want some one to show other person pic from mobile and mark attendance
Have you done any progress on that? I am thinking in the same direction...
How to stop somebody showing the picture for the attendance?
@@asifrehman4214 i am thinking to use windows tab and use this application on windows tab.
I encountered some problems when using this system. If the people are captured in the dataset, face detection is correct. But when there is an unknown person who is not captured in the dataset, face detection is not detected unknow label, it show name of someone in dataset. Can you give me solution ?
my cv2 keeps crashing?
hi i just want to ask how can fix this because im using window 10
"in run recognition small frame = cv2.resize(frame, (0, 0), fx=0.25, fy=0.25) cv2.error: OpenCV(4.8.1) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src
esize.cpp:4062: error: (-215:Assertion failed) !ssize.empty() in function 'cv::resize'"
need help , i fixed
Great presentation - very much appreciated. I am a noob hack messing with python and esp32-cams. Any easy/quick suggestions/references for using this with multiple video streams?
may I have the code/github link ?
I think you got left and right mixed up as well. Left is y. Right is the width.
nevermind
where is code?
does it works with 3.11 python version?
Using Tensorflow isn't better than python face dedication dependencies?
Great tutorial, but where's the source code you mentioned ?
why do i get "cannot find reference 'videocapture' in '__init__.py | __init__.py' " i had to downgrade opencv to get other references to cv2 operational. It didn't fix the video capture issue though. using windows 11, x64 if that makes a difference.
i have no idea what fixed this because i did a million things, but it works now. i downgraded opencv, numpy and imported cv2 as cv2 for starters. i also had to clear open cv cache with some pip command that i already forgot lmao
@@Austin-vz9rt hey man, can you please help me on this issue😢
Hello! What app are you using for writting the code?
top left - pycharm
which version python are you using ?
Thank you so much , everything work with me from the first time without any error 😍
Can you please help me too?
I'm having couple of issues
I tried to add a face into the folder and got the error IndexError: list index out of range. whats happening?
i had also gotten the same error, its because it can't locate the face from your database of photos. Try uploading a clear photo with a clear background.
When i tried to add a face, it says permission denied. How to tackle that issue?
How to train the model bro for a set of images
thiis really nice. i intend to put this on A web aopp as interface. any idea how?
Thank you so much, my program ran. But it is slow and I want it run fresher and faster. I need the help 😮
My webcam sometimes Not responding how can i solve the problem. but the cam working good.the recognition is strucked sometimes
same issue
will this work on LFW datasets?
can we implement this in website? if yes..how to?
the camera opens and working, but after it detects face it stops or lag. HElp
same any fix?
I'm getting one problem, an error just occurred, saying 'no module named face_recognition'. How can I solve this problem?
th-cam.com/video/7xbRHiYNSds/w-d-xo.html
@@Indently i also need help. My webcam is starting but not showing the names
Could I take more pictures of me, from different angles to make the detection better, also could I use this to detect or even Recognize my cats? Thanks in advance🎉
Hello, I followed your tutorial, but my camera is capturing my face with noticeable lag. Could this be due to my camera's high 1080-pixel resolution, also I'm using the "hog" model for the face.location function?
Same here even after I commented out "self.process_current_frame = not self.process_current_frame"
Hello. I found your video is very important. Thank you for the tutorial. Now my question is I don't want to recognize the static images like photo copy or something else that is static because any person can recognize the face by scanning the static photo copy. So, is there any way to recognize only the live face? Like in your case, obama's photo is recognized but it should not be because any person can get the photo of obama from internet and he/she can just scan it.I hope you understood my question.
can i use vs code rather than pycharm
You can
Can you make it to detect what is on the screen like a dog, cat, human etc. 🤔
I faild to install dlib
Did you manage to fix it?
thank you so much!
it's worked for me.. however, i need to update some config to adapt from my laptop..
Getting index out of range error can someone help?
very cool video, Please make a tutorial how to install dlib in windows 10 and specify version of python.❤❤
Did you manage to fix it?
Getting error in installing dlib
same
your tut are soooooooooooooo cool I love
Thanks buddy!
Hey great video! I wrote it on my machine and it worked, just one question tho - I tried to convert the same program to do face detection on a video file instead of the camera stream, but the video plays extremely slowly when its running in the face detection program, like 1/50th the normal speed. Is there anyway you know of to fix this?
what versions of python and opencv did you use
Run recognition process in other thread and that's it
Can you do a tutorial for python 3.12
Sir One Question:
After 05 minutes of working; the system stops detecting images...No detection on the camera.
Plz can you guide ?
Can you do this on window 10 ?
@@forschool4136 yes ...
I do not see the code in description 😭😭
thank u so much bro
heartlyllove u
its so annoyed ! it getting eror! not detecting faces . what u skiped in his video nothing is working as excepted
Can you make a face recognition tutorial using flask?
How to make web application, where to store data
I can't find the source code !!!!!!!!!
Dlib will not install for me
We’re sorry to hear that you’re facing trouble with this tutorial. We have some suggestions for you:
1. Try watching the tutorial again to check if you missed something (remember that programming languages are strict, and that uppercase & lowercase characters are completely different.)
2. If you’re facing an error, try copying and pasting it into the Google search engine, it’s the fastest way to find the best response for the issue you are facing.
3. If it’s still too confusing for you, try taking a step back and working on an easier project to try to improve your programming skills before tackling the project in this video.
We wish you the best of luck with your project!
If you still need help, reply.
@@fernandez06 Still trying to download dlib but it seems impossible to do :(
@@ano0os050 ok, did you try deleting and downloading it again?
Where is source code ?
Did not work. I keep getting type errors.
hi, your tutorial so good, I hope the next time you gonna post up about face_Encoding and compare them in the database...~
where is the source code
hi good video but i cant seem to get the source code guthub link an you please share that. Thanks so much would appreciate
I've been trying to instal dlib for so long!! Ugh
Great video....i do not see the source code, can you please add a link?
its just not detecting my face
very good, can you share the code please!
does this work in vs code
Mine worked fine in VS Code, only issue I ran into was that rgb_small_frame would crash my system whenever it detected a face.
Fixed by rgb_small_frame = cv2.cvtColor(small_frame, cv2.COLOR_BGR2RGB)
its not working