tonic.datasets.nmnist#

Module Contents#

Classes#

NMNIST

N-MNIST

Functions#

stabilize(events)

Stabilize digits, code ported from https://www.garrickorchard.com/datasets/n-mnist

class tonic.datasets.nmnist.NMNIST(save_to: str, train: bool = True, first_saccade_only: bool = False, stabilize: bool = False, transform: Optional[Callable] = None, target_transform: Optional[Callable] = None, transforms: Optional[Callable] = None)[source]#

Bases: tonic.dataset.Dataset

N-MNIST

Events have (xytp) ordering.

@article{orchard2015converting,
  title={Converting static image datasets to spiking neuromorphic datasets using saccades},
  author={Orchard, Garrick and Jayawant, Ajinkya and Cohen, Gregory K and Thakor, Nitish},
  journal={Frontiers in neuroscience},
  volume={9},
  pages={437},
  year={2015},
  publisher={Frontiers}
}
Parameters:
  • save_to (string) – Location to save files to on disk.

  • train (bool) – If True, uses training subset, otherwise testing subset.

  • first_saccade_only (bool) – If True, only work with events of the first of three saccades. Results in about a third of the events overall.

  • stabilize (bool) – If True, it stabilizes egomotion of the saccades, centering the digit.

  • transform (callable, optional) – A callable of transforms to apply to the data.

  • target_transform (callable, optional) – A callable of transforms to apply to the targets/labels.

  • transforms (callable, optional) – A callable of transforms that is applied to both data and labels at the same time.

base_url = 'https://data.mendeley.com/public-files/datasets/468j46mzdv/files/'#
train_url#
train_filename = 'train.zip'#
train_md5 = '20959b8e626244a1b502305a9e6e2031'#
train_folder = 'Train'#
test_url#
test_filename = 'test.zip'#
test_md5 = '69ca8762b2fe404d9b9bad1103e97832'#
test_folder = 'Test'#
classes = ['0 - zero', '1 - one', '2 - two', '3 - three', '4 - four', '5 - five', '6 - six', '7 - seven',...#
sensor_size = (34, 34, 2)#
dtype#
ordering#
__getitem__(index)[source]#
Returns:

a tuple of (events, target) where target is the index of the target class.

__len__() int[source]#
Return type:

int

tonic.datasets.nmnist.stabilize(events)[source]#

Stabilize digits, code ported from https://www.garrickorchard.com/datasets/n-mnist :returns: stabilized events, removing the egomotion caused by saccades.