Skip to content
Snippets Groups Projects
Commit 144a7ec4 authored by gfjiangly's avatar gfjiangly Committed by Kai Chen
Browse files

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.
parent c5c7ef90
No related branches found
No related tags found
No related merge requests found
...@@ -300,7 +300,7 @@ class Normalize(object): ...@@ -300,7 +300,7 @@ class Normalize(object):
@PIPELINES.register_module @PIPELINES.register_module
class RandomCrop(object): class RandomCrop(object):
"""Random crop the image & bboxes. """Random crop the image & bboxes & masks.
Args: Args:
crop_size (tuple): Expected size after cropping, (h, w). crop_size (tuple): Expected size after cropping, (h, w).
...@@ -348,7 +348,7 @@ class RandomCrop(object): ...@@ -348,7 +348,7 @@ class RandomCrop(object):
# filter and crop the masks # filter and crop the masks
if 'gt_masks' in results: if 'gt_masks' in results:
valid_gt_masks = [] 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: gt_mask = results['gt_masks'][i][crop_y1:crop_y2, crop_x1:
crop_x2] crop_x2]
valid_gt_masks.append(gt_mask) valid_gt_masks.append(gt_mask)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment