{"id":16735542,"url":"https://github.com/392781/faceoff","last_synced_at":"2025-03-17T01:31:52.960Z","repository":{"id":41524018,"uuid":"198715554","full_name":"392781/FaceOff","owner":"392781","description":"Steps towards physical adversarial attacks on facial recognition","archived":false,"fork":false,"pushed_at":"2023-10-03T18:19:39.000Z","size":138030,"stargazers_count":80,"open_issues_count":1,"forks_count":14,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-02-27T16:21:21.817Z","etag":null,"topics":["adversarial-attacks","adversarial-machine-learning","facenet-pytorch","facial-recognition","physical-adversarial-attacks"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc-by-sa-4.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/392781.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":"2019-07-24T22:03:10.000Z","updated_at":"2024-11-15T07:04:32.000Z","dependencies_parsed_at":"2024-10-27T11:51:51.809Z","dependency_job_id":"55278257-a5a8-48e0-a51b-8a17afa2deb8","html_url":"https://github.com/392781/FaceOff","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/392781%2FFaceOff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/392781%2FFaceOff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/392781%2FFaceOff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/392781%2FFaceOff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/392781","download_url":"https://codeload.github.com/392781/FaceOff/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243836015,"owners_count":20355615,"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":["adversarial-attacks","adversarial-machine-learning","facenet-pytorch","facial-recognition","physical-adversarial-attacks"],"created_at":"2024-10-13T00:06:24.753Z","updated_at":"2025-03-17T01:31:49.461Z","avatar_url":"https://github.com/392781.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FaceOff\n### Steps towards physical adversarial attacks on facial recognition\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/392781/FaceOff/master/examples/faces/input-face-example.png\" width=\"175\"\u003e \n  \u003cimg src=\"https://raw.githubusercontent.com/392781/FaceOff/master/examples/faces/delta-example.png\" width=\"175\"\u003e \n  \u003cimg src=\"https://raw.githubusercontent.com/392781/FaceOff/master/examples/faces/combined-face-example.png\" width=\"175\"\u003e \n  \u003cimg src=\"https://raw.githubusercontent.com/392781/FaceOff/master/examples/faces/target-face-example.png\" width=\"175\"\u003e\n\u003c/p\u003e\n\nInput image on the left is detected as the target image on the right after the mask has been applied.\n\n[![CC BY-SA 4.0][cc-by-sa-shield]][cc-by-sa]\n\nThis work is licensed under a\n[Creative Commons Attribution-ShareAlike 4.0 International License][cc-by-sa].\n\n[![CC BY-SA 4.0][cc-by-sa-image]][cc-by-sa]\n\n[cc-by-sa]: http://creativecommons.org/licenses/by-sa/4.0/\n[cc-by-sa-image]: https://licensebuttons.net/l/by-sa/4.0/88x31.png\n[cc-by-sa-shield]: https://img.shields.io/badge/License-CC%20BY--SA%204.0-lightgrey.svg\n\n## Table of contents\n\n* [Table of contents](#table-of-contents)\n* [Description](#description)\n* [Installation](#installation)\n  + [Requirements](#requirements)\n  + [Instructions](#instructions)\n* [Citation](#citation)\n* [References](#references)\n\n## Description\nThe purpose of this library is to create adversarial attacks against the FaceNet face recognizer.  This is the preliminary work towards creating a more robust physical attack using a mask that a person could wear over their face.\n\nFor more details, please check out my [research poster](https://github.com/392781/FaceOff/blob/master/rlencevicius_poster.pdf).\n\nThe current pipeline consists of an aligned input image with a calculated mask.  This is then fed into a face detector using dlib's histogram of oriented gradients detector to test whether the face is still detected.  This is then passed to FaceNet where which ouputs a face embedding and a loss which is then calculated and propagated back.  This perturbs the input mask which generates enough of a disturbance to affect the loss.\n\nThe loss function maximizes the Euclidean distance between the inputs' true identity and minimizes the distance between the adversarial input and the target image.\n\nAn image of this process can be seen below.\n\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/392781/FaceOff/master/examples/procedure.png\" width=55%\u003e\n\u003c/p\u003e\n\n## Installation\n\n### Requirements\n\nThis project works on Linux (Ubuntu 20.04).  Windows and Mac are not supported but may work.\n\n### Instructions\n\n1. Create a virtual environment\n\n```bash\nconda create -n facial_recognition python=3.8.5\nconda activate facial_recognition\n```\n\n2. Clone the repo \n\n```git\ngit clone https://github.com/392781/FaceOff.git\n```\n\n3. Install the required libraries \n\n```bash\npip install -r requirements.txt\n```\n\n4. Install FaceOff from inside the folder where `setup.py` is located\n\n```bash\npip install -e .\n```\n\n5. Import and use!\n\n```python\nfrom FaceOff.AFR import load_data, Attack\n```\n\nFor training instructions look at [`example.py`](https://github.com/392781/FaceOff/blob/master/examples/example.py) to get started in less than 30 lines.\n\n## Citation\nPlease cite `FaceOff` if used in your research:\n\n```tex\n@misc{FaceOff,\n  author = {Ronaldas Paulius Lencevicius},\n  howpublished = {GitHub},\n  title = {Face-Off: Steps towards physical adversarial attacks on facial recognition},\n  URL = {https://github.com/392781/FaceOff},\n  month = {Aug}\n  year = {2019},\n}\n```\n\n## References\n* Sharif, Mahmood, et al. \"Accessorize to a crime: Real and stealthy attacks on state-of-the-art face recognition.\" Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security. ACM, 2016.\n* Wang, Mei, and Weihong Deng. \"Deep face recognition: A survey.\" arXiv preprint arXiv:1804.06655 (2018).\n* MacDonald, Bruce. “Fooling Facial Detection with Fashion.” Towards Data Science, Towards Data Science, 4 June 2019, towardsdatascience.com/fooling-facial-detection-with-fashion-d668ed919eb.\n* Thys, Simen, et al. \"Fooling automated surveillance cameras: adversarial patches to attack person detection.\" Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops. 2019.\n\nUsed the [PyTorch FaceNet implementation](https://github.com/timesler/facenet-pytorch) by Tim Esler\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F392781%2Ffaceoff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F392781%2Ffaceoff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F392781%2Ffaceoff/lists"}