FacialRecognitionModel

A class derived from BiometricsModel containing details specific to facial recognition

Declaration

@objc final public class FacialRecognitionModel : BiometricsModel {
    @objc final public var identifier: String { get }
    @objc final public var recognizedImage: UIImage { get }
    @objc final public var recognizedImagePath: String? { get }
    @objc final public var croppedRecognizedImage: UIImage { get }
    @objc final public var croppedRecognizedImagePath: String? { get }
    @objc final public var confidence: Float { get }
    
    @objc override final public func saveImages()
    override final public func encode(to encoder: Encoder) throws
}

Only relevant details are shown, boilerplate or standard Swift generated code is omitted

Summary

Public variables

Name

Type

Description

String

The unique identifier of the model that was recognized.

UIImage

The image that triggered recognition to succeed.

String?

UIImage

String?

Float

Indicates how confident the algorithm is that the face matched the trained model's face.

Public methods

Signature

Return Type

Description

Void

Void

Encodes the model using the encoder provided. Used to convert the model to JSON.

Public variables

identifier

@objc final public var identifier: String { get }

The unique identifier of the model that was recognized.

recognizedImage

@objc final public var recognizedImage: UIImage { get }

The image that triggered recognition to succeed.

recognizedImagePath

@objc final public var recognizedImagePath: String? { get }

The path to recognizedImage, after it is saved. Otherwise nil.

croppedRecognizedImage

@objc final public var croppedRecognizedImage: UIImage { get }

The cropped version of recognizedImage, containing just the face.

croppedRecognizedImagePath

@objc final public var croppedRecognizedImagePath: String? { get }

The path to croppedRecognizedImage, after it is saved. Otherwise nil.

confidence

@objc final public var confidence: Float { get }

Indicates how confident the algorithm is that the face matched the trained model's face.

Range: 0 - 1

Due to the laws of physics and limitations that exists between humans and machines, values will rarely be exactly 1 or 0 but should not be discredited.

The closer the value is to 0 the less the face matched the trained model's face. The closer the value is to 1 the more the face matched the trained model's face.

Public methods

saveImages()

@objc override final public func saveImages()

This function also calls its super function

Saves the recognizedImage and croppedRecognizedImage and populates their respective path variables.

encode(to encoder: Encoder)

override final public func encode(to encoder: Encoder) throws

This function also calls its super function

Encodes the model using the encoder provided. Used to convert the model to JSON.

See also

Where this is used

Last updated