Commit 1714b7c2 authored by Menglin Jia's avatar Menglin Jia Committed by Francisco Massa

revised for RLE assert (#679)

parent c5c4d52e
...@@ -57,10 +57,10 @@ class BinaryMaskList(object): ...@@ -57,10 +57,10 @@ class BinaryMaskList(object):
elif isinstance(masks[0], dict) and "counts" in masks[0]: elif isinstance(masks[0], dict) and "counts" in masks[0]:
# RLE interpretation # RLE interpretation
assert all( assert all(
[(size[0], size[1]) == tuple(inst["size"]) for inst in masks] [(size[1], size[0]) == tuple(inst["size"]) for inst in masks]
) ) # in RLE, height come first in "size"
masks = mask_utils.decode(masks) masks = mask_utils.decode(masks) # [h, w, n]
masks = torch.tensor(masks).permute(2, 0, 1) masks = torch.tensor(masks).permute(2, 0, 1) # [n, h, w]
else: else:
RuntimeError( RuntimeError(
"Type of `masks[0]` could not be interpreted: %s" % type(masks) "Type of `masks[0]` could not be interpreted: %s" % type(masks)
...@@ -70,7 +70,7 @@ class BinaryMaskList(object): ...@@ -70,7 +70,7 @@ class BinaryMaskList(object):
masks = masks.masks.clone() masks = masks.masks.clone()
else: else:
RuntimeError( 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: if len(masks.shape) == 2:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment