-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Move image loading logic to _load_image in VOC datasets (similar to COCO) #4975
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
Comments
I would recommend to inherit from the class, and override |
Here's what I do now: Overriding getitem would entail to the same thing - having to copy-paste the even less standard / error-prone annotation parsing line. Not wanting the dataset to load images for only metadata purposes is a valid and frequent usecase (often happens for some stats computation and avoiding duplicating ground truth preparation functions). At least simplifying hacking around would be helpful and minimize the copy-pasting. Accepting a method for image loading by a given path in |
As discussed in #4991, I'm ok with moving the functionality into a private method on the dataset as long as it is a 1-to-1 copy of the current behavior. Still, the BC part of #4975 (comment) applies. |
🚀 The feature
This would allow simple stubbing out image loading if needed for fast dataset transformed metadata access (when image reading is not needed) by
dataset._load_image = lambda _: None
and also make API more consistent across datasets.It's also impossible to monkey-patch
__getitem__
at instance level: https://stackoverflow.com/questions/57413453/is-it-possible-to-override-getitem-at-instance-level-in-python :(Motivation, pitch
N/A
Alternatives
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: