{"id":20518753,"url":"https://github.com/happynear/normface","last_synced_at":"2026-02-18T03:03:11.702Z","repository":{"id":80975146,"uuid":"86638407","full_name":"happynear/NormFace","owner":"happynear","description":"NormFace: L2 HyperSphere Embedding for Face Verification, 99.21% on LFW","archived":false,"fork":false,"pushed_at":"2017-12-13T02:15:01.000Z","size":2114,"stargazers_count":369,"open_issues_count":5,"forks_count":106,"subscribers_count":29,"default_branch":"master","last_synced_at":"2025-10-23T18:48:12.832Z","etag":null,"topics":["acm-mm","caffe","face-verification","mirror-face","normface"],"latest_commit_sha":null,"homepage":"","language":"Matlab","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/happynear.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":"2017-03-29T23:28:07.000Z","updated_at":"2025-07-15T02:02:48.000Z","dependencies_parsed_at":"2023-03-12T12:56:07.903Z","dependency_job_id":null,"html_url":"https://github.com/happynear/NormFace","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/happynear/NormFace","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/happynear%2FNormFace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/happynear%2FNormFace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/happynear%2FNormFace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/happynear%2FNormFace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/happynear","download_url":"https://codeload.github.com/happynear/NormFace/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/happynear%2FNormFace/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29566663,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T00:47:08.760Z","status":"online","status_checked_at":"2026-02-18T02:00:09.468Z","response_time":162,"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":["acm-mm","caffe","face-verification","mirror-face","normface"],"created_at":"2024-11-15T21:45:59.451Z","updated_at":"2026-02-18T03:03:11.673Z","avatar_url":"https://github.com/happynear.png","language":"Matlab","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NormFace\nNormFace: L2 HyperSphere Embedding for Face Verification\n\nhttp://www.cs.jhu.edu/~alanlab/Pubs17/wang2017normface.pdf\n\n| Baseline Model      | Original Accuracy | Finetune Using Normalization |\n| ------------------- |:-----------------:|:----------------------------:|\n| [Light CNN(MaxOut)](https://github.com/AlfredXiangWu/face_verification_experiment)   | 98.41%\\*          |98.78%                        |\n| [Center Face(ResNet)](https://github.com/ydwen/caffe-face) | 99.03%            |99.21%                        |\n\n\\* It is 98.13% on [Light CNN's project page](https://github.com/AlfredXiangWu/face_verification_experiment). After applying [the mirror face trick](./MirrorFace.md), it becomes 98.41%.\n\n# Requirements\n\n1. My Caffe (https://github.com/happynear/caffe-windows/tree/ms). It also works on Linux. Anyway, if you want to use your own Caffe, please transplant the `inner_product_layer`, `inner_distance_layer`, `normalize_layer`, `general_contrastive_layer`, `flip_layer` and `accuracy_layer` to your Caffe. Since there are too many layers to transplant, I suggest you to use my Caffe directly:)\n2. Matlab to draw some figures.\n3. GPU with CUDA support.\n4. MTCNN face and facial landmark detector(https://github.com/kpzhang93/MTCNN_face_detection_alignment).\n5. Baseline model such as [Center Face](https://github.com/ydwen/caffe-face) or [Light CNN](https://github.com/AlfredXiangWu/face_verification_experiment) or your own model trained by softmax loss. I don't know whether my loss helps or not if your model is trained by other loss functions. You may have a try. I believe it will be effective if there is no normalization term in your model.\n\n# Train\n\n1. The dataset used in this paper is [CASIA-Webface](http://www.cbsr.ia.ac.cn/english/CASIA-WebFace-Database.html). Note that there are 3 identities overlap between CASIA-Webface and LFW. They are `0166921`, `1056413` and `1193098`. For fair evaluation, it is recommended to remove them from CAISA-Webface.\nUpdate: Actually there are 17 overlap identities, the list is in [my FaceDatasets repository](https://github.com/happynear/FaceDatasets/blob/master/CASIA/webface_lfw_overlap_detail.txt).\n2. Align all face images using MTCNN. The script can be found in [my FaceVerification repository](https://github.com/happynear/FaceVerification/blob/master/dataset/general_align.m).\n3. Replace the final inner-product layer and softmax layer with layers defined in [scaled_cosine_softmax.prototxt](./prototxt/scaled_cosine_softmax.prototxt) or [normalized_Euclidean_contrastive.prototxt](./prototxt/normalized_Euclidean_contrastive.prototxt).\n4. **Fine-tune** the network based on the original model using a small learning rate, say 0.001 or 0.0001.\n\n# Evaluation\n\nEvaluation codes are in [my another github repository](https://github.com/happynear/FaceVerification). Please refer to the second paragraph of the Update section. \n\nA trick called mirror face is used during extracting the features. A sample code is in `./prototxt/example_of_mirror_face.prototxt`.\n\n**About the mirror face:**  See [./MirrorFace.md](./MirrorFace.md)\n\n**About the histogram feature for video face verification:** Details are in [./YTF](https://github.com/happynear/NormFace/tree/master/YTF).\n\n# Trained Models\n\nLight CNN B model(98.78%): [Google Drive](https://drive.google.com/open?id=0B0OhXbSTAU1HT3I5V3ZLd0JDaW8) or [Baidu Yun](https://pan.baidu.com/s/1gfklrrl).\n\nps: I used to get a model of 98.8%, but I lost it....\n\nCenter Face (ResNet-27) model(99.21%): [Google Drive](https://drive.google.com/open?id=0B0OhXbSTAU1HM2NWcWFiN2lvbTg) or [Baidu Yun](https://pan.baidu.com/s/1i4Q4vD7).\n\n# License\n\nThis code is distributed under MIT LICENSE. The released models are only allowed for non-commercial use.\n\n# Citation\n\nIf you find my paper or the codes useful in your research, please cite\n```\n@inproceedings{wang2017normface,\n  title={NormFace: L2 Hypersphere Embedding for Face Verification},\n  author={Wang, Feng and Xiang, Xiang and Cheng, Jian and Yuille, Alan L.},\n  booktitle={Proceedings of the 25th ACM international conference on Multimedia},\n  year={2017},\n  organization={ACM},\n  doi = {https://doi.org/10.1145/3123266.3123359}\n}\n```\n\n# Contact\n\nFeng Wang [feng.wff(at)gmail.com], please replace (at) with @.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhappynear%2Fnormface","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhappynear%2Fnormface","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhappynear%2Fnormface/lists"}