Caltech-101 Detection Dataset
caltech101_detection_dataset(
root = tempdir(),
transform = NULL,
target_transform = NULL,
download = FALSE
)
Root directory where the dataset is stored or will be downloaded to.
Optional transform function applied to the image.
Optional transform function applied to the target (labels, boxes, etc.).
Logical. If TRUE, downloads and extracts the dataset if not already present in root
.
A torch dataset. Each item is a list with two elements:
A 3D torch_tensor
of shape (3, H, W)
representing the image in RGB format.
A list with:
A 2D torch_tensor
of shape (1, 4)
containing the bounding box in xywh
format.
A character scalar giving the class label for the image.
A 2D torch_tensor
of shape (N, 2)
with the object contour coordinates.
Loads the Caltech-101 dataset with image-level labels, bounding boxes, and object contours.
if (FALSE) { # \dontrun{
caltech101 <- caltech101_detection_dataset(download = TRUE)
first_item <- caltech101[1]
first_item$x <- torch_tensor(first_item$x, dtype = torch::torch_uint8())
# Draw bounding box
bboxes <- draw_bounding_boxes(
image = first_item$x,
boxes = first_item$y$boxes,
labels = caltech101$classes[first_item$y$labels],
colors = "red"
)
tensor_image_browse(bboxes)
# Draw contour points as keypoints
contour_points <- draw_keypoints(
image = first_item$x,
keypoints = first_item$y$contour,
colors = "green",
radius = 2
)
tensor_image_browse(contour_points)
} # }