faces_functions.php
Table of Contents
Functions
- faces_detect() : bool
- Detects faces in the image associated with a given resource.
- faces_tag() : bool
- Tags detected faces in a given resource based on similarity to existing tagged faces.
- api_faces_set_node() : bool
- API function to update the named person tag for a specific face using the provided node value.
- faces_detect_missing() : int
- Detect faces in resources that have not yet been processed
- faces_count_missing() : int
- Return count of images to process
- faces_count_faces() : int
- Return a count of the detected faces
Functions
faces_detect()
Detects faces in the image associated with a given resource.
faces_detect(int $ref[, bool $force = false ]) : bool
This function attempts to locate a suitable JPEG file for the specified resource.
It then sends the file to the Python FastAPI service. For each detected
face, it records the bounding box, detection score, and face vector into the
resource_face database table. The resource is then marked as processed.
Parameters
- $ref : int
-
The resource reference ID to process.
- $force : bool = false
-
Force the processing of this resource, for example when replacing the file or where it was previously not possible to find the file.
Return values
bool —Returns true if face detection and storage were successful, or false if the file was missing, the service failed, or invalid data was returned.
faces_tag()
Tags detected faces in a given resource based on similarity to existing tagged faces.
faces_tag(int $resource) : bool
This function finds all untagged faces for the specified resource, sends each face to
the Python FastAPI service to find similar known faces, and tags the face with
the most frequently matched metadata node. It also updates the resource_face table
to associate the face with the chosen metadata node.
Parameters
- $resource : int
-
The resource reference ID to process and tag faces for.
Return values
bool —Returns true on successful processing, or false if any service errors or invalid responses are encountered.
api_faces_set_node()
API function to update the named person tag for a specific face using the provided node value.
api_faces_set_node(int $resource, int $face, int $node) : bool
Typically triggered when selecting a name from a dropdown, this function assigns a metadata node
(e.g. representing a person) to a face record in the resource_face table by updating the node field.
Parameters
- $resource : int
- $face : int
-
The unique reference ID of the face to update (from
resource_face.ref). - $node : int
-
The node ID to assign to the face (typically corresponds to a controlled vocabulary entry).
Tags
Return values
bool —Returns true on successful update.
faces_detect_missing()
Detect faces in resources that have not yet been processed
faces_detect_missing() : int
Tags
Return values
int —A count of the resources processed.
faces_count_missing()
Return count of images to process
faces_count_missing() : int
Return values
int —The count
faces_count_faces()
Return a count of the detected faces
faces_count_faces() : int
Return values
int —The count