Facial Training

Declaration

func trainFace(
    on viewController: UIViewController, 
    for identifier: String, 
    success: SybrinBiometrics.facialTrainingSuccessCallbackType? = nil, 
    failure: SybrinBiometrics.failureCallbackType? = nil, 
    cancel: SybrinBiometrics.cancelCallbackType? = nil
)

To view all the type aliases, go to the SybrinBiometrics class

Handling thesuccess , failureor cancel callbacks are optional but recommended.

Calling the function

Parameters

Type

Description

UIViewController

The controller you would like to present on.

String

The identifier you would like to train this face for.

Sybrin does not provide user management for the identifiers you train and recognize on your license key. The proper management and storage of unique identifiers is the sole responsibility of you as the developer.

Handling callback responses

success

The success callback will be executed after the session has finished and the view controller has been dismissed.

Parameters:

Type

Description

An object containing the results of the facial training session.

Example:

success: { (model) in
    print("Facial training finished. Took \(model.trainingTimeTakenMilliseconds) milliseconds to train")
}

failure

The failure callback will be executed after the session has failed and the view controller has been dismissed.

Parameters:

Type

Description

String

A message describing the error.

If you would like to report a bug, contact us!

Example:

failure: { (message) in
    print("Facial training failed because \(message)")
}

cancel

The cancel callback will be executed after the user has dismissed the view controller and before the session could finish.

Parameters:

None

Example:

cancel: {
    print("Facial training canceled")
}

Full Example

let identifier = "uniqueIdentifier"

SybrinBiometrics.shared.trainFace(on: self, for: identifier) { (model) in
    print("Facial training finished. Took \(model.trainingTimeTakenMilliseconds) milliseconds to train")
} failure: { (message) in
    print("Facial training failed because \(message)")
} cancel: {
    print("Facial training canceled")
}

Last updated