INNER CODE UNIT · Python

__init__

allenai/ai2thor · ai2thor/server.py:60

    def __init__(self, image_ids_data: bytes, metadata: dict):
        self._masks: Dict[str, np.ndarray] = {}
        self._loaded = False
        screen_width = metadata["screenWidth"]
        screen_height = metadata["screenHeight"]
        item_size = int(len(image_ids_data) / (screen_width * screen_height))
        self._unique_integer_keys: Optional[Set[np.uint32]] = None
        self._empty_mask: Optional[np.ndarray] = None

        if item_size == 4:
            self.instance_segmentation_frame_uint32 = read_buffer_image(
                image_ids_data, screen_width, screen_height, dtype=np.uint32
            ).squeeze()
            # within ImageSynthesis.cs a RGBA32 frame is read, the alpha channel
            # is always equal to 255
            self._alpha_channel_value = 255

        elif item_size == 3:  # 3 byte per pixel for backwards compatibility, RGB24 texture

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…