{"id":19115345,"url":"https://github.com/alfredxiangwu/lightcnn","last_synced_at":"2025-04-12T23:37:14.059Z","repository":{"id":47607515,"uuid":"96199030","full_name":"AlfredXiangWu/LightCNN","owner":"AlfredXiangWu","description":"A Light CNN for Deep Face Representation with Noisy Labels, TIFS 2018","archived":false,"fork":false,"pushed_at":"2022-02-09T07:09:29.000Z","size":20,"stargazers_count":960,"open_issues_count":2,"forks_count":166,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-04-12T23:36:09.845Z","etag":null,"topics":["face-recognition","lightcnn","pytorch"],"latest_commit_sha":null,"homepage":"https://arxiv.org/abs/1511.02683","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/AlfredXiangWu.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}},"created_at":"2017-07-04T09:12:03.000Z","updated_at":"2025-04-05T10:15:21.000Z","dependencies_parsed_at":"2022-09-13T12:42:42.598Z","dependency_job_id":null,"html_url":"https://github.com/AlfredXiangWu/LightCNN","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/AlfredXiangWu%2FLightCNN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlfredXiangWu%2FLightCNN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlfredXiangWu%2FLightCNN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlfredXiangWu%2FLightCNN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlfredXiangWu","download_url":"https://codeload.github.com/AlfredXiangWu/LightCNN/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248647257,"owners_count":21139081,"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":["face-recognition","lightcnn","pytorch"],"created_at":"2024-11-09T04:46:07.961Z","updated_at":"2025-04-12T23:37:14.030Z","avatar_url":"https://github.com/AlfredXiangWu.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Light CNN for Deep Face Recognition, in PyTorch\nA [PyTorch](http://pytorch.org/) implementation of [A Light CNN for Deep Face Representation with Noisy Labels](https://arxiv.org/abs/1511.02683) from the paper by Xiang Wu, Ran He, Zhenan Sun and Tieniu Tan.  The official and original Caffe code can be found [here](https://github.com/AlfredXiangWu/face_verification_experiment).  \n\n### Table of Contents\n- \u003ca href='#updates'\u003eUpdates\u003c/a\u003e\n- \u003ca href='#installation'\u003eInstallation\u003c/a\u003e\n- \u003ca href='#datasets'\u003eDatasets\u003c/a\u003e\n- \u003ca href='#training'\u003eTraining\u003c/a\u003e\n- \u003ca href='#evaluation'\u003eEvaluate\u003c/a\u003e\n- \u003ca href='#performance'\u003ePerformance\u003c/a\u003e\n- \u003ca href='#citation'\u003eCitation\u003c/a\u003e\n- \u003ca href='#references'\u003eReferences\u003c/a\u003e\n\n## Updates\n\n- Feb 9, 2022\n    - Light CNN v4 pretrained model is released.\n- Jan 17, 2018\n\t- Light CNN-29 v2 model and training code are released. The `100% - EER` on LFW achieves **99.43%**.\n\t- The performance of set 1 on MegaFace achieves **76.021%** for rank-1 accuracy and **89.740%** for TPR@FAR=10^-6. \n- Sep 12, 2017\n\t- Light CNN-29 model and training code are released. The `100% - EER` on LFW achieves **99.40%**.\n\t- The performance of set 1 on MegaFace achieves **72.704%** for rank-1 accuracy and **85.891%** for TPR@FAR=10^-6. \n- Jul 12, 2017 \n\t- Light CNN-9 model and training code are released. The `100% - EER` on LFW obtains **98.70%**.  \n\t- The performance of set 1 on MegaFace achieves **65.782%** for rank-1 accuracy and **76.288%** for TPR@FAR=10^-6. \n- Jul 4, 2017\n\t- The repository was built.\n\n## Installation\n- Install [pytorch](http://pytorch.org/) following the website.\n- Clone this repository.\n\t- Note: We currently only run it on Python 2.7.\t\n\n## Datasets\n- Download face dataset such as  CASIA-WebFace, VGG-Face and MS-Celeb-1M.\n\t- The MS-Celeb-1M clean list is uploaded: [Baidu Yun](http://pan.baidu.com/s/1gfxB0iB), [Google Drive](https://drive.google.com/file/d/0ByNaVHFekDPRbFg1YTNiMUxNYXc/view?usp=sharing).\n- All face images are converted to gray-scale images and normalized to **144x144** according to landmarks. \n- According to the five facial points, we not only rotate two eye points horizontally but also set the distance between the midpoint of eyes and the midpoint of mouth(ec_mc_y), and the y axis of midpoint of eyes(ec_y) .\n- The aligned LFW images are uploaded on [Baidu Yun](https://pan.baidu.com/s/1eR6vHFO).\n  \n  Dataset     | size    |  ec_mc_y  | ec_y  \n  :----| :-----: | :----:    | :----: \n  Training set | 144x144 |     48    | 48    \n  Testing set  | 128x128 |     48    | 40 \n\n## Training \n- To train Light CNN using the train script simply specify the parameters listed in ```train.py``` as a flag or manually change them.\n```Shell\npython train.py --root_path=/path/to/your/datasets/ \\\n\t\t--train_list=/path/to/your/train/list.txt \\\n\t\t--val_list=/path/to/your/val/list.txt \\\n\t\t--save_path=/path/to/your/save/path/ \\\n\t\t--model=\"LightCNN-9/LightCNN-29\" --num_classes=n\n```\n\t\n- Tips:\n\t- The lists of train and val datasets are followed by the format of caffe. The details of data loader is shown in ```load_imglist.py```. Or you can use ```torchvision.datasets.ImageFolder``` to load your datasets.\n\t- The ```num_classes``` denotes the number of identities in your training dataset.\n\t- When training by pytorch, you can set a larger learning rate than caffe and it is faster converaged by pytorch than caffe for Light CNN.\n\t- We enlarge the learning rate for the parameters of fc2 which may lead better performance. If the training is collapsed on your own datasets, you can decrese it. \n\t- We modify the implementation of SGD with momentum since the official pytorch implementation is different from Sutskever et. al. The details are shown in [here](http://pytorch.org/docs/master/optim.html#torch.optim.SGD).\n\t- The training datasets for LightCNN-29v2 are CASIA-WebFace and MS-Celeb-1M, therefore, the ```num_classes``` is **80013**. \n\t \n\t\n## Evaluation\n\n- To evaluate a trained network:\n```\npython extract_features.py --resume=/path/to/your/model \\\n\t\t\t   --root_path=/path/to/your/datasets/ \\\n\t\t\t   --img_list=/path/to/your/list.txt \\\n\t\t\t   --save_path=/path/to/your/save/path/ \\\n\t\t\t   --model=\"LightCNN-9/LightCNN-29/LightCNN-29v2\"\\\n\t\t\t   --num_classes=n (79077 for LightCNN-9/LightCNN-29, 80013 for LightCNN-29v2)\n```\n- You can use ```vlfeat``` or ```sklearn``` to evaluate the features on ROC and obtain ```EER``` and ```TPR@FPR``` for your testing datasets. \n- The model of LightCNN-9 is released on [Google Drive](https://drive.google.com/open?id=0ByNaVHFekDPRWk5XUFRvTTRIVmc).\n\t- Note that the released model contains the whole state of the light CNN module and optimizer. The details of loading model can be found in ```train.py```. \n- The model of LightCNN-29 is released on [Google Drive](https://drive.google.com/file/d/0ByNaVHFekDPRMGlLWVBhbkVGVm8/view).\n- The model of LightCNN-29 v2 is released on [Google Drive](https://drive.google.com/open?id=1Jn6aXtQ84WY-7J3Tpr2_j6sX0ch9yucS).\n- The features of [lfw](https://drive.google.com/open?id=0ByNaVHFekDPRbDV4cEtWSVl3d0k) and [megaface](https://drive.google.com/open?id=0ByNaVHFekDPRZXhQejRwOUtDYm8) of LightCNN-9 are released. \n- The model of LightCNN v4 is released on [Google Drive](https://drive.google.com/file/d/1zFB8RmxeS00Nbq2fM0EoME15RIHtVOqn/view?usp=sharing).\n  - The detailed structure of LightCNN v4 is shown in light_cnn_v4.py\n  - The input is an aligned 128*128 **BGR** face image.\n  - The input pixel value is normalized by mean ([0.0, 0.0, 0.0]) and std ([255.0, 255.0, 255.0]).\n\n## Performance\nThe Light CNN performance on lfw 6,000 pairs.   \n\n|   Model | 100% - EER | TPR@FAR=1%   | TPR@FAR=0.1%| TPR@FAR=0| \n| :------- | :----: | :---: | :---: |:---: | \n| LightCNN-9| 98.70% | 98.47% | 95.13% | 89.53% |\n| LightCNN-29 | 99.40% |    99.43%    |    98.67%  |    95.70%  | \n| LightCNN-29v2 | 99.43% |    99.53%    |    99.30%  |    96.77%  | \n| LightCNN v4 | 99.67% |    99.67%    |    99.57%  |    99.27%  |\n\nThe Light CNN performance on [lfw BLUFR protocols](http://www.cbsr.ia.ac.cn/users/scliao/projects/blufr/)\n\n|   Model | VR@FAR=0.1% | DIR@FAR=1%| \n| :------- | :----: | :---: |  \n| LightCNN-9| 96.80% | 83.06% | \n| LightCNN-29 | 98.95% |    91.33%    |  \n| LightCNN-29v2 | 99.41% |    94.43%    |  \n\nThe Light CNN performance on MegaFace\n\n|   Model | Rank-1 | TPR@FAR=1e-6| \n| :------- | :----: | :---: |  \n| LightCNN-9| 65.782% | 76.288% | \n| LightCNN-29 | 72.704% |  85.891%    |  \n| LightCNN-29v2 | 76.021% |  89.740%    |  \n\n## Citation\nIf you use our models, please cite the following paper:\n```\n@article{wu2018light,\n  title={A light CNN for deep face representation with noisy labels},\n  author={Wu, Xiang and He, Ran and Sun, Zhenan and Tan, Tieniu},\n  journal={IEEE Transactions on Information Forensics and Security},\n  volume={13},\n  number={11},\n  pages={2884--2896},\n  year={2018},\n  publisher={IEEE}\n}\n```\n\t\n## References\n- [Original Light CNN implementation (caffe)](https://github.com/AlfredXiangWu/face_verification_experiment).\n- [Pytorch](https://github.com/pytorch/pytorch). \n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falfredxiangwu%2Flightcnn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falfredxiangwu%2Flightcnn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falfredxiangwu%2Flightcnn/lists"}