Learn R Programming

torchvision (version 0.7.0)

caltech_dataset: Caltech Datasets

Description

Caltech Datasets

Loads the Caltech-256 Object Category Dataset for image classification. It consists of 30,607 images across 256 distinct object categories. Each category has at least 80 images, with variability in image size.

Usage

caltech101_dataset(
  root = tempdir(),
  transform = NULL,
  target_transform = NULL,
  download = FALSE
)

caltech256_dataset( root = tempdir(), transform = NULL, target_transform = NULL, download = FALSE )

Value

An object of class caltech101_dataset, which behaves like a torch dataset. Each element is a named list with:

  • x: A H x W x 3 integer array representing an RGB image.

  • y: An Integer representing the label.

An object of class caltech256_dataset, which behaves like a torch dataset. Each element is a named list with:

  • x: A H x W x 3 integer array representing an RGB image.

  • y: An Integer representing the label.

Arguments

root

Character. Root directory for dataset storage. The dataset will be stored under root/caltech256.

transform

Optional function to transform input images after loading. Default is NULL.

target_transform

Optional function to transform labels. Default is NULL.

download

Logical. Whether to download the dataset if not found locally. Default is FALSE.

Details

The Caltech-101 and Caltech-256 collections are classification datasets made of color images with varying sizes. They cover 101 and 256 object categories respectively and are commonly used for evaluating visual recognition models.

The Caltech-101 dataset contains around 9,000 images spread over 101 object categories plus a background class. Images have varying sizes.

Caltech-256 extends this to about 30,000 images across 256 categories.

See Also

Other classification_dataset: cifar10_dataset(), eurosat_dataset(), fer_dataset(), fgvc_aircraft_dataset(), flowers102_dataset(), mnist_dataset(), oxfordiiitpet_dataset(), tiny_imagenet_dataset()

Examples

Run this code
if (FALSE) {
caltech101 <- caltech101_dataset(download = TRUE)

first_item <- caltech101[1]
first_item$x  # Image array
first_item$y  # Integer label
}

Run the code above in your browser using DataLab