dvs_layer#

class DVSLayer(input_shape: Tuple[int, int], pool: Tuple[int, int] = (1, 1), crop: Optional[Tuple[Tuple[int, int], Tuple[int, int]]] = None, merge_polarities: bool = False, flip_x: bool = False, flip_y: bool = False, swap_xy: bool = False, disable_pixel_array: bool = True)[source]#

DVSLayer representing the DVS pixel array on chip and/or the pre-processing. The order of processing is as follows MergePolarity -> Pool -> Cut -> Flip

Parameters
  • input_shape; – Shape of input (height, width)

  • pool – Sum pooling kernel size (height, width)

  • crop – Crop the input to the given ROI ((top, bottom), (left, right))

  • merge_polarities – If true, events from both polarities will be merged.

  • flip_x – Flip the X axis

  • flip_y – Flip the Y axis

  • swap_xy – Swap X and Y dimensions

  • disable_pixel_array – Disable the pixel array. This is useful if you want to use the DVS layer for input preprocessing.

Initializes internal Module state, shared by both nn.Module and ScriptModule.

forward(data)[source]#

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

classmethod from_layers(input_shape: Tuple[int, int, int], pool_layer: Optional[sinabs.layers.pool2d.SumPool2d] = None, crop_layer: Optional[sinabs.backend.dynapcnn.crop2d.Crop2d] = None, flip_layer: Optional[sinabs.backend.dynapcnn.flipdims.FlipDims] = None) sinabs.backend.dynapcnn.dvs_layer.DVSLayer[source]#

Alternative factory method. Generate a DVSLayer from a set of torch layers

Parameters
  • input_shape – (channels, height, width)

  • pool_layer – SumPool2d layer

  • crop_layer – Crop2d layer

  • flip_layer – FlipDims layer

Returns

DVSLayer

get_config_dict() dict[source]#
get_flip_dict() dict[source]#

Configuration dictionary for x, y flip

Returns

dict

get_output_shape() Tuple[int, int, int][source]#

Output shape of the layer

Returns

(channel, height, width)

get_output_shape_after_pooling() Tuple[int, int, int][source]#

Get the shape of data just after the pooling layer.

Returns

(channel, height, width)

get_output_shape_dict() dict[source]#

Configuration dictionary for output shape

Returns

dict

get_pooling() Tuple[int, int][source]#

Pooling kernel shape

Returns

(ky, kx)

get_roi() Tuple[Tuple[int, int], Tuple[int, int]][source]#

The coordinates for ROI. Note that this is not the same as crop parameter passed during the object construction.

Returns

((top, bottom), (left, right))

get_swap_xy() bool[source]#

True if XY has to be swapped.

Returns

bool

property input_shape_dict: dict#

The configuration dictionary for the input shape

Returns

dict

training: bool#