-
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
Add illustrations of transforms with sphinx-gallery #3652
Conversation
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.
Well it looks like it went fine - it's almost a miracle!
The gallery is at https://504027-73328905-gh.circle-artifacts.com/0/docs/auto_examples/index.html and contains one (very WIP) example so far.
Backlinks are added properly: https://504027-73328905-gh.circle-artifacts.com/0/docs/transforms.html#torchvision.transforms.Pad.forward
@fmassa what are your first impressions?
docs/source/transforms.rst
Outdated
@@ -76,6 +76,11 @@ Transforms on PIL Image and torch.\*Tensor | |||
.. autoclass:: Pad | |||
:members: | |||
|
|||
.. include:: gen_modules/backreferences/torchvision.transforms.Pad.examples |
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.
there's a better way to do this with more recent versions of sphinx-gallery (and possibly even with this one, I didn't dive too much into it)
gallery/plot_transforms.py
Outdated
img = Image.fromarray(astronaut()) | ||
|
||
plt.figure().suptitle("Before padding") | ||
plt.imshow(np.asarray(img)) |
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.
TODO: Surely there's a better way to render PIL images...
This approach looks great, thanks! How do you want to approach this, get a small example with a few transforms merged and then progressively extend it? Also, it might be good to avoid using skimage and instead provide our own version of |
Thanks for the feedback!
Pretty much, yeah. I was thinking of inviting the community to contribute with more transform illustrations once the basis is merged?
OK, I wasn't sure about this - I'll include the image as an asset. |
@fmassa I think this is ready for a review. The latest example is here: https://519065-73328905-gh.circle-artifacts.com/0/docs/auto_examples/plot_transforms.html#sphx-glr-auto-examples-plot-transforms-py I think we can merge this one and them I'll open an issue to invite contributors to expand it |
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!
One thing we might want to consider when scaling up with implementing examples for other transforms is to potentially split the gallery in a few different ones, grouped by transformation type (color / geometric / etc).
Reviewed By: NicolasHug Differential Revision: D28169127 fbshipit-source-id: 8233282c3b03a051f253f6a0447029ed9d85ac4b
This PR uses
sphinx-gallery
to add an example that illustrates how the transforms affect a given image.Closes #1409
#1426