Oxford-IIIT Pet Datasets
Character. Root directory where the dataset is stored or will be downloaded to. Files are placed under root/oxfordiiitpet
.
Logical. If TRUE, use the training set; otherwise, use the test set. Not applicable to all datasets.
Optional. A function that takes an image and returns a transformed version (e.g., normalization, cropping).
Optional. A function that transforms the label.
Logical. If TRUE, downloads the dataset to root/
. If the dataset is already present, download is skipped.
A torch dataset object oxfordiiitpet_dataset
or oxfordiiitpet_binary_dataset
.
Each element is a named list with:
x
: A H x W x 3 integer array representing an RGB image.
y
: An integer label:
For oxfordiiitpet_dataset
: a value from 1–37 representing the breed.
For oxfordiiitpet_binary_dataset
: 1 for Cat, 2 for Dog.
The Oxford-IIIT Pet collection is a classification dataset consisting of high-quality images of 37 cat and dog breeds. It includes two variants:
oxfordiiitpet_dataset
: Multi-class classification across 37 pet breeds.
oxfordiiitpet_binary_dataset
: Binary classification distinguishing cats vs dogs.
The Oxford-IIIT Pet dataset contains over 7,000 images across 37 categories, with roughly 200 images per class. Each image is labeled with its breed and species (cat/dog).
Other classification_dataset:
caltech_dataset
,
cifar10_dataset()
,
eurosat_dataset()
,
fer_dataset()
,
fgvc_aircraft_dataset()
,
flowers102_dataset()
,
mnist_dataset()
,
tiny_imagenet_dataset()
if (FALSE) { # \dontrun{
# Multi-class version
oxford <- oxfordiiitpet_dataset(download = TRUE)
first_item <- oxford[1]
first_item$x # RGB image
first_item$y # Label in 1–37
oxford$classes[first_item$y] # Breed name
# Binary version
oxford_bin <- oxfordiiitpet_binary_dataset(download = TRUE)
first_item <- oxford_bin[1]
first_item$x # RGB image
first_item$y # 1 for Cat, 2 for Dog
oxford_bin$classes[first_item$y] # "Cat" or "Dog"
} # }