numpy 图像通道转换[n c h w] 转 [n h w c]

numpy 图像通道转换[n c h w] 转 [n h w c]

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

img_hwc = np.transpose(img_chw, (1, 2, 0))

image = np.expand_dims(image, axis=0)

posted @ 2023-03-09 16:18  michaelchengjl  阅读(310)  评论(0编辑  收藏  举报