medmnist_fetcher
orchard.data_handler.fetchers.medmnist_fetcher
¶
MedMNIST Dataset Fetcher.
Downloads MedMNIST NPZ files with robust retry logic, MD5 verification,
and atomic file operations. Follows the same pattern as galaxy10_converter
to keep each domain's fetch logic self-contained.
ensure_medmnist_npz(metadata, retries=5, delay=5.0)
¶
Downloads a MedMNIST NPZ file with retries and MD5 validation.
Implements a three-phase strategy
- Return immediately if a valid local copy already exists.
- Delete any corrupted local copy.
- Stream-download with retry loop and atomic file replacement.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metadata
|
DatasetMetadata
|
Metadata containing URL, MD5, name and target path. |
required |
retries
|
int
|
Max number of download attempts. |
5
|
delay
|
float
|
Base delay (seconds) between retries (quadratic backoff on 429). |
5.0
|
Returns:
| Name | Type | Description |
|---|---|---|
Path |
Path
|
Path to the successfully validated .npz file. |
Raises:
| Type | Description |
|---|---|
OrchardDatasetError
|
If all download attempts fail. |