Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subset sampling entire dataset #36

Open
dajopr opened this issue Jul 13, 2021 · 1 comment
Open

Subset sampling entire dataset #36

dajopr opened this issue Jul 13, 2021 · 1 comment

Comments

@dajopr
Copy link

dajopr commented Jul 13, 2021

Hi everyone,

I have a question concering using subsets with this sampler. According to the code it chooses samples from all entries in the parent dataset:

elif isinstance(dataset, torch.utils.data.Subset):
return dataset.dataset.imgs[:][1]

Shouldn't it only sample from the samples the chosen subset in dataset.indices? When I try to run _get_labels as is, I get length mismatch. Is my implementation of subset unusual or should this be changed? Only returning the labels corresponding to dataset.indices solved this problem for me:

        elif isinstance(dataset, torch.utils.data.Subset):
            return [dataset.dataset.imgs[ind][1] for ind in dataset.indices]
@SilenceMonk
Copy link

@Tisner Thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants