2024-03-24 08:49:28 +00:00
---
title: Code Examples
---
2025-02-09 17:46:40 +00:00
The following examples demonstrate registering, retrieving, and ingesting your data through the Hyper-Datasets Python
2024-03-24 08:49:28 +00:00
interface.
## Registering your Data
2025-02-13 11:21:35 +00:00
* [register_dataset_with_roi.py ](https://github.com/clearml/clearml/blob/master/examples/hyperdatasets/data-registration/register_dataset_with_roi.py ) - Demonstrates
2024-03-24 08:49:28 +00:00
creating a new DatasetVersion and adding to it frames, supporting ROI annotations and metadata
2025-02-13 11:21:35 +00:00
* [register_dataset_masks.py ](https://github.com/clearml/clearml/blob/master/examples/hyperdatasets/data-registration/register_dataset_masks.py ) - Demonstrates
2024-03-24 08:49:28 +00:00
creating a new DatasetVersion and adding to it frames containing masks. This example also demonstrates the
DatasetVersion-level [pixel segmentation masks ](masks.md#pixel-segmentation-masks ).
After executing either of these scripts, you can view your DatasetVersion contents and details in the UI.
## Using your Data
### Dataviews
2025-02-13 11:21:35 +00:00
The [dataview_example_framegroup.py ](https://github.com/clearml/clearml/blob/master/examples/hyperdatasets/data-ingestion/dataview_example_framegroup.py )
and [dataview_example_singleframe.py ](https://github.com/clearml/clearml/blob/master/examples/hyperdatasets/data-ingestion/dataview_example_singleframe.py )
2024-03-24 08:49:28 +00:00
examples demonstrate how to use a [DataView ](dataviews.md ) to retrieve your data as SingleFrames and FrameGroups as
2025-02-06 15:31:11 +00:00
part of a running task. This is done by creating a DataView query and then retrieving the corresponding frames.
2024-03-24 08:49:28 +00:00
2025-02-06 15:31:11 +00:00
DataView details are displayed in the UI in a task's **DATAVIEWS** tab.
2024-03-24 08:49:28 +00:00
### Data Ingestion
2025-02-13 11:21:35 +00:00
The [pytorch_dataset_example.py ](https://github.com/clearml/clearml/blob/master/examples/hyperdatasets/data-ingestion/pytorch_dataset_example.py )
2024-03-24 08:49:28 +00:00
example demonstrates how to feed your DataViews to an ML framework by creating a DataView query and wrapping it as a
PyTorch Dataset.
2025-02-13 11:21:35 +00:00
The [pytorch_dataset_example_with_masks.py ](https://github.com/clearml/clearml/blob/master/examples/hyperdatasets/data-ingestion/pytorch_dataset_example_with_masks.py )
2024-03-24 08:49:28 +00:00
example demonstrates the additional actions required when your frames contain masks.