def __call__(self, dataset_dict):
        """
        Args:
            dataset_dict (dict): Metadata of one image, in Detectron2 Dataset format.

        Returns:
            dict: a format that builtin models in detectron2 accept
        """
        dataset_dict = copy.deepcopy(dataset_dict)  # it will be modified by code below
        file_name = dataset_dict['file_name']
        if self.is_train == False:
            image = utils.read_image(file_name, format=self.img_format)
            utils.check_image_size(dataset_dict, image)
            image, _ = T.apply_transform_gens(self.tfm_gens, image)
            dataset_dict["image"] = torch.as_tensor(np.ascontiguousarray(image.transpose(2, 0, 1)))

            grounding_anno = dataset_dict['grounding_info']
            assert len(grounding_anno) > 0
            masks_grd = []
            texts_grd = []
            boxes_grd = []
            for ann in grounding_anno:
                rle = mask.frPyObjects(
                    ann['segmentation'], dataset_dict['height'], dataset_dict['width'])
                m = mask.decode(rle)
                # sometimes there are multiple binary map (corresponding to multiple segs)
                m = np.sum(m, axis=2)
                m = m.astype(np.uint8)  # convert to np.uint8
                masks_grd += [m]
                texts_grd.append([x['raw'].lower() for x in ann['sentences']])
                boxes_grd.append(ann['bbox']) # xywh
            masks_grd = torch.from_numpy(np.stack(masks_grd))
            boxes_grd = torch.tensor(boxes_grd)

            groundings = {'masks': masks_grd, 'texts': texts_grd, 'boxes': boxes_grd}
            dataset_dict["groundings"] = groundings
        else:
            image = utils.read_image(dataset_dict["file_name"], format=self.img_format)
            utils.check_image_size(dataset_dict, image)
            image, transforms = T.apply_transform_gens(self.tfm_gens, image)
            image_shape = image.shape[:2]  # h, w
            dataset_dict["image"] = torch.as_tensor(np.ascontiguousarray(image.transpose(2, 0, 1)))

            grounding_anno = dataset_dict['grounding_info']
            assert len(grounding_anno) > 0
            masks_grd = []
            texts_grd = []
            boxes_grd = []
            hash_grd = []
            for ann in grounding_anno:
                rle = mask.frPyObjects(
                    ann['segmentation'], dataset_dict['height'], dataset_dict['width'])
                m = mask.decode(rle)
                # sometimes there are multiple binary map (corresponding to multiple segs)
                m = np.sum(m, axis=2)
                m = m.astype(np.uint8)  # convert to np.uint8
                m = transforms.apply_segmentation(m[:,:,None])[:,:,0]
                masks_grd += [m]
                rand_id = random.randint(0, len(ann['sentences'])-1)
                texts_grd.append(ann['sentences'][rand_id]['raw'].lower())
                hash_grd.append(hash(ann['sentences'][rand_id]['raw'].lower()))
            masks_grd = torch.from_numpy(np.stack(masks_grd))
            boxes_grd = torch.tensor(boxes_grd)
            groundings = {'masks': masks_grd, 'texts': texts_grd, 'hash': hash_grd, 'mode': 'text'}
            dataset_dict["groundings"] = groundings
        return dataset_dict

        Args:
            dataset_dict (dict): Metadata of one image, in Detectron2 Dataset format.

        Returns:
            dict: a format that builtin models in detectron2 accept
        
datasets/dataset_mappers/refcoco_dataset_mapper.py