preprocessor.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:tefla 作者: openAGI 项目源码 文件源码
def random_adjust_saturation(image, min_delta=0.8, max_delta=1.25):
    """Randomly adjusts saturation.

    Makes sure the output image is still between 0 and 1.

    Args:
      image: rank 3 float32 tensor contains 1 image -> [height, width, channels]
             with pixel values varying between [0, 1].
      min_delta: see max_delta.
      max_delta: how much to change the saturation. Saturation will change with a
                 value between min_delta and max_delta. This value will be
                 multiplied to the current saturation of the image.

    Returns:
      image: image which is the same shape as input image.
    """
    with tf.name_scope('RandomAdjustSaturation', values=[image]):
        image = tf.image.random_saturation(image, min_delta, max_delta)
        image = tf.clip_by_value(image, clip_value_min=0.0, clip_value_max=1.0)
        return image
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号