PySNN Documentation

pysnn.datasets

pysnn.datasets

pysnn.datasets.train_test(root_dir, train_size=0.8, seed=42)

Split dataset into train and test sets.

Takes in a directory where it looks for sub-directories. Content of each directory is split into train and test subsets.

Parameters
  • root_dir – Directory containing data.

  • train_size – Percentage of the data to be assigned to training set, 1 - train_size is assigned as test set.

  • seed – Seed for random number generator.

class pysnn.datasets.NeuromorphicDataset(data, sampling_time, sample_length, height, width, im_transform=None, lbl_transform=None)

Class that wraps around several neuromorphic datasets.

The class adheres to regular PyTorch dataset conventions.

Parameters
  • data – Data for dataset formatted in a pd.DataFrame.

  • sampling_time – Duration of interval between samples.

  • sample_length – Total duration of a single sample.

  • height – Number of pixels in height direction.

  • width – Number of pixels in width direction.

  • im_transform – Image transforms, same convention as for PyTorch datasets.

  • lbl_transform – Lable transforms, same convention as for PyTorch datasets.

pysnn.datasets.ncaltech_train_test(root, sampling_time=1, sample_length=300, height=200, width=300, im_transform=None, lbl_transform=None)

Neurmorphic version of the Caltech-101 dataset, obtained from:

‘Converting Static Image Datasets to Spiking Neuromorphic Datasets Using Saccades’ by G. Orchard et al.

Returns

NeuromorphicDataset for both and training and test data.

pysnn.datasets.nmnist_train_test(root, sampling_time=1, sample_length=300, height=34, width=34, im_transform=None, lbl_transform=None)

Neurmorphic version of the MNIST dataset, obtained from:

‘Converting Static Image Datasets to Spiking Neuromorphic Datasets Using Saccades’ by G. Orchard et al.

Returns

NeuromorphicDataset for both and training and test data.

pysnn.datasets.ncars_train_test(root, sampling_time=1, sample_length=100, height=100, width=120, im_transform=None, lbl_transform=None)

Neurmorphic dataset containing images of cars or background, obtained from:

This is a two class problem.

Returns

NeuromorphicDataset for both and training and test data.

class pysnn.datasets.Boolean(data_encoder=None, data_transform=None, lbl_transform=None, repeats=1)

Dataset for generating event-based, boolean data samples. Can be used to construct AND, OR, XOR datasets.

Parameters
  • data_encoderEncoder to convert scalar data values to spiketrains.

  • data_transform – Image transforms, same convention as for PyTorch datasets.

  • lbl_transform – Label transforms, same convention as for PyTorch datasets.

Repeats

Number of times to repeat the 4 samples within a single iteration of the dataset, total is 4 * repeats.

class pysnn.datasets.XOR(data_encoder=None, data_transform=None, lbl_transform=None, repeats=1)

XOR dataset, inherits directly from Boolean.

class pysnn.datasets.AND(data_encoder=None, data_transform=None, lbl_transform=None, repeats=1)

AND dataset, inherits directly from Boolean.

class pysnn.datasets.OR(data_encoder=None, data_transform=None, lbl_transform=None, repeats=1)

OR dataset, inherits directly from Boolean.

class pysnn.datasets.DiscretizeFloat

Discretize float to nearest integer values, returns a torch.Float.

class pysnn.datasets.BooleanNoise(low_thresh, high_thresh)

Add noise to the integer boolean values, e.g. 1 -> 0.8 and 0 -> 0.2

Parameters
  • low_thresh – Upper boundary for the negative values.

  • high_thresh – Lower boundary for the positive values.

class pysnn.datasets.Intensity(intensity)

Multiplication with a fixed scalar value.