def deprocess_and_save(x, img_path):
# Remove the batch dimension
x = np.squeeze(x)
# Restore the mean values on each channel
x[:, :, 0] += 103.939
x[:, :, 1] += 116.779
x[:, :, 2] += 123.68
# BGR --> RGB
x = x[:, :, ::-1]
# Clip unprintable colours
x = np.clip(x, 0, 255).astype('uint8')
# Save the image
imsave(img_path, x)
评论列表
文章目录