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 -----------------------------------
n06_pytorch_utils.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录