Skip to content

Instantly share code, notes, and snippets.

@esc
Last active September 8, 2017 12:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save esc/a15ff21a29a8bc71e4d1fc247b514828 to your computer and use it in GitHub Desktop.
Save esc/a15ff21a29a8bc71e4d1fc247b514828 to your computer and use it in GitHub Desktop.
GulpIO Blogpost Adapter
class AbstractDatasetAdapter(ABC):
""" Base class adapter for gulping (video) datasets.
Inherit from this class and implement the `iter_data` method. This method
should iterate over your entire dataset and for each element return a
dictionary with the following fields:
id : a unique(?) ID for the element.
frames : a list of frames (PIL images, numpy arrays..)
meta : a dictionary with arbitrary metadata (labels, start_time...)
For examples, see the custom adapters below.
"""
@abstractmethod
def iter_data(self, slice_element=None):
return NotImplementedError
@abstractmethod
def __len__(self):
return NotImplementedError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment