:py:mod:`tonic.datasets.nmnist`
===============================

.. py:module:: tonic.datasets.nmnist


Module Contents
---------------

Classes
~~~~~~~

.. autoapisummary::

   tonic.datasets.nmnist.NMNIST



Functions
~~~~~~~~~

.. autoapisummary::

   tonic.datasets.nmnist.stabilize



.. py:class:: NMNIST(save_to: str, train: bool = True, first_saccade_only: bool = False, stabilize: bool = False, transform: collections.abc.Callable | None = None, target_transform: collections.abc.Callable | None = None, transforms: collections.abc.Callable | None = None)


   Bases: :py:obj:`tonic.dataset.Dataset`

   `N-MNIST <https://www.garrickorchard.com/datasets/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}
       }

   :param save_to: Location to save files to on disk.
   :type save_to: string
   :param train: If True, uses training subset, otherwise testing subset.
   :type train: bool
   :param first_saccade_only: If True, only work with events of the first of three saccades.
                              Results in about a third of the events overall.
   :type first_saccade_only: bool
   :param stabilize: If True, it stabilizes egomotion of the saccades, centering the digit.
   :type stabilize: bool
   :param transform: A callable of transforms to apply to the data.
   :type transform: callable, optional
   :param target_transform: A callable of transforms to apply to the targets/labels.
   :type target_transform: callable, optional
   :param transforms: A callable of transforms that is applied to both data and
                      labels at the same time.
   :type transforms: callable, optional

   .. py:attribute:: base_url
      :value: 'https://data.mendeley.com/public-files/datasets/468j46mzdv/files/'

      

   .. py:attribute:: train_url

      

   .. py:attribute:: train_filename
      :value: 'train.zip'

      

   .. py:attribute:: train_md5
      :value: '20959b8e626244a1b502305a9e6e2031'

      

   .. py:attribute:: train_folder
      :value: 'Train'

      

   .. py:attribute:: test_url

      

   .. py:attribute:: test_filename
      :value: 'test.zip'

      

   .. py:attribute:: test_md5
      :value: '69ca8762b2fe404d9b9bad1103e97832'

      

   .. py:attribute:: test_folder
      :value: 'Test'

      

   .. py:attribute:: classes
      :value: ['0 - zero', '1 - one', '2 - two', '3 - three', '4 - four', '5 - five', '6 - six', '7 - seven',...

      

   .. py:attribute:: sensor_size
      :value: (34, 34, 2)

      

   .. py:attribute:: dtype

      

   .. py:attribute:: ordering

      

   .. py:method:: __getitem__(index)

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


   .. py:method:: __len__() -> int



.. py:function:: stabilize(events)

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


