Skip to content
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

Implementing interpolation methods beyond bi-linear in tfa.image.resample #1

Open
3 tasks
EiffL opened this issue Jun 29, 2021 · 3 comments
Open
3 tasks

Comments

@EiffL
Copy link
Member

EiffL commented Jun 29, 2021

Here is a written description of this issue, where we want to add support for other interpolation methods in this function tfa.image.resampler

So, essentially it's a matter of modifying the following files, that I've already started to mess with:

  • tensorflow_addons/custom_ops/image/cc/kernels/resampler_ops.cc : This is where the CPU kernel and its gradients are defined
  • tensorflow_addons/custom_ops/image/cc/kernels/resampler_ops.h : That's the corresponding header
  • tensorflow_addons/custom_ops/image/cc/ops/resampler_ops.cc : That's where the C++ TF ops are defined

Another important file will be:

  • tensorflow_addons/custom_ops/image/cc/kernels/resampler_ops_gpu.cu.cc : This is where the GPU kernel and its gradients are defined

All of this should compile easily following the instructions in this part of the README

So essentially, what I've tried to start doing for CPU is removing the default bilinear interpolation scheme and instead replace it by something generic using the resampling kernels already defined in TensorFlow here: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/kernels/image/sampling_kernels.h

If we could get Cubic interpolation to work we would already be pretty happy :-)

So concretely, the steps would be:

Alright, this description is not super heavy in explanations so don't hesitate if you have questions @Dr-Zero!

@EiffL
Copy link
Member Author

EiffL commented Jul 25, 2021

@Dr-Zero @andrevitorelli how are we doing on this :-) any cool results? or any questions? On implementation itself or on test cases?

@EiffL
Copy link
Member Author

EiffL commented Jul 29, 2021

So how are we doing guys :-) ?

@andrevitorelli
Copy link
Collaborator

@EiffL, I have written the issue to the tfa repo (you're linked there), they seem to understand it as a bug, also. @Dr-Zero told me he could have it by next Tue.
The code provided there is not as small as 6-7 lines, and is essentially the same of your gist notebook, but that will do, and serves as a unit test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants