dm_utils.py 文件源码

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

项目:deep-makeover 作者: david-gpu 项目源码 文件源码
def distort_image(image):
    """Perform random distortions to the given 4D image and return result"""

    # Switch to 3D as that's what these operations require
    slices = tf.unpack(image)
    output = []

    # Perform pixel-wise distortions
    for image in slices:
        image  = tf.image.random_flip_left_right(image)
        image  = tf.image.random_saturation(image, .2, 2.)
        image += tf.truncated_normal(image.get_shape(), stddev=.05)
        image  = tf.image.random_contrast(image, .85, 1.15)
        image  = tf.image.random_brightness(image, .3)

        output.append(image)

    # Go back to 4D
    image   = tf.pack(output)

    return image
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号