tonic.functional.event_downsampling#

Module Contents#

Functions#

differentiator_downsample(events, sensor_size, ...[, ...])

Spatio-temporally downsample using the integrator method coupled with a differentiator to effectively

integrator_downsample(events, sensor_size, target_size, dt)

Spatio-temporally downsample using with the following steps:

tonic.functional.event_downsampling.differentiator_downsample(events: numpy.ndarray, sensor_size: tuple, target_size: tuple, dt: float, differentiator_time_bins: int = 2, noise_threshold: int = 0)[source]#

Spatio-temporally downsample using the integrator method coupled with a differentiator to effectively downsample large object sizes relative to downsampled pixel resolution in the DVS camera’s visual field.

Incorporates the paper Ghosh et al. 2023, Insect-inspired Spatio-temporal Downsampling of Event-based Input, https://doi.org/10.1145/3589737.3605994

Parameters:
  • events (ndarray) – ndarray of shape [num_events, num_event_channels].

  • sensor_size (tuple) – a 3-tuple of x,y,p for sensor_size.

  • target_size (tuple) – a 2-tuple of x,y denoting new down-sampled size for events to be re-scaled to (new_width, new_height).

  • dt (float) – step size for simulation, in ms.

  • differentiator_time_bins (int) – number of equally spaced time bins with respect to the dt to be used for the differentiator.

  • noise_threshold (int) – number of events before a spike representing a new event is emitted.

Returns:

the spatio-temporally downsampled input events using the differentiator method.

tonic.functional.event_downsampling.integrator_downsample(events: numpy.ndarray, sensor_size: tuple, target_size: tuple, dt: float, noise_threshold: int = 0, differentiator_call: bool = False)[source]#

Spatio-temporally downsample using with the following steps:

  1. Differencing of ON and OFF events to counter camera shake or jerk.

2. Use an integrate-and-fire (I-F) neuron model with a noise threshold similar to the membrane potential threshold in the I-F model to eliminate high-frequency noise.

Multiply x/y values by a spatial_factor obtained by dividing sensor size by the target size.

Parameters:
  • events (ndarray) – ndarray of shape [num_events, num_event_channels].

  • sensor_size (tuple) – a 3-tuple of x,y,p for sensor_size.

  • target_size (tuple) – a 2-tuple of x,y denoting new down-sampled size for events to be re-scaled to (new_width, new_height).

  • dt (float) – temporal resolution of events in milliseconds.

  • noise_threshold (int) – number of events before a spike representing a new event is emitted.

  • differentiator_call (bool) – Preserve frame spikes for differentiator method in order to optimise differentiator method.

Returns:

the spatio-temporally downsampled input events using the integrator method.