dtorchvision.datasets

Description

This package contains some datasets for Image computation. Here’s and example of how to use it:

from dtorchvision.datasets import MNISTDataset

dataset = MNISTDataset(download=True)

(x, _), _ = dataset.data

Datasets

class MNISTDataset(JDataset)

The MNIST dataset.

__init__(root: str = './data', split: Tuple[str] | str = ('train', 'test'), download: bool = False)
Parameters:
  • root – The root directory where the dataset will be stored.

  • split – The split to be used. Can be a tuple of strings or a single string.

  • download – If True, downloads the dataset from the internet and puts it in root directory. If dataset is already downloaded, it is not downloaded again.

data: Tuple[Tuple[torch.Tensor, torch.Tensor], Tuple[torch.Tensor, torch.Tensor]]

The data of the dataset. It is a tuple of two tuples, the first one containing the training data and the second one containing the test data. Each tuple contains two tensors, the first one containing the images and the second one containing the labels.

train_data()
Returns:

The training data of the dataset. (x, y)

test_data()
Returns:

The test data of the dataset. (x, y)