| image_scores_dir | R Documentation |
This function scans a directory for image files and computes scores for each image using a Hugging Face CLIP model. It loads the model once and reuses text embeddings for speed, returning one row per image with the filename as image_id and probability columns for each class.
image_scores_dir(
dir,
classes,
face_selection = "largest",
pattern = "\\.(jpg|jpeg|png|bmp)$",
recursive = FALSE,
model = "oai-base",
local_model_path = NULL,
face_detector = c("yunet", "haar")
)
dir |
Path to a directory containing images. |
classes |
Character vector of labels/classes (length >= 2). |
face_selection |
Face selection strategy: "largest", "left", "right", or
"none" (one row per image), "all" (one row per face, with faces of the same
person sharing a |
pattern |
Optional regex to filter images (default supports common formats). |
recursive |
Whether to search subdirectories (default FALSE). |
model |
CLIP model alias or HuggingFace model id (see image_scores()). |
local_model_path |
Optional local path to a pre-downloaded model. |
face_detector |
|
A data.frame with columns: image_id and one column per class. With
"all" or a data frame of faces, one row per face, with the columns of
face_scores after image_id.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.