tensorflow: how to rotate an image for data augmentation?

后端 未结 7 2028
遇见更好的自我
遇见更好的自我 2020-12-09 05:27

In tensorflow, I would like to rotate an image from a random angle, for data augmentation. But I don\'t find this transformation in the tf.image module.

7条回答
  •  情歌与酒
    2020-12-09 05:40

    For rotating an image or a batch of images counter-clockwise by multiples of 90 degrees, you can use tf.image.rot90(image,k=1,name=None).

    k denotes the number of 90 degrees rotations you want to make.

    In case of a single image, image is a 3-D Tensor of shape [height, width, channels] and in case of a batch of images, image is a 4-D Tensor of shape [batch, height, width, channels]

提交回复
热议问题