Skip to content

LambdaDataset? #525

@kohr-h

Description

@kohr-h

I'm wondering if this is of interest to the torchvision community: a dataset defined with two functions. It would look like this:

wrapped_dset = # some dataset

def data(i):
    return wrapped_dset[i][0]

def target(i):
    return data(i)[:, ::2, ::2]  # downsample on the fly

dset = LambdaDataset(data_func=data, target_func=target, length=len(wrapped_dset))

It could be super-handy to combine datasets, switch out the target like above, etc., without having to write a separate class.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions