Training of EB Classification Model

This Python script allows you to train a supervised classification model with recorded event streams. Depending on the parameters used, either a recurrent neural network (RNN) or a feedforward neural network (FNN) can be trained.

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

Training a RNN Classification Model

Expected Output

Training result:

  • checkpoints (models at different training stages)

  • log files

  • videos on test dataset

A training demo is shown below:



Setup & requirements

To run the script, you need:

  • path to the output folder

  • path to the training dataset:

    • a folder containing 3 sub folders, named train, val, test.

    • each subfolder should contain one or multiple h5 files and their corresponding <h5 filename>_bbox.npy labels. The label is by default set to EventBbox format, except that only the column “ts” and “class_id” are actually used, the rest can be set to a constant dummy value.

    • a dictionary file named label_map_dictionary.json, which contains all the classification categories.

If you don’t have a dataset, you can try this sample with our Gen3 Gesture/Chifoumi dataset pre-processed with histo_quantized in HDF5 format.

How to start

To run the script:

python train_classification.py /path/to/logging /path/to/dataset

To find the full list of options, run:

python train_classification.py -h

Training a FNN Classification Model

Expected Output

Training result:

  • checkpoints (models at different training stages)

  • log files

  • videos on test dataset

Setup & requirements

To run the script, you need:

  • path to the output folder

  • path to the training dataset:

    • a folder containing 3 sub folders, named train, val, test.

    • each subfolder should contain one or multiple h5 files and their corresponding <h5 filename>_labels.npz labels. Every label file should contain two fields labels and ts, which store the labels and their corresponding timestamps.

    • a dictionary file named label_map_dictionary_fnn.json, which contains all the classification categories. The dictionary keys must include ignore and background. And the value of the ignore key must be set to 255.

How to start

To run the script:

python train_classification.py /path/to/logging /path/to/dataset --models Mobilenetv2Classifier

To find the full list of options, run:

python train_classification.py -h