Skip to content

Allow user to ask for features other than image and label in ImageDataset #2571

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

grodino
Copy link
Contributor

@grodino grodino commented Aug 19, 2025

Hi team timm,

As the title suggests, this PR allows the ImageDataset's __getitem__ to return more than the (img, target) tuple.
This is necessary for rate-constrained optimization (fairness repair methods for example) but could also be interesting for any other application that requires more than the img, target tuple.

For now, I only implemented this for ImageDataset using the ReaderHfds (as it is my use-case) but I'd be happy to generalize it if you are interested.

Cheers,
Augustin

PS: here is a sample code that uses this feature

waterbirds = create_dataset("grodino/waterbirds",split="test",additional_features="place")

for image, target, group in DataLoader(waterbirds):
    ...

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

Successfully merging this pull request may close these issues.

1 participant