from PIL import Image
import numpy as np
# random image data
image_data = np.random.randint(low=0, high=256, size=(48,48,3)).astype(np.uint8)
image_small = Image.fromarray(image_data)
# there are many settings you can play here, depending on how you want the image resized
image_large = image_small.resize((120,120))
np.array(image_large)
您可以毫无问题地使用
tensorflow.image.resize
方法如果您阅读tensorflow的文档,它说明您可以使用不同的方法进行向下采样和向上采样
方法参数需要image.ResizeMethod枚举中的项或等效字符串。这些选择包括:
here details
这可能有用
相关问题 更多 >
编程相关推荐