{"id":19232013,"url":"https://github.com/paoloripamonti/face-recognition","last_synced_at":"2025-04-21T04:32:01.509Z","repository":{"id":35135493,"uuid":"211041276","full_name":"paoloripamonti/face-recognition","owner":"paoloripamonti","description":"Face Recognition","archived":false,"fork":false,"pushed_at":"2023-11-19T12:42:57.000Z","size":1581,"stargazers_count":16,"open_issues_count":5,"forks_count":13,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-01T09:25:28.696Z","etag":null,"topics":["deep-learning","face-alignement","face-detection","face-encoding","face-recognition","machine-learning"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paoloripamonti.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-26T08:39:11.000Z","updated_at":"2025-01-11T14:17:21.000Z","dependencies_parsed_at":"2023-01-15T14:32:44.484Z","dependency_job_id":null,"html_url":"https://github.com/paoloripamonti/face-recognition","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paoloripamonti%2Fface-recognition","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paoloripamonti%2Fface-recognition/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paoloripamonti%2Fface-recognition/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paoloripamonti%2Fface-recognition/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paoloripamonti","download_url":"https://codeload.github.com/paoloripamonti/face-recognition/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249996117,"owners_count":21358067,"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","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":["deep-learning","face-alignement","face-detection","face-encoding","face-recognition","machine-learning"],"created_at":"2024-11-09T16:05:05.381Z","updated_at":"2025-04-21T04:32:01.223Z","avatar_url":"https://github.com/paoloripamonti.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Face Recognition\n\nSimple library to recognize faces from given images\n\n[\u003cimg src=\"https://raw.githubusercontent.com/paoloripamonti/face-recognition/master/img/home.png\"\u003e](https://www.kaggle.com/paoloripamonti/face-recogniton)\n\n### Face Recognition pipeline\n\nBelow the pipeline for face recognition:\n- **Face Detection**: the [MTCNN](https://github.com/ipazc/mtcnn) algorithm is used to do face detection\n- **Face Alignement** Align face by eyes line\n- **Face Encoding** Extract encoding from face using [FaceNet](https://github.com/faustomorales/keras-facenet)\n- **Face Classification** Classify face via eculidean distrances between face encodings\n\n### How to install\n```git\npip install git+https://github.com/paoloripamonti/face-recognition\n```\n\n### How to train custom model\n\nInitialize model\n```python\nfrom face_recognition import FaceRecognition\n\nfr = FaceRecognition()\n```\n\n#### Train model with pandas DataFrame:\n\n```python\nfr = FaceRecognition()\n\nfr.fit_from_dataframe(df)\n```\n\nwhere 'df' is pandas DataFrame with column **person** (person name) and column **path** (image path)\n\n#### Train model with folder:\n\n```python\nfr = FaceRecognition()\n\nfr.fit('/path/root/')\n```\n\nthe root folder must have the following structure:\n\n```\nroot\\\n    Person_1\\\n        image.jpg\n        ...\n        image.jpg\n    Person_2\\\n        image.jpg\n        ...\n        image.jpg\n    ...\n        \n```\n\n### Save and load model\n\nyou can save and load model as **pickle** file.\n\n\n```python\nfr.save('model.pkl')\n```\n\n```python\nfr = FaceRecognition()\n\nfr.load('model.pkl')\n```\n\n\n### Predict image\n\n```python\nfr.predict('/path/image.jpg')\n```\n\nRecognize faces from given image.\nThe output is a JSON with folling structure:\n\n```\n{\n  \"frame\": \"image data\", # base64 image with bounding boxes\n  \"elapsed_time\": time, # elapsed time in seconds\n  \"predictions\": [\n      {\n        \"person\": \"Person\", # person name\n        \"confidence\": float, # prediction confidence\n        \"box\": (x1, y1, x2, y2) # face bounding box\n      }\n  ]\n}\n```\n\n### Example\n\n[\u003cimg src=\"https://raw.githubusercontent.com/paoloripamonti/face-recognition/master/img/test1.png\"\u003e](https://www.kaggle.com/paoloripamonti/face-recogniton)\n\n[\u003cimg src=\"https://raw.githubusercontent.com/paoloripamonti/face-recognition/master/img/test2.png\"\u003e](https://www.kaggle.com/paoloripamonti/face-recogniton)\n\n\nFor more details you can see: [https://www.kaggle.com/paoloripamonti/face-recogniton](https://www.kaggle.com/paoloripamonti/face-recogniton)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaoloripamonti%2Fface-recognition","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaoloripamonti%2Fface-recognition","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaoloripamonti%2Fface-recognition/lists"}