dataeval.utils.data.datasets.CIFAR10

class dataeval.utils.data.datasets.CIFAR10(root, download=False, image_set='train', size=-1, classes=None, unit_interval=False, dtype=None, channels='channels_first', flatten=False, crop=None, normalize=None, balance=True, slice_back=False, verbose=False)

CIFAR10 Dataset as Torch tensors.

Parameters:
root : str or pathlib.Path

Root directory of dataset where the mnist folder exists.

download : bool, default False

If True, downloads the dataset from the internet and puts it in root directory. Class checks to see if data is already downloaded to ensure it does not create a duplicate download.

image_set : "train", "test" or "base", default "train"

If “base”, returns all of the data to allow the user to create their own splits.

size : int, default -1

Limit the dataset size, must be a value greater than 0.

classes : "airplane", "automobile", "bird", "cat", "deer", "dog", "frog", "horse", "ship", "truck", int, list, or None, default None

Option to select specific classes from dataset. Classes are 0-9, any other number is ignored.

unit_interval : bool, default False

Shift the data values to the unit interval [0-1].

dtype : type | None, default None

Change the NumPy dtype - data is loaded as np.uint8

channels : "channels_first" or "channels_last", default "channels_first"

Location of channel axis, default is channels first (N, 1, 28, 28)

flatten : bool, default False

Flatten data into single dimension (N, 784) - cannot use both channels and flatten. If True, channels parameter is ignored.

normalize : tuple[mean, std] or None, default None

Normalize images acorrding to provided mean and standard deviation

balance : bool, default True

If True, returns equal number of samples for each class.

slice_back : bool, default False

If True and size has a value greater than 0, then grabs selection starting at the last image.

verbose : bool, default False

If True, outputs print statements.

crop : int | None

index2label

Dictionary which translates from class integers to the associated class strings.

Type:

dict

label2index

Dictionary which translates from class strings to the associated class integers.

Type:

dict

dataset_dir

Location of the folder containing the data. Different from root if downloading data.

Type:

Path

metadata

Dictionary containing Dataset metadata, such as id which returns the dataset class name.

Type:

dict

class_set

The chosen set of labels to use. Default is all 10 classes (0-9) but can be down selected using the classes parameter.

Type:

set

num_classes

The number of classes in class_set.

Type:

int

info()

Pretty prints dataset name and information.

Return type:

str