facenet-pytorch
Pretrained Pytorch face detection and recognition models
What it is and what it does
facenet-pytorch wraps pretrained Inception ResNet V1 models (trained on VGGFace2 and CASIA-Webface datasets) and an efficient MTCNN face detector into a PyTorch package. The models are ported from an external TensorFlow implementation and automatically download and cache their weights on first use. You use it to detect faces in images, extract 512-dimensional face embeddings for recognition tasks, or classify faces into known identities.
The package handles the full pipeline: MTCNN crops and aligns faces from raw images, then Inception ResNet V1 generates embeddings or classification logits. Both models are pretrained and ready to use without training. You can also finetune the models on new data or use the embeddings with clustering or distance metrics to identify faces. The package includes examples for video face tracking, batch processing, and performance comparisons.
Use it for:
- Extract face embeddings from images for identity verification or clustering unknown faces.
- Detect and locate faces in images or video frames using MTCNN before downstream processing.
- Build a face recognition system by comparing embeddings against a known face database.
- Finetune pretrained models on custom face datasets for domain-specific recognition tasks.
- Track faces across video frames using MTCNN's detection output.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides pretrained PyTorch models for face detection using MTCNN and face recognition using Inception ResNet V1, with automatic model downloading and caching.
Yes, with conditions. The package is well-maintained for its scope (5160 GitHub stars, low install friction, no known vulnerabilities), but maintenance is aging—the last release was April 2024. Install it if you need pretrained face detection and recognition models and can accept that bug fixes or compatibility updates may lag behind new PyTorch releases. For production systems requiring active support, verify compatibility with your PyTorch version first.
Install
facenet-pytorch on PyPI
pip
pip install facenet-pytorchuv
uv add facenet-pytorchpoetry
poetry add facenet-pytorchInstalling facenet-pytorch
Before you install
Low friction install with a pure Python wheel. Maintenance is aging—last release was April 2024 with last commit September 2025, though the repository remains active with 5160 stars and is not archived.
License in practice
Licensed under MIT (permissive), allowing commercial and private use with minimal restrictions.
Quickstart
pip install facenet-pytorch
from facenet_pytorch import MTCNN, InceptionResnetV1
mtcnn = MTCNN(image_size=160)
resnet = InceptionResnetV1(pretrained='vggface2').eval()
img_cropped = mtcnn(img)
img_embedding = resnet(img_cropped.unsqueeze(0))
Requires torch and torchvision; pretrained models are downloaded automatically on first use and cached.
Verify before relying
- Compatibility with PyTorch versions released after April 2024.
- GPU memory requirements for batch processing and model inference.
- Whether the package supports modern Python versions beyond what classifiers declare.
Package facts
| License | not declared (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 6 — numpy, Pillow, requests, torch, torchvision, tqdm |
| Maintenance | aging — 837 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 154,911/month — #10,839 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: facenet_pytorch-2.6.0-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
pretrainedmodelsProvides a unified interface to load pretrained…
permissive · top 15,000 on PyPI
pytorchcvProvides a collection of pretrained computer…
unclear · top 15,000 on PyPI
mtcnnDetects faces and facial landmarks (eyes, nose,…
permissive · top 5,000 on PyPI
face_recognition_modelsProvides pre-trained deep learning models for…
permissive · top 15,000 on PyPI
face-recognitionDetects, locates, and identifies faces in…
permissive · top 15,000 on PyPI
deepfaceDeepFace performs face recognition,…
permissive · top 15,000 on PyPI
retina-faceDetects faces in images and extracts facial…
permissive · top 15,000 on PyPI
pytorch-fidComputes Fréchet Inception Distance (FID), a…
permissive · top 15,000 on PyPI
effdetPyTorch implementation of EfficientDet object…
permissive · top 15,000 on PyPI
retinaface-pyDetects and localizes faces in images using a…
permissive · top 15,000 on PyPI