def _load_annotations(self) -> Tuple[List[dict], List[dict]]:
        """Load data from annotations in COCO format."""

        assert exists(self.ann_file), 'Annotation file does not exist'

        with get_local_path(self.ann_file) as local_path:
            self.coco = COCO(local_path)
        # set the metainfo about categories, which is a list of dict
        # and each dict contains the 'id', 'name', etc. about this category
        try:
            self._metainfo['CLASSES'] = self.coco.loadCats(self.coco.getCatIds())
        except:
            self._metainfo['CLASSES'] = None

        instance_list = []
        image_list = []

        if 'UBody' in self.ann_file:
            test_ubody_path = np.load('data/UBody/splits/intra_scene_test_list.npy')
            test_ubody_path = test_ubody_path.tolist()

        for img_id in self.coco.getImgIds():
            img = self.coco.loadImgs(img_id)[0]

            if 'UBody' in self.ann_file:
                if img_id % 10 !=0:
                    continue
                video_name = img['file_name'].split('/')[-2]
                if 'Trim' in video_name:
                    video_name = video_name.split('_Trim')[0]
                if self.test_mode == False:
                    if video_name in self.test_ubody_path: continue
                else:
                    if video_name not in self.test_ubody_path: continue

            img.update({
                'img_id':
                img_id,
                'img_path':
                osp.join(self.data_prefix['img'], img['file_name']),
            })
            image_list.append(img)

            ann_ids = self.coco.getAnnIds(imgIds=img_id)
            for ann in self.coco.loadAnns(ann_ids):

                instance_info = self.parse_data_info(
                    dict(raw_ann_info=ann, raw_img_info=img))

                # skip invalid instance annotation.
                if not instance_info:
                    continue

                instance_list.append(instance_info)
        return instance_list, image_list
Load data from annotations in COCO format.
mmpose/mmpose/datasets/datasets/base/base_coco_style_dataset.py