Downloads · 30 days
0
RuxwezDev/arcface-onnx
arcface-onnx is a machine learning model from RuxwezDev. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
A high-accuracy face recognition (embedding) model exported to ONNX format, ready to run with onnxruntime.
Downloads · 30 days
0
Access
Public
Updated Jun 20, 2026
Repo size
137 MB
Likes
0
Public
Click a slice to open those files.
.onnx137 MB · 100%
From the Hugging Face model README
A high-accuracy face recognition (embedding) model exported to ONNX format, ready to run with onnxruntime.
Download the ONNX model using:
wget https://huggingface.co/garavv/arcface-onnx/resolve/main/arc.onnx?download=true -O arcface.onnx
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)
Install with:
pip install onnxruntime numpy opencv-python