From e3d703d7feb1ce3bae19abe68925339149fda93c Mon Sep 17 00:00:00 2001 From: wangxinxin08 <69842442+wangxinxin08@users.noreply.github.com> Date: Mon, 12 Apr 2021 11:09:50 +0800 Subject: [PATCH] fix gridmask op and modify some comments (#2558) --- ppdet/data/transform/gridmask_utils.py | 2 +- ppdet/data/transform/operators.py | 5 +++-- static/ppdet/data/transform/gridmask_utils.py | 2 +- static/ppdet/data/transform/operators.py | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ppdet/data/transform/gridmask_utils.py b/ppdet/data/transform/gridmask_utils.py index a23e69b20..115cb1e9d 100644 --- a/ppdet/data/transform/gridmask_utils.py +++ b/ppdet/data/transform/gridmask_utils.py @@ -45,7 +45,7 @@ class GridMask(object): self.prob = self.st_prob * min(1, 1.0 * curr_iter / self.upper_iter) if np.random.rand() > self.prob: return x - _, h, w = x.shape + h, w, _ = x.shape hh = int(1.5 * h) ww = int(1.5 * w) d = np.random.randint(2, h) diff --git a/ppdet/data/transform/operators.py b/ppdet/data/transform/operators.py index 06cc6165b..a85fb52af 100644 --- a/ppdet/data/transform/operators.py +++ b/ppdet/data/transform/operators.py @@ -165,7 +165,7 @@ class Permute(BaseOperator): @register_op class Lighting(BaseOperator): """ - Lighting the imagen by eigenvalues and eigenvectors + Lighting the image by eigenvalues and eigenvectors Args: eigval (list): eigenvalues eigvec (list): eigenvectors @@ -1799,12 +1799,13 @@ class Pad(BaseOperator): offsets=None, fill_value=(127.5, 127.5, 127.5)): """ - Pad image to a specified size or multiple of size_divisor. random target_size and interpolation method + Pad image to a specified size or multiple of size_divisor. Args: size (int, Sequence): image target size, if None, pad to multiple of size_divisor, default None size_divisor (int): size divisor, default 32 pad_mode (int): pad mode, currently only supports four modes [-1, 0, 1, 2]. if -1, use specified offsets if 0, only pad to right and bottom. if 1, pad according to center. if 2, only pad left and top + offsets (list): [offset_x, offset_y], specify offset while padding, only supported pad_mode=-1 fill_value (bool): rgb value of pad area, default (127.5, 127.5, 127.5) """ super(Pad, self).__init__() diff --git a/static/ppdet/data/transform/gridmask_utils.py b/static/ppdet/data/transform/gridmask_utils.py index a23e69b20..115cb1e9d 100644 --- a/static/ppdet/data/transform/gridmask_utils.py +++ b/static/ppdet/data/transform/gridmask_utils.py @@ -45,7 +45,7 @@ class GridMask(object): self.prob = self.st_prob * min(1, 1.0 * curr_iter / self.upper_iter) if np.random.rand() > self.prob: return x - _, h, w = x.shape + h, w, _ = x.shape hh = int(1.5 * h) ww = int(1.5 * w) d = np.random.randint(2, h) diff --git a/static/ppdet/data/transform/operators.py b/static/ppdet/data/transform/operators.py index 4646e2582..78ae281e9 100644 --- a/static/ppdet/data/transform/operators.py +++ b/static/ppdet/data/transform/operators.py @@ -626,7 +626,7 @@ class GridMaskOp(BaseOperator): sample['curr_iter']) if not batch_input: samples = samples[0] - return sample + return samples @register_op @@ -2100,7 +2100,7 @@ class BboxXYXY2XYWH(BaseOperator): @register_op class Lighting(BaseOperator): """ - Lighting the imagen by eigenvalues and eigenvectors + Lighting the image by eigenvalues and eigenvectors Args: eigval (list): eigenvalues eigvec (list): eigenvectors -- GitLab