图像增广

来源:互联网 发布:js的math.abs 编辑:程序博客网 时间:2024/05/16 16:07


安装增广:

只需文件夹AugmentorSam即可

增广的使用:

一段实例程序:

 

 

 

其中path = "D:\\train_data\\JPEGImages"

path2 = "D:\\train_data\\Annotations"

分别是图像的文件夹和标定的文件夹

 

p = AugmentorSam.Pipeline(path, path2) 定义增广

p.rotate( 0.3 , 2 , 2 )

p.random_distortion ( 0.7 , 2 , 2 , 6 )

p.zoom2 ( 0.4 , 1 , 1.2 )

为添加增广的函数,其中第一项为概率,后面为函数参数

p.sample(1000)为增广的图片个数

增广的函数汇总:

p.rotate( probability_rotate, max_left_rotation, max_right_rotation)

p.rotate90( probability_rotate90)

p.rotate_random_90( probability_rotate_random_90)

p.rotate270( probability_rotate270)

p.rotate180( probability_rotate180)

p.flip_top_bottom( probability_flip_top_bottom)

p.flip_left_right( probability_flip_left_right)

p.flip_random( probability_flip_random)

p.random_distortion ( probability_random_distortion, grid_width, grid_height, magnitude)

p.gaussian_distortion ( probability_gaussian_distortion, grid_width, grid_height, magnitude, corner, method, mex=0.5, mey=0.5, sdx=0.05, sdy=0.05)

p.zoom ( probability_zoom, min_factor, max_factor)

p.zoom_random ( probability_zoom_random, percentage_area, randomise_percentage_area=False)

p.crop_by_size ( probability_crop_by_size, width, height, centre=True)

p.crop_centre ( probability_crop_centre, percentage_area, randomise_percentage_area=False)

p.crop_random ( probability_crop_random, percentage_area, randomise_percentage_area=False)

p.histogram_equalisation ( probability_histogram_equalisation)

p.scale ( probability_scale, scale_factor)

p.resize ( probability_resize, width, height, resample_filter="BICUBIC")

p.skew_left_right ( probability_skew_left_right, magnitude=1)

p.skew_top_bottom ( probability_skew_top_bottom, magnitude=1)

p.skew_tilt ( probability_skew_tilt, magnitude=1)

p.skew_corner ( probability_skew_corner, magnitude=1)

p.skew ( probability_skew, magnitude=1)

p.shear ( probability_shear, max_shear_left, max_shear_right)

p.greyscale ( probability_greyscale)

p.black_and_white ( probability_black_and_white, threshold=128)

p.invert ( probability_invert)

p.random_erasing ( probability_random_erasing, rectangle_area)