INNER CODE UNIT · Python

LazyInstanceDetections2D

allenai/ai2thor · ai2thor/server.py:237

class LazyInstanceDetections2D(LazyDetections2D):
    def __init__(self, instance_masks: LazyInstanceSegmentationMasks):
        super().__init__(instance_masks)
        self._detections2d: Dict[str, Optional[Tuple[int, int, int, int]]] = {}

    def __eq__(self, other: object):
        if isinstance(other, self.__class__):
            return self.instance_masks == other.instance_masks
        else:
            return False

    def mask_bounding_box(self, mask: np.ndarray) -> Optional[Tuple[int, int, int, int]]:
        rows = np.any(mask, axis=1)
        cols = np.any(mask, axis=0)
        rw = np.where(rows)
        if len(rw[0]) == 0:
            return None

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…