Loader (rpx_benchmark.loader)¶
Reads a manifest JSON and yields Sample batches to the runner.
loader
¶
Data loading utilities for RPX benchmark.
Reads a JSON manifest describing a slice of the RPX dataset (usually
produced by :func:rpx_benchmark.hub.download_split) and yields
:class:~rpx_benchmark.api.Sample batches the :class:BenchmarkRunner
can feed to a model.
Manifest format
::
{
"task": "monocular_depth",
"root": "/absolute/path/or/snapshot/root",
"samples": [
{
"id": "scene_001_clutter_00000",
"scene": "scene_001",
"phase": "clutter",
"difficulty": "hard",
"rgb": "scenes/scene_001/0/rgb/00000.png",
"depth": "scenes/scene_001/0/depth/00000.png",
"mask": "scenes/scene_001/0/mask/00000.png",
"pose": "scenes/scene_001/0/pose/00000.npz"
},
...
]
}
All sample paths are resolved relative to root unless they are
absolute. depth files are 16-bit PNGs in millimetres (as saved by
save_device_data.py); the loader converts to float32 metres on
read. pose files are .npz with position and orientation
(T265 convention, [x, y, z, w] quaternion).
Errors
All load-time failures are raised as
:class:~rpx_benchmark.exceptions.ManifestError so user code can
catch them specifically.
RPXDataset(samples: List[Dict[str, Any]], task: TaskType, root: Path, batch_size: int = 1)
dataclass
¶
Iterates over RPX samples for a specific task.
Manifest format (JSON)::
{
"task": "object_segmentation",
"root": "/path/to/data",
"samples": [
{
"id": "scene_001_clutter_00000",
"scene": "scene_001",
"phase": "clutter",
"difficulty": "hard",
"rgb": "scene_001/0/rgb/00000.png",
"depth": "scene_001/0/depth/00000.png",
"mask": "scene_001/0/mask/00000.png",
"pose": "scene_001/0/pose/00000.npz",
...
}
]
}
All paths are relative to root.
depth files are 16-bit PNG in millimetres (as saved by save_device_data.py).
pose files are NPZ with keys position ([x,y,z] metres) and
orientation ([x,y,z,w] quaternion) from the T265 tracker.
from_manifest(manifest_path: str | Path, batch_size: int = 1) -> 'RPXDataset'
classmethod
¶
Load a manifest JSON file from disk and return a dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
manifest_path
|
str or Path
|
Path to the manifest JSON. Produced either by
:func: |
required |
batch_size
|
int
|
Number of samples per iteration. Default 1. |
1
|
Returns:
| Type | Description |
|---|---|
RPXDataset
|
|
Raises:
| Type | Description |
|---|---|
ManifestError
|
If the manifest file is missing, not valid JSON, or is missing required top-level fields. |
Source code in rpx_benchmark/loader.py
from_dict(manifest: Dict[str, Any], batch_size: int = 1, default_root: str | Path | None = None) -> 'RPXDataset'
classmethod
¶
Build a dataset from an already-parsed manifest dict.
Raises:
| Type | Description |
|---|---|
ManifestError
|
If |