Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions luxonis_ml/data/loaders/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ The `LuxonisLoader` class provides efficient access to dataset samples with conf

- [LuxonisML Loader](#luxonisml-loader)
- [Parameters](#parameters)
- [Output Structure](#output-structure)

## Parameters

Expand All @@ -26,3 +27,49 @@ The `LuxonisLoader` class provides efficient access to dataset samples with conf
| `keep_categorical_as_strings` | `bool` | `False` | Whether to keep categorical metadata as strings |
| `update_mode` | `UpdateMode` | `UpdateMode.ALL` | Applicable to remote datasets. The loader internally calls the [`pull_from_cloud`](../datasets/README.md#pulling-from-remote-storage) method to download the dataset from the cloud. |
| `filter_task_names` | `Optional[List[str]]` | `None` | If provided, only include annotations for these specified tasks, ignoring any others in the data. |

## Output Structure

`LuxonisLoader` implements `__getitem__`, so each `dataset[i]` returns a **tuple** of `(inputs, labels)`.

```python
(
inputs: np.ndarray | Dict[str, np.ndarray], # one or more image-like np arrays, where keys are source names
labels: Labels # task-specific labels
)
```

### Accessing Labels

Labels can be accessed using specific keys in the `labels` dictionary. These keys follow the format:

```python
f"{task_name}/{task_type}"
```

If the dataset was created without specifying a `task_name`, the default keys will be:

```
/boundingbox, /classification, /segmentation, /instance_segmentation, /keypoints, /metadata/<key>
```

In the case of metadata, the `/metadata/<key>` format uses a field name that was provided when creating the dataset in place of `<key>` (e.g., `/metadata/id`, `/metadata/camera_angle`, etc.).

If a dataset was created using multiple `task_name`s—which is especially helpful for more structured or complex datasets—you might define one task for **segmentation** and another for **keypoint detection**. In that case, you would access the labels using keys like:

```
segmentation_task/segmentation, pose_task/keypoints
```

This naming convention makes it easier to manage, access, and process annotations in multi-task datasets.

### Labels Structure

| Task Type | Example Shape | Description |
| ------------------------- | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| **classification** | `(N_classes,)` | One-hot encoded classification vector. |
| **segmentation** | `(C, H, W)` | One-hot encoded per-pixel class mask in CHW format, where `C` is the number of classes. |
| **boundingbox** | `(N_instances, 5)` | Each row represents an object as `[cls, x_min, y_min, w, h]`. |
| **instance_segmentation** | `(N_instances, H, W)` | Binary mask for each instance. |
| **keypoints** | `(N_instances, n_keypoints * 3)` | Keypoints in `x, y, v` format (visibility flag), repeated per keypoint. |
| **metadata** | — | Follows the same structure as yielded. Values are accessible via keys such as `"metadata/key1"`, `"metadata/key2"`, etc. |
Loading