augmentation.py 文件源码

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

项目:gconv_experiments 作者: tscohen 项目源码 文件源码
def rotate_transform_batch(x, rotation=None):

    r = np.random.uniform(-0.5, 0.5, size=x.shape[0]) * rotation

    # hack; skimage.transform wants float images to be in [-1, 1]
    factor = np.maximum(np.max(x), np.abs(np.min(x)))
    x = x / factor

    x_out = np.empty_like(x)
    for i in range(x.shape[0]):
        x_out[i, 0] = tf.rotate(x[i, 0], r[i])

    x_out *= factor

    return x_out
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号