{"id":16505356,"url":"https://github.com/jubinjacob03/facedetection-raspberrypi-iot","last_synced_at":"2026-05-03T20:33:48.123Z","repository":{"id":177518195,"uuid":"657759839","full_name":"jubinjacob03/facedetection-RaspberryPi-IOT","owner":"jubinjacob03","description":"Face detection by Computer Vision using Library file - openCV , on Raspberry Pi  . ","archived":false,"fork":false,"pushed_at":"2023-06-24T22:06:22.000Z","size":2801,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-05T16:54:46.045Z","etag":null,"topics":["haar-cascade-classifier","iot","knn-classification","machinelearning","opencv","python","raspberry-pi-3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jubinjacob03.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-23T19:35:50.000Z","updated_at":"2024-07-12T20:58:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"848bda42-fcf1-48c7-8118-ab50ede59180","html_url":"https://github.com/jubinjacob03/facedetection-RaspberryPi-IOT","commit_stats":null,"previous_names":["jubinjacob03/facedetection-raspberrypi-iot"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jubinjacob03/facedetection-RaspberryPi-IOT","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jubinjacob03%2Ffacedetection-RaspberryPi-IOT","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jubinjacob03%2Ffacedetection-RaspberryPi-IOT/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jubinjacob03%2Ffacedetection-RaspberryPi-IOT/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jubinjacob03%2Ffacedetection-RaspberryPi-IOT/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jubinjacob03","download_url":"https://codeload.github.com/jubinjacob03/facedetection-RaspberryPi-IOT/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jubinjacob03%2Ffacedetection-RaspberryPi-IOT/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32584054,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T06:36:36.687Z","status":"ssl_error","status_checked_at":"2026-05-03T06:36:09.306Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["haar-cascade-classifier","iot","knn-classification","machinelearning","opencv","python","raspberry-pi-3"],"created_at":"2024-10-11T15:10:47.795Z","updated_at":"2026-05-03T20:33:48.097Z","avatar_url":"https://github.com/jubinjacob03.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# facedetection-RaspberryPi-IOT\nFace detection by Computer Vision using Library file - openCV , on Raspberry Pi  . \n\n# Requirements \n- Raspberry Pi 3+ (Having the extra computing power 'oomph' that the Pi provides is invaluable)\n- Raspberry Pi Official Camera Module V2 (You can also use the Raspberry Pi High-Quality Camera)\n- Micro SD Card \n- Power Supply \n- Monitor\n- HDMI Cord \n- Mouse and Keyboard\n\n# Installation \n- Download \u0026 Flash Raspberry OS on to the Micro SD Card using Raspberry Pi Imager.\n- Connect the Raspberry Pi to monitor with peripheries and make sure that the Pi Camera is installed in the correct slot.\n- Open up the Raspberry Pi Configuration menu (found using the top left Menu and scrolling over preferences) and enable the Camera found under the Interfaces tab.\n- After enabling reset the Raspberry Pi.\n- Copy or clone git module files into any directory in the Raspberry OS. Now you can intiate the face detection module.\n\n# Packages to install\n\n\u003ch4\u003e:exclamation: This will be a long stream of terminal commands forewarning. This will also take a substantial amount of time.\u003c/h4\u003e\n\n\u003cem\u003e\n  \npip install picamera[array]\n\nSudo apt-get update\n\nSudo apt-get upgrade\n\nsudo apt install cmake build-essential pkg-config git\n\nsudo apt install libjpeg-dev libtiff-dev libjasper-dev libpng-dev libwebp-dev libopenexr-dev\n\nsudo apt install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev libdc1394-22-dev libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev\n\nsudo apt install libgtk-3-dev libqtgui4 libqtwebkit4 libqt4-test python3-pyqt5\n\nsudo apt install libatlas-base-dev liblapacke-dev gfortran\n\nsudo apt install libhdf5-dev libhdf5-103\n\nsudo apt install python3-dev python3-pip python3-numpy  \u003c/em\u003e\n\nWe must now expand the swapfile before running the next set of commands. To do this type and enter into the Terminal the following line.\n\n\u003cem\u003esudo nano /etc/dphys-swapfile   \u003c/em\u003e\n \nThe change the number on CONF_SWAPSIZE = 100 to CONF_SWAPSIZE=2048. Having done this press Ctrl-X, Y, and then Enter Key to save these changes. This change is only temporary and we will be changing it back. To have these changes affect anything we must restart the swapfile by entering the following command to the terminal. Then we will resume Terminal Commands as normal.\n\n\u003cem\u003e\nsudo systemctl restart dphys-swapfile\n\ngit clone https://github.com/opencv/opencv.git\n\ngit clone https://github.com/opencv/opencv_contrib.git\n\nmkdir ~/opencv/build\n\ncd ~/opencv/build\n\ncmake -D CMAKE_BUILD_TYPE=RELEASE \\\n\n-D CMAKE_INSTALL_PREFIX=/usr/local \\\n\n-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \\\n\n-D ENABLE_NEON=ON \\\n\n-D ENABLE_VFPV3=ON \\\n\n-D BUILD_TESTS=OFF \\\n\n-D INSTALL_PYTHON_EXAMPLES=OFF \\\n\n-D OPENCV_ENABLE_NONFREE=ON \\\n\n-D CMAKE_SHARED_LINKER_FLAGS=-latomic \\\n\n-D BUILD_EXAMPLES=OFF ..\n\nmake -j$(nproc)\n\u003c/em\u003e\n\n\nThis | make | Command will take over an hour to install and there will be no indication of how much longer it will take. It may also freeze the monitor display. Be ultra patient and it will work. Once complete you are most of the way done. Then you can resume terminal commands.\n\n\u003cem\u003esudo make install\n\nsudo ldconfig\n\npip install face-recognition --no-cache-dir \u003c/em\u003e  \n\n\n\nThis | pip install face-recognition| Command will take over 40 mins to install and there will be no indication of how much longer it will take. Be ultra patient and it will work. Once complete you are most of the way done. Then we will resume terminal commands.\n\n\n\u003cem\u003epip install imutils \u003c/em\u003e   \n\n\nWe must now return the swapfile before running the next set of commands. To do this type into Terminal this line.\n\n\n\u003cem\u003esudo nano /etc/dphys-swapfile \u003c/em\u003e   \n\n\nThe change the number on CONF_SWAPSIZE = 2048 to CONF_SWAPSIZE=100. Having done this press Ctrl-X, Y, and then Enter Key to save these changes. This returns the Swapfile to normal. To have these changes affect anything we must restart the swapfile by entering the following command to the terminal. Then we will resume terminal Commands as normal.\n\n\n\u003cem\u003esudo systemctl restart dphys-swapfile  \u003c/em\u003e\n\n# Running the Module\n- Before loading the module, setup all the required packages mentioned in [Packages section](#packages-to-install)\n- Locate the file named 'dataset_picam.py' in root directory, ( eg- home/pi/facedetection-RapsberryPi-IOT/dataset_picam.py ).\n- Right Click on the file and open that Python Script up with either Thonny or Geany. Edit the line \u003ccode\u003ename = 'Jubin' #replace with your name\u003c/code\u003e and change value of name variable to your \u003cem\u003e\u003cstrong\u003etarget person's name\u003c/strong\u003e\u003c/em\u003e and save the file.\n- Go back to the parent directory and locate the folder called \"dataset\" and create a subfolder with the name that you just changed in python script, Because this is where the dataset training image will be saved.\n- Jump back to the Python editor (dataset_picam.py) and run the code. This will then open up a little window and a terminal window which you can use to save images of your face. Press \u003cem\u003e\u003cstrong\u003eSpacebar Key\u003c/strong\u003e\u003c/em\u003e to take a picture (take around 10) and then \u003cem\u003e\u003cstrong\u003eQ key\u003c/strong\u003e\u003c/em\u003e to close the window.\n- Now the images of your face will be stored in the folder you created for your name.\n- Open up a new terminal using the black console button on the top left and type the following command and pressing \u003cem\u003e\u003cstrong\u003eenter\u003c/strong\u003e\u003c/em\u003e after each line. \n  \u003cp\u003e\u003ccode\u003e cd facedetection-RapsberryPi-IOT  \u003c/code\u003e\u003c/p\u003e\n  \u003cp\u003e\u003ccode\u003e  python train_model.py \u003c/code\u003e\u003c/p\u003e \n- This will start the training process which you can see occurring for each image that you took of your face. After completion the Raspberry Pi will have learned what your face looks like.\n- Open a new terminal. Then type the following and press \u003cem\u003e\u003cstrong\u003eenter\u003c/strong\u003e\u003c/em\u003e after each step.\n  \u003cp\u003e\u003ccode\u003e cd facedetection-RapsberryPi-IOT \u003c/code\u003e\u003c/p\u003e\n  \u003cp\u003e\u003ccode\u003e python facial_recog.py \u003c/code\u003e\u003c/p\u003e\n- A small window pop up with a live stream of the Raspberry Pi Camera searching for faces and when it has been supplied with one it will draw a square box around the face. It will also determine if it is a known face displaying Unknown if it is not a known face and the name of the person if it is.\n- NOTE : If you tip your head to the side a couple of degrees it will completely disable facial recognition and if you cover your nose it struggles as well. Close the terminal window or press \u003cem\u003e\u003cstrong\u003eCtrl C\u003c/strong\u003e\u003c/em\u003e on the Keyboard to stop the script running.\n\n# Help and Reference\n\n\u003cmark\u003e\u003ch3\u003eFiles inside this project -\u003c/h3\u003e\u003c/mark\u003e\n\u003cp\u003e\u003col\u003e\n\u003cli\u003e dataset_picam.py : Python Script used to capture train data images when using Raspberry PI camera module.\u003c/li\u003e\n\u003cli\u003e dataset_nrmlcam.py : Python Script used to capture train data images using other camera modules.\u003c/li\u003e\n\u003cli\u003e facial_recog.py : Main python script, running this will intiate Face Recognition Module.\u003c/li\u003e \n\u003cli\u003e train_model.py : Python Script for training test data to Computer Vision using machine Learning.\u003c/li\u003e\n\u003cli\u003e haarcascade_frontalface_default.xml : Xml file that contains face_recognition codecs.\u003c/li\u003e\n\u003cli\u003e dataset_folder : This is the parent folder of individual target person subfolder where test data images are stored.\u003c/li\u003e\n\u003cli\u003e photo_folder : This is where output images will be saved.\u003c/li\u003e\n\u003c/ol\u003e\u003c/p\u003e\n\u003cbr\u003e\n\n- For learning more about openCV visit [opencv.org](https://docs.opencv.org/4.x/d9/df8/tutorial_root.html).\n- Project reference link [here](https://pyimagesearch.com/2018/06/25/raspberry-pi-face-recognition/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjubinjacob03%2Ffacedetection-raspberrypi-iot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjubinjacob03%2Ffacedetection-raspberrypi-iot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjubinjacob03%2Ffacedetection-raspberrypi-iot/lists"}