The VGGFace2 dataset is a large-scale face recognition dataset containing images of celebrities from a wide range of ethnicities, professions, and ages. Each identity has multiple images with variations in context, pose, age, and illumination.
vggface2_dataset(
root = tempdir(),
split = "val",
transform = NULL,
target_transform = NULL,
download = FALSE
)Character. Root directory where the dataset will be stored under root/vggface2.
One of "train", "val", or "test". Default is "val".
Optional. A function that takes an image and returns a transformed version (e.g., normalization, cropping).
Optional. A function that transforms the label.
Logical. If TRUE, downloads the dataset to root/. If the dataset is already present, download is skipped.
A torch dataset object vggface2_dataset:
x: RGB image array.
y: Integer label (1…N) for the identity.
ds$classes is a named list mapping integer labels to a list with:
name: Character name of the person.
gender: "Male" or "Female".
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(),
places365_dataset(),
tiny_imagenet_dataset(),
whoi_plankton_dataset(),
whoi_small_coralnet_dataset()
if (FALSE) { # \dontrun{
#Load the training set
ds <- vggface2_dataset(download = TRUE)
item <- ds[1]
item$x # image array RGB
item$y # integer label
ds$classes[item$y] # list(name=..., gender=...)
#Load the test set
ds <- vggface2_dataset(download = TRUE, train = FALSE)
item <- ds[1]
item$x # image array RGB
item$y # integer label
ds$classes[item$y] # list(name=..., gender=...)
} # }