Created
March 13, 2021 00:22
-
-
Save symisc/bcd7d41b93513be3ed6e10291e0a3bba to your computer and use it in GitHub Desktop.
Face Verification. Check whether the given two face image (eg. selfie and ID photo) belong to the same person or not using the PixLab API - https://pixlab.io/cmd?id=facecompare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
# Given two faces (eg. selfie and ID photo). Check whether they belong to the same person or not. | |
# https://pixlab.io/#/cmd?id=facecompare for additional information. | |
src = 'https://static-secure.guim.co.uk/sys-images/Guardian/Pix/pictures/2012/7/9/1341860104423/obama_face.jpg' | |
target = 'https://static01.nyt.com/images/2011/07/31/sunday-review/FACES/FACES-jumbo.jpg' | |
# Unrelated face | |
#target = 'https://s-media-cache-ak0.pinimg.com/736x/60/aa/e4/60aae45858ab6ce9dc5b33cc2e69baf7.jpg' | |
req = requests.get('https://api.pixlab.io/facecompare',params={ | |
'src': src, | |
'target': target, | |
'key':'PIXLAB_API_KEY', # Get your PixLab API Key at https://pixlab.io/dashboard | |
}) | |
reply = req.json() | |
if reply['status'] != 200: | |
print (reply['error']) | |
else: | |
print ("Same Face: "+ str(reply['same_face'])) | |
print ("Confidence: "+ str(reply['confidence'])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment