Skip to content

Commit

Permalink
Merge pull request #4 from Jinksi/segm-index-fix
Browse files Browse the repository at this point in the history
Segmentation index error fix
  • Loading branch information
Jinksi authored Feb 20, 2020
2 parents fa586d4 + c34d5cb commit fcc5c68
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion maskrcnn_benchmark/structures/segmentation_mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ def __getitem__(self, item):
else:
# advanced indexing on a single dimension
selected_polygons = []
if isinstance(item, torch.Tensor) and item.dtype == torch.uint8:
if isinstance(item, torch.Tensor) and (
item.dtype == torch.uint8 or item.dtype == torch.bool
):
item = item.nonzero()
item = item.squeeze(1) if item.numel() > 0 else item
item = item.tolist()
Expand Down

0 comments on commit fcc5c68

Please sign in to comment.