load_dataset#

load_dataset(train: bool = True, batch_size: int = 32, num_workers: int = 0, shuffle: bool = False, pin_memory: bool = True, object_type: Literal['VisionData', 'DataLoader'] = 'DataLoader', n_samples: Optional[int] = None, device: Union[str, device] = 'cpu') Union[DataLoader, VisionData][source]#

Get the COCO128 dataset and return a dataloader.

Parameters
trainbool, default: True

if True train dataset, otherwise test dataset

batch_sizeint, default: 32

Batch size for the dataloader.

num_workersint, default: 0

Number of workers for the dataloader.

shufflebool, default: False

Whether to shuffle the dataset.

pin_memorybool, default: True

If True, the data loader will copy Tensors into CUDA pinned memory before returning them.

object_typeLiteral[‘Dataset’, ‘DataLoader’], default: ‘DataLoader’

type of the return value. If ‘Dataset’, deepchecks.vision.VisionData will be returned, otherwise torch.utils.data.DataLoader

n_samplesint, optional

Only relevant for loading a VisionData. Number of samples to load. Return the first n_samples if shuffle is False otherwise selects n_samples at random. If None, returns all samples.

devicet.Union[str, torch.device], default‘cpu’

device to use in tensor calculations

Returns
Union[DataLoader, VisionData]

A DataLoader or VisionData instance representing COCO128 dataset