INNER CODE UNIT · Python
a
allenai/ai2thor · ai2thor/server.py:126
a = np.array(color + [self._alpha_channel_value], dtype=np.uint8)
# mypy complains, but it is safe to modify the dtype on an ndarray
a.dtype = np.uint32 # type: ignore
return a[0]
def _load_all(self):
if not self._loaded:
all_integer_keys = self.unique_integer_keys
for color_name, color in self.instance_colors.items():
if self._integer_color_key(color) in all_integer_keys:
self.__getitem__(color_name)
self._loaded = True
def mask(self, key: str, default: Optional[np.ndarray] = None) -> Optional[np.ndarray]:
if key not in self.instance_colors:
return default
elif key in self._masks: