when I get patches, how do I get the (x, y) axes of the pixel ?
pixel=image.reshape(image.shape[0], image.shape[1]*image.shape[2])
how do I know the axes of the pixel (x, y) plz
when I get patches, how do I get the (x, y) axes of the pixel ?
pixel=image.reshape(image.shape[0], image.shape[1]*image.shape[2])
how do I know the axes of the pixel (x, y) plz
if c, h, w = image.shape
and the index into the pixel
tensor is i, j
, then y = j // w
, x = j % w
.
Best regards
Thomas
The instruction you posted “flattens” the image, so you transform the x y index into a a single j index. You can then use any j between 0 and h * w - 1.