frarch.datasets.mit67 module
frarch.datasets.mit67 module#
- class frarch.datasets.mit67.Mit67(train: bool = True, transform: Optional[Callable] = None, target_transform: Optional[Callable] = None, download: bool = True, root: Union[str, pathlib.Path] = '~/.cache/frarch/datasets/mit67/')[source]#
Bases:
torch.utils.data.dataset.Dataset
Mit 67 dataset object.
Data loader for the Mit 67 dataset for indoor scene recognition. The dataset can be obtained from http://groups.csail.mit.edu/vision/LabelMe/NewImages/indoorCVPR_09.tar.
- Parameters
train (bool) – True for loading the train subset and False for valid. Defaults to True.
transform (Callable) – a callable object that takes an PIL.Image object and returns a modified PIL.Image object. Defaults to None, which won’t apply any transformation.
target_transform (Callable) – a callable object that the label data and returns modified label data. Defaults to None, which won’t apply any transformation.
download (bool) – True for downloading and storing the dataset data in the root directory if it’s not present. Defaults to True.
root (Union[str, Path]) – root directory for the dataset. Defaults to ~/.cache/frarch/datasets/mit67/.
References
Examples
Simple usage of the dataset class:
from frarch.datasets import Mit67 from frarch.utils.data import create_dataloader from torchvision.transforms import ToTensor dataset = Mit67(True, ToTensor, None, True, "./data/") dataloader = create_dataloader(dataset) for batch_idx, (batch, labels) in enumerate(dataloader): # process batch