{"id":22919921,"url":"https://github.com/zjcv/facenet","last_synced_at":"2025-04-15T14:33:43.373Z","repository":{"id":111996914,"uuid":"436639920","full_name":"ZJCV/facenet","owner":"ZJCV","description":"[CVPR 2015] FaceNet: A Unified Embedding for Face Recognition and Clustering","archived":false,"fork":false,"pushed_at":"2021-12-13T11:46:18.000Z","size":76,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-28T21:12:33.120Z","etag":null,"topics":["facenet","mixed-precision-training","multi-gpu","pytorch","zcls"],"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/ZJCV.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":"2021-12-09T14:07:39.000Z","updated_at":"2024-05-28T11:07:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"c46ed97f-5c7a-42e6-8e88-9440f90da34a","html_url":"https://github.com/ZJCV/facenet","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/ZJCV%2Ffacenet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZJCV%2Ffacenet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZJCV%2Ffacenet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZJCV%2Ffacenet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZJCV","download_url":"https://codeload.github.com/ZJCV/facenet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249088806,"owners_count":21210865,"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":["facenet","mixed-precision-training","multi-gpu","pytorch","zcls"],"created_at":"2024-12-14T07:13:52.963Z","updated_at":"2025-04-15T14:33:43.367Z","avatar_url":"https://github.com/ZJCV.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"right\"\u003e\n  Language:\n    🇺🇸\n  \u003ca title=\"Chinese\" href=\"./README.zh-CN.md\"\u003e🇨🇳\u003c/a\u003e\n\u003c/div\u003e\n\n \u003cdiv align=\"center\"\u003e\u003ca title=\"\" href=\"https://github.com/ZJCV/facenet\"\u003e\u003cimg align=\"center\" src=\"./imgs/facenet.png\"\u003e\u003c/a\u003e\u003c/div\u003e\n\n\u003cp align=\"center\"\u003e\n  «facenet» re-implements the paper \u003ca href=\"https://arxiv.org/abs/1503.03832\"\u003eFaceNet: A Unified Embedding for Face Recognition and Clustering\u003c/a\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n  \u003ca href=\"https://github.com/RichardLitt/standard-readme\"\u003e\u003cimg src=\"https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://conventionalcommits.org\"\u003e\u003cimg src=\"https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"http://commitizen.github.io/cz-cli/\"\u003e\u003cimg src=\"https://img.shields.io/badge/commitizen-friendly-brightgreen.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nBased on the [similarity](https://github.com/pytorch/vision/tree/main/references/similarity) implementation, the following functions have been added: \n\n1. Add configuration file module to support configurable training parameters;\n2. Support Multi-GPU training  and  Mixed-Precision training;\n3. Add a variety of preprocessing functions and training configuration.\n\nAbout training results for `FMNIST/CIFAR/LFW`, see [details](docs/README.md)\n\n## Table of Contents\n\n- [Table of Contents](#table-of-contents)\n- [Background](#background)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Maintainers](#maintainers)\n- [Thanks](#thanks)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Background\n\n[facenet](https://arxiv.org/ABS/1503.03832) is an excellent face recognition paper, which innovatively puts forward a new training paradigm - `triplet loss training`. The core idea of triple loss is to reduce the Euclidean distance between similar faces and expand the distance between different classes as much as possible. Every training needs to collect training images (*anchor points*), positive samples of the same class and negative samples of different classes. \n\n[similarity](https://github.com/pytorch/vision/tree/main/references/similarity) provides an excellent `facenet`' training project. Before each round of training, distribute the data through the sampler to ensure that each batch of data contains `p` categories and each category has `k` training samples; After the forward calculation is completed, pairwise calculation is carried out on the same batch of data, and the positive and negative sample pairs that meet the definition of `semi-hard` (*the negative sample is not closer to the anchor point than the positive sample, but its distance is still within the boundary range*) are collected to participate in the loss function calculation. \n\nThe deficiency of the above project lies in that it does not support multi-GPU training, mixed precision training and no good modular design, which leads to weak scalability and can not be directly applied to practical applications. In order to better train `facenet`, this warehouse has enhanced the operation based on [similarity](https://github.com/pytorch/vision/tree/main/references/similarity), providing a more friendly training implementation. \n\n## Installation\n\n```\n$ pip install -r requirements.txt\n```\n\n## Usage\n\n1. Get data file. See [how to get data](./docs/how-to-get-data.md)\n2. Training\n   1. Single GPU training\n      ```angular2html\n      $ CUDA_VISIBLE_DEVICES=0 python tools/train.py -cfg=configs/lfw/r18_lfw_224_e2_adam_g1.yaml\n      ```\n   2. Multi GPU training\n      ```angular2html\n      $ CUDA_VISIBLE_DEVICES=0,1,2,3 python tools/train.py -cfg=configs/lfw/r18_lfw_224_e2_adam_g4.yaml\n      ```\n\n## Maintainers\n\n* zhujian - *Initial work* - [zjykzj](https://github.com/zjykzj)\n\n## Thanks\n\n* [ pytorch/vision](https://github.com/pytorch/vision)\n\n```\n@article{2015,\n   title={FaceNet: A unified embedding for face recognition and clustering},\n   url={http://dx.doi.org/10.1109/CVPR.2015.7298682},\n   DOI={10.1109/cvpr.2015.7298682},\n   journal={2015 IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},\n   publisher={IEEE},\n   author={Schroff, Florian and Kalenichenko, Dmitry and Philbin, James},\n   year={2015},\n   month={Jun}\n}\n```\n\n## Contributing\n\nAnyone's participation is welcome! Open an [issue](https://github.com/ZJCV/facenet/issues) or submit PRs.\n\nSmall note:\n\n* Git submission specifications should be complied\n  with [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0-beta.4/)\n* If versioned, please conform to the [Semantic Versioning 2.0.0](https://semver.org) specification\n* If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme)\n  specification.\n\n## License\n\n[Apache License 2.0](LICENSE) © 2021 zjykzj","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzjcv%2Ffacenet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzjcv%2Ffacenet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzjcv%2Ffacenet/lists"}