Convert Bbox from a Sequential Text to NPY

This Python script allows you to convert annotated bounding boxes (Bbox) from a custom text format to Numpy array (NPY).

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

Expected Output

Converted Bbox in EventBbox format.

Setup & requirements

You will need to provide the following input:

  • a text file input : a custom text file containing a list of sequential actions on the annotated bounding bounding boxes.

    • The text file should include 9 columns without headers

    • The 9 columns are: timestamp(ts), Object ID, Command action, Class_ID, X Coordinate, Y Coordinate, Width, Height, Detection Confidence (p)

    • There are 5 types of command actions: BB_CREAT, BB_MOVE, BB_RESIZE, BB_MOVE_AND_RESIZE, BB_DELETE.

How to start

To run the script:

Linux

python3 bbox_txt2npy.py -i /path/to/input.txt -o /path/to/output.npy

Windows

python bbox_txt2npy.py -i /path/to/input.txt -o /path/to/output.npy

To find the full list of options, run:

Linux

python3 bbox_txt2npy.py -h

Windows

python bbox_txt2npy.py -h