--- tags: - model_hub_mixin - pytorch_model_hub_mixin license: mit library_name: py-feat pipeline_tag: image-feature-extraction --- # FaceNet > **Licensing scope:** See the [license and provenance notice](LICENSE-NOTICE.md) before relying on this card's license metadata for pretrained-weight redistribution or commercial use. Existing valid grants are preserved. ## Model Description facenet uses an Inception Residual Masking Network pretrained on VGGFace2 to classify facial identities. Facenet also exposes a 512 latent facial embedding space. ## Model Details - **Model Type**: Convolutional Neural Network (CNN) - **Architecture**: Inception Residual masking network. Output layer classifies facial identities. Also provides a 512 dimensional representation layer - **Input Size**: 112 x 112 pixels - **Framework**: PyTorch ## Model Sources - **Repository**: [GitHub Repository](https://github.com/timesler/facenet-pytorch/tree/master) - **Paper**: [FaceNet: A Unified Embedding for Face Recognition and Clustering](https://arxiv.org/abs/1503.03832) ## Citation If you use this model in your research or application, please cite the following paper: F. Schroff, D. Kalenichenko, J. Philbin. FaceNet: A Unified Embedding for Face Recognition and Clustering, arXiv:1503.03832, 2015. ``` @inproceedings{schroff2015facenet, title={Facenet: A unified embedding for face recognition and clustering}, author={Schroff, Florian and Kalenichenko, Dmitry and Philbin, James}, booktitle={Proceedings of the IEEE conference on computer vision and pattern recognition}, pages={815--823}, year={2015} } ``` ## Acknowledgements We thank Tim Esler and David Sandberg for sharing their implementation and pretrained checkpoints. Their code licenses and checkpoint/data provenance are addressed separately below. ## Example Useage ```python import numpy as np import torch import torch.nn as nn from feat.identity_detectors.facenet.facenet_model import InceptionResnetV1 from huggingface_hub import hf_hub_download device = 'cpu' identity_detector = InceptionResnetV1( pretrained=None, classify=False, num_classes=None, dropout_prob=0.6, device=device, ) identity_detector.logits = nn.Linear(512, 8631) identity_model_file = hf_hub_download(repo_id='py-feat/facenet', filename="facenet_20180402_114759_vggface2.pth") identity_detector.load_state_dict(torch.load(identity_model_file, map_location=device)) identity_detector.eval() identity_detector.to(device) # Test model face_image = "path/to/your/test_image.jpg" # Replace with your extracted face image that is [224, 224] # 512 dimensional Facial Embeddings identity_embeddings = identity_detector.forward(extracted_faces) ``` ## License and provenance This distribution retains its existing `license: mit` metadata, and the [facenet-pytorch implementation](https://github.com/timesler/facenet-pytorch/blob/master/LICENSE.md) is MIT. The shipped file is `facenet_20180402_114759_vggface2.pth`, corresponding to the **VGGFace2-trained 20180402-114759** checkpoint in the [upstream checkpoint table](https://github.com/davidsandberg/facenet#pre-trained-models). CASIA-WebFace is a separate upstream checkpoint; this artifact must not be described as jointly trained on both. [VGGFace2](https://www.robots.ox.ac.uk/~vgg/data/vgg_face2/) data/source-image rights and the exact pretrained-weight grant require separate consideration from the implementation license. Selecting FaceNet or reading an MIT badge does not establish unconditional commercial clearance. This notice clarifies scope; it does not revoke existing valid grants or create a new license for third-party material. Dataset and teacher terms do not automatically relicense every trained artifact or inference output. A software license or model-card badge alone does not establish all checkpoint redistribution or commercial-use permissions.