code cleanup
This commit is contained in:
parent
ea9cf12db0
commit
73d1742cbd
44 changed files with 6 additions and 2835 deletions
26
dataset_loaders/Dataset.py
Normal file
26
dataset_loaders/Dataset.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
from abc import abstractmethod, ABC
|
||||
from os.path import join, curdir
|
||||
from typing import Callable
|
||||
|
||||
from torch.utils.data import Dataset as TorchDataset
|
||||
|
||||
"""
|
||||
Author: Tibo De Peuter
|
||||
"""
|
||||
class Dataset(TorchDataset, ABC):
|
||||
"""Abstract base class for datasets."""
|
||||
@abstractmethod
|
||||
def __init__(self, root: str, transform: Callable = None):
|
||||
"""
|
||||
:param root: Relative path to the dataset root directory
|
||||
"""
|
||||
self._root: str = join(curdir, 'data', root)
|
||||
self.transform = transform
|
||||
self.dataset = None
|
||||
|
||||
@property
|
||||
def root(self):
|
||||
return self._root
|
||||
|
||||
def __len__(self):
|
||||
return len(self.dataset)
|
||||
Reference in a new issue