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.3.tar.gz (6.5 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.3-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: face_matching_king-0.1.3.tar.gz
  • Upload date:
  • Size: 6.5 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.3.tar.gz
Algorithm Hash digest
SHA256 d2dddb80b06a091dc9d5eb6087c0262cfe4182159d8a133557b25db69164a0ba
MD5 9fc66f66722bcdfd624b5a82e1371c51
BLAKE2b-256 e522ead764ae69a9598a4b343fb5b0e718c418fa3037259ca012281974115e6c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for face_matching_king-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4308c458e29a54eedfe92306fc498d40d2a137b8fbc5252c6fc771ac227671ac
MD5 25c49872b9f9a7b35cb4bebe231d4768
BLAKE2b-256 f6de36fe7e71f8c77926f0b6dfc618b418d574aab36a66ac1837943c925a3123

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