tensor/矩阵/图片等更换通道,调整size

由(326, 474, 3) 变为 (3, 326, 474)

img = np.transpose(img, (2,0,1))

(326, 474, 3)还是(326, 474, 3),只不过最后的3的channel由BGR变为RGB(右移一位)

img = img[:,:,::-1]

猜你喜欢

转载自blog.csdn.net/hxxjxw/article/details/113920058