當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。