diagnostic
orchard.data_handler.diagnostic
¶
Diagnostic Utilities for Health Checks and Smoke Tests.
This private submodule provides lightweight data utilities used exclusively for pipeline validation (health checks, smoke tests, CI). These are not part of the production training pipeline.
create_synthetic_dataset(num_classes=8, samples=100, resolution=28, channels=3, name='syntheticmnist')
¶
Create a synthetic NPZ-compatible dataset for testing.
This function generates random image data and labels, saves them to a temporary .npz file, and returns a DatasetData object that can be used with the existing data pipeline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_classes
|
int
|
Number of classification categories (default: 8) |
8
|
samples
|
int
|
Number of training samples (default: 100) |
100
|
resolution
|
int
|
Image resolution (HxW) (default: 28) |
28
|
channels
|
int
|
Number of color channels (default: 3 for RGB) |
3
|
name
|
str
|
Dataset name for identification (default: "syntheticmnist") |
'syntheticmnist'
|
Returns:
| Name | Type | Description |
|---|---|---|
DatasetData |
DatasetData
|
A data object compatible with the existing pipeline |
Example
data = create_synthetic_dataset(num_classes=8, samples=100) train_loader, val_loader, test_loader = get_dataloaders( ... data, cfg.dataset, cfg.training, cfg.augmentation, cfg.num_workers ... )
Source code in orchard/data_handler/diagnostic/synthetic.py
create_synthetic_grayscale_dataset(num_classes=8, samples=100, resolution=28)
¶
Create a synthetic grayscale NPZ dataset for testing.
Convenience function for creating single-channel (grayscale) synthetic data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_classes
|
int
|
Number of classification categories (default: 8) |
8
|
samples
|
int
|
Number of training samples (default: 100) |
100
|
resolution
|
int
|
Image resolution (HxW) (default: 28) |
28
|
Returns:
| Name | Type | Description |
|---|---|---|
DatasetData |
DatasetData
|
A grayscale data object compatible with the pipeline |
Source code in orchard/data_handler/diagnostic/synthetic.py
create_temp_loader(dataset_path, batch_size=_DEFAULT_HEALTHCHECK_BATCH_SIZE)
¶
Load a NPZ dataset lazily and return a DataLoader for health checks.
This avoids loading the entire dataset into RAM at once, which is critical for large datasets (e.g., 224x224 images).