-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Always pass transform and target_transform to abstract dataset #1126
Conversation
Thanks for the PR! I'll have it reviewed tomorrow. Just to answer your question:
I think we should still keep the separate transforms for now, as in most cases it's simpler for the user. |
Should I add it to |
Codecov Report
@@ Coverage Diff @@
## master #1126 +/- ##
==========================================
+ Coverage 64.89% 65.24% +0.34%
==========================================
Files 68 68
Lines 5413 5384 -29
Branches 835 835
==========================================
Hits 3513 3513
+ Misses 1643 1615 -28
+ Partials 257 256 -1
Continue to review full report at Codecov.
|
In the references directory, the dataset of vision/references/detection/coco_utils.py Line 209 in 8837e0e
Is it necessary to pass transforms (here is _transforms ) to the constructor?
|
@zhiqwang that is a custom dataset wrapper, and I on purpose not passed it to the constructor because I want the transforms to be applied after modifying the annotations to include the vision/references/detection/coco_utils.py Line 216 in 8837e0e
Ideally I'd remove that and let the image id be returned by the dataloader, but that is currently not possible.
It generally makes more sense to have joint transforms only because it are a segmentation dataset, and if you perform a transformation on the image you generally need to apply the same one to the target. |
@fmassa Thanks for your explanation, and it help me understand the detection datasets a lot. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @pmeier !
I think that we should keep the changes that passes the transform
and target_transform
to the constructor of VisionDataset
, but I'm less sure of the benefits of adding transforms
to all datasets, because that is generally not needed, and I'm not clear on which use-case this would come in handy.
Could you remove the added transforms
in the constructor, and just pass the transform
and target_transform
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more comment and then this is good to go, thanks a lot!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks a lot for you contribution!
Just waiting for CI to finish so that I can merge this
Kicked of by @zhiqwang (comment). Now,
transforms
,transform
, andtarget_transform
are passed toVisionDataset.__init__()
for all datasets as intended.@fmassa Should the usage of separate transforms deprecated? I'm asking since
SBDataset
only has joint transform:vision/torchvision/datasets/sbd.py
Lines 52 to 57 in 8837e0e
I'll fix the docstrings afterwards.