tensorflow图像预处理常用函数

1. 随机剪裁图像:
tf.random_crop(value(org. image), size=[row, column, channal],)


2. Randomly flip the image horizontally:
image = tf.image.random_flip_left_right(image)


3.随机HUE, max_delta必须介于0 和0.5之间:
tf.image.random_hue(image, max_delta=0.05)

随机对比度:
tf.image.random_contrast(image, lower=0.3, upper=1.0)

随机亮度:
tf.image.random_brightness(image, max_delta=0.2)

随机饱和度:
image = tf.image.random_saturation(image, lower=0.0, upper=2.0)


3.剪裁或填充,  如果图片过大, 则中心剪裁, 过小则填充, image可以是4维矩阵[batch, 高, 宽, channal], 或不带batch的三维:
tf.image.resize_image_with_crop_or_pad(image,target_height,target_width)


4. map功能, 一般 func.是一个lambda函数, elements为处理对象:
tf.map_fn(func., elements)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值