Adaptive Rate Events Splitter using Python

The sample metavision_adaptive_rate_events_splitter.py shows how to use a metavision_core.event_io.AdaptiveRateEventsIterator to slice a stream of events.

The slicing is done adaptively to the scene activity, in order to ensure sharp event frames (i.e. short accumulation time in case of high activity, long accumulation in case of low activity).

This approach is an alternative to fixed delta_t (where events are gathered over a fixed time window) or fixed N events (where a constant number of events are gathered). Here, the number of events per slice (as well as the slice duration) is adaptive and depends on the content of the events stream.

It will generate a sequence of reasonably sharp event frames. Those could be used in a variable duration processing pipeline (for example detection and tracking, or optical flow computation). We could also consider dropping some of the frames to cope with limited computational budget (in the case of detection for example).

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

Note

The role of the –downsampling_factor parameter in the sample is to control the resolution at which the statistics used for adaptive slicing are computed. The size of the visualization is not affected by this parameter, only the way the event stream is sliced.

It is not easy to predict how a change in the downsampling_factor parameter will impact the resulting slices. Hence this setting should be seen as a parameter for tuning the internal implementation of the algorithm, not really as a user-exposed parameter.

Expected Output

The sample visualizes the sequence of output event frames along with some statistics, and offers the possibility to save a video.

How to start

To start the sample based on recorded data, provide the full path to a RAW file (here, we use the file from Metavision Datasets):

Linux

python3 metavision_adaptive_rate_events_splitter.py spinner.raw

Windows

python metavision_adaptive_rate_events_splitter.py spinner.raw

To check for additional options:

Linux

python3 metavision_adaptive_rate_events_splitter.py -h

Windows

python metavision_adaptive_rate_events_splitter.py -h