-
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
Re-write getting started guide for transforms V2 #7870
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/vision/7870
Note: Links to docs will display an error until the docs builds have been completed. ❌ 8 New Failures, 2 Unrelated FailuresAs of commit dfeafa2 with merge base 11e49de ( NEW FAILURES - The following jobs have failed:
FLAKY - The following job failed but was likely due to flakiness present on trunk:
BROKEN TRUNK - The following job failed but was present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
from torchvision.utils import draw_bounding_boxes | ||
|
||
|
||
def plot(imgs): |
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.
I think we need to reduce the boilerplate to a very strict minimum in the examples, because they're already complex enough as it is - we don't need noise.
I opted for the option of creating a new file here. I don't have a super strong opinion on how it should be done, other than the fact that this code shouldn't be part of the example itself.
Hopefully this is non-blocking anyway and we can figure out a long-term solution later, if there are concerns with this one.
# dataset = wrap_dataset_for_transforms_v2(dataset) | ||
# # Now the dataset returns datapoints! | ||
# | ||
# Using your own datasets |
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.
I dropped the part about PennFudanDataset here. It seems too specific for this "getting started" guide.
Depending on what pytorch/tutorials#2533 looks like, we may link to it form there.
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.
Good re-write. Just few comments and good to go from my side
Co-authored-by: vfdev <vfdev.5@gmail.com>
…nto AAAAAAAAAaaaaaaaaaaa
Co-authored-by: vfdev <vfdev.5@gmail.com>
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.
Few minor comments, but LGTM anyway.
|
||
assets_directory = pathlib.Path("../assets") | ||
# If you're trying to run that on collab, you can download the assets and the | ||
# helpers from https://github.com/pytorch/vision/tree/main/gallery/ |
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.
# helpers from https://github.com/pytorch/vision/tree/main/gallery/ | |
# helpers from https://github.com/pytorch/vision/tree/main/gallery/v2_transforms |
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.
assets are in gallery
# If you're trying to run that on collab, you can download the assets and the | ||
# helpers from https://github.com/pytorch/vision/tree/main/gallery/ | ||
from helpers import plot | ||
img = read_image(str(Path('../assets') / 'astronaut.jpg')) |
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.
This will also not work on Collab without user interference, right?
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.
probably not
|
||
return path, image, bounding_boxes, masks, labels | ||
transforms = v2.Compose([ |
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.
Should we avoid the plural for the variable name to not clash with the namespace? Somewhat weak argument, since for some datasets we would have transforms=transform
. Still, I would prefer keeping it singular here and in general.
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.
This is sort of related to #7866.
These are transforms, it makes sense to call this variable transforms. If there was a single transform I'd call it transform, or t.
I personally strongly dislike the new trend of importing the module as transforms
in our tests.
Co-authored-by: Philip Meier <github.pmeier@posteo.de>
…nto AAAAAAAAAaaaaaaaaaaa
Summary: (Note: this ignores all push blocking failures!) Reviewed By: matteobettini Differential Revision: D48900408 fbshipit-source-id: 04f3cf195318b4b03c527feb05de92d5700717e0 Co-authored-by: vfdev <vfdev.5@gmail.com> Co-authored-by: Philip Meier <github.pmeier@posteo.de>
Will submit re-write of "e2e" example when this is merged.