Facial Recognition for Raspberry Pi with OpenCV and Python (Updated Tutorial)

Поділитися
Вставка
  • Опубліковано 2 лют 2025

КОМЕНТАРІ • 104

  • @trythelatest
    @trythelatest 3 місяці тому +7

    You have brilliantly explained so much, so well, in 12 minutes.
    Folks have no idea how long this takes to do well!

    • @Core-Electronics
      @Core-Electronics  3 місяці тому

      Thank you very much for the kind words, hope you enjoyed!

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

    Jaryd! I follow you on your own UA-cam channel and loved all your videos making crazy stuff. I was shocked to randomly be looking into OpenCV videos to find you doing the tutorial. Love the walkthrough and this core electronics channel already!

    • @Core-Electronics
      @Core-Electronics  Місяць тому

      I am just equally as shocked to get people from that channel recognising me here! 💜

  • @AdwaithK-p8e
    @AdwaithK-p8e 2 місяці тому +1

    thanks a lot sir, i have been looking for this for about 5 days for a project ...(a new subscriber here)🤗

    • @AdwaithK-p8e
      @AdwaithK-p8e Місяць тому

      at last , i also did it !!!😃

  • @nonoobgaming2776
    @nonoobgaming2776 Місяць тому +1

    Great Tutorial for 12 minutes completely worth it

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

    my teacher suggested me this channel, this is really helpfull. Thank you!

  • @fluffyninjamenace4661
    @fluffyninjamenace4661 3 місяці тому +1

    Fantastic tutorial! This video was very easy to follow!

  •  Місяць тому

    Great guide. Please keep up the good works. I really appreciate your effort.

  • @sorenfirestar2657
    @sorenfirestar2657 3 місяці тому

    This was legit an awesome tutorial

  • @bryanlee7295
    @bryanlee7295 3 місяці тому +2

    you got yourself a subscriber

  • @gearscodeandfire
    @gearscodeandfire 2 місяці тому

    Dude, you rule, great video
    Also, Luke is pleasantly menacing; he is a good foil and i look forward to watching more videos!

  • @kedrickperkins331
    @kedrickperkins331 5 днів тому

    Great videos!

  • @robnowobilski4201
    @robnowobilski4201 2 місяці тому +1

    I'm stuck, when trying to run the model_training.py, line 3 in the module, no module name face recognition is found.. (error) .. right at minute 6:52. when i get the error message an it runs not super simple (upside down smile)

    • @Core-Electronics
      @Core-Electronics  2 місяці тому +1

      Lets try and turn the upside down smile, upside down... again. That error means that Thonny can't find the face recognition library. The likely culprit is that there was an issue with setting up Thonny to use the Virtual environment we set up. Try and run the process shown at 4:12 again.
      If that still doesn't work then there likely was an issue installing the library. Give the installation from the beginnning of the video a go again, might fix it.
      If all of that fails, feel free to post your issue on our community forum topic for this video, we have a lot of people over there that can help out!
      forum.core-electronics.com.au/t/face-recognition-with-raspberry-pi-and-opencv/21033/2

    • @robnowobilski4201
      @robnowobilski4201 2 місяці тому

      @@Core-Electronics Thanks Jaryd the happiness of locking/unlocking the door with your face was great then "Luke get in here and try to unlock my door" had my Lollerblading ! Keep up the good work, please.

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

    You rock! Thanks a lot

  • @MomentsToRemembr
    @MomentsToRemembr Місяць тому +1

    4:43 I don’t have a “face recognition 7z” file does anyone know why?

    • @Core-Electronics
      @Core-Electronics  Місяць тому

      Hey, sorry for the late reply over the Chrissy break, but if you are still having issues, we have a dedicated community forum topic for this video. Feel free to post your issue over there as we have a lot of makers that can help out!
      forum.core-electronics.com.au/t/face-recognition-with-raspberry-pi-and-opencv/21033

  • @Videogame9559
    @Videogame9559 15 днів тому

    Hi can i use a usb camera to work with opencv recognition its working great with raspi camera module ist a very large picture how can make it smaller

    • @Core-Electronics
      @Core-Electronics  14 днів тому

      It may require a bit of reworking to get a webcam going but its definitely possible. In the written guide we have a section on changing the camera resolution as well: core-electronics.com.au/guides/raspberry-pi/face-recognition-with-raspberry-pi-and-opencv/#running-facial-recognition

  • @suyeonlee6300
    @suyeonlee6300 24 дні тому

    hello sir...May i ask a few question? if i want to take a snapshot whenever someone else(Unknown) person is detected, how the code must be modified? and the same camera(which is used for face recognition) can still be used to take a snapshot of the unknown person?

  • @201crunt6
    @201crunt6 3 місяці тому

    Sold out ✌️

  • @nirbinyamin5805
    @nirbinyamin5805 2 місяці тому

    Hey man great video!
    do you know how to make the camera follow the pupil?
    i want to build an eye -tracker using the raspi 5 and raspi moudle 3
    thank you so much

  • @ir.iskandar2542
    @ir.iskandar2542 28 днів тому

    can I detect playing cards using this code? for example I take a photo of queen of spade. and when I run facial_recognition_hardware.py and put queen of spade on camera it will print detected

    • @Core-Electronics
      @Core-Electronics  27 днів тому +1

      Unfortunately this library is only able to do human faces. Your best bet may be to run object detection with a custom model. We have the "running object detection" part of that, but not the custom model part yet unfortunately.
      ua-cam.com/video/XKIm_R_rIeQ/v-deo.html

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

    How is this any different from the GitHub project for the magic mirror “MMM-Face-Recognition-SMAI”? Are the installations any different?

    • @Core-Electronics
      @Core-Electronics  Місяць тому

      That seems to be a different project with different installations. That project seems to be an add on for a specific smart mirror setup, but this is a "how to set up facial recogntiion in Python to add to your custom project" sort of deal.

  • @Falc-101
    @Falc-101 28 днів тому

    For some reason for me it says when I am opening the model training file that "No module name face_recognition" What should I do?

    • @Falc-101
      @Falc-101 28 днів тому

      Nevermind I just ran it again and it worked. Thanks for you work jaryd!

  • @piotrek6948
    @piotrek6948 3 місяці тому

    Hi, can I use a external usb webcam ?

    • @Core-Electronics
      @Core-Electronics  3 місяці тому +1

      This code is untested on a webcam, but it should be possible. The colours may be off though as depending on your webcam, it may use a different colour space, so it may need a bit of tweaking to get the colours right!

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

    First off THANK YOU! The first tutorial that has gotten me to successfully run the camera! It worked with the image capture just fine, and created a data folder. BUT when I try to run image_capture.py I get a file not found error:
    No such file or directory: ‘encoding.pickle’
    Is there a pickle library I forgot to install???

    • @Core-Electronics
      @Core-Electronics  Місяць тому

      Hey, sorry for the late reply over the Chrissy break, but if you are still having issues, we have a dedicated community forum topic for this video. Feel free to post your issue over there as we have a lot of makers that can help out!
      forum.core-electronics.com.au/t/face-recognition-with-raspberry-pi-and-opencv/21033

  • @anseltom8471
    @anseltom8471 3 місяці тому +7

    ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them. guys can you help to solve the error i am facing to install face recognition librarie in my raspberry pi 5

    • @bademuscuriacius2266
      @bademuscuriacius2266 Місяць тому +2

      how you can fix that? ( if it have been fixed)

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

      i am also having that error :(

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

      @@facundoibietaserafini4191 i ve fixed that downloading library and installing from archieve. Cause of my error was low speed of internet

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

      I had that error on the last package that needed to be installed… did it over and over… I rebooted my system and tried again and it loaded just fine … hope this helps

  • @leoandcarb
    @leoandcarb 2 місяці тому

    Is it possible if I use raspberry pi 4 model b on this project?

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

      Yeah. But take care on proper cooling..

  • @spartandani3795
    @spartandani3795 3 місяці тому +1

    awesome video man! By any chance have you tested something like this using the Hailo npu hat for raspberry??

    • @Core-Electronics
      @Core-Electronics  3 місяці тому

      We have found that its not as flexible as this in terms of running it in a Python script. And while it does a lot of other computer vision tasks really well, you might be out of luck on face recognition. Right now its not very possible to just type in a line and off-load the processing to it, you need to find a model and then go through the conversion process to get it in the model format it accepts. So if you could find a compatible face recognition model and convert it, that might be possible. But as of now it might not be possible.

  • @Sujju-Aero
    @Sujju-Aero Місяць тому

    I did install the face recognition library which took more than 30 mins .. however iam not able to see this zip file in downloads.. tried to download it again but pi says Requirement already satisfied.. is there a way to know where this library might be saved it?

    • @Core-Electronics
      @Core-Electronics  Місяць тому

      Hey, the Zip folder is on the written guide page, you can find it here:
      core-electronics.com.au/guides/raspberry-pi/face-recognition-with-raspberry-pi-and-opencv/#code-download

    • @Sujju-Aero
      @Sujju-Aero Місяць тому

      @@Core-Electronics thanks a lot mate... this surely helped a lot.. 🙂

    • @Sujju-Aero
      @Sujju-Aero Місяць тому

      @@Core-Electronics iam using a camera which has autofocus capability.. when i run the imagecapture .py the video / image is blurred... is there any changes in the code that i need to do in this file to enable my camera with autofocus ?.

  • @tarunjeetsingh1111
    @tarunjeetsingh1111 3 місяці тому +1

    Please make a video on pose detection with the same setup

  • @AlexBingham-v7j
    @AlexBingham-v7j 2 місяці тому

    Hi Jaryd, great video. If I upgrade to a Pi AI Camera, does this still work?

    • @Core-Electronics
      @Core-Electronics  2 місяці тому

      The AI Camera has its own workflows and needs its own custom model format so unfortunately its not as simple as plugging it in and running this off it. 😞

    • @johnhamirkarim3696
      @johnhamirkarim3696 2 місяці тому

      ​@@Core-Electronics Hello, will it be possible to run models like facenet on the new AI camera?

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

    So.. Everything is going fine. But on the final face recognition file (to live test it) its giving me an Error with no module named nupy._core what can I possibly do here?

    • @Core-Electronics
      @Core-Electronics  Місяць тому

      We haven't seen anyone with that issue before, but it sounds like it may be something to do with virtual environments. Double-check that Thonny is set up in the venv we installed the packages into, from memory I don't think the first 2 scripts use any libraries and its the 3rd that does.
      If that doesn't work we have a dedicated forum topic for this video, feel free to post your issue over there as we have an army of makers that can help!
      forum.core-electronics.com.au/t/face-recognition-with-raspberry-pi-and-opencv/21033/2

  • @aufu
    @aufu 2 місяці тому

    Hey thank you for making these videos, just subscribed. I need about 5 of these kits and I'm hesitant to order this for real facial recognition.
    If I'm right, this doesn't distinct if the scanned face is real or the user putting a a photo in front of the camera.
    For this case, do you know any devkit like this but with some sort of 3D scanner that allows real facial recognition?
    Thanks!

    • @Core-Electronics
      @Core-Electronics  2 місяці тому

      I haven't tried it but I'm fairly certain this will be tricked by a printed photo of someone. When you get into 3d scanning it starts to get quite involved as well. There are some projects like this:
      pypi.org/project/pifacecam/
      That use a 2 camera setup to fight against printed images, but we don't have a guide for that unfortunately.

  • @Dr_af-rd9nn
    @Dr_af-rd9nn День тому

    can i run raspi 3 ? 1gb

    • @Core-Electronics
      @Core-Electronics  23 години тому

      We found that we needed more than 1GB of RAM, and it was already slow on a Pi 4. But if you have a Pi 3 already, give it a go! It might work!

  • @ambadaspatil2508
    @ambadaspatil2508 3 місяці тому

    hi after running the face recgonition code in thonny it is showing "list index out of range " error please help

    • @Core-Electronics
      @Core-Electronics  3 місяці тому

      Hmmm, I haven't come across that issue. If you are still having problems, feel free to post it on our forum topic for this post. Just give us your code and setup, as well as the error message. We do most of our technical support over there!
      forum.core-electronics.com.au/t/face-recognition-with-raspberry-pi-and-opencv/21033

    • @Core-Electronics
      @Core-Electronics  3 місяці тому

      I think I have just encountered the same issue! My camera wasn't plugged in correctly and I received (possibly) the same error message.

    • @adarshshaji4329
      @adarshshaji4329 3 місяці тому

      Did you solve this , I have been facing the same error

    • @leoandcarb
      @leoandcarb 2 місяці тому

      ​@@Core-Electronics i have been receiving the same error. Is there another problem ir is it mainly my camera's connection

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

      ​@@Core-Electronics Sir even I am facing the same issue. If you find any solution for this please do tell us

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

    I'm stuck in the installation part where I have to install facial recognition. It has been In the step where it says building wheel for dlib (setup.py). It just keeps showing / and - and |

    • @emiber9783
      @emiber9783 26 днів тому

      restart and try again, worked for me

  • @vernievlog5495
    @vernievlog5495 2 місяці тому

    Will this work with the AI camera?

    • @Core-Electronics
      @Core-Electronics  2 місяці тому

      You can use the camera part of the AI camera as it can function like a regular Pi camera module, but you won't be able to use the onboard AI chip to speed this up. There is a different workflow and system for using the AI camera's processing power 😢

  • @maheshkumar_2017
    @maheshkumar_2017 14 днів тому

    i am facing issue to install face recongni tion

    • @Core-Electronics
      @Core-Electronics  12 днів тому

      We have a forum topic for this video, there may be some helpful information in there and if not, feel free to post your issue there with some details!
      forum.core-electronics.com.au/t/face-recognition-with-raspberry-pi-and-opencv/21033/21

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

    But the thing is that why is it so slow i have done it with dlib it is extremely slow

  • @somahqari9894
    @somahqari9894 29 днів тому

    i want the code and how can i upload the code to raspberry pi?

    • @Core-Electronics
      @Core-Electronics  29 днів тому

      All the code is on our written guide and you can find a download link to all the files at the end of the first paragraph:
      core-electronics.com.au/guides/raspberry-pi/face-recognition-with-raspberry-pi-and-opencv/

  • @nsf8443
    @nsf8443 3 місяці тому

    is it possible if using webcam?

    • @Core-Electronics
      @Core-Electronics  3 місяці тому

      This code is untested on a webcam, but it should be possible. The colours may be off though as depending on your webcam, it may use a different colour space, so it may need a bit of tweaking to get the colours right!

    • @nsf8443
      @nsf8443 2 місяці тому

      @Core-Electronics oooh i get it, thank you so much for your explainationn

  • @kirilllee8800
    @kirilllee8800 2 місяці тому

    Can I use it with Raspberry AI kit?

  •  Місяць тому

    Hi, thank you for the video, i could finally dip a toe in live image recognition and yolo. I found one thing - when installing ultralytics, just use pip install ultralytics, not the pip install ultralytics[export]. Export version took too long to install, was installing seems unneeded packages. Program works same with just ultralytics package. Tested on Pi 4 and Pi 5.

    • @Core-Electronics
      @Core-Electronics  Місяць тому

      The [export] on the end is just to make it more thorough, we ran into some issues without it on specific setups. But if it works without it, it works!

  • @PPTMatkul
    @PPTMatkul 3 місяці тому

    hello. Can I get the code ? thank you

  • @rblxaccsimonhloska1236
    @rblxaccsimonhloska1236 24 дні тому

    nice one altho my pi takes already like 1 hour installing the opencv-python. Anyone knows why this happens?

  • @haytamdz1157
    @haytamdz1157 2 місяці тому

    I tried the model, and when I turn it on, it works, but when it reveals my face, the image freezes. Why?

  • @amandapanda3750
    @amandapanda3750 2 місяці тому

    I've been trying to attempt this tutorial. I'm using a 8 GB RAM raspberry pi on a 250GB SD card and the interface keeps on crashing on me. And I'm having storage issues due to the size of Tensor Flow and OpenCV. Any suggestions on how to mitigate this issue?

    • @Core-Electronics
      @Core-Electronics  2 місяці тому

      That is very odd, OpenCV and Tensor Flow barely push into the Gigabyte range and I had no issues with this on a 32GB SD card. Is your SD card having issues?
      We don't do much support over UA-cam, but we have a forum topic for this video that you can post to, we have lots of makers who can help out! Just give us a bit more info about which interface keeps crashing, and maybe some error messaged about your storage issues.
      forum.core-electronics.com.au/t/face-recognition-with-raspberry-pi-and-opencv/21033

  • @AtinderKharoud-em5ol
    @AtinderKharoud-em5ol 2 місяці тому

    Hello i got 2 questions 1. Where to download the face recognition file and 2. Can we use our laptops webcam ? Pls answer asap ❤❤

    • @Core-Electronics
      @Core-Electronics  2 місяці тому

      Hey, the file is in the written guide (at the end of the very first paragraph):
      core-electronics.com.au/guides/raspberry-pi/face-recognition-with-raspberry-pi-and-opencv/
      and this will work with a laptop webcam, but the colours might be mixed up depending on what webcam you are using, its possible to correct it in the code though it will all depend on what webcam you use.

    • @AtinderKharoud-em5ol
      @AtinderKharoud-em5ol 2 місяці тому

      K but my dumbass can't figure how to use the webcam pls tell me how to solve it , it says in thonny when I run the image capture script it says no module found cv2

    • @Core-Electronics
      @Core-Electronics  2 місяці тому

      That issue is less camera related and more the Pi not being able to dind the OpenCV library. Either there was an issue with the installation, or Thonny isn't set up to use the virtual environment we installed the packages into.
      We have a guide on using virtual environments here:
      core-electronics.com.au/guides/raspberry-pi/raspberry-pi-virtual-environments/
      And if you still have issues, feel free to chuck a post on our community forum topic for this guide. We have lots of makers over there that can help!
      forum.core-electronics.com.au/t/face-recognition-with-raspberry-pi-and-opencv/21033

    • @AtinderKharoud-em5ol
      @AtinderKharoud-em5ol 2 місяці тому

      Hey, thanks my open cv is working but I keep running in a problem there is a error capture_photots(PERSON_NAME)
      AND , picam2 = picamera2()
      And camera_num = self.global_camera_info()[camera_num][num]
      And last index error : inder out of range
      Pls help me solve out these and tell me where to replace anything like where to replace word name and put my name , and pls tell me how to use laptops webcam with raspberry pi pls give me the code

  • @lucutes2936
    @lucutes2936 3 місяці тому

    thx

  • @madwilliamflint
    @madwilliamflint 3 місяці тому

    JUST got this built and working. Couple questions:
    - Is there a relatively simple way for it to capture a pic for unrecognized faces (at a limit of 1 a minute or something sane?)
    - I'd really like to set up a "once X has been in frame for a couple seconds, shoot a command off" function. (I want it to play a greeting file for people who's pictures I've trained it on, for instance.)
    It's 12:30 am and I'm about to start spelunking in to docs, but I'm getting a little loopy so I figured I'd ask here just in case.

    • @madwilliamflint
      @madwilliamflint 3 місяці тому

      Okay so...calculated fps x number of repeated frames with face_encoding...okay, I think I've got that.

    • @Core-Electronics
      @Core-Electronics  3 місяці тому

      If you still need a hand, large language models like ChatGPT and Claude are very good at writing Python code. If you past in the entire script, as well as any questions or things you want it to do, they should be able to write it and explain it for your. They are free to use nowadays as well which is amazing!

    • @madwilliamflint
      @madwilliamflint 3 місяці тому

      @@Core-Electronics Oh I'm good, thanks. I was a little loopy because I was working on this at about 2:30 in the morning. A good night's sleep knocked the dust off my head. :)

  • @Jon509h
    @Jon509h 3 місяці тому

    Where is the code

    • @Core-Electronics
      @Core-Electronics  3 місяці тому

      You can find it on our written guide page
      core-electronics.com.au/guides/raspberry-pi/face-recognition-with-raspberry-pi-and-opencv/
      But here is a direct link as well!
      core-electronics.com.au/attachments/uploads/facial-recognition-updated.zip

  • @kirilllee8800
    @kirilllee8800 2 місяці тому

    Can you make tutorial using Face Recognition as attendance?

  • @HnedWebTV
    @HnedWebTV 3 місяці тому

    Najs

  • @jamesharris6062
    @jamesharris6062 16 днів тому

    Hi Grate video well explained thanks got it woking if any one follows this guild wait along time before running image talking part I had my dinner and a cup of coffee waiting for it to load opencv .

  • @raycalumag6177
    @raycalumag6177 4 дні тому

    Guys anyone here knows how to connect the capture_photos() to a Qt5 btn without conflicts?

    • @raycalumag6177
      @raycalumag6177 4 дні тому

      Im having problem with the cv2. Imshow and qt5