Python数据增强(data augmentation)库--Augmentor 使用介绍
Augmentor 使用介绍
原图
1.random_distortion(probability, grid_height, grid_width, magnitude)
最终选择参数为
p.random_distortion(probability=0.8, grid_height=3, grid_width=3, magnitude=6)
其他参数效果:
magnitude和grid_width,grid_height越大,扭曲程度越大
p.random_distortion(probability=0.6, grid_height=6, grid_width=6, magnitude=5)
p.random_distortion(probability=0.6, grid_height=6, grid_width=6, magnitude=9)
p.random_distortion(probability=0.6, grid_height=10, grid_width=10, magnitude=5)
2.random_erasing(probability, rectangle_area)
rectangle_area表示覆盖区域的比例,值越大比例越大。但是设置为1的时候并不是全覆盖,不知道为什么,反正也没必要弄清楚
p.random_erasing(1,1)
3.zoom_random(probability, percentage_area)
放大图片,然后按照percenta_area的比例对图片进行crop。
p.zoom_random(probability=1, percentage_area=0.2)
p.zoom_random(probability=1, percentage_area=0.8)
4.zoom(probability, min_factor, max_factor)
p.zoom(probability=1, min_factor=1.1, max_factor=1.5)
p.zoom(probability=1, min_factor=2, max_factor=2)
组合操作
p.rotate_random_90(probability=0.8)
p.random_distortion(probability=0.8, grid_height=3, grid_width=3, magnitude=6)
p.random_erasing(0.3, 0.2)
p.zoom(probability=0.4, min_factor=1.1, max_factor=1.5)
p.sample(6)