{"id":13443944,"url":"https://github.com/kuaikuaikim/dface","last_synced_at":"2025-04-08T09:11:27.491Z","repository":{"id":44566833,"uuid":"111272712","full_name":"kuaikuaikim/dface","owner":"kuaikuaikim","description":"Deep learning face detection and recognition, implemented by pytorch. (pytorch实现的人脸检测和人脸识别)","archived":false,"fork":false,"pushed_at":"2024-02-21T03:26:35.000Z","size":3850,"stargazers_count":1295,"open_issues_count":32,"forks_count":355,"subscribers_count":66,"default_branch":"master","last_synced_at":"2025-04-01T08:37:29.497Z","etag":null,"topics":["deeplearning","facedetection","facerecognition","mtcnn","mtcnn-pytorch","pytorch"],"latest_commit_sha":null,"homepage":"http://dface.tech","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/kuaikuaikim.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-11-19T07:07:45.000Z","updated_at":"2025-03-24T14:08:18.000Z","dependencies_parsed_at":"2024-09-20T22:31:15.408Z","dependency_job_id":"6b9b4b40-e788-4a6a-affb-5a1c229d05ca","html_url":"https://github.com/kuaikuaikim/dface","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuaikuaikim%2Fdface","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuaikuaikim%2Fdface/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuaikuaikim%2Fdface/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuaikuaikim%2Fdface/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kuaikuaikim","download_url":"https://codeload.github.com/kuaikuaikim/dface/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247809964,"owners_count":20999816,"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":["deeplearning","facedetection","facerecognition","mtcnn","mtcnn-pytorch","pytorch"],"created_at":"2024-07-31T03:02:14.622Z","updated_at":"2025-04-08T09:11:27.472Z","avatar_url":"https://github.com/kuaikuaikim.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"\u003cdiv align=center\u003e\n\u003ca href=\"https://dface.tech\" target=\"_blank\"\u003e\u003cimg src=\"http://dftech.oss-cn-hangzhou.aliyuncs.com/web/DFACE-logo_dark.png\" width=\"160\"\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n-----------------\n# Dface • [![License](http://dftech.oss-cn-hangzhou.aliyuncs.com/opendface/img/apache_2.svg)](https://opensource.org/licenses/Apache-2.0)\n\n\n| **`Linux CPU`** | **`Linux GPU`** | **`Mac OS CPU`** | **`Windows CPU`** |\n|-----------------|---------------------|------------------|-------------------|\n| [![Build Status](http://dftech.oss-cn-hangzhou.aliyuncs.com/opendface/img/build_pass.svg)](http://dftech.oss-cn-hangzhou.aliyuncs.com/opendface/img/build_pass.svg) | [![Build Status](http://dftech.oss-cn-hangzhou.aliyuncs.com/opendface/img/build_pass.svg)](http://dftech.oss-cn-hangzhou.aliyuncs.com/opendface/img/build_pass.svg) | [![Build Status](http://dftech.oss-cn-hangzhou.aliyuncs.com/opendface/img/build_pass.svg)](http://dftech.oss-cn-hangzhou.aliyuncs.com/opendface/img/build_pass.svg) | [![Build Status](http://dftech.oss-cn-hangzhou.aliyuncs.com/opendface/img/build_pass.svg)](http://dftech.oss-cn-hangzhou.aliyuncs.com/opendface/img/build_pass.svg) |\n\n\n**Free and open source face detection. Based on the MTCNN**\n\n[Official Website(https://dface.tech)](https://dface.tech)  \n\n**We also provide fully face recognize SDK, Contains tracking, detection, face recognition, face anti-spoofing and so on. See [dface.tech](https://dface.tech) for details.**  \n![DFACE SDK](https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExYXI5aGt5NDFxamk2cTdkZWlpMml1bDhqNnAyc2lyOXV3bnF2Y3RnYyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/MkHTo4WQ5VuPzegTFV/giphy-downsized.gif)\n\n\n**Dface** is an open source software for face detection and recognition. All features implemented by the **[pytorch](https://github.com/pytorch/pytorch)** (the facebook deeplearning framework). With PyTorch, we use a technique called reverse-mode auto-differentiation, which allows developer to change the way your network behaves arbitrarily with zero lag or overhead.\nDFace inherit these advanced characteristic, that make it dynamic and ease code review.\n\nDFace support GPU acceleration with NVIDIA cuda. We highly recommend you use the linux GPU version.It's very fast and extremely realtime.\n\nOur inspiration comes from several research papers on this topic, as well as current and past work such as [Joint Face Detection and Alignment using Multi-task Cascaded Convolutional Networks](https://arxiv.org/abs/1604.02878) and face recognition topic [FaceNet: A Unified Embedding for Face Recognition and Clustering](https://arxiv.org/abs/1503.03832)\n\n**MTCNN Structure**　　\n\n![Pnet](http://dftech.oss-cn-hangzhou.aliyuncs.com/opendface/img/pnet.jpg)\n![Rnet](http://dftech.oss-cn-hangzhou.aliyuncs.com/opendface/img/rnet.jpg)\n![Onet](http://dftech.oss-cn-hangzhou.aliyuncs.com/opendface/img/onet.jpg)\n\n**If you want to contribute to DFace, please review the CONTRIBUTING.md in the project.We use [Slack](https://dfaceio.slack.com/) for tracking requests and bugs. Also you can following the QQ group 681403076 or my wechat jinkuaikuai005**\n\n\n## TODO(contribute to DFace)\n- Based on cener loss or triplet loss implement the face conpare. Recommended Model is ResNet inception v2. Refer this [Paper](https://arxiv.org/abs/1503.03832) and [FaceNet](https://github.com/davidsandberg/facenet)\n- Face Anti-Spoofing, distinguish from face light and texture。Recomend with the LBP algorithm and SVM.\n- 3D mask  Anti-Spoofing.\n- Mobile first with caffe2 and c++.\n- Tensor rt migration.\n- Docker support, gpu version\n\n## Installation\n\nDFace has two major module, detection and recognition.In these two, We provide all tutorials about how to train a model and running.\nFirst setting a pytorch and cv2. We suggest Anaconda to make a virtual and independent python envirment.**If you want to train on GPU,please install Nvidia cuda and cudnn.**\n\n### Requirements\n* cuda 8.0\n* anaconda\n* pytorch\n* torchvision\n* cv2\n* matplotlib  \n\n\n```shell\ngit clone https://github.com/kuaikuaikim/dface.git\n```\n\n\nAlso we provide a anaconda environment dependency list called environment.yml (windows please use environment-win64.yml,Mac environment_osx.yaml) in the root path. \nYou can create your DFace environment very easily.\n```shell\ncd DFace\n\nconda env create -f path/to/environment.yml\n```\n\nAdd Dface to your local python path  \n\n```shell\nexport PYTHONPATH=$PYTHONPATH:{your local DFace root path}\n```\n\n\n### Face Detetion and Recognition\n\nIf you are interested in how to train a mtcnn model, you can follow next step.\n\n#### Train mtcnn Model\nMTCNN have three networks called **PNet**, **RNet** and **ONet**.So we should train it on three stage, and each stage depend on previous network which will generate train data to feed current train net, also propel the minimum loss between two networks.\nPlease download the train face **datasets** before your training. We use **[WIDER FACE](http://mmlab.ie.cuhk.edu.hk/projects/WIDERFace/)** and **[CelebA](http://mmlab.ie.cuhk.edu.hk/projects/CelebA.html)**  .WIDER FACE is used for training face classification and face bounding box, also CelebA is used for face landmarks. The original wider face annotation file is matlab format, you must transform it to text. I have put the transformed annotation text file into [anno_store/wider_origin_anno.txt](https://github.com/kuaikuaikim/DFace/blob/master/anno_store/wider_origin_anno.txt). This file is related to the following parameter called  --anno_file.\n\n\n* Create the DFace train data temporary folder, this folder is involved in the following parameter --dface_traindata_store \n\n```shell\nmkdir {your dface traindata folder}\n```   \n\n\n* Generate PNet Train data and annotation file\n\n```shell\npython dface/prepare_data/gen_Pnet_train_data.py --prefix_path {annotation file image prefix path, just your local wider face images folder} --dface_traindata_store  {dface train data temporary folder you made before }  --anno_file ｛wider face original combined  annotation file, default anno_store/wider_origin_anno.txt}\n```\n* Assemble annotation file and shuffle it\n\n```shell\npython dface/prepare_data/assemble_pnet_imglist.py\n```\n* Train PNet model\n\n```shell\npython dface/train_net/train_p_net.py\n```\n* Generate RNet Train data and annotation file\n\n```shell\npython dface/prepare_data/gen_Rnet_train_data.py --prefix_path {annotation file image prefix path, just your local wider face images folder} --dface_traindata_store {dface train data temporary folder you made before } --anno_file ｛wider face original combined  annotation file, default anno_store/wider_origin_anno.txt} --pmodel_file {your PNet model file trained before}\n```\n* Assemble annotation file and shuffle it\n\n```shell\npython dface/prepare_data/assemble_rnet_imglist.py\n```\n* Train RNet model\n\n```shell\npython dface/train_net/train_r_net.py\n```\n* Generate ONet Train data and annotation file\n\n```shell\npython dface/prepare_data/gen_Onet_train_data.py --prefix_path {annotation file image prefix path, just your local wider face images folder} --dface_traindata_store {dface train data temporary folder you made before } --anno_file ｛wider face original combined  annotation file, default anno_store/wider_origin_anno.txt} --pmodel_file {your PNet model file trained before} --rmodel_file {your RNet model file trained before}\n```\n* Generate ONet Train landmarks data\n\n```shell\npython dface/prepare_data/gen_landmark_48.py\n```\n* Assemble annotation file and shuffle it\n\n```shell\npython dface/prepare_data/assemble_onet_imglist.py\n```\n* Train ONet model\n\n```shell\npython dface/train_net/train_o_net.py\n```\n\n#### Test face detection  \n**If you don't want to train,i have put onet_epoch.pt,pnet_epoch.pt,rnet_epoch.pt in model_store folder.You just try test_image.py**\n\n```shell\npython test_image.py\n```    \n\n\n## Demo  \n\n![mtcnn](http://dftech.oss-cn-hangzhou.aliyuncs.com/opendface/img/dface_demoall.PNG)  \n\n\n### QQ交流群  \n![](http://dftech.oss-cn-hangzhou.aliyuncs.com/opendface/img/dfaceqqsm.png)\n\n\n#### 681403076  \n\n#### 本人微信(wechat)  \n##### cobbestne\n\n\n## License  \n\n[Apache License 2.0](LICENSE)\n\n\n## Reference\n\n* [OpenFace](https://github.com/cmusatyalab/openface)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkuaikuaikim%2Fdface","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkuaikuaikim%2Fdface","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkuaikuaikim%2Fdface/lists"}