| 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
)
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". |
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. |
A data.frame with columns: image_id and one column per class.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.