KYC selfie verification compares a live photo of you with the photo on your ID document to confirm the document is yours. It runs in four steps: find the face in both images, check the selfie's quality (face big enough, sharp, properly lit), turn each face into an embedding (a vector from a face-recognition model) and compare them with cosine similarity , then decide: match above the threshold, human review below it, or retry when quality is too poor to judge. A liveness check runs alongside, to make sure the selfie is a live person and not a photo. The quality gate matters more than it looks: asking for a better photo is cheaper than a wrong decision on a bad one. Tested Python for the gates and the decision is below.
The decision flow tested below, with each outcome and the message a user would see.
Step 1: quality gates
A face recognition model will produce a score for any image, including a blurry, dark one where the face is a few pixels wide.…