Skip to content
Open
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
6 changes: 3 additions & 3 deletions segment_anything/utils/amg.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import numpy as np
import torch

import math
from copy import deepcopy
from itertools import product
Expand All @@ -18,17 +17,18 @@ class MaskData:
A structure for storing masks and their related data in batched format.
Implements basic filtering and concatenation.
"""
SUPPORTED_TYPES = (list, np.ndarray, torch.Tensor)

def __init__(self, **kwargs) -> None:
for v in kwargs.values():
assert isinstance(
v, (list, np.ndarray, torch.Tensor)
v, (self.SUPPORTED_TYPES)
), "MaskData only supports list, numpy arrays, and torch tensors."
self._stats = dict(**kwargs)

def __setitem__(self, key: str, item: Any) -> None:
assert isinstance(
item, (list, np.ndarray, torch.Tensor)
item, (self.SUPPORTED_TYPES)
), "MaskData only supports list, numpy arrays, and torch tensors."
self._stats[key] = item

Expand Down