Exemplo n.º 1
0
def make_pipeline(imageset_path, output_dir):
    """returns an augmentation pipeline for a given image set"""
    p = Pipeline(imageset_path, output_dir)
    p.random_distortion(probability=0.7,
                        grid_width=4,
                        grid_height=4,
                        magnitude=8)
    p.flip_left_right(probability=0.5)
    p.flip_top_bottom(probability=0.5)
    p.zoom(probability=0.3, min_factor=1.1, max_factor=1.4)
    p.rotate(probability=0.5, max_left_rotation=10, max_right_rotation=10)
    return p
Exemplo n.º 2
0
    def create_aug_pipeline_train(input_size):
        """Image Augmentation Pipeline for Training Set."""

        p_train = Pipeline()
        # Random crop
        p_train.add_operation(CropPercentageRange(probability=1, min_percentage_area=0.8, max_percentage_area=1, centre=False))
        # Rotate the image by either 90, 180, or 270 degrees randomly
        p_train.rotate_random_90(probability=0.5)
        # Flip the image along its vertical axis
        p_train.flip_top_bottom(probability=0.5)
        # Flip the image along its horizontal axis
        p_train.flip_left_right(probability=0.5)
        # Random change brightness of the image
        p_train.random_brightness(probability=0.5, min_factor=0.9, max_factor=1.1)
        # Random change saturation of the image
        p_train.random_color(probability=0.5, min_factor=0.9, max_factor=1.1)
        # Resize the image to the desired input size of the model
        p_train.resize(probability=1, width=input_size[0], height=input_size[1])

        return p_train
Exemplo n.º 3
0
#
# # create a new pipeline
# file_path = "C:\\liyu\\files\\tiff\\cells"
# p = Augmentor.Pipeline(file_path)

from Augmentor.Pipeline import *
import time

# create a new pipeline
file_path = "C:\\liyu\\files\\tiff\\newtest"
p = Pipeline(file_path)

# add operations to the pipeline

# 水平翻转
p.flip_left_right(probability=0.8)

# # 垂直翻转
# p.flip_top_bottom(probability=0.5)
#
# # 随机90, 180, 270 度旋转
# p.rotate_random_90(probability=0.75)
#
# # 随机20度内旋转,不变形, 四角填充黑色,图片大小不变
# p.rotate_without_crop(probability=0.5, max_left_rotation=20, max_right_rotation=20)
#
# # 随机20度内旋转,不变形, 四角填充黑色,图片大小调整
# p.rotate_without_crop(probability=0.5, max_left_rotation=20, max_right_rotation=20, expand=True)
#
# # 随机剪切, 中心不变
# p.crop_by_size(probability=0.5, width=100, height=100)