onnx-community/arcface-onnx
By onnx-community · ↓ 0 · ♥ 1 · Updated 2025-08-12
What's in this repo
This page lists the files in onnx-community/arcface-onnx, including arcface.onnx.
- 1 ONNX models (.onnx files)
- 3 files, including 1 .md, 1 .onnx
- Last updated 2025-08-12
ONNX files
| File | Size | Download |
|---|---|---|
| arcface.onnx | — | Download |
How to use
These ONNX files can be loaded with ONNX Runtime. To inspect a model graph, upload the file to the Netron viewer. Download links point to the original files on Hugging Face.
README
ArcFace ONNX
A high-accuracy face recognition (embedding) model exported to ONNX format, ready to run with onnxruntime.
- Input: Cropped RGB face image, resized to 112x112.
- Output: 512-dimensional embedding (vector).
- Use case: Face verification and recognition (compare two faces for similarity).
📥 Download Model
Download the ONNX model using:
wget https://huggingface.co/garavv/arcface-onnx/resolve/main/arc.onnx?download=true -O arcface.onnx
🚀 Quick Start
import cv2
import numpy as np
import onnxruntime as ort
def preprocess(img_path):
img = cv2.imread(img_path)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
img = cv2.resize(img, (112, 112))
img = (img.astype(np.float32) - 127.5) / 128.0
return img[np.newaxis, ...] # shape: (1, 112, 112, 3)
sess = ort.InferenceSession("arcface.onnx")
input_name = sess.get_inputs()[0].name
output_name = sess.get_outputs()[0].name
emb1 = sess.run([output_name], {input_name: preprocess("face1.jpg")})[0][0]
emb2 = sess.run([output_name], {input_name: preprocess("face2.jpg")})[0][0]
# Normalize
emb1 = emb1 / np.linalg.norm(emb1)
emb2 = emb2 / np.linalg.norm(emb2)
cosine_sim = np.dot(emb1, emb2)
print("Cosine similarity:", cosine_sim)
📦 Dependencies
- Python 3.7+
- onnxruntime
- numpy
- opencv-python
Install with:
pip install onnxruntime numpy opencv-python
📝 Model Details
- Architecture: ArcFace (ONNX, 512-dim output)
- Input shape: (1, 112, 112, 3) (batch, height, width, channels)
- Output: (1, 512) embedding vector
Files (3)
.gitattributes
README.md
arcface.onnx
ONNX
Related models
More from onnx-community
More models
No task type declared.