Face Embedding with MobileFaceNet ONNX

A lightweight face embedding and verification experiment using MobileFaceNet and ONNX Runtime.

Overview

This project demonstrates a basic face embedding pipeline:

Image
β†’ Preprocessing
β†’ 112 Γ— 112 RGB Input
β†’ MobileFaceNet
β†’ 128-D Face Embedding
β†’ L2 Normalization
β†’ Cosine Similarity

Model Input

  • Input shape: [1, 3, 112, 112]
  • Data type: float32
  • Image size: 112 Γ— 112

Model Output

  • Output shape: [1, 128]
  • Produces a 128-dimensional face embedding.

Current Experiment

Initial test:

  • Identical image comparison: 1.0 cosine similarity
  • Different-person example: 0.6479911 cosine similarity

These values are experimental results and should NOT be treated as a production verification threshold.

Preprocessing

The current experiment performs:

  1. Load image using OpenCV
  2. Convert BGR to RGB
  3. Resize to 112 Γ— 112
  4. Convert to float32
  5. Normalize pixel values
  6. Convert HWC to CHW
  7. Add batch dimension

Current Status

This is an early experimental version.

Planned improvements:

  • Face detection
  • Face cropping
  • Facial landmark detection
  • Face alignment
  • Genuine/impostor pair evaluation
  • ROC curve
  • FAR and FRR
  • EER calculation
  • Threshold evaluation
  • Hugging Face Space demo

Privacy

Face images and face embeddings are biometric data. Test images used during development are not included in this repository.

Use biometric systems only with appropriate consent, security, and privacy safeguards.

Limitations

The current implementation directly resizes input images before embedding extraction.

A production face-verification system should use appropriate face detection and alignment and should be evaluated on representative datasets before choosing a verification threshold.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support