ljchang commited on
Commit
406704c
1 Parent(s): c8b806a

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +67 -3
README.md CHANGED
@@ -2,8 +2,72 @@
2
  tags:
3
  - model_hub_mixin
4
  - pytorch_model_hub_mixin
 
 
5
  ---
6
 
7
- This model has been pushed to the Hub using the [PytorchModelHubMixin](https://huggingface.co/docs/huggingface_hub/package_reference/mixins#huggingface_hub.PyTorchModelHubMixin) integration:
8
- - Library: [More Information Needed]
9
- - Docs: [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  tags:
3
  - model_hub_mixin
4
  - pytorch_model_hub_mixin
5
+ license: mit
6
+ library_name: pytorch
7
  ---
8
 
9
+ # FaceNet
10
+
11
+ ## Model Description
12
+ facenet uses an Inception Residual Masking Network pretrained on VGGFace2 to classify facial identities. Facenet also exposes a 512 latent facial embedding space.
13
+
14
+ ## Model Details
15
+ - **Model Type**: Convolutional Neural Network (CNN)
16
+ - **Architecture**: Inception Residual masking network. Output layer classifies facial identities. Also provides a 512 dimensional representation layer
17
+ - **Input Size**: 112 x 112 pixels
18
+ - **Framework**: PyTorch
19
+
20
+ ## Model Sources
21
+ - **Repository**: [GitHub Repository](https://github.com/timesler/facenet-pytorch/tree/master)
22
+ - **Paper**: [FaceNet: A Unified Embedding for Face Recognition and Clustering](https://arxiv.org/abs/1503.03832)
23
+
24
+ ## Citation
25
+ If you use this model in your research or application, please cite the following paper:
26
+
27
+ F. Schroff, D. Kalenichenko, J. Philbin. FaceNet: A Unified Embedding for Face Recognition and Clustering, arXiv:1503.03832, 2015.
28
+
29
+ ```
30
+ @inproceedings{schroff2015facenet,
31
+ title={Facenet: A unified embedding for face recognition and clustering},
32
+ author={Schroff, Florian and Kalenichenko, Dmitry and Philbin, James},
33
+ booktitle={Proceedings of the IEEE conference on computer vision and pattern recognition},
34
+ pages={815--823},
35
+ year={2015}
36
+ }
37
+ ```
38
+
39
+ ## Acknowledgements
40
+ We thank Tim Esler and David Sandberg for sharing their code and training weights with a permissive license.
41
+
42
+ ## Example Useage
43
+
44
+ ```python
45
+ import numpy as np
46
+ import torch
47
+ import torch.nn as nn
48
+ from feat.identity_detectors.facenet.facenet_model import InceptionResnetV1
49
+ from huggingface_hub import hf_hub_download
50
+
51
+ device = 'cpu'
52
+ identity_detector = InceptionResnetV1(
53
+ pretrained=None,
54
+ classify=False,
55
+ num_classes=None,
56
+ dropout_prob=0.6,
57
+ device=device,
58
+ )
59
+ identity_detector.logits = nn.Linear(512, 8631)
60
+ identity_model_file = hf_hub_download(repo_id='py-feat/facenet', filename="facenet_20180402_114759_vggface2.pth")
61
+ identity_detector.load_state_dict(torch.load(identity_model_file, map_location=device))
62
+ identity_detector.eval()
63
+ identity_detector.to(device)
64
+
65
+ # Test model
66
+ face_image = "path/to/your/test_image.jpg" # Replace with your extracted face image that is [224, 224]
67
+
68
+ # 512 dimensional Facial Embeddings
69
+ identity_embeddings = identity_detector.forward(extracted_faces)
70
+
71
+ ```
72
+
73
+