metadata
orchard.core.metadata
¶
Dataset Metadata Package.
This package centralizes the specifications for all supported datasets. It serves as the single source of truth for the Orchard, ensuring that data dimensions, labels, and normalization constants are consistent across the entire pipeline.
DatasetMetadata
¶
Bases: BaseModel
Immutable metadata container for a dataset entry.
Holds identity, source, image properties, and normalization constants
for both classification and detection datasets. Detection datasets
additionally specify an annotation_path for bounding-box labels.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Short identifier (e.g., |
display_name |
str
|
Human-readable name for reporting. |
md5_checksum |
str
|
MD5 hash for download integrity verification. |
url |
str
|
Source URL for dataset download. |
path |
Path
|
Local path to the |
classes |
list[str]
|
Class labels in index order. |
in_channels |
int
|
Number of image channels (1=grayscale, 3=RGB). |
native_resolution |
int | None
|
Native pixel resolution (e.g., 28, 224). |
mean |
tuple[float, ...]
|
Channel-wise normalization mean. |
std |
tuple[float, ...]
|
Channel-wise normalization standard deviation. |
annotation_path |
Path | None
|
Local path to annotation |
ClassificationRegistryWrapper
¶
Bases: DatasetRegistryWrapper
Registry wrapper for classification datasets (medical, space, benchmark).
DatasetRegistryWrapper
¶
Bases: BaseModel
Base wrapper for dataset registries.
Provides resolution validation, deep-copied access, and the
get_dataset lookup method. Subclasses define which domain
registries are available.
Attributes:
| Name | Type | Description |
|---|---|---|
resolution |
int
|
Target dataset resolution. |
registry |
dict[str, DatasetMetadata]
|
Deep-copied metadata registry for the selected resolution. |
get_dataset(name)
¶
Retrieve a DatasetMetadata entry by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Dataset identifier. |
required |
Returns:
| Type | Description |
|---|---|
DatasetMetadata
|
Deep copy of the matching DatasetMetadata. |
Raises:
| Type | Description |
|---|---|
KeyError
|
If dataset not found in registry. |
Source code in orchard/core/metadata/wrapper.py
DetectionRegistryWrapper
¶
get_registry(resolution, task_type='classification')
¶
Factory function to obtain the correct registry wrapper for a task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resolution
|
int
|
Target image resolution. |
required |
task_type
|
str
|
|
'classification'
|
Returns:
| Type | Description |
|---|---|
DatasetRegistryWrapper
|
Registry wrapper with datasets available for the given task and resolution. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |