hf_detect_objects: Detect Objects in Images

View source: R/multimodal.R

hf_detect_objectsR Documentation

Detect Objects in Images

Description

Detect objects and bounding boxes in images using an object-detection model via the Hugging Face Inference Providers API.

Usage

hf_detect_objects(
  image,
  threshold = NULL,
  model = hf_default_model("detect_objects"),
  token = NULL,
  endpoint_url = NULL,
  content_type = NULL,
  ...
)

Arguments

image

Image input: a local file path, URL, raw vector, or vector/list of paths/URLs.

threshold

Numeric or NULL. Optional minimum confidence score to keep.

model

Character string. Model ID from Hugging Face Hub. Default: "facebook/detr-resnet-50".

token

Character string or NULL. API token for authentication.

endpoint_url

Character string or NULL. A custom Inference Endpoint URL.

content_type

Character string or NULL. MIME type to use for raw image inputs. Paths and URLs are inferred when possible.

...

Additional arguments (currently unused).

Value

A tibble with columns: image, label, score, xmin, ymin, xmax, ymax.

See Also

https://huggingface.co/docs/inference-providers/tasks/object-detection

Examples

## Not run: 
boxes <- hf_detect_objects("cat.png", threshold = 0.5)
boxes

## End(Not run)

huggingfaceR documentation built on Aug. 30, 2026, 1:06 a.m.