Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

Commit

Permalink
revised for RLE assert (facebookresearch#679)
Browse files Browse the repository at this point in the history
  • Loading branch information
KMnP authored and fmassa committed Apr 16, 2019
1 parent 903781c commit 88dfcf2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions maskrcnn_benchmark/structures/segmentation_mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ def __init__(self, masks, size):
elif isinstance(masks[0], dict) and "counts" in masks[0]:
# RLE interpretation
assert all(
[(size[0], size[1]) == tuple(inst["size"]) for inst in masks]
)
masks = mask_utils.decode(masks)
masks = torch.tensor(masks).permute(2, 0, 1)
[(size[1], size[0]) == tuple(inst["size"]) for inst in masks]
) # in RLE, height come first in "size"
masks = mask_utils.decode(masks) # [h, w, n]
masks = torch.tensor(masks).permute(2, 0, 1) # [n, h, w]
else:
RuntimeError(
"Type of `masks[0]` could not be interpreted: %s" % type(masks)
Expand All @@ -70,7 +70,7 @@ def __init__(self, masks, size):
masks = masks.masks.clone()
else:
RuntimeError(
"Type of `masks` argument could not be interpreted:%s" % tpye(masks)
"Type of `masks` argument could not be interpreted:%s" % type(masks)
)

if len(masks.shape) == 2:
Expand Down Expand Up @@ -527,7 +527,7 @@ def __next__(self):
self.iter_idx += 1
return next_segmentation
raise StopIteration()

next = __next__ # Python 2 compatibility

def __repr__(self):
Expand Down

0 comments on commit 88dfcf2

Please sign in to comment.