From c83320a1b7626cc66b14bb3c1fd4c2a0656ede1b Mon Sep 17 00:00:00 2001 From: jiangjiajun Date: Tue, 26 May 2020 17:49:23 +0800 Subject: [PATCH] modify transforms --- paddlex/cv/transforms/det_transforms.py | 1 - paddlex/cv/transforms/seg_transforms.py | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/paddlex/cv/transforms/det_transforms.py b/paddlex/cv/transforms/det_transforms.py index 07b2785..19db331 100644 --- a/paddlex/cv/transforms/det_transforms.py +++ b/paddlex/cv/transforms/det_transforms.py @@ -156,7 +156,6 @@ class Compose(DetTransform): if not isinstance(augmenters, list): raise Exception( "augmenters should be list type in func add_augmenters()") - assert mode == 'train', "There should be exists augmenters while on train mode" self.transforms = augmenters + self.transforms.transforms diff --git a/paddlex/cv/transforms/seg_transforms.py b/paddlex/cv/transforms/seg_transforms.py index dd2b250..d3c6764 100644 --- a/paddlex/cv/transforms/seg_transforms.py +++ b/paddlex/cv/transforms/seg_transforms.py @@ -108,6 +108,12 @@ class Compose(SegTransform): outputs = (im, im_info) return outputs + def add_augmenters(self, augmenters): + if not isinstance(augmenters, list): + raise Exception( + "augmenters should be list type in func add_augmenters()") + self.transforms = augmenters + self.transforms.transforms + class RandomHorizontalFlip(SegTransform): """以一定的概率对图像进行水平翻转。当存在标注图像时,则同步进行翻转。 -- GitLab