AI for Everyone LESSON 16: Face Recognition with OpenCV

Поділитися
Вставка
  • Опубліковано 6 лис 2024

КОМЕНТАРІ • 147

  • @cavalrycome
    @cavalrycome 3 роки тому +64

    I had a problem installing the face_recognition package because of an issue with the installation of dlib, but I managed to solve it. If others are experiencing the same issue, install dlib using 'pip install dlib==19.7' and then install face_recognition using the command 'pip install face_recognition==1.2.3'. At least, that worked for me.

    • @paulmcwhorter
      @paulmcwhorter  3 роки тому +6

      The the Cmake install work properly prior to installing face_recognition?

    • @cavalrycome
      @cavalrycome 3 роки тому +10

      @@paulmcwhorter Yes, Cmake installed without any problems, but then when installing face_recognition, it gave an error with the dlib package. I noticed that the installer was looking for a version of dlib greater than or equal to 19.7 so I guessed that there might be an issue with the latest version and explicitly installed dlib 19.7 before trying face_recognition again, and it worked.

    • @keithlohmeyer
      @keithlohmeyer 3 роки тому +6

      Thanks. That fixed my problem.

    • @bigbogeyface
      @bigbogeyface 3 роки тому +4

      @@cavalrycome Yessss!!!! 🥳🥳🥳
      Thank you so much, that worked a treat 👍
      I crown you No#1 bug fixer of the week 👑 👍✌👋

    • @arlo4051
      @arlo4051 3 роки тому +2

      I had a problem also, Cmake installed ok, but in the process I lost the cv2 module also. Your fix made it work and i was able to get cv2 reinstalled. Biggest problem was it kept using the face_recognition cache version and when trying to uninstall would say" module not loaded,uninstall bypassed".

  • @tilakdavidd2358
    @tilakdavidd2358 2 роки тому +1

    Thanks Paul for teaching everything for free.

  • @PranavVibhute-z2i
    @PranavVibhute-z2i 10 місяців тому

    I love the way you teach am blessed to find this channel. Its just fun learning from your classes i which there was a option to like all your videos.

  • @RDKCREATIONS
    @RDKCREATIONS 3 роки тому +3

    best lesson so far 👏👏👏

  • @carlmalouf
    @carlmalouf 2 роки тому

    Love the lessons as always Paul. Thank you. Only advice I would add is when you get an issue as you did with the putText method, don't be afraid to go to the documentation, particularly when the error message is a little ambiguous.

  • @SteveLeone
    @SteveLeone 10 місяців тому

    Another great lesson Paul. Thank you!!!

  • @aman-sood
    @aman-sood 2 роки тому +1

    A little tip paul, if you want to replace all '\'in a program with /, you can use vscode's search and replace function. You give it something to search for and give it a value which it will replace the searched value with.

  • @timwatkins6785
    @timwatkins6785 2 роки тому

    Awesome video Paul! I had to take a break from the series for a little bit but I am catching up on the videos now. This stuff is too cool! You are legend!

  • @edSabio572
    @edSabio572 2 роки тому

    Thanks Paul! I had to uninstall / reinstall all the libraries to get it to work. No issues after that. Your lessons never disappoint.
    Your face recognition / servo motor idea is something I would be very interested in. Please leave us a link where we can purchase the needed hardware to match what you have. Amazon would be great!

  • @bkairosh8164
    @bkairosh8164 3 роки тому

    Yes, it'd be a great idea to connect face recognition with servo-motor to physically track one's movement. It'd be interesting to learn how everything comes together.

  • @smokingunnz
    @smokingunnz 3 роки тому

    Thanks, Paul. Another fabo lesson. Can't get enough.

  • @aman-sood
    @aman-sood 2 роки тому

    A very fun lesson as always. Homework seems simple enough.

  • @leeg.1402
    @leeg.1402 3 роки тому +1

    Thanks for another GREAT video!! You made it so easy!! 😉👍

  • @cbrombaugh
    @cbrombaugh 3 роки тому

    This is a great lesson. Thanks Paul. I would be very interested in the pan/tilt project!

  • @karincatech6322
    @karincatech6322 2 роки тому

    Hi Paul thanks for great content.
    Is it possible to detect disguise, i mean if the person is live or a photograph.
    thanks.

  • @haastrupadebayoibukun6817
    @haastrupadebayoibukun6817 2 роки тому

    I encountered all sort of issues installing the libraries("Install visual studio C++",whl is not supported on this platform"..etc), but I found my way around it. I will just share this for as many that might encounter the same issue. To cut the long story short, i noticed that python 3.6 is a 32bit. I had to uninstall it to install a 3.6.6 version which is 64bit, and I followed previous processes in setting it up as my virtual environment. It worked.

  • @augustinecalvin7722
    @augustinecalvin7722 Рік тому

    Thanks Paul

  • @bkairosh8164
    @bkairosh8164 3 роки тому +1

    I'm curious to know, when we encode the array what is really happening there?

  • @edSabio572
    @edSabio572 2 роки тому

    Question to Paul: In order to use Arduino and servo motors, do we need to see some of your videos?

  • @juldupont
    @juldupont Рік тому

    you are a legend!!! you are amazing

  • @angelovillano6364
    @angelovillano6364 2 роки тому

    This is Great! thank you Paul!

  • @callmeandoru2627
    @callmeandoru2627 2 роки тому

    The fact that OpenCV works in BGR instead in RGB which then leads Donald’s face being blue is the funniest thing I learn today

  • @engineering_design
    @engineering_design 3 роки тому +1

    What sensor do I need to use to count the number of water droplets?
    Please sir answer me?

    • @bigbogeyface
      @bigbogeyface 3 роки тому +2

      I would use a flat laser beam (they cost around the same as a normal laser module, about £5) 💷
      Every time a water droplet passed through the laser beamed area, there would be a flash of light 💡
      I would then use an LDR trained over the laser beamed area to count the flashes of light 👁
      That way I could calculate the number of droplets per second in a given area.
      That is, if you were talking about counting rain droplets 🌧 ☔👍

  • @phisicoloco
    @phisicoloco 3 роки тому +1

    I loved this class

  • @VR-vm7rl
    @VR-vm7rl 3 роки тому

    Sir i wanna design software with an artificial intelligency which would be installed in cars that would help automatic car works
    What it would be come under article intelligency or not ?

  • @arshdeepsingh5950
    @arshdeepsingh5950 2 роки тому

    Hi sir, I have a problem, how to handle when there are more than 1 True in the list of matches. I used 4 people (a group photo) and it was classifying everyone with the same name even tho i trained it with unique pics of the everyone in the group. When i analyzed it was detecting a person as more than 1 person (Like Jack in photo matched encoding with both Jack itself and Smith and John and classified as John the final result because it was the first one encoded) How to solve this?

  • @terryterry1655
    @terryterry1655 2 роки тому

    is it possible to pull multi jpg from unknown folder instead of individually loading only one jpg file ?thx

  • @dr.kerstin-evelynevoigt5061
    @dr.kerstin-evelynevoigt5061 2 роки тому

    Just a little householding comment. I had difficulties to install the library face_recognition. I am working on a new PC where Visual Studio for C++ was not installed. Fortunately, the terminal showed the missing and after Visual Studio, everything is working ok.

  • @tntragan
    @tntragan Рік тому +1

    This is getting intense. Real time tracking of real people. Only recognized people will be allowed into my soon to be secure household. All others will be vaporized by your next tutorial on photon torpedoes.😬

  • @neilausten9404
    @neilausten9404 3 роки тому

    Tried reinstalling virtual environments, can't get it to work on 3.6.8. Both cMake and face recognition now won't install. Could this version of python be the problem? Noticed someone else had no success with 3.6.8. Hoping the rest of the series doesn't rely on these libraries.

  • @mattphorwich
    @mattphorwich 3 роки тому +2

    Groovy! :)

  • @wayneswan3092
    @wayneswan3092 2 роки тому

    yeah, I been trying everything I can find online. I can't install dlib, or face_recognition. I get a long drawn out thing of red lettered error that I cannot decipher.

  • @jayyoder667
    @jayyoder667 2 роки тому

    Finally got dlib and face_recognition to install without errors. When I put 'import face_recognition as FR' in the ide it has a squiggly underline indicating it can't find the module. Sure enough when I run it it gives module not found error. However when I go the the terminal start python and run it there no problem. What am I missing here?

    • @jacklam5658
      @jacklam5658 2 роки тому

      I have exactly the same problem as you described.
      I spent 2days searching on the web and found a guy proposed to install the c++ library before installing cmake and face recognition. After doing this, it takes very long time to install the face recognition but looks success. However, the problem you describes appears :(.
      Have you solved your problem yet ? If yes, can you share your solution with me?

  • @khanshary623
    @khanshary623 2 роки тому

    sir i have trained on two pic one is mine another is my cousin then i compare those two object so it return true my mean it is not very accurate i am going to make attendence system using face recognition so please sugest me any library in python with more and more accuracy please

  • @peterwooldridge7285
    @peterwooldridge7285 3 роки тому

    A general question: when programming how does one determine the inclusion of a specific library is necessary for the functionality of the code?

    • @paulmcwhorter
      @paulmcwhorter  3 роки тому

      You just have to know what functions are available in the standard python install, and the ones that are not will require loading a library.

  • @PoojaKumari-ic7zh
    @PoojaKumari-ic7zh 3 роки тому

    Dear Paul, I could not install face_recognition in pyAI3.6. I tried with pyAI3.7 and it worked. 'pip install dlib==19.7' this is also not working for me. In pyAI3.7, i am getting this error: donFace=FR.load_image_file('C:/Users/shiva/Documents/Python/demoImages/known/Donald Trump.jpg')
    AttributeError: module 'face_recognition' has no attribute 'load_image_file'

  • @ajistechlab2243
    @ajistechlab2243 2 роки тому

    hello sir, i am getting this message while trying to install face_recogniton,
    You must use Visual Studio to build a python extension on windows. If you
    are getting this error it means you have not installed Visual C++. Note
    that there are many flavors of Visual Studio, like Visual Studio for C#
    development. You need to install Visual Studio for C++.
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    please help sir.

  • @wishicouldarduino8880
    @wishicouldarduino8880 3 роки тому +1

    Would a robot need a camera mounted on the hand to be able to pick up something?😁👍cool video

    • @bigbogeyface
      @bigbogeyface 3 роки тому +1

      Not necessarily.

    • @vaughntaylor2855
      @vaughntaylor2855 3 роки тому +1

      i would think it would be practical using sonic or other type of non-image proximity detectors?

    • @wishicouldarduino8880
      @wishicouldarduino8880 3 роки тому +1

      @@vaughntaylor2855 possibly a 10 to 80 cm infrared sensor or even 4 to 30 that would be cool since I already have these modules .

  • @idkwhatiamdoing2389
    @idkwhatiamdoing2389 Рік тому +2

    Update it worked I can't believe it here what you need to do first
    1 download Python 3.6.8 64bit
    2 create an environment
    3 download Cmake 3.21
    4 download dlib 19.7
    5 download face_recognition 1.2.3
    And that ladies and gentlemen the best shortcut to do if you don't want to spend half a day trying to figure it out I am not even joking I spend maybe more then half a day crying and banging my head

    • @elipkm10
      @elipkm10 6 місяців тому

      thank you so much!

  • @HASANALI-wd1yl
    @HASANALI-wd1yl Рік тому

    Hi Paul. I've installed all the libraries but my code isn't running. This is the error i'm getting:
    Traceback (most recent call last):
    site-packages\face_recognition\api.py", line 153, in _raw_fac", line 6, in e_landmarks
    face_locations = _raw_face_locations(face_image) site-packages\face_recognition\api.py", line 209, in face_encodings
    File "C:\Users\SAR Computer\Documents\Python\myVirtEnv\lib\e_locations, model="small")site-packages\face_recognition\api.py", line 102, in _raw_facsite-packages\face_recognition\api.py", line 153, in _raw_face_landmarkse_locations
    return face_detector(img, number_of_times_to_upsample) site-packages\face_recognition\api.py", line 102, in _raw_face_locations
    RuntimeError: Unsupported image type, must be 8bit gray or RGB image. B image.
    Can you help?

    • @tntragan
      @tntragan Рік тому

      Did you look through the pinned comment at the top? I wonder if it might be related to what happened to some of the people that had issues with loading the libraries? Also I would make sure that you converted the image as Paul describes in the video from RGB to BGR?

  • @jabcek
    @jabcek 3 роки тому

    I managed to do the homework, but my FPS is under 1, if i resize the video to 1/4 i get about 1, but in this case it only senses 1 person , in my mp4 video file, and about 3 on my camera. Not realy satisfied with the results... Also it takes some time to load all encodings about 5s for each, is it maybe posible to save the encodings to pickle (or something similar)?

    • @paulmcwhorter
      @paulmcwhorter  3 роки тому

      Storing the training data will make the program launch faster but will not improve fps. To go faster you really need to run the openCV and libraries on the graphics card, not the CPU but showing how to do that is beyond the scope of a simple youtube video. Other thing would be to get yourself a jetson nano and it will run at probably 15 fps on that, as it has 128 core processors, and just costs about $100

    • @jabcek
      @jabcek 3 роки тому

      @@paulmcwhorter I know that storing data wont speed the recognition, it would only speed up the start of procesing (i have also checked that we did use pickle in nano lessions, but i forgot). Also i do have a nano, went thrue you lessions and yea, i know that there was faster. The knowledge faints fast if you dont use it :)

  • @thedude333
    @thedude333 3 роки тому

    i wonder if there is a way to create a pre trained model with all the known faces instead of encoding them all over again in every runtime. something like the cascades just using the face_recognition module.

    • @paulmcwhorter
      @paulmcwhorter  3 роки тому +2

      You can train on the faces you are interested in, then use pickle to save the training arrays, that is encoding array and name array. Then just load those at run time rather than training each time you run

    • @thedude333
      @thedude333 3 роки тому

      @@paulmcwhorter cool, will try that, thanks

  • @thedude333
    @thedude333 3 роки тому

    Starting with the cool stuff ha ;)

  • @keithlohmeyer
    @keithlohmeyer 3 роки тому +1

    Looks like I may have to pass on this lesson. I spent several hours trying to install the face_recognition library without success this afternoon. I took a break and tried for another hour tonight triple checking I am doing the same as Paul in the video. Still no joy. I will look at it tomorrow after getting some sleep. I hope others have better luck.

    • @paulmcwhorter
      @paulmcwhorter  3 роки тому +1

      Keith, I pinned a comment by cavalrycome who made suggestions on fixing the problem. Please see if his recommendation works for you. Dont give up!

    • @GCRickerNH
      @GCRickerNH 3 роки тому

      @@paulmcwhorter The pinned solution didn't work for me either. Within the error message says that, "You need to install Visual Studio for C++". Not sure if I want to do that though.

  • @danny12345
    @danny12345 3 роки тому

    Thank you

  • @alexandrevaliquette1941
    @alexandrevaliquette1941 3 роки тому +1

    I'm curious to know more about "how to create a library". I mean, the genius guy who live in a cold cave without light.. this guy who wrote the code to create "face_recognition".
    How ugly is this code, how can you create wonderful thing?
    I don't want to do it, but I'm very curious to know how this magic is done.
    Alex from Montréal
    Ps Love your work, Thumbs up, as usual.
    Ps2 Hope you are doing great in Africa. God is proud of you... so I am!

  • @neilausten9404
    @neilausten9404 3 роки тому

    Installed cMake OK, then dlib==1.9.7 OK but it all came apart when I tried to install facerecognition library. I note that when I previously ran the python command it came up 3.7.9 but the note on lower left hand corner of visual studio showed vers 3.6.8 virtual env. Any comment would be appreciated, hate to have to give it up after getting this far.

    • @paulmcwhorter
      @paulmcwhorter  3 роки тому

      I would go back to lesson 3 and create a fresh python virtual environment, use python 3.6.6, install my version of openCV, and then do the installs. It really should work. Once things get messed up, sometimes it is best to go back to square one.

    • @neilausten9404
      @neilausten9404 2 роки тому

      I tried installing python on my laptop computer and everything downloaded with no problems. Can't explain why, I used all the same keystrokes that I used on my laptop. Thankfully I was able to carry on with this excellent course.

  • @TheCourtoh
    @TheCourtoh 2 роки тому

    Has anyone encountered or know how to fix this error "ModuleNotFoundError: No module named 'face_recognition'" ?

    • @TheCourtoh
      @TheCourtoh 2 роки тому

      It works when I click "Debug python file" or " Run python file" in the drop down menu next to the play button.

  • @cbrombaugh
    @cbrombaugh 3 роки тому

    I got an error installing face_recognition with pip. "import face_recognition" then has the nasty squiggly line under it. So I cannot do this lesson. I tried the pip install a second time and had the same error. I have been using python 3.6.8 without any previous problems. I don't know how to switch to 3.6.6 to see if that fixes the problem.

    • @paulmcwhorter
      @paulmcwhorter  3 роки тому

      Did you get Cmake installed correctly? What was the error installing face_recognition? Were you connected to the internet. This should work fine on 3.6.8

    • @cbrombaugh
      @cbrombaugh 3 роки тому

      @@paulmcwhorter Thanks for the follow up, Paul. Cmake installed correctly. After I typed pip install face_recogntion it looked like the installation was going OK. Then it said
      "--Building for: NMake Makefiles", then "Cmake Error at CMakelists.txt:5 (message)", then a line of !!!!!!!!, then "You must use Visual Studio to build a python extension on windows. If you are getting this error it means you have not installed Visual c++".
      This was followed by more lines of info including a few lines of red text which was probably error info that I could not understand.
      I hope you can help me with this problem.

    • @paulmcwhorter
      @paulmcwhorter  3 роки тому

      @@cbrombaugh check out the comment pinned above by cavalrycome who offers some suggestions. See if that helps. Thanks

    • @cbrombaugh
      @cbrombaugh 3 роки тому

      @@paulmcwhorter I tried cavalrycome's solution without success. I received an error on installing dlib. The error messages started with:
      "Running setup.py install for dlib ... error".
      Among other things, in the red block of messages was:
      "error: Cannot find cmake, ensure it is installed and in the path."
      I hope we can find a resolution to this issue. I will try anything that you suggest. I don't know how to copy text from the terminal to possibly paste it here for you.

    • @paulmcwhorter
      @paulmcwhorter  3 роки тому

      So the issue is dlib is not installing. Are you sure that Cmake installed without error? dlib fails if you do not have Cmake.

  • @Lehibob
    @Lehibob Рік тому

    Not exactly legend, I didn't fold either... It took a bit of brain-cramp to figure out how to use the WEBcam 'frame' as the image for searching for faces. Paul did a great job of teaching the concepts... But I had to work to make it frame faces and label them correctly. Having said that, I was happy with the result. Nobody in my family wanted to be on the WEBcam so I just used my OWN image and made an image of Albert Einstein whose image I have hanging in my office.
    My UA-cam video of my homework solution can be found at: ua-cam.com/video/bjN0mFbLfqI/v-deo.html

  • @vaughntaylor2855
    @vaughntaylor2855 3 роки тому +1

    Thank you Paul for the fun and challenging lesson! You are so sincerely appreciated!
    Here is the video with the assignment.
    ua-cam.com/video/IimSMv_ntF4/v-deo.html

    • @paulmcwhorter
      @paulmcwhorter  3 роки тому +2

      Excellent. Have you got your grandson coding yet?

    • @vaughntaylor2855
      @vaughntaylor2855 3 роки тому +2

      @@paulmcwhorter Well, I have had him coding in Scratch for quite some time and he has been getting pretty creative with it. As far as programming in languages like Python, at 8 years old, i think he will be ready soon!

    • @zaqk2
      @zaqk2 3 роки тому +1

      Nicely done Vaughn... Your code runs so smoothly...

    • @keithlohmeyer
      @keithlohmeyer 3 роки тому +1

      Great job!

    • @vaughntaylor2855
      @vaughntaylor2855 3 роки тому +1

      @@zaqk2 Thank You!

  • @idkwhatiamdoing2389
    @idkwhatiamdoing2389 Рік тому

    I need future help everybody so pip got my blood rising to the roof because it wasn't working I spend half an hr trying to figure out the problem I switched to another ev and download every library that didn't work the only thing that worked is when I moved my main pythonauAI folder from my Desktop to Document where it was originally created, that got it working but I am worried that when I want to migrate to another laptop it will mess very thing up so no matter went you read this message I will need your so anyone gives me some initial or any info that may relate to my future problem, and thank you

    • @jbelmont72
      @jbelmont72 9 місяців тому

      I know this is late. Did you figure out how to migrate (clone) the project to another computer. I'm interested if you had to create the virtual environment first and then transfer/ or used GitHub/GitHub Desktop etc.

  • @KurasFtc
    @KurasFtc 3 роки тому +2

    Thanks Paul for your lessons.
    I had problems with the installation of dlib, but after install c++ with visual studio solved the issue.
    This is my solution for the homework : ua-cam.com/video/EUe-todwQ9c/v-deo.html

    • @keithlohmeyer
      @keithlohmeyer 3 роки тому

      Great job. Subscribed to your channel so I don't miss your vids.

  • @itsmeintorrespain2714
    @itsmeintorrespain2714 3 роки тому

    Homework published :- ua-cam.com/video/BQV-_AYJRnE/v-deo.html

  • @LiamAllbright
    @LiamAllbright Місяць тому

    Why do i need C++ for this to work now wth

  • @bobingridshaw5361
    @bobingridshaw5361 3 роки тому

    Help! I can't pip install face_recognition==1.2.3. It seems to say I have not installed Visual Studio for C++. I get errors when it loads either dlib or pillow I believe. The dark red error notes in the power program's dark blue background make reading almost impossible! Any suggestions please??? I have removed Python folder and rebuilt several times with the same result using py -3.7.6.

    • @sridhars3467
      @sridhars3467 3 роки тому

      Have a look at the pinned comment....u just need to pip install the dlib to mentioned version & then start with pip install facerecog.....just have a look at pinned comment 👍🏻

  • @aboudezoa
    @aboudezoa 3 роки тому +1

    Brace yourself for political debate 😅😂

    • @bigbogeyface
      @bigbogeyface 3 роки тому +1

      We'll have none of that, however: if AGI ran for parliament I for one am voting it in 👆

  • @Ggg44445
    @Ggg44445 Рік тому

    Sorry

  • @keithlohmeyer
    @keithlohmeyer 3 роки тому

    Sub par Homework submitted ua-cam.com/video/G1ugv-a2LlU/v-deo.html
    Thanks Paul for the great lessons!