flowers102_dataset | R Documentation |
Loads the Oxford 102 Category Flower Dataset. This dataset consists of 102 flower categories, with between 40 and 258 images per class. Images in this dataset are of variable sizes.
flowers102_dataset(
root = tempdir(),
split = "train",
transform = NULL,
target_transform = NULL,
download = FALSE
)
root |
Root directory for dataset storage. The dataset will be stored under |
split |
One of |
transform |
Optional function to transform input images after loading. Default is |
target_transform |
Optional function to transform labels. Default is |
download |
Logical. Whether to download the dataset if not found locally. Default is |
This is a classification dataset where the goal is to assign each image to one of the 102 flower categories.
The dataset is split into:
"train"
: training subset with labels.
"val"
: validation subset with labels.
"test"
: test subset with labels (used for evaluation).
An object of class flowers102_dataset
, which behaves like a torch dataset.
Each element is a named list:
x
: a W x H x 3 numeric array representing an RGB image.
y
: an integer label indicating the class index.
Other classification_dataset:
caltech_dataset
,
cifar10_dataset()
,
eurosat_dataset()
,
fer_dataset()
,
fgvc_aircraft_dataset()
,
mnist_dataset()
,
oxfordiiitpet_dataset()
,
tiny_imagenet_dataset()
## Not run:
# Load the dataset with inline transforms
flowers <- flowers102_dataset(
split = "train",
download = TRUE,
transform = . %>% transform_to_tensor() %>% transform_resize(c(224, 224))
)
# Create a dataloader
dl <- dataloader(
dataset = flowers,
batch_size = 4
)
# Access a batch
batch <- dataloader_next(dataloader_make_iter(dl))
batch$x # Tensor of shape (4, 3, 224, 224)
batch$y # Tensor of shape (4,) with numeric class labels
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.