n06_pytorch_utils.py 文件源码

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

项目:kaggle_amazon_from_space 作者: N01Z3 项目源码 文件源码
def augment(x):
    x = x.astype(np.float32) / 255
    u = 0.75
    if random.random() < u:
        if random.random() > 0.5:
            x = randomDistort1(x, distort_limit=0.35, shift_limit=0.25, u=1)
        else:
            x = randomDistort2(x, num_steps=10, distort_limit=0.2, u=1)
        x = randomShiftScaleRotate(x, shift_limit=0.0625, scale_limit=0.10, rotate_limit=45, u=1)

    x = randomFlip(x, u=0.5)
    x = randomTranspose(x, u=0.5)
    x = randomContrast(x, limit=0.2, u=0.5)
    # x = randomSaturation(x, limit=0.2, u=0.5),
    x = randomFilter(x, limit=0.5, u=0.2)
    x = np.uint8(255.0 * np.transpose(x, (2, 0, 1)))
    return x


# draw -----------------------------------
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号