Add grid sampling#361
Conversation
|
I've commented out failing test for the depthwise conv for now. Should I bring it back? |
|
They were failing intermittently, mostly in the multi-threading environment. Since we have a few multithreaded methods, better have the multithreaded CI passing, so I'm ok with keeping those problematic tests out. We should open an issue for those depthwiseconv failures if there is no one already. I'll try to review in the next few days, thanks for this contribution, at a first glance looks perfect already! |
|
@CarloLucibello RE CI failures, feel free to rename and re-purpose #359. |
src/sampling.jl
Outdated
| Where for each `(W_out, H_out, N)` grid contains `(x, y)` | ||
| coordinates that specify sampling locations normalized by the `input` shape. | ||
|
|
||
| Therefore, it should have values mostly in `[-1, 1]` range. |
There was a problem hiding this comment.
| Therefore, it should have values mostly in `[-1, 1]` range. | |
| Therefore, `x` and `y` should have values mostly in `[-1, 1]` range. |
Also, why "mostly?"
There was a problem hiding this comment.
Also, why "mostly?"
It was added as a hint that the values can be outside, but probably makes no sense.
|
Hi! Just to leave this here, as I ported the tri/bi/linear upsampling code from pytorch: 1) Setting |
|
Just to confirm, is there any plan to add 5D support for grid_sampling? |
|
No active plans that I know of, but contribution are welcome. Maybe @maxfreu could provide some guidance. |
|
Hi @gRox167 ! As imaging science phd student this is the perfect task for you :D In principle it should be quite simple:
It should be pretty straight forward and more of a writing than a thinking task. Optionally, you can simply use ChatGPT, show it the current julia and the pytorch code and tell it to expand it. I guess that should also work pretty well nowadays. The key to success in any case are good tests for the forward and backward pass. |
Thanks for your guidance, I think I can take a try. |
|
Please refer to PR #627 . |
This PR adds grid sampling for the 4D case.
This is needed for things like self-supervised depth estimation, where a neural network would learn a depth
Dfor the current image and projection transformationPfor the adjacent images and does "warping" of the images usingDandP.And this function does image sampling given projected coordinates (a.k.a.
grid).The implementation differs from the PyTorch's version in that it assumes
align_corners = Trueand uses only bilinear interpolation. It was tested to give the same results as PyTorch's version.PR with the CUDA kernels.