Generate HDF5 Tensor Files

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

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

This sample outputs HDF5 tensor file(s) which share the name as the input files.

Setup & requirements

The basic input to run the script:

How to start

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

Linux

python3 generate_hdf5.py file.raw -o /path/to/output --preprocess event_cube

Windows

python generate_hdf5.py file.raw -o /path/to/output --preprocess event_cube

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

Linux

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

Windows

python generate_hdf5.py 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:

Linux

python3 generate_hdf5.py /path/to/dataset/* -o /path/to/output

Windows

python generate_hdf5.py /path/to/dataset/* -o /path/to/output

Note

  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 tensor 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:

Linux

python3 generate_hdf5.py -h

Windows

python generate_hdf5.py -h