I have a input T1 of size (1,256,256,3) i.e. images/grid of batch size 1. I have another tensor T2 of size (1, N, 2) i.e. tensor consisting of coordinates i.e. [ [10.5 , 200.787], [150.568, 190.456], …]. How do I compute functional values (using bilinear interpolation) of coordinates in T2 from T1 data?
Or is there any function equivalent to tensorflow function “tf.contrib.resampler.resampler”?
You would have to normalize your coordinates to [-1, 1], permute the input to have the shape [batch_size, channels, height, width], and you could apply grid_sample.
Thanks for the reply. I have used it as you have suggested
The output of grid_sample however is not as expected. I am attaching the files input image, grid and output.
Output is being replicated four times after i apply grid sample as visible in the image
Order of images: Input image(left), grid(right), output(bottom).
May I know where would it go wrong?