if (FALSE) {
# Load Pascal VOC segmentation dataset (2007 train split)
pascal_seg <- pascal_segmentation_dataset(
transform = transform_to_tensor,
download = TRUE,
year = "2007"
)
# Access the first image and its mask
first_item <- pascal_seg[1]
first_item$x # Image
first_item$y$masks # Segmentation mask
first_item$y$labels # Unique class labels in the mask
pascal_seg$classes[first_item$y$labels] # Class names
# Visualise the first image and its mask
masked_img <- draw_segmentation_masks(first_item)
tensor_image_browse(masked_img)
# Load Pascal VOC detection dataset (2007 train split)
pascal_det <- pascal_detection_dataset(
transform = transform_to_tensor,
download = TRUE,
year = "2007"
)
# Access the first image and its bounding boxes
first_item <- pascal_det[1]
first_item$x # Image
first_item$y$labels # Object labels
first_item$y$boxes # Bounding box tensor
# Visualise the first image with bounding boxes
boxed_img <- draw_bounding_boxes(first_item)
tensor_image_browse(boxed_img)
}
Run the code above in your browser using DataLab