If your image has three channels, you should apply the deformation only on the x and y dimension. So suppose that your image x has shape (channels, height, width), you would do the deformation with
# generate a 2D displacement grid of 3 x 3, with two displacement coordinates per grid point
displacement = numpy.random.randn(2, 3, 3) * 5
# apply the deformation to the last two dimensions of x
x_deformed = etorch.deform_grid(x, displacement, axis=(1, 2))
If your image has three channels, you should apply the deformation only on the x and y dimension. So suppose that your image
x
has shape(channels, height, width)
, you would do the deformation with