Skip to main content

High-accuracy face matching library for comparing faces from images, files, or base64 strings.

Project description

face-matching-king

A simple, high-accuracy face matching library for verifying whether two face images belong to the same person.

Compare faces from file paths, numpy arrays, or base64 strings with a single method call.


Installation

pip install face-matching-king

GPU support (CUDA): install with the gpu extra to get onnxruntime-gpu:

pip install "face-matching-king[gpu]"

Quick Start

from face_matching_king import FaceMatcher

matcher = FaceMatcher()

# --- from file paths ---
result = matcher.match_from_path("photo.jpg", "id_card.jpg")

# --- from numpy arrays (BGR, OpenCV format) ---
import cv2
img1 = cv2.imread("photo.jpg")
img2 = cv2.imread("id_card.jpg")
result = matcher.match(img1, img2)

# --- from base64 strings (raw or data-URI) ---
result = matcher.match_from_base64(base64_str_1, base64_str_2)

print(result.similarity)   # e.g. 0.82  (display score, 0.0 – 1.0)
print(result.match)        # True / False
print(result.threshold)    # threshold used for this comparison

print(result.to_dict())
# {
#   "similarity": 0.82,
#   "match":      True,
#   "threshold":  0.70,
# }

API Reference

FaceMatcher(threshold, det_size, providers)

Parameter Type Description
threshold float Similarity cut-off for the match/no-match decision
det_size (int, int) Face detector input resolution (default 640×640)
providers list[str] ONNX Runtime execution providers

Methods

Method Input Description
match(img1, img2) np.ndarray (BGR) Compare two OpenCV images
match_from_path(p1, p2) str | Path Compare two image files
match_from_base64(b1, b2) str Compare two base64 strings or data-URIs

All methods accept an optional threshold keyword to override the instance default for a single call.

MatchResult

Field Type Description
similarity float Display similarity score in the range 0.0 – 1.0
match bool True if similarity >= threshold
threshold float Threshold used for this comparison

License

MIT © Raja Kaushal

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

face_matching_king-0.1.1.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

face_matching_king-0.1.1-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file face_matching_king-0.1.1.tar.gz.

File metadata

  • Download URL: face_matching_king-0.1.1.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for face_matching_king-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1ebcd7a2fa7fd98f23f93f4e63f61789c2ff83eeb1026b33fa3ab84f65c76304
MD5 7d61d464f11db6f07cedc3bec65f12c7
BLAKE2b-256 8163514f613d5ce045ca706278a44a4b6b0df0fa3b8af28bdbdb9206b7881f72

See more details on using hashes here.

File details

Details for the file face_matching_king-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for face_matching_king-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 78c9595a14c4664fc9e990a584e1a709a857bb3504a8d062f0b657842ecf3d31
MD5 257c3dadd64f28152dcc895811580b98
BLAKE2b-256 7ec4dcd142ef24157f3c25aeac31bf83e5033013ee573d56717e00a9e28b6c48

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page