Datasets
Dataset utilities provide convenient access to commonly used datasets for experimentation and benchmarking.
All dataset loaders documented here are part of KeyDNN’s public presentation API.
load_mnist
Load the MNIST dataset with sensible defaults.
This is a thin convenience wrapper around :class:MNIST that:
- Uses a default dataset root (data/)
- Automatically downloads the dataset if it is not already present
- Exposes only the commonly tuned parameters in the public API
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
train
|
bool
|
Whether to load the training split. If False, loads the test split. |
True
|
transform
|
callable
|
Optional transform applied to each image. |
None
|
target_transform
|
callable
|
Optional transform applied to each label. |
None
|
normalize
|
bool
|
Whether to apply standard MNIST mean/std normalization. |
True
|
return_numpy
|
bool
|
Whether to return NumPy arrays. If False, callers may wrap outputs into tensors downstream. |
False
|
dtype
|
str
|
Floating-point dtype used for image conversion. |
"float32"
|
root_path
|
str or Path
|
Base directory for dataset storage. The MNIST files are stored under
|
"data"
|
Returns:
| Type | Description |
|---|---|
MNIST
|
An initialized MNIST dataset instance. |
load_cifar10
Load the CIFAR-10 dataset with sensible defaults.
This is a thin convenience wrapper around :class:CIFAR10 that:
- Uses a default dataset root (data/)
- Automatically downloads the dataset if it is not already present
- Exposes only the commonly tuned parameters in the public API
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
train
|
bool
|
Whether to load the training split. If False, loads the test split. |
True
|
transform
|
callable
|
Optional transform applied to each image. |
None
|
target_transform
|
callable
|
Optional transform applied to each label. |
None
|
normalize
|
bool
|
Whether to apply standard CIFAR-10 mean/std normalization. |
True
|
return_numpy
|
bool
|
Whether to return NumPy arrays. If False, callers may wrap outputs into tensors downstream. |
False
|
dtype
|
str
|
Floating-point dtype used for image conversion. |
"float32"
|
root_path
|
str or Path
|
Base directory for dataset storage. The CIFAR-10 files are stored
under |
"data"
|
Returns:
| Type | Description |
|---|---|
CIFAR10
|
An initialized CIFAR-10 dataset instance. |
load_cifar100
Load the CIFAR-100 dataset with sensible defaults.
This is a thin convenience wrapper around :class:CIFAR100 that:
- Uses a default dataset root (data/)
- Automatically downloads the dataset if it is not already present
- Exposes only the commonly tuned parameters in the public API
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
train
|
bool
|
Whether to load the training split. If False, loads the test split. |
True
|
transform
|
callable
|
Optional transform applied to each image. |
None
|
target_transform
|
callable
|
Optional transform applied to each label. |
None
|
normalize
|
bool
|
Whether to apply standard CIFAR-100 mean/std normalization. |
True
|
return_numpy
|
bool
|
Whether to return NumPy arrays. If False, callers may wrap outputs into tensors downstream. |
False
|
dtype
|
str
|
Floating-point dtype used for image conversion. |
"float32"
|
root_path
|
str or Path
|
Base directory for dataset storage. The CIFAR-100 files are stored
under |
"data"
|
Returns:
| Type | Description |
|---|---|
CIFAR100
|
An initialized CIFAR-100 dataset instance. |
Notes
- Dataset loaders may download data automatically if not already present.
- Returned data is typically provided as NumPy arrays or
Tensorobjects, depending on configuration. - For reproducibility, consider setting seeds and determinism before loading datasets.