kaira.data.sample_data.ImageDataset

Inheritance diagram of ImageDataset

Inheritance diagram for ImageDataset

class kaira.data.sample_data.ImageDataset(name: str = 'cifar10', train: bool = True, size: Tuple[int, int] | None = None, normalize: bool = True, root: str = '~/.cache/kaira')[source]

Bases: Dataset

Simple wrapper for common image datasets.

Provides easy access to CIFAR-10, CIFAR-100, and MNIST datasets with consistent interface and optional preprocessing.

Methods

__init__

Initialize the image dataset.

subset

Create a random subset of the dataset.

__init__(name: str = 'cifar10', train: bool = True, size: Tuple[int, int] | None = None, normalize: bool = True, root: str = '~/.cache/kaira')[source]

Initialize the image dataset.

Parameters:
  • name – Dataset name (“cifar10”, “cifar100”, “mnist”)

  • train – Whether to use training split

  • size – Target image size (H, W). If None, uses original size

  • normalize – Whether to normalize images to [0, 1]

  • root – Root directory for dataset storage

subset(size: int, seed: int | None = None) Subset[source]

Create a random subset of the dataset.

Parameters:
  • size – Number of samples in the subset

  • seed – Random seed for reproducibility

Returns:

Subset of the dataset