0

I have 4 sequences of images, each formed by 5 RGB images with shape (10x10). Everything is represented by a numpy array with shape:

batch.shape = (4, 5, 10, 10, 3)

I need to apply some normalization operations on the array, where for each image, I have to subtract a fixed value from all the pixels in each of the 3 channels (a different, fixed value for each channel). An easy way to do this is:

batch[:, :, :, :, 0] -= 0.485
batch[:, :, :, :, 1] -= 0.456
batch[:, :, :, :, 2] -= 0.406

but I was wondering if there's an even faster way to do this.

Carlo
  • 1,321
  • 12
  • 37

0 Answers0