captcha_dataset | R Documentation |
This object implements a dataset using the torch::dataset()
framework.
It loads all the images in torch tensors, as well as the labels.
captcha_dataset(
root,
transform_image = captcha::captcha_transform_image,
transform_label = captcha::captcha_transform_label,
augmentation = NULL
)
root |
(string): root directory where the files are stored |
transform_image |
(callable, optional): A function/transform
that takes in an file path and returns an torch tensor prepared
to feed the model. By default, uses the |
transform_label |
(callable, optional): A function/transform
that takes in the file paths and transform them. By default, uses the
|
augmentation |
(function, optional) If not This is an object of class The function calculates the vocabulary based on the identified values in the dataset. |
if (torch::torch_is_installed()) {
annotated_folder <- system.file(
"examples/annotated_captcha",
package = "captcha"
)
suppressMessages({
ds <- captcha_dataset(annotated_folder)
})
# gets the first item (the only item in the example)
# returns a list with x and y torch tensors.
ds$.getitem(1)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.