def results2json(self, keypoints: Dict[int, list],
                     outfile_prefix: str) -> str:
        """Dump the keypoint detection results into a json file.

        Args:
            keypoints (Dict[int, list]): Keypoint detection results
                of the dataset.
            outfile_prefix (str): The filename prefix of the json files.
                If the prefix is "somepath/xxx", the json files will be named
                "somepath/xxx.keypoints.json".

        Returns:
            str: The json file name of keypoint results.
        """
        categories = []

        cat = {}
        cat['supercategory'] = 'person'
        cat['id'] = 1
        cat['name'] = 'person'
        cat['keypoints'] = [
            'nose', 'head_bottom', 'head_top', 'left_ear', 'right_ear',
            'left_shoulder', 'right_shoulder', 'left_elbow', 'right_elbow',
            'left_wrist', 'right_wrist', 'left_hip', 'right_hip', 'left_knee',
            'right_knee', 'left_ankle', 'right_ankle'
        ]
        cat['skeleton'] = [[16, 14], [14, 12], [17, 15], [15, 13], [12, 13],
                           [6, 12], [7, 13], [6, 7], [6, 8], [7, 9], [8, 10],
                           [9, 11], [2, 3], [1, 2], [1, 3], [2, 4], [3, 5],
                           [4, 6], [5, 7]]
        categories.append(cat)

        # path of directory for official gt files
        gt_folder = osp.join(
            osp.dirname(self.ann_file),
            osp.splitext(self.ann_file.split('_')[-1])[0])
        # the json file for each video sequence
        json_files = [
            pos for pos in os.listdir(gt_folder) if pos.endswith('.json')
        ]

        for json_file in json_files:
            gt = load(osp.join(gt_folder, json_file))
            annotations = []
            images = []

            for image in gt['images']:
                img = {}
                img['id'] = image['id']
                img['file_name'] = image['file_name']
                images.append(img)

                img_kpts = keypoints[img['id']]

                for track_id, img_kpt in enumerate(img_kpts):
                    ann = {}
                    ann['image_id'] = img_kpt['img_id']
                    ann['keypoints'] = np.array(
                        img_kpt['keypoints']).reshape(-1).tolist()
                    ann['scores'] = np.array(ann['keypoints']).reshape(
                        [-1, 3])[:, 2].tolist()
                    ann['score'] = float(img_kpt['score'])
                    ann['track_id'] = track_id
                    annotations.append(ann)

            pred_file = osp.join(osp.dirname(outfile_prefix), json_file)
            info = {}
            info['images'] = images
            info['categories'] = categories
            info['annotations'] = annotations

            dump(info, pred_file, sort_keys=True, indent=4)
Dump the keypoint detection results into a json file.

        Args:
            keypoints (Dict[int, list]): Keypoint detection results
                of the dataset.
            outfile_prefix (str): The filename prefix of the json files.
                If the prefix is "somepath/xxx", the json files will be named
                "somepath/xxx.keypoints.json".

        Returns:
            str: The json file name of keypoint results.
        
mmpose/mmpose/evaluation/metrics/posetrack18_metric.py