| places365_dataset | R Documentation |
Loads the MIT Places365 dataset for scene classification.
places365_dataset(
root = tempdir(),
split = c("train", "val", "test"),
transform = NULL,
target_transform = NULL,
download = FALSE,
loader = magick_loader
)
places365_dataset_large(
root = tempdir(),
split = c("train", "val", "test"),
transform = NULL,
target_transform = NULL,
download = FALSE,
loader = magick_loader
)
root |
Root directory for dataset storage. The dataset will be stored under |
split |
One of |
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 |
loader |
A function to load an image given its path. Defaults to
|
The dataset provides three splits: "train", "val", and "test".
Folder structure and image layout on disk are handled internally by the loader.
This function downloads and prepares the smaller 256x256 image version (~30 GB).
For the high-resolution variant (~160 GB), use places365_dataset_large().
Note that images in the large version come in varying sizes, so resizing may be
needed before batching.
The test split corresponds to the private evaluation set used in the
Places365 challenge. Annotation files are not publicly released, so only the
images are provided.
A torch dataset of class places365_dataset. Each element is a named
list with:
x: the image as loaded (or transformed if transform is set).
y: the integer class label. For the test split, no labels are available
and y will always be NA.
places365_dataset_large(): High resolution variant (~160 GB).
Other classification_dataset:
caltech_dataset,
cifar10_dataset(),
eurosat_dataset(),
fer_dataset(),
fgvc_aircraft_dataset(),
flowers102_dataset(),
image_folder_dataset(),
lfw_dataset,
mnist_dataset(),
oxfordiiitpet_dataset(),
tiny_imagenet_dataset(),
whoi_plankton_dataset(),
whoi_small_coralnet_dataset()
## Not run:
ds <- places365_dataset(
split = "val",
download = TRUE,
transform = transform_to_tensor
)
item <- ds[1]
tensor_image_browse(item$x)
# Show class index and label
label_idx <- item$y
label_name <- ds$classes[label_idx]
cat("Label index:", label_idx, "Class name:", label_name, "\n")
dl <- dataloader(ds, batch_size = 2)
batch <- dataloader_next(dataloader_make_iter(dl))
batch$x
ds_large <- places365_dataset_large(
split = "val",
download = TRUE,
transform = . %>% transform_to_tensor() %>% transform_resize(c(256, 256))
)
dl <- torch::dataloader(dataset = ds_large, batch_size = 2)
batch <- dataloader_next(dataloader_make_iter(dl))
batch$x
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.