vflip

paddle.vision.transforms.vflip ( img ) [源代码]

对输入图像进行垂直方向翻转。

参数

  • img (PIL.Image|numpy.ndarray) - 输入的图像。

返回

PIL.Image 或 numpy.ndarray,翻转后的图像数据。

代码示例

  1. import numpy as np
  2. from PIL import Image
  3. from paddle.vision.transforms import functional as F
  4. fake_img = (np.random.rand(256, 300, 3) * 255.).astype('uint8')
  5. fake_img = Image.fromarray(fake_img)
  6. flpped_img = F.vflip(fake_img)
  7. print(flpped_img.size)