Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

[Masks] image size in RLE assert #679

Merged
merged 1 commit into from
Apr 16, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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