Skip to content

Face recognition iOS with 3D passive liveness detection(anti-spoofing). This repo supports the following functionality: face matching, face compare, face comparison, facial recognition, feature extraction, face anti-spoofing and face liveness for IDV

Notifications You must be signed in to change notification settings

kby-ai/FaceRecognition-iOS

Repository files navigation

📚 Product & Resources - Here

🛟 Help Center - Here

💼 KYC Verification Demo - Here

🙋‍♀️ Docker Hub - Here

FaceRecognition-iOS

Overview

This repository demonstrates both face liveness detection and face recognition technology developed from KBY-AI.

In this repository, we integrated KBY-AI's both face liveness detection and face recognition technology into iOS platform.

◾FaceSDK(Mobile) Details

Basic 🔽 Standard Premium
Face Detection Face Detection Face Detection
Face Liveness Detection Face Liveness Detection Face Liveness Detection
Pose Estimation Pose Estimation Pose Estimation
Face Recognition Face Recognition
68 points Face Landmark Detection
Face Quality Calculation
Face Occlusion Detection
Eye Closure Detection
Age, Gender Estimation

◾FaceSDK(Mobile) Product List

No. Repository SDK Details
1 Face Liveness Detection - Android Basic SDK
2 Face Liveness Detection - iOS Basic SDK
3 Face Recognition - Android Standard SDK
➡️ Face Recognition - iOS Standard SDK
5 Face Recognition - Flutter Standard SDK
6 Face Recognition - React-Native Standard SDK
7 Face Attribute - Android Premium SDK
8 Face Attribute - iOS Premium SDK

To get Face SDK(server), please visit products here.

Download on the App Store

Performance Video

You can visit our YouTube video here to see how well our demo app works.

Face Recognition Android

Screenshots

SDK License

The face recognition project relies on kby-ai's SDK, which requires a license for each bundle ID.

  • The code below shows how to use the license:

    var ret = FaceSDK.setActivation("bv5lxJJiUWq/TW3LDv4VUIQLMRN0TeOQSaMmAvt1jIRwfTjMIIh9IZxl5R1wncfiituo8sf9N+62" +
    "L+CcSdMdDNBaXAdwWNRvahc8G4cUTpH6jcchgqdf0evH/syEqvc4ew8ZXDf/kyMYFMwhXPWsuuDA" +
    "mxZrbrdZPHMJgTBNTKOP0ntD2ao81sSpCaXsEaIe6eYGJRUiJ5txMERM5Q3w6bnZEXjvBu1kXsup" +
    "OEYrxnynCxK4OodTp1M5VscT8THm+QKLnxRX7X69hD1zfIUKTlMXrLWFmGSmWJeC5Z/MzHqkuqOd" +
    "bSNBO/7yHLCil6ViA7VY7scdto2yyaF7yZakQg==")
    if(ret == SDK_SUCCESS.rawValue) {

  • To request a license, please ping us on the following contact address:

Please contact us:

🧙Email: contact@kby-ai.com
🧙Telegram: @kbyai
🧙WhatsApp: +19092802609
🧙Skype: live:.cid.66e2522354b1049b
🧙Facebook: https://www.facebook.com/KBYAI

About SDK

Set up

  1. Copy the SDK (facesdk.framework folder) to the root folder of your project.

  2. Add SDK framework to the project in xcode

Project Navigator -> General -> Frameworks, Libraries, and Embedded Content

image

  1. Add the bridging header to your project settings

Project Navigator -> Build Settings -> Swift Compiler - General

image

Initializing an SDK

  • Step One

To begin, you need to activate the SDK using the license that you have received.

FaceSDK.setActivation("...") 

If activation is successful, the return value will be SDK_SUCCESS. Otherwise, an error value will be returned.

  • Step Two

After activation, call the SDK's initialization function.

FaceSDK.initSDK()

If initialization is successful, the return value will be SDK_SUCCESS. Otherwise, an error value will be returned.

Face Detection and Liveness Detection

The FaceSDK offers a single function for detecting face and liveness detection, which can be used as follows:

let faceBoxes = FaceSDK.faceDetection(image)

CVPixelBufferLockBaseAddress(pixelBuffer, CVPixelBufferLockFlags.readOnly)
let ciImage = CIImage(cvPixelBuffer: pixelBuffer)
let context = CIContext()
let cgImage = context.createCGImage(ciImage, from: ciImage.extent)
let image = UIImage(cgImage: cgImage!)
CVPixelBufferUnlockBaseAddress(pixelBuffer, CVPixelBufferLockFlags.readOnly)
// Rotate and flip the image
let capturedImage = image.rotate(radians: .pi/2).flipHorizontally()
let faceBoxes = FaceSDK.faceDetection(capturedImage)
for faceBox in (faceBoxes as NSArray as! [FaceBox]) {

This function takes a single parameter, which is a UIImage object. The return value of the function is a list of FaceBox objects. Each FaceBox object contains the detected face rectangle, liveness score, and facial angles such as yaw, roll, and pitch.

Create Templates

The FaceSDK provides a function that can generate a template from a UIImage. This template can then be used to verify the identity of the individual captured in the image.

let templates = FaceSDK.templateExtraction(capturedImage, faceBox: faceBox)

let faceBox = faceBoxes[0] as! FaceBox
if(faceBox.liveness > livenessThreshold) {
let templates = FaceSDK.templateExtraction(capturedImage, faceBox: faceBox)

The SDK's template extraction function takes two parameters: a UIImage object and an object of FaceBox.

The function returns a Data, which contains the template that can be used for person verification.

Calculation similiarity

The "similarityCalculation" function takes a byte array of two templates as a parameter.

let similarity = FaceSDK.similarityCalculation(templates, templates2: personTemplates)

It returns the similarity value between the two templates, which can be used to determine the degree of similarity between the two individuals.

About

Face recognition iOS with 3D passive liveness detection(anti-spoofing). This repo supports the following functionality: face matching, face compare, face comparison, facial recognition, feature extraction, face anti-spoofing and face liveness for IDV

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published