zea.data¶

Data subpackage for working with the zea data format.

This subpackage provides core classes and utilities for working with the zea data format, including file and dataset access, validation, and data loading. For more information on the zea data format, see Data.

Main classes¶

  • zea.File — open, create, and validate a single zea HDF5 file.

  • zea.Dataset — manage and iterate over a collection of zea data files.

  • zea.Dataloader — Data loader for training pipelines.

See the data notebook for a more detailed example: Working with the zea data format

Example usage¶

>>> from zea import File, Dataset, Dataloader

>>> # Work with a single file
>>> path_to_file = (
...     "hf://zeahub/picmus/database/experiments/contrast_speckle/"
...     "contrast_speckle_expe_dataset_iq/contrast_speckle_expe_dataset_iq.hdf5"
... )

>>> with File(path_to_file, revision="v0.1.0", mode="r") as file:
...     data = file.data.raw_data[0]  # first frame
...     params = file.load_parameters()

>>> # Work with a dataset (folder or list of files)
>>> dataset = Dataset("hf://zeahub/picmus")
>>> files = []
>>> for file in dataset:
...     files.append(file)  # process each file as needed
>>> dataset.close()

>>> # Use a dataloader for training
>>> dataloader = Dataloader(
...     "hf://zeahub/camus-sample/",
...     key="data/image",
...     batch_size=4,
...     image_size=(256, 256),
...     shuffle=True,
... )
>>> for batch in dataloader:
...     # process batch for training
...     pass

Modules

augmentations

Augmentation layers for ultrasound data.

convert

Data conversion of datasets to the zea data format.

data_format

Functions to write and validate datasets in the zea format.

dataloader

H5 dataloader for loading images from zea datasets.

datasets

zea.data.datasets

file

zea data file (HDF5).

file_operations

This module provides some utilities to edit zea data files, either individually or in bulk.

layers

Keras layers for data preprocessing.

legacy_file

spec