Face Recognition

Pre-requisite: The user has to be signed in to perform the following operations.


Overview

Face registration lets a Home Security space recognise known people. A registered face is a named profile plus a set of images captured from several angles; once the backend has generated an embedding for it, events involving that person carry the face tag and list them in EventModel.faces (EventFaceModel.id / name). Face recognition must be switched on for the space first — SpaceSettings.face via updateSpaceSettings.

FacePosition lists the angles to capture — center, left, right, topLeft, topRight, bottomLeft, bottomRight — and exposes minimumImagePerAngle (2) / maximumImagePerAngle (5) so the capture screen can enforce the counts. center is mandatory: its first image becomes the thumbnail, and the upload fails with .uploadFailed(reason: "Missing center image") without it. The minimum applies to each angle that is present.

uploadFaceImage reports progress as ImageUploadingStatus: .uploading, .thumbnailUploading, .uploadSuccess(name:), .uploadFailed(reason:), .statusUpdatefailed.

All calls are on Factory.faceService.


List Faces

To fetch all faces associated with a space, The following method can be used:

  • spaceId (required): The space ID of the User.
  • queryItems (required): Contains the query parameter includeToken with value true used to filter the face list.
Factory.faceService.getFaces(
        spaceId: String,
        queryItems: [QueryItem]
    ) -> IVPublisher<FaceListModel>

Create Face

To create a new face within a space, The following method can be used:

  • spaceId (required): The space ID of the User.
  • request (required): Contains face profile information.
Factory.faceService.createFace(
        spaceId: String,
        request: UpdateFaceNameRequest
    ) -> IVPublisher<FaceResponseModel>

Update Face

To update an existing face, The following method can be used:

  • spaceId (required): The space ID of the User.
  • faceId (required): The ID of the face.
  • request (required): Contains the updated face information.
Factory.faceService.updateFace(
        spaceId: String,
        faceId: String,
        request: UpdateFaceNameRequest
    ) -> IVPublisher<FaceItemModel>

Delete Face

To delete an existing face, The following method can be used:

  • spaceId (required): The space ID of the User.
  • faceId (required): The ID of the face.
Factory.faceService.deleteFace(
        spaceId: String,
        faceId: String
    ) -> IVPublisher<Void>

Upload Face Images

To upload face images for a face, The following method can be used:

  • spaceId (required): The space ID of the User.
  • face (required): The face profile for which images will be uploaded.
  • images (required): Dictionary containing images grouped by face position.
Factory.faceService.uploadFaceImage(
        spaceId: String,
        face: FaceResponseModel,
        images: [FacePosition: [UIImage]]
    ) -> AnyPublisher<ImageUploadingStatus, Never>