{"id":17602468,"url":"https://github.com/johnwmillr/facer","last_synced_at":"2025-04-04T22:09:06.217Z","repository":{"id":40981088,"uuid":"199515433","full_name":"johnwmillr/Facer","owner":"johnwmillr","description":"Simple (🤞) face averaging (🙂) in Python (🐍)","archived":false,"fork":false,"pushed_at":"2024-12-24T02:36:04.000Z","size":1672,"stargazers_count":80,"open_issues_count":1,"forks_count":11,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-28T21:09:04.360Z","etag":null,"topics":["dlib","face-average","face-averaging","face-detection","facer","image-processing","opencv"],"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/johnwmillr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"johnwmillr"}},"created_at":"2019-07-29T19:33:04.000Z","updated_at":"2024-12-24T23:51:51.000Z","dependencies_parsed_at":"2024-12-16T19:11:26.827Z","dependency_job_id":"13e7804f-767c-4306-94d4-526bc9e4d994","html_url":"https://github.com/johnwmillr/Facer","commit_stats":{"total_commits":53,"total_committers":6,"mean_commits":8.833333333333334,"dds":"0.13207547169811318","last_synced_commit":"aca2241c7631f6354d1511104c0d1660a1e29ff5"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnwmillr%2FFacer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnwmillr%2FFacer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnwmillr%2FFacer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnwmillr%2FFacer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnwmillr","download_url":"https://codeload.github.com/johnwmillr/Facer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247256115,"owners_count":20909240,"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":["dlib","face-average","face-averaging","face-detection","facer","image-processing","opencv"],"created_at":"2024-10-22T13:08:28.270Z","updated_at":"2025-04-04T22:09:06.201Z","avatar_url":"https://github.com/johnwmillr.png","language":"Python","readme":"# Facer\n\nFace detection, alignment, and averaging using OpenCV and `dlib`.\n\nFacer draws heavily on [this tutorial](https://www.learnopencv.com/average-face-opencv-c-python-tutorial/) from [Satya Mallick](https://github.com/spmallick). I had to update the code pretty heavily to get the project to work, so I thought I'd share my modifications.\n\n## Example\n\nThe image below is an example of Facer's output for one of my posts on [`r/dataisbeautiful`](https://www.reddit.com/r/dataisbeautiful/comments/crxrud/the_average_faces_of_rap_rock_and_country/).\n\n[![Average faces of rap, rock, and country music](https://www.johnwmillr.com/assets/images/FaceAverages/Faces_RapRockCountry.png)](https://www.reddit.com/r/dataisbeautiful/comments/crxrud/the_average_faces_of_rap_rock_and_country/)\n\n## Installation\n\nYou have my 100% money-back guarantee that the most difficult part of using this package is installing its requirements. Once you've got OpenCV installed, the rest ~~will~~ should be smooth sailing. I've had the best luck with the OpenCV using the `opencv-python` package from PyPI.\n\nInstall `facer` using `pip`:\n\n```bash\npip install -U average-facer\n```\n\n### Pre-trained detection model\n\nThe face landmark detection relies on a pre-trained model that must be downloaded separately from the `dlib` package itself.\n\n```shell\nwget http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2\n```\n\nUnzip the compressed file after it finishes downloading and move it into a `./model` directory.\n\nIf you store the downloaded file somewhere other than `./model` (or if you use an entirely different model name), you can set a custom model path as an environment variable:\n\n```bash\nexport FACER_PREDICTOR_PATH=\"./custom/path/to/your/model.dat\"\n```\n\n## Usage\n\n```python\nfrom facer import facer\nimport matplotlib.pyplot as plt\n\n\n# Load face images\npath_to_images = \"./face_images\"  # Put your images here\nimages = facer.load_images(path_to_images)\n\n# Detect landmarks for each face\nlandmarks, faces = facer.detect_face_landmarks(images)\n\n# Use the detected landmarks to create an average face\naverage_face = facer.create_average_face(faces, landmarks, save_image=True)\n\n# View the composite image\nplt.imshow(average_face)\nplt.show()\n```\n\nFacer also supports creating animated GIFs of the averaging process:\n\n```python\nfrom facer import facer\n\npath_to_images = \"./face_images\"\ngif, average_face = facer.create_animated_gif(path_to_images)\n```\n","funding_links":["https://github.com/sponsors/johnwmillr"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnwmillr%2Ffacer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnwmillr%2Ffacer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnwmillr%2Ffacer/lists"}