diff --git a/docs/gallery/representations/plot_totimesurface.py b/docs/gallery/representations/plot_totimesurface.py index f7bfee72..48c278b0 100644 --- a/docs/gallery/representations/plot_totimesurface.py +++ b/docs/gallery/representations/plot_totimesurface.py @@ -3,7 +3,7 @@ ToTimesurface ============= -:class:`~tonic.transforms.ToTimesurface` creates local or global time surfaces for each event. +:class:`~tonic.transforms.ToTimesurface` creates global time surfaces at a specific time interval dt. """ import tonic @@ -11,11 +11,6 @@ nmnist = tonic.datasets.NMNIST("../../tutorials/data", train=False) events, label = nmnist[0] - -#################################### -# ToTimesurface global -# -------------------------------- - transform = tonic.transforms.ToTimesurface( sensor_size=nmnist.sensor_size, tau=30000, @@ -25,17 +20,3 @@ frames = transform(events) ani = tonic.utils.plot_animation(frames) - - -#################################### -# ToTimesurface local -# -------------------------------- - -transform = tonic.transforms.ToTimesurface( - sensor_size=nmnist.sensor_size, surface_dimensions=(9, 9), tau=100000, decay="exp" -) - -frames = transform(events) - -# only plot a few of them -ani = tonic.utils.plot_animation(frames[::70]) diff --git a/docs/getting_involved/contribute.rst b/docs/getting_involved/contribute.rst index 3669e32c..8631432b 100644 --- a/docs/getting_involved/contribute.rst +++ b/docs/getting_involved/contribute.rst @@ -38,7 +38,7 @@ To download a dataset, Tonic makes use of a copy of pytorch vision's tools that `here `_. Cloud providers such as Dropbox, Google Drive, OneDrive etc. are usually not straightforward to automatically download from, so if the dataset owner provides multiple mirrors, -prefer a simple REST-like webpage such as https://www.neuromorphic-vision.com/public/downloads/. +prefer a simple REST-like webpage. The trickier question is the one of file decoding. There exist a variety of file formats that events and related data are saved in, including .txt, .aedat, .dat, .es, .mat, .hdf5, .rosbag diff --git a/docs/getting_started/nmnist.ipynb b/docs/getting_started/nmnist.ipynb index b37ec1f9..fd4b3738 100644 --- a/docs/getting_started/nmnist.ipynb +++ b/docs/getting_started/nmnist.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "id": "72ab4fec-4fe8-49cc-867f-6a77bcfaa062", "metadata": { @@ -37,6 +38,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "6e9f45be-20da-44f8-962b-2b842fc862df", "metadata": {}, @@ -56,6 +58,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "dba2d3f0-f82b-4f16-a06f-97669b73bec4", "metadata": {}, @@ -82,6 +85,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "dcfd768d-0a7f-48c8-b1d1-6f80d0b516a4", "metadata": {}, @@ -112,6 +116,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "9733a1da-96a5-4ab1-ad0e-d0d46f7a305c", "metadata": {}, @@ -137,6 +142,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "10406fbc-ddb2-4104-9a0d-ab375f3e653c", "metadata": { @@ -167,6 +173,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "5c9d5bb7-8658-409a-bcc7-24c7e0587479", "metadata": {}, @@ -182,7 +189,7 @@ "outputs": [], "source": [ "surfaces = transforms.ToTimesurface(\n", - " sensor_size=sensor_size, surface_dimensions=None, tau=10000, decay=\"exp\"\n", + " sensor_size=sensor_size, dt=10000, tau=30000,\n", ")(events_denoised)\n", "\n", "n_events = events_denoised.shape[0]\n", @@ -196,6 +203,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "a167e44a-39d8-4e42-b5e5-39a9e9179463", "metadata": {}, @@ -220,6 +228,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "b2f027cc-55ba-46b6-848d-deedf4e5a3e4", "metadata": {}, @@ -245,6 +254,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "aac04620-cf13-4c03-b653-7d3520d52380", "metadata": {}, diff --git a/tonic/transforms.py b/tonic/transforms.py index 915d1b01..b849ad0b 100644 --- a/tonic/transforms.py +++ b/tonic/transforms.py @@ -904,18 +904,12 @@ def __call__(self, events): @dataclass(frozen=True) class ToTimesurface: - """Create global or local time surfaces for each event. Modeled after the paper Lagorce et al. - 2016, Hots: a hierarchy of event-based time-surfaces for pattern recognition - https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=7508476. + """Create global time surfaces at a specific time interval dt. Parameters: - sensor_size: a 3-tuple of x,y,p for sensor_size - surface_dimensions (int, int): width does not have to be equal to height, however both numbers have to be odd. - if surface_dimensions is None: the time surface is defined globally, on the whole sensor grid. - tau (float): time constant to decay events around occuring event with. - delta_t (float): the interval at which the time-surfaces are accumulated, if set 0 number of time-surfaces will - equal to the number of events. (defaults to 0.0) - decay (str): can be either 'lin' or 'exp', corresponding to linear or exponential decay. + sensor_size: A 3-tuple of x,y,p for sensor_size + dt (float): The interval at which the time-surfaces are accumulated. + tau (float): Time constant to decay events with. """ sensor_size: Tuple[int, int, int]