示例#1
0
 def getData(self, index):
     """
     Load ICDAR2019ArT data
     :param index: zero-based data index
     :return: A dict like { img: RGB, bboxes: nxkx2 np array, tags: n }
     """
     img_path = self.img_paths[index]
     # RGB
     img = get_img(img_path)
     if self.split == 'test':
         return {'img': img, 'path': img_path}
     # get gt
     img_name = os.path.basename(img_path).split('.')[0]
     gt = self.gt[img_name]
     bboxes, tags, langs, trans = parse_gt(gt)
     item = {
         'img': img,
         'type': 'quad',
         'bboxes': bboxes,
         'lang': langs,
         'trans': trans,
         'tags': tags,
         'path': img_path
     }
     return item
示例#2
0
    def getData(self, index):
        """
        Load MSRA-TD500 data
        :param index: zero-based data index
        :return: A dict like { img: RGB, bboxes: nxkx2 np array, tags: n }
        """
        img_path = self.img_paths[index]
        gt_path = self.gt_paths[index]
        # RGB
        img = get_img(img_path)
        # bbox normed to 0~1
        bboxes, tags = get_bboxes(img, gt_path)

        item = {'img': img, 'type': 'contour', 'bboxes': bboxes, 'tags': tags,
                'path': img_path}
        return item
示例#3
0
 def getData(self, index):
     """
     Load ICDAR2019MLT data
     :param index: zero-based data index
     :return: A dict like { img: RGB, bboxes: nxkx2 np array, tags: n }
     """
     img_path = self.img_paths[index]
     # RGB
     img = get_img(img_path)
     if self.split == 'test':
         return {'img': img, 'path': img_path}
     gt_path = self.gt_paths[index]
     # bbox normed to 0~1
     bboxes, tags, langs, trans = get_bboxes(img, gt_path)
     # scale it back to pixel coord
     item = {'img': img, 'type': 'quad', 'bboxes': bboxes,
             'lang': langs, 'trans': trans,
             'tags': tags, 'path': img_path}
     return item
示例#4
0
 def getData(self, index):
     """
     Load ICDAR2019ReCTS data
     :param index: zero-based data index
     :return: A dict like { img: RGB, bboxes: nxkx2 np array, tags: n }
     """
     img_path = self.img_paths[index]
     # RGB
     img = get_img(img_path)
     if self.split == 'test':
         return {'img': img, 'path': img_path}
     # get gt
     gt_path = self.gt_paths[index]
     bboxes, tags, trans = parse_gt(gt_path)
     item = {
         'img': img,
         'type': 'quad',
         'bboxes': bboxes,
         'trans': trans,
         'tags': tags,
         'path': img_path
     }
     return item