oxfordiiitpet_dataset | R Documentation |
Oxford-IIIT Pet Datasets
oxfordiiitpet_dataset(
root = tempdir(),
train = TRUE,
transform = NULL,
target_transform = NULL,
download = FALSE
)
oxfordiiitpet_binary_dataset(
root = tempdir(),
train = TRUE,
transform = NULL,
target_transform = NULL,
download = FALSE
)
root |
Character. Root directory where the dataset is stored or will be downloaded to. Files are placed under |
train |
Logical. If TRUE, use the training set; otherwise, use the test set. Not applicable to all datasets. |
transform |
Optional. A function that takes an image and returns a transformed version (e.g., normalization, cropping). |
target_transform |
Optional. A function that transforms the label. |
download |
Logical. If TRUE, downloads the dataset to |
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).
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.
Other classification_dataset:
caltech_dataset
,
cifar10_dataset()
,
eurosat_dataset()
,
fer_dataset()
,
fgvc_aircraft_dataset()
,
flowers102_dataset()
,
mnist_dataset()
,
tiny_imagenet_dataset()
## Not run:
# 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"
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.