class LuxonisLoader(BaseLoader):
Constructor: LuxonisLoader(dataset, view, augmentation_engine, augmentation_config, ...)
Indexed loader for LuxonisDataset samples.
LuxonisLoader reads one split or multiple splits, loads image
sources, assembles labels by task key, optionally applies
augmentations, and returns LoaderOutput values with images, labels,
and sample metadata.
Iterating a LoaderOutput preserves the legacy tuple behavior:
for a single-source dataset it yields (image, labels). For a
multi-source dataset it yields (images, labels), where images
maps source names to arrays.
Label keys use "task_name/task_type". If a dataset was created without a task name, the default task name is empty and keys look like "/boundingbox" or "/segmentation".
| Method | __getitem__ |
Load a sample and its annotations. |
| Method | __init__ |
Create a loader for a Luxonis dataset. |
| Method | __len__ |
Return the number of samples in the loader. |
| Instance Variable | augmentations |
Optional augmentation engine. |
| Instance Variable | classes |
Class-name mappings per task. |
| Instance Variable | color |
Output color space per source. |
| Instance Variable | dataset |
Dataset being loaded. |
| Instance Variable | df |
Dataframe with records used by the loader. |
| Instance Variable | exclude |
Whether empty annotations are omitted. |
| Instance Variable | filter |
Optional task-name allowlist. |
| Instance Variable | height |
Optional output image height. |
| Instance Variable | idx |
Mapping from loader index to dataframe row indices. |
| Instance Variable | instances |
Group IDs included in the selected views. |
| Instance Variable | keep |
Whether categorical metadata remains as strings. |
| Instance Variable | source |
Source names expected in each sample. |
| Instance Variable | sync |
Whether the dataset is remote and pulled before loading. |
| Instance Variable | tasks |
Segmentation tasks where unassigned pixels are mapped to background class 0. |
| Instance Variable | view |
Split names loaded by this loader. |
| Instance Variable | width |
Optional output image width. |
| Static Method | _merge |
Undocumented |
| Method | _add |
Undocumented |
| Method | _get |
Undocumented |
| Method | _init |
Undocumented |
| Method | _load |
Load image data and annotations by index. |
| Method | _load |
Undocumented |
| Method | _precompute |
Undocumented |
| Instance Variable | _augmentations |
Undocumented |
| Instance Variable | _autopopulate |
Undocumented |
| Instance Variable | _classes |
Undocumented |
| Instance Variable | _color |
Undocumented |
| Instance Variable | _df |
Undocumented |
| Instance Variable | _df |
Undocumented |
| Instance Variable | _exclude |
Undocumented |
| Instance Variable | _filter |
Undocumented |
| Instance Variable | _height |
Undocumented |
| Instance Variable | _idx |
Undocumented |
| Instance Variable | _idx |
Undocumented |
| Instance Variable | _instances |
Undocumented |
| Instance Variable | _keep |
Undocumented |
| Instance Variable | _source |
Undocumented |
| Instance Variable | _tasks |
Undocumented |
| Instance Variable | _view |
Undocumented |
| Instance Variable | _width |
Undocumented |
Inherited from BaseLoader:
| Method | __iter__ |
Iterate over the dataset. |
Load a sample and its annotations.
| Parameters | |
idx:int | Index of the sample to retrieve. |
| Returns | |
LoaderOutput | Image data and annotation labels. |
| Raises | |
ValueError | If the selected views contain no records or a grayscale source has an unsupported image shape. |
FileNotFoundError | If an image path cannot be found or read. |
LuxonisDataset, view: str | list[ str] = 'train', augmentation_engine: Literal[ 'albumentations'] | str = 'albumentations', augmentation_config: list[ Params] | PathType | None = None, height: int | None = None, width: int | None = None, keep_aspect_ratio: bool = True, exclude_empty_annotations: bool = False, color_space: dict[ str, Literal[ 'RGB', 'BGR', 'GRAY']] | Literal[ 'RGB', 'BGR', 'GRAY'] | None = None, seed: int | None = None, min_bbox_visibility: float = 0.0, bbox_area_threshold: float = 0.0004, *, keep_categorical_as_strings: bool = False, update_mode: UpdateMode | Literal[ 'all', 'missing'] = UpdateMode.ALL, filter_task_names: list[ str] | None = None, autopopulate_metadata: bool = True):
¶
Create a loader for a Luxonis dataset.
Example
augmentation_config = [
{
"name": "Defocus",
"params": {"p": 1},
},
{
"name": "RandomCrop",
"params": {"height": 512, "width": 512, "p": 1},
},
{
"name": "Mosaic4",
"params": {
"height": 256,
"width": 256,
"p": 1.0,
},
},
]
loader = LuxonisLoader(
dataset,
view="train",
augmentation_config=augmentation_config,
height=640,
width=640,
)| Parameters | |
dataset:LuxonisDataset | Dataset to load from. |
view:str | list[ | Split name or split names to load. |
augmentationLiteral[ | Augmentation engine registry name. |
augmentationlist[ | Optional augmentation configuration or path to a configuration file. Each configuration item contains name and optional params keys. |
height:int | None | Optional output image height. Required when augmentations are enabled. |
width:int | None | Optional output image width. Required when augmentations are enabled. |
keepbool | Whether resizing should preserve image aspect ratio. |
excludebool | Whether to omit empty annotations from the returned label dictionary. |
colordict[ | Optional color space for each source. A single value applies to all sources; if omitted, all sources use "RGB". |
seed:int | None | Optional random seed for augmentations. |
minfloat | Minimum fraction of the original bounding box that must remain visible after augmentation. |
bboxfloat | Minimum normalized area for bounding boxes to remain valid. The default removes very small boxes and their associated keypoints. |
keepbool | Whether to keep categorical metadata labels as strings instead of converting them to integers. |
updateUpdateMode | Literal[ | Sync mode for media files in remote datasets. Annotations and metadata are always overwritten. |
filterlist[ | Optional task names to include. If omitted, all tasks are included. |
autopopulatebool | Whether to add automatic sample metadata such as source filenames. |
| Raises | |
ValueError | If color_space is neither a string nor a
dictionary. |
ValueError | If filter_task_names contains task names not
present in the dataset. |
RuntimeError | If split metadata is missing. |
Segmentation tasks where unassigned pixels are mapped to background class 0.
dict[ str, np.ndarray], labels: Labels) -> tuple[ dict[ str, np.ndarray], Labels]:
¶
Undocumented
Literal[ 'albumentations'] | str, augmentation_config: list[ Params] | PathType, height: int | None, width: int | None, keep_aspect_ratio: bool, seed: int | None = None, min_bbox_visibility: float = 0.0, bbox_area_threshold: float = 0.0004) -> AugmentationEngine | None:
¶
Undocumented
Load image data and annotations by index.
| Parameters | |
idx:int | Index of the image. |
| Returns | |
tuple[ | Images, labels, and sample metadata present for the sample. |