From 144a7ec4ca9d75e7393a717cd27de9fa987dc2c0 Mon Sep 17 00:00:00 2001 From: gfjiangly <38396233+gfjiangly@users.noreply.github.com> Date: Mon, 9 Sep 2019 22:47:20 +0800 Subject: [PATCH] fix bugs for cropping masks in RandomCrop (#1333) * add g++ requirement for INSTALL.md. * fix bugs for cropping masks in RandomCrop. * simplify the code to fix bugs for cropping masks in RandomCrop. --- mmdet/datasets/pipelines/transforms.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mmdet/datasets/pipelines/transforms.py b/mmdet/datasets/pipelines/transforms.py index 18b1cc1..45a383b 100644 --- a/mmdet/datasets/pipelines/transforms.py +++ b/mmdet/datasets/pipelines/transforms.py @@ -300,7 +300,7 @@ class Normalize(object): @PIPELINES.register_module class RandomCrop(object): - """Random crop the image & bboxes. + """Random crop the image & bboxes & masks. Args: crop_size (tuple): Expected size after cropping, (h, w). @@ -348,7 +348,7 @@ class RandomCrop(object): # filter and crop the masks if 'gt_masks' in results: valid_gt_masks = [] - for i in valid_inds: + for i in np.where(valid_inds)[0]: gt_mask = results['gt_masks'][i][crop_y1:crop_y2, crop_x1: crop_x2] valid_gt_masks.append(gt_mask) -- GitLab