def _load_detection_results(self) -> List[dict]:
        """Load data from detection results with dummy keypoint annotations."""
        assert exists(self.ann_file), 'Annotation file does not exist'
        assert exists(self.bbox_file), 'Bbox file does not exist'

        # load detection results
        det_results = load(self.bbox_file)
        assert is_list_of(det_results, dict)

        # load coco annotations to build image id-to-name index
        with get_local_path(self.ann_file) as local_path:
            self.coco = COCO(local_path)

        # mapping image name to id
        name2id = {}
        # mapping image id to name
        id2name = {}
        for img_id, image in self.coco.imgs.items():
            file_name = image['file_name']
            id2name[img_id] = file_name
            name2id[file_name] = img_id

        num_keypoints = self.metainfo['num_keypoints']
        data_list = []
        id_ = 0
        for det in det_results:
            # remove non-human instances
            if det['category_id'] != 1:
                continue

            # get the predicted bbox and bbox_score
            bbox_xywh = np.array(
                det['bbox'][:4], dtype=np.float32).reshape(1, 4)
            bbox = bbox_xywh2xyxy(bbox_xywh)
            bbox_score = np.array(det['score'], dtype=np.float32).reshape(1)

            # use dummy keypoint location and visibility
            keypoints = np.zeros((1, num_keypoints, 2), dtype=np.float32)
            keypoints_visible = np.ones((1, num_keypoints), dtype=np.float32)

            # deal with different bbox file formats
            if 'nframes' in det:
                nframes = int(det['nframes'])
            else:
                if 'image_name' in det:
                    img_id = name2id[det['image_name']]
                else:
                    img_id = det['image_id']
                img_ann = self.coco.loadImgs(img_id)[0]
                nframes = int(img_ann['nframes'])

            # deal with multiple image paths
            img_paths: list = []
            if 'image_name' in det:
                image_name = det['image_name']
            else:
                image_name = id2name[det['image_id']]
            # get the image path of the center frame
            center_img_path = osp.join(self.data_prefix['img'], image_name)
            # append the center image path first
            img_paths.append(center_img_path)

            # "images/val/012834_mpii_test/000000.jpg" -->> "000000.jpg"
            center_image_name = image_name.split('/')[-1]
            ref_idx = int(center_image_name.replace('.jpg', ''))

            # select the frame indices
            if self.frame_sampler_mode == 'fixed':
                indices = self.frame_indices
            else:  # self.frame_sampler_mode == 'random':
                low, high = self.frame_range
                indices = np.random.randint(low, high + 1,
                                            self.num_sampled_frame)

            for idx in indices:
                if self.test_mode and idx == 0:
                    continue
                # the supporting frame index
                support_idx = ref_idx + idx
                # clip the frame index to make sure that it does not exceed
                # the boundings of frame indices
                support_idx = np.clip(support_idx, 0, nframes - 1)
                sup_img_path = center_img_path.replace(
                    center_image_name,
                    str(support_idx).zfill(self.ph_fill_len) + '.jpg')

                img_paths.append(sup_img_path)

            data_list.append({
                'img_id': det['image_id'],
                'img_path': img_paths,
                'frame_weights': self.frame_weights,
                'bbox': bbox,
                'bbox_score': bbox_score,
                'keypoints': keypoints,
                'keypoints_visible': keypoints_visible,
                'id': id_,
            })

            id_ += 1

        return data_list
Load data from detection results with dummy keypoint annotations.
mmpose/mmpose/datasets/datasets/body/posetrack18_video_dataset.py