当前位置: 首页>>代码示例>>Python>>正文


Python Augmentor.Pipeline方法代码示例

本文整理汇总了Python中Augmentor.Pipeline方法的典型用法代码示例。如果您正苦于以下问题:Python Augmentor.Pipeline方法的具体用法?Python Augmentor.Pipeline怎么用?Python Augmentor.Pipeline使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Augmentor的用法示例。


在下文中一共展示了Augmentor.Pipeline方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: import Augmentor [as 别名]
# 或者: from Augmentor import Pipeline [as 别名]
def __init__(self, 
            dataset_config=None,
            additional_augmentor_obj=None
        ):
        self.p = Augmentor.Pipeline()

        if dataset_config is not None and 'pipeline' in dataset_config:
            for pipeline in dataset_config['pipeline']:
                method_to_call = getattr(self.p, pipeline[0])
                parameters = pipeline[1]
                method_to_call(**parameters)
            if additional_augmentor_obj is not None:
                for pipeline in additional_augmentor_obj:
                    method_to_call = getattr(self.p, pipeline[0])                    
                    parameters = pipeline[1]
                    method_to_call(**parameters)

        self.transform = self.p.torch_transform()
        if dataset_config is not None and 'scaling' in dataset_config:
            self.scaling = dataset_config['scaling']
        else:
            self.scaling = 'tanh' 
开发者ID:pfnet-research,项目名称:chainer-stylegan,代码行数:24,代码来源:dataset_augmentor.py

示例2: augment

# 需要导入模块: import Augmentor [as 别名]
# 或者: from Augmentor import Pipeline [as 别名]
def augment():
	p = Augmentor.Pipeline(
		source_directory=ORIGIN_MERGED_SOURCE_DIRECTORY,
		output_directory=AUGMENT_OUTPUT_DIRECTORY
	)
	p.rotate(probability=0.2, max_left_rotation=2, max_right_rotation=2)
	p.zoom(probability=0.2, min_factor=1.1, max_factor=1.2)
	p.skew(probability=0.2)
	p.random_distortion(probability=0.2, grid_width=100, grid_height=100, magnitude=1)
	p.shear(probability=0.2, max_shear_left=2, max_shear_right=2)
	p.crop_random(probability=0.2, percentage_area=0.8)
	p.flip_random(probability=0.2)
	p.sample(n=TRAIN_SET_SIZE + VALIDATION_SET_SIZE + TEST_SET_SIZE) 
开发者ID:DuFanXin,项目名称:U-net,代码行数:15,代码来源:data_TF.py

示例3: distort

# 需要导入模块: import Augmentor [as 别名]
# 或者: from Augmentor import Pipeline [as 别名]
def distort():
    p = Augmentor.Pipeline()
    p.random_distortion(probability=1, grid_width=5, grid_height=5, magnitude=8)

    def call(x):
        x = p.sample_with_array(x.astype('uint8'), False)
        return x

    return call 
开发者ID:mctigger,项目名称:KagglePlanetPytorch,代码行数:11,代码来源:transforms.py

示例4: __init__

# 需要导入模块: import Augmentor [as 别名]
# 或者: from Augmentor import Pipeline [as 别名]
def __init__(self):
        self.imgaug_transform = iaa.Sequential(
            [iaa.Multiply((1.5, 1.5), per_channel=False), iaa.Add((127, 127), per_channel=False)]
        )
        self.augmentor_pipeline = Pipeline()
        self.augmentor_pipeline.add_operation(
            Operations.RandomBrightness(probability=1, min_factor=1.5, max_factor=1.5)
        )
        self.augmentor_pipeline.add_operation(Operations.RandomContrast(probability=1, min_factor=1.5, max_factor=1.5))
        self.solt_stream = slc.Stream(
            [
                slt.ImageRandomBrightness(p=1, brightness_range=(127, 127)),
                slt.ImageRandomContrast(p=1, contrast_range=(1.5, 1.5)),
            ]
        ) 
开发者ID:albumentations-team,项目名称:albumentations,代码行数:17,代码来源:benchmark.py


注:本文中的Augmentor.Pipeline方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。