Generate HDF5

This Python script allows you to convert one or multiple RAW or DAT files to precomputed tensor features in HDF5 datasets.

The source code of this sample can be found in <install-prefix>/share/metavision/sdk/ml/python_samples/generate_hdf5 when installing Metavision SDK from installer or packages. For other deployment methods, check the page Path of Samples.

Expected Output

HDF5 file(s) which share the name as the input files.

Setup & requirements

The basic input to run the script:

  • a list of paths or a path to the RAW or DAT files. You can use files from our Sample Recordings.

How to start

To run it on a single RAW file with Event Cube preprocessing function:


python3 file.raw -o /path/to/output --event_cube


python file.raw -o /path/to/output --event_cube

You can preprocess multiple input files by providing a list of input paths. For example:


python3 file1.raw file2.raw -o /path/to/output


python file1.raw file2.raw -o /path/to/output

You can preprocess all the file of a directory by using wildcards. For example, if the RAW files are in /path/to/dataset, you can call:


python3 /path/to/dataset/* -o /path/to/output


python /path/to/dataset/* -o /path/to/output


  1. use –max-duration-ms to set the maximum storage duration in ms. If the raw data is longer than this period, then several hdf5 files will be produced accordingly.

  2. use –box-labels to process the label files together with the RAW or DAT input files.

To find the full list of options, run:


python3 -h


python -h