R/dataset-rf100-peixos.R
rf100_peixos_segmentation_dataset.RdLoads the Roboflow 100 "peixos" dataset for semantic segmentation. "peixos" contains 3 splits of respectively 821 / 118 / 251 color images of size 640 x 640. Segmentation masks are generated on-the-fly from polygon annotations of the unique "fish" category.
the subset of the dataset to choose between c("train", "test", "valid").
directory path to download the dataset.
Logical. If TRUE, downloads the dataset if not present at root.
Optional transform function applied to the image.
Optional transform function applied to the target.
Optional transform function applied to the whole item, such as
item_transform_rotate(), once transform and target_transform have been applied.
It is only used by .getitem(), not by the batched .getbatch().
A torch dataset. Each element is a named list with:
x: H × W × 3 array (use transform_to_tensor() in transform to get
C × H × W tensor).
y: a list with:
masks: boolean tensor of shape (1, H, W).
labels: integer vector with the class index (always 1 for "fish").
The returned item is given class image_with_segmentation_mask so it can be
visualised with helpers like draw_segmentation_masks(), and its y is given
class segmentation_target, which target transforms dispatch on. The dataset
itself inherits segmentation_dataset.
Other segmentation_dataset:
cityscapes_dataset(),
coco_segmentation_dataset(),
oxfordiiitpet_segmentation_dataset(),
pascal_voc_datasets
if (FALSE) { # \dontrun{
ds <- rf100_peixos_segmentation_dataset(
split = "train",
transform = transform_to_tensor,
download = TRUE
)
item <- ds[1]
overlay <- draw_segmentation_masks(item)
tensor_image_browse(overlay)
} # }