Hi all,
I want to crop images with given indices like follows:
images = given Tensor with shape N x C x H x W
lt_x = given Tensor with shape N
lt_y = given Tensor with shape N
rb_x = given Tensor with shape N
rb_y = given Tensor with shape N
for i in range(images.size(0)):
croped_images.append(images[i, :, lt_x[i]: rb_x[i], lt_y[i]: rb_y[i]])
But the for loop is too slow. Thus I want to know if there are some batch operation that can do the similar operation, like
croped_images = images[:, :, lt_x: rb_x, lt_y: rb_y]
Thanks.