{"id":20083453,"url":"https://github.com/mlabarrere/webcam-recognition","last_synced_at":"2025-07-26T07:40:16.788Z","repository":{"id":78835491,"uuid":"132762666","full_name":"mlabarrere/webcam-recognition","owner":"mlabarrere","description":"📽An AI for detecting people with webcam","archived":false,"fork":false,"pushed_at":"2023-12-07T10:03:17.000Z","size":1518,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-02T13:51:01.842Z","etag":null,"topics":["artificial-intelligence","faces","haar","statistics","webcam","webcam-recognition"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mlabarrere.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2018-05-09T13:41:43.000Z","updated_at":"2022-06-10T01:57:28.000Z","dependencies_parsed_at":"2025-03-02T13:44:18.648Z","dependency_job_id":"3b5766a7-2a1f-40e6-9989-6232e7b38fb1","html_url":"https://github.com/mlabarrere/webcam-recognition","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mlabarrere/webcam-recognition","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlabarrere%2Fwebcam-recognition","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlabarrere%2Fwebcam-recognition/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlabarrere%2Fwebcam-recognition/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlabarrere%2Fwebcam-recognition/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mlabarrere","download_url":"https://codeload.github.com/mlabarrere/webcam-recognition/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlabarrere%2Fwebcam-recognition/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267137060,"owners_count":24041306,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["artificial-intelligence","faces","haar","statistics","webcam","webcam-recognition"],"created_at":"2024-11-13T15:47:16.577Z","updated_at":"2025-07-26T07:40:16.726Z","avatar_url":"https://github.com/mlabarrere.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Webcam Recognition\nA tool for detecting who is in front of your webcam\n\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/1229cb95b4df4cdb889ccffa535da5f0)](https://app.codacy.com/app/mickael.labarrere/webcam-recognition?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=mlabarrere/webcam-recognition\u0026utm_campaign=Badge_Grade_Settings)\n\n[![Python 3.6](https://img.shields.io/badge/python-3.6-blue.svg)](https://www.python.org/downloads/release/python-360/)\n\n[![CodeFactor](https://www.codefactor.io/repository/github/mlabarrere/webcam-recognition/badge)](https://www.codefactor.io/repository/github/mlabarrere/webcam-recognition)  [![BCH compliance](https://bettercodehub.com/edge/badge/mlabarrere/webcam-recognition?branch=master)](https://bettercodehub.com/)\n\n[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/2549/badge)](https://bestpractices.coreinfrastructure.org/projects/2549)\n\n## Download\n\nTo get the source code, run:\n```\ngit clone https://github.com/mlabarrere/webcam-recognition.git\n```\n\n## Project Structure\n\n```\nWebcam Recognition\n│   test_reco.py\n│   train_reco.py\n│   README.md (To Complete)\n│   requirements.txt\n│   setup.py (To Do)\n│   LICENSE.md\n│\n└───src\n│       │   __init__.py\n│       │   lib.py\n│  \n└───haar\n│       │  haarcascade_frontalface_alt.xml\n│       │  haarcascade_frontalface_alt2.xml\n│       │  haarcascade_frontalface_alt_tree.xml\n│       │  haarcascade_frontalface_default.xml\n│  \n└───data\n│       │   You will populate it\n│  \n└───model\n│       │   It will populate on its own\n```\n\n### Installing\n\nFirst, let's install the required libraries, `cd` to the root of the project where `requirements.txt` is :\n\n```shell\ncd yourDirectory/webcam-recognition/\n```\n\nthen\n\n```shell\npip install -r requirements.txt\n```\n\nCool, you've got everything ready to run the program\n\n### Train your model\n\nThe model is based on [Haar like features](https://en.wikipedia.org/wiki/Haar-like_feature), hence, you need to train your model.\n\nFor this, you need to gather pictures of you and your friends (ask them before). Then put all thoses pictures into separated named folders ìnto the `data` folder. Please, use only common letters (look how I had to remove the `é` from `Pépito`).\n\nTo train your model to detect Pépito and Paolo, do something like this:\n\n```\ndata\n└───Pepito\n│       │   picture1.jpg\n│       │   picture2.png\n│       │   picture_with_whatever_name_or_classic_format.jpg\n│\n└───Paolo\n│       │   picture1.jpg\n│       │   picture2.png\n│       │   picture_with_whatever_name_or_classic_format.jpg\n```\n\nNice, it seems that you are ready to train your model now.\n\nOk, then you just have to `cd` to the root of the repository, and run:\n\n```shell\npython train_reco.py\n```\n\nThe prompt will show you things like:\n\n```\nPreparing data...\nTraining for Pepito, Paolo               # Check if this is ok\n[ INFO:0] Initialize OpenCL runtime...   # You just don't care about it\nData prepared\n\nTraining the model...\nTraining complete\n\nSaving model...\nSaving done\n```\n\n#### Train your model - Best Practices\n\nThe thing is, Haar is not Google's top neural networks, hence you need to help him to do his work.\n\n* Quality over quantity:\n\n  One good picture, like one from a recent ID card, will always be better than ten from your last Project X party.\n\n* Balance the number of pictures over people to reduce over/under fitting:\n  \n  Assume Pépito has 30 pictures to train on, and Paolo only 5, you can be sure the model will say everyone is Pépito.\n\n\n* Crop your pictures to avoid loosing training examples:\n  \n  If the prompt prints this `Impossible to find Paolo`, it means that on a picture, he wasn't able to recognise anyone. \n  So there is three main reason of this : \n    1. There is multiple faces on this picture\n    2. The algorithm cannot detect a face from a weird light\n    3. The picture has no background, do not crop the face to make the face filling the picture. Let some air. \n  \n  \n  In any cases: you just lost a training example.\n\n\n* Turn lights on and show yourself:\n\n  The model will have hard time recognising you in a middle of the night, or if you have changed drastically from your training pictures. Ex : You just shaved your beloved beard, you have no longer a skater's long hair, etc...\n\n\n* Avoid twins:\n\n  Well, because... They are twins.\n\n\n#### Test your model\n\nYou have now the folder `model` filled with two files:\n1. `model.xml` : The model :)\n2. `dict.pickle` : The mapper, because the model can associate only faces with numbers, this dictionary will map numbers to faces.\n\nBut you don't have to care about it.\n\nNow, let's see how the model recognizes you:\n\n```shell\npython test_reco.py\n```\n\nYou'll see the webcam fire, and see yourself in a window, with a green box around your face.\n\nDoes the model recognize you? If not, you need to train it better, with more and better pictures. \n\n\n\nThanks for reading.\n\n\n\nSorry for the long post, here is a potatoe: 🥔\n\n\n\n## Author\n\n* **Mickaël Labarrère** - [mlabarrere](https://github.com/mlabarrere)\n\nSee also the list of [contributors](https://github.com/mlabarrere/webcam-recognition/graphs/contributors) who participated in this project.\n\n## License\n\nThis project is licensed under the Apache 2 License - see the [LICENSE.md](https://github.com/mlabarrere/webcam-recognition/LICENSE.md) file for details\n\n\n\n## Acknowledgments\n\n* [@MAmineA](https://github.com/MAmineA)\n* [@benjaminborac](https://github.com/benjaminborac)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlabarrere%2Fwebcam-recognition","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmlabarrere%2Fwebcam-recognition","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlabarrere%2Fwebcam-recognition/lists"}