TensorFlow face weights, reborn in PyTorch with fast detection
It ports pretrained TensorFlow face-recognition weights into PyTorch and claims the fastest available MTCNN implementation.

What it does
This repo gives PyTorch-native access to Inception Resnet V1 face-recognition models pretrained on VGGFace2 and CASIA-Webface, plus an MTCNN detector to crop faces before inference. It is fundamentally a careful port of David Sandberg’s TensorFlow FaceNet weights into PyTorch, with outputs verified to be numerically identical to the originals. You get 512-dimensional embeddings by default, or you can flip a classify flag to get logits instead.
The interesting bit
The authors rewrote MTCNN in PyTorch rather than wrapping the old implementation, then benchmarked it against dlib and the reference MTCNN on a Kaggle P100, reporting higher frame rates at every tested resolution. They also ship a FastMTCNN algorithm that exploits frame-to-frame similarity in video to push speed further.
Key highlights
- Pretrained models auto-download and cache on first use; the VGGFace2 checkpoint is listed at 0.9965 LFW accuracy, the CASIA-Webface one at 0.9905.
- The MTCNN module handles detection, cropping, and prewhitening, and supports batched inference.
- Example notebooks cover face tracking, finetuning, and a full detection-to-recognition pipeline.
- The TensorFlow-to-PyTorch conversion utility is included, and the README shows a numerical distance of ~1.3e-06 between original and ported outputs.
Caveats
- Models were trained on 160×160 px images, so the README warns that resizing is effectively mandatory for best results.
- The repository name contains a hyphen, which breaks Python imports unless you rename the directory when cloning.
- The “fastest MTCNN” claim is qualified with “to our knowledge” and was tested only on a specific Kaggle P100 kernel.
Verdict
Worth a look if you want pretrained face recognition inside a PyTorch pipeline without bridging TensorFlow. Less useful if you need newer architectures or if your workload differs significantly from the benchmarked Kaggle environment.
Frequently asked
- What is timesler/facenet-pytorch?
- It ports pretrained TensorFlow face-recognition weights into PyTorch and claims the fastest available MTCNN implementation.
- Is facenet-pytorch open source?
- Yes — timesler/facenet-pytorch is open source, released under the MIT license.
- What language is facenet-pytorch written in?
- timesler/facenet-pytorch is primarily written in Python.
- How popular is facenet-pytorch?
- timesler/facenet-pytorch has 5.2k stars on GitHub.
- Where can I find facenet-pytorch?
- timesler/facenet-pytorch is on GitHub at https://github.com/timesler/facenet-pytorch.