-
Notifications
You must be signed in to change notification settings - Fork 182
Open
Labels
enhancementNew feature or requestNew feature or request
Description
I am trying to load a dataset consisting of 1 channel images, and don't know how to do it.
I have modified the loading to open them as grayscale:
def pil_loader_grayscale(path: str) -> Image.Image:
return pil_loader(path, mode="L")and the dataset accordingly:
my_dataset = torchvision.datasets.ImageFolder(root="path2data", loader=pil_loader_grayscale)and then to write this down:
from ffcv.writer import DatasetWriter
from ffcv.fields import RGBImageField, IntField
# Your dataset (`torch.utils.data.Dataset`) of (image, label) pairs
write_path = 'ds.beton'
# Pass a type for each data field
writer = DatasetWriter(write_path, {
# Tune options to optimize dataset size, throughput at train-time
'image': RGBImageField(max_resolution=32),
'label': IntField()
})
# Write dataset
writer.from_indexed_dataset(my_dataset)but shouldn't I be using something different that the RGBImageField?
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request