{"id":17929628,"url":"https://github.com/angrybayblade/facenet_mini","last_synced_at":"2025-04-03T10:15:56.261Z","repository":{"id":125388029,"uuid":"252535118","full_name":"angrybayblade/facenet_mini","owner":"angrybayblade","description":"👨🏽⬅➡🧑🏽 FaceNet for face verification, recognition and clustering.","archived":false,"fork":false,"pushed_at":"2020-07-06T19:14:22.000Z","size":358221,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-08T23:28:20.939Z","etag":null,"topics":["embeddings","face-verification","python","python3","siamese-network"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/angrybayblade.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2020-04-02T18:28:03.000Z","updated_at":"2020-07-06T19:14:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"588593b6-c234-4576-9055-6c7b4892ad77","html_url":"https://github.com/angrybayblade/facenet_mini","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/angrybayblade%2Ffacenet_mini","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angrybayblade%2Ffacenet_mini/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angrybayblade%2Ffacenet_mini/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angrybayblade%2Ffacenet_mini/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/angrybayblade","download_url":"https://codeload.github.com/angrybayblade/facenet_mini/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246981166,"owners_count":20863828,"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":["embeddings","face-verification","python","python3","siamese-network"],"created_at":"2024-10-28T21:09:52.614Z","updated_at":"2025-04-03T10:15:56.232Z","avatar_url":"https://github.com/angrybayblade.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Face Verification, Clustering and Recognition Tasks Using FaceNet And Triplet Loss\n\n**This is a simpler and intuative implementation for the original facenet paper by Google ( https://arxiv.org/abs/1503.03832 ).**\n\n\u003e In traditional methods we try to train our model to recognize faces as categories using deep neural nets and minimizes the losses using Softmax and Crossentropy functions but it can get  pretty messy at large scale datasets, so this paper introduces a system calles FaceNet, that directly learns a mapping from face images to a compact Euclidean space where distances directly correspond to a measure of face similarity.\n\n\u003eOnce this space has been produced, tasks such as face recognition, verification and clusteringcan be easily implemented using standard techniques with FaceNet embeddings as feature vectors.\n\n\u003eThe network takes an image as input and outputs a N-Dimensional Vector which are used as embeddings for the given image. \n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"doc/arch.PNG\" /\u003e\n\u003c/p\u003e\n\n    This paper proposes concept of triplet loss. To understand the loss function let's take an \n    example of three images, where two images are of a same person where one is called as anchor and \n    the other one is calles as positive and a third one is of a different person which is reffered \n    as negative. Objective of this function to reduce the distance between output of anchor and \n    positive image and increase the distance between output of anchor image and negative image.\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"doc/triplet.PNG\" /\u003e\n\u003c/p\u003e\n\n#### I used custom deep neural network to produce embeddings you can use your own network and customize the number of dimensions as you require. \n\n### Training on 50 Faces Mini Batch\n\n\u003e Training Process For 50 faces \n\n![](doc/facenet.gif)\n\n\u003e Trained On 100 faces with margin set to 8.\n\n![](doc/2d_cluster.jpg)\n\n\n\u003e Trained On 200 faces with margin set to 8.\n\n![](doc/200_cluster.jpg)\n\n\u003e Testing On Face Images\n\n\u003cimg src=\"doc/test.jpg\" width=\"100%\" /\u003e\n\n\n### Traning On Custom Dataset.\n\n\u003e This repo already includes a training script just run with your dataset and it will do the work. For this script to work\nyou need the facenet_mini installed on your system or just keep it in the same folder. Also to train the net you need \nspecific folder structure which is as following.\n\n    |_ training_folder\n    |\n    |__ person_0\n    |___ 0.jpg\n    |___ 1.jpg\n    |___ 2.jpg\n    |\n    |__ person_2\n    |___ 2.jpg\n    |___ 6.jpg\n    |___ 7.jpg\n    |\n    |...\n\n\u003e after aranging the folder just run the training script as follows.\n\n```bash\npython3 train.py --path path_to_training_folder --n_faces number_of_faces\n```\n\n### Training Parameters.\n\n| Param | Description | Values |\n|-------|-------------|--------|\n|--path        | Path to image folder                                                | any string  |\n|--n_faces     | Number of faces in dataset                                          | any integer |\n|--d           | Dimension length for embedding vector                               | any integer |\n|--m           | Multiplication factor that decides output range of embedding vector | any integer |\n|--output      | Output dir for trained model                                        | path string |\n|--margin      | Margin value for  triplets                                          | any integer |\n|--epochs      | Number of epochs                                                    | any integer |\n|--batch_size  | Batch Size                                                          | any integer |\n\n\n#### Citations\n\n    LFW funneled images\n    @InProceedings{Huang2007a,\n        author =    {Gary B. Huang and Vidit Jain and Erik Learned-Miller},\n        title =     {Unsupervised Joint Alignment of Complex Images},\n        booktitle = {ICCV},\n        year =      {2007}\n    }\n\n    @INPROCEEDINGS{7298682,\n        author={F. {Schroff} and D. {Kalenichenko} and J. {Philbin}},\n        booktitle={2015 IEEE Conference on Computer Vision and Pattern Recognition (CVPR)}, \n        title={FaceNet: A unified embedding for face recognition and clustering}, \n        year={2015},\n        volume={},\n        number={},\n        pages={815-823},\n    }","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangrybayblade%2Ffacenet_mini","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fangrybayblade%2Ffacenet_mini","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangrybayblade%2Ffacenet_mini/lists"}