-
Notifications
You must be signed in to change notification settings - Fork 140
Options for padding #859
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
This discussion and PRs #727, #734, #738 might be references to discussions of a requested feature of different types of padding. I don't know if we have plans for adding different types of padding. @lostanlen is in the process of refactoring the padding module/operation from the 1D scattering. @edouardoyallon do you think its a good idea to add different types of padding in 2d, like reflective or constant or what not? It should be easy to do I think, but correctness/comparison to a base implementation might be an issue |
Hello @flyIchtus , Right now, what you're doing is indeed the only way to have custom padding/unpadding in Kymatio 2D: pass But i agree that this is not satisfactory and ideally you should be able to pass a single keyword argument at runtime. Not: scattering=Scattering2D(4,data.shape,8, pad_type=pad_type)
results_order2=scattering(data)
... But scattering=Scattering2D(4,data.shape,8)
results_order2=scattering(data, pad_type=pad_type)
... (the keyword In other words, the scattering = Scattering2D(J=4, shape=data.shape, L=8)
S2_symm = scattering(data, pad_type='symmetric')
S2_reflect = scattering(data, pad_type='reflect') Thoughts? |
OK, sorry for the long delay. Thank you both for pointing me to useful discussions. Great proposal @lostanlen , having flexible padding options for the same scattering object really more elegant (and lean). Agree that pad_mode seems better than pad_type. As for validation and correctness issue @MuawizChaudhary : A starting point could be something like https://arxiv.org/abs/2010.02178 Hoping for "perfect" 2D padding, that would allow to forget boundary effects, seems unreasonable however. Anyway, on texture datasets, it would be interesting to (statistically) compare
I might be able to have a try on my weather dataset (which, strictly speaking, is not a texture but incorporate some). I keep you updated on this issue 1) if you are interested and 2) if i can get it done in the coming weeks. |
#926 has added zero-padding to 1D backends |
Uh oh!
There was an error while loading. Please reload this page.
Working with scattering for weather forecasts image analysis, I was wondering what influence the type of padding did have on results.
The reflection padding implemented by default seems to produce high gradients on the boundaries. After a few subsamplings, the large values on the boundary gain a certain weight in the spatial average, that could lead to estimation biases.
This is visible on orientation averaged second-order coefficients.
Question 1 : have the topic already been discussed ?
Question 2 : what about providing numpy padding modes as an option to scattering ?
Now for a bit of demo, if it adds to the discussion.
After a fork and 1 or 2 adds on numpy frontend/backend, one comes to the following code :
The data is downloadable in the zip attached.
wind_norm.zip
The result of this yields:
-19.169381905671035 13.210792343005728 -0.07116768707598231
Here both transforms coincide at the center, but not on the border. Overestimation by reflection padding is manifest here.
The text was updated successfully, but these errors were encountered: