I have a image
im, and need to crop it to a bounding box
(x1, x2, y1, y2). Currently I am doing
im[y1: y2, x1: x2], but pytorch reminds me that indices should be
None. Is it possible to make the operation back-propagatable with respect to
x1, x2, y1, y2?
You need something like spatial transformer networks.
My requirement is a little different from your paper. Rather than learning to focus to and transform specific region of an image, I would like to deterministically crop a given region.
indexing is not differentiable wrt the indices. you will need to use a non-differentiable optimization method, probably reinforcement learning.