Commit c5c4d52e authored by Csaba Botos's avatar Csaba Botos Committed by Francisco Massa
parent 42fa3a1d
...@@ -54,10 +54,13 @@ class BinaryMaskList(object): ...@@ -54,10 +54,13 @@ class BinaryMaskList(object):
elif isinstance(masks, (list, tuple)): elif isinstance(masks, (list, tuple)):
if isinstance(masks[0], torch.Tensor): if isinstance(masks[0], torch.Tensor):
masks = torch.stack(masks, dim=2).clone() masks = torch.stack(masks, dim=2).clone()
elif isinstance(masks[0], dict) and "count" in masks[0]: elif isinstance(masks[0], dict) and "counts" in masks[0]:
# RLE interpretation # RLE interpretation
assert all(
masks = mask_utils [(size[0], size[1]) == tuple(inst["size"]) for inst in masks]
)
masks = mask_utils.decode(masks)
masks = torch.tensor(masks).permute(2, 0, 1)
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)
......
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