We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
False 'segmentation' labeled in 'macaque_train/test.json'
In general, the macaque dataset is missing parts of segmentation.

猴子的数据集：每当身体位置是分开的时候，‘'segmentation’ 的标注都有问题。我check了原始csv标注数据，是正确的；是你们制作的“macaque_train/test.json”出现了偏差。

![image](https://user-images.githubusercontent.com/17546446/135393754-c2539040-10d6-4e24-a3ca-b6bf721287ed.png)


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `tools/dataset/parse_macaquepose_dataset.py`
Content:
```
1 # Copyright (c) OpenMMLab. All rights reserved.
2 import csv
3 import json
4 import os
5 import time
6 
7 import cv2
8 import numpy as np
9 
10 np.random.seed(0)
11 
12 
13 def PolyArea(x, y):
14     """Calculate area of polygon given (x,y) coordinates (Shoelace formula)
15 
16     :param x: np.ndarray(N, )
17     :param y: np.ndarray(N, )
18     :return: area
19     """
20     return 0.5 * np.abs(np.dot(x, np.roll(y, 1)) - np.dot(y, np.roll(x, 1)))
21 
22 
23 def save_coco_anno(data_annotation,
24                    img_root,
25                    save_path,
26                    start_img_id=0,
27                    start_ann_id=0,
28                    kpt_num=17):
29     """Save annotations in coco-format.
30 
31     :param data_annotation: list of data annotation.
32     :param img_root: the root dir to load images.
33     :param save_path: the path to save transformed annotation file.
34     :param start_img_id: the starting point to count the image id.
35     :param start_ann_id: the starting point to count the annotation id.
36     :param kpt_num: the number of keypoint.
37     """
38     images = []
39     annotations = []
40 
41     img_id = start_img_id
42     ann_id = start_ann_id
43 
44     for i in range(0, len(data_annotation)):
45         data_anno = data_annotation[i]
46         image_name = data_anno[0]
47 
48         img = cv2.imread(os.path.join(img_root, image_name))
49 
50         kp_string = data_anno[1]
51         kps = json.loads(kp_string)
52 
53         seg_string = data_anno[2]
54         segs = json.loads(seg_string)
55 
56         for kp, seg in zip(kps, segs):
57             keypoints = np.zeros([kpt_num, 3])
58             for ind, p in enumerate(kp):
59                 if p['position'] is None:
60                     continue
61                 else:
62                     keypoints[ind, 0] = p['position'][0]
63                     keypoints[ind, 1] = p['position'][1]
64                     keypoints[ind, 2] = 2
65 
66             segmentation = np.array(seg[0]['segment'])
67             max_x, max_y = segmentation.max(0)
68             min_x, min_y = segmentation.min(0)
69 
70             anno = {}
71             anno['keypoints'] = keypoints.reshape(-1).tolist()
72             anno['image_id'] = img_id
73             anno['id'] = ann_id
74             anno['num_keypoints'] = int(sum(keypoints[:, 2] > 0))
75             anno['bbox'] = [
76                 float(min_x),
77                 float(min_y),
78                 float(max_x - min_x + 1),
79                 float(max_y - min_y + 1)
80             ]
81             anno['iscrowd'] = 0
82             anno['area'] = float(
83                 PolyArea(segmentation[:, 0], segmentation[:, 1]))
84             anno['category_id'] = 1
85             anno['segmentation'] = segmentation.reshape([1, -1]).tolist()
86 
87             annotations.append(anno)
88             ann_id += 1
89 
90         image = {}
91         image['id'] = img_id
92         image['file_name'] = image_name
93         image['height'] = img.shape[0]
94         image['width'] = img.shape[1]
95 
96         images.append(image)
97         img_id += 1
98 
99     cocotype = {}
100 
101     cocotype['info'] = {}
102     cocotype['info']['description'] = 'MacaquePose Generated by MMPose Team'
103     cocotype['info']['version'] = '1.0'
104     cocotype['info']['year'] = time.strftime('%Y', time.localtime())
105     cocotype['info']['date_created'] = time.strftime('%Y/%m/%d',
106                                                      time.localtime())
107 
108     cocotype['images'] = images
109     cocotype['annotations'] = annotations
110     cocotype['categories'] = [{
111         'supercategory':
112         'animal',
113         'id':
114         1,
115         'name':
116         'macaque',
117         'keypoints': [
118             'nose', 'left_eye', 'right_eye', 'left_ear', 'right_ear',
119             'left_shoulder', 'right_shoulder', 'left_elbow', 'right_elbow',
120             'left_wrist', 'right_wrist', 'left_hip', 'right_hip', 'left_knee',
121             'right_knee', 'left_ankle', 'right_ankle'
122         ],
123         'skeleton': [[16, 14], [14, 12], [17, 15], [15, 13], [12, 13], [6, 12],
124                      [7, 13], [6, 7], [6, 8], [7, 9], [8, 10], [9, 11], [2, 3],
125                      [1, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7]]
126     }]
127 
128     os.makedirs(os.path.dirname(save_path), exist_ok=True)
129     json.dump(cocotype, open(save_path, 'w'), indent=4)
130     print('number of images:', img_id)
131     print('number of annotations:', ann_id)
132     print(f'done {save_path}')
133 
134 
135 dataset_dir = '/data/macaque/'
136 
137 with open(os.path.join(dataset_dir, 'annotations.csv'), 'r') as fp:
138     data_annotation_all = list(csv.reader(fp, delimiter=','))[1:]
139 
140 np.random.shuffle(data_annotation_all)
141 
142 data_annotation_train = data_annotation_all[0:12500]
143 data_annotation_val = data_annotation_all[12500:]
144 
145 img_root = os.path.join(dataset_dir, 'images')
146 save_coco_anno(
147     data_annotation_train,
148     img_root,
149     os.path.join(dataset_dir, 'annotations', 'macaque_train.json'),
150     kpt_num=17)
151 save_coco_anno(
152     data_annotation_val,
153     img_root,
154     os.path.join(dataset_dir, 'annotations', 'macaque_test.json'),
155     start_img_id=12500,
156     start_ann_id=15672,
157     kpt_num=17)
158
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/tools/dataset/parse_macaquepose_dataset.py b/tools/dataset/parse_macaquepose_dataset.py
--- a/tools/dataset/parse_macaquepose_dataset.py
+++ b/tools/dataset/parse_macaquepose_dataset.py
@@ -10,14 +10,22 @@
 np.random.seed(0)
 
 
-def PolyArea(x, y):
+def get_poly_area(x, y):
     """Calculate area of polygon given (x,y) coordinates (Shoelace formula)
 
     :param x: np.ndarray(N, )
     :param y: np.ndarray(N, )
     :return: area
     """
-    return 0.5 * np.abs(np.dot(x, np.roll(y, 1)) - np.dot(y, np.roll(x, 1)))
+    return float(0.5 *
+                 np.abs(np.dot(x, np.roll(y, 1)) - np.dot(y, np.roll(x, 1))))
+
+
+def get_seg_area(segmentations):
+    area = 0
+    for segmentation in segmentations:
+        area += get_poly_area(segmentation[:, 0], segmentation[:, 1])
+    return area
 
 
 def save_coco_anno(data_annotation,
@@ -63,9 +71,26 @@
                     keypoints[ind, 1] = p['position'][1]
                     keypoints[ind, 2] = 2
 
-            segmentation = np.array(seg[0]['segment'])
-            max_x, max_y = segmentation.max(0)
-            min_x, min_y = segmentation.min(0)
+            segmentations = []
+
+            max_x = -1
+            max_y = -1
+            min_x = 999999
+            min_y = 999999
+            for segm in seg:
+                if len(segm['segment']) == 0:
+                    continue
+
+                segmentation = np.array(segm['segment'])
+                segmentations.append(segmentation)
+
+                _max_x, _max_y = segmentation.max(0)
+                _min_x, _min_y = segmentation.min(0)
+
+                max_x = max(max_x, _max_x)
+                max_y = max(max_y, _max_y)
+                min_x = min(min_x, _min_x)
+                min_y = min(min_y, _min_y)
 
             anno = {}
             anno['keypoints'] = keypoints.reshape(-1).tolist()
@@ -79,10 +104,11 @@
                 float(max_y - min_y + 1)
             ]
             anno['iscrowd'] = 0
-            anno['area'] = float(
-                PolyArea(segmentation[:, 0], segmentation[:, 1]))
+            anno['area'] = get_seg_area(segmentations)
             anno['category_id'] = 1
-            anno['segmentation'] = segmentation.reshape([1, -1]).tolist()
+            anno['segmentation'] = [
+                seg.reshape(-1).tolist() for seg in segmentations
+            ]
 
             annotations.append(anno)
             ann_id += 1
@@ -133,7 +159,6 @@
 
 
 dataset_dir = '/data/macaque/'
-
 with open(os.path.join(dataset_dir, 'annotations.csv'), 'r') as fp:
     data_annotation_all = list(csv.reader(fp, delimiter=','))[1:]

{"golden_diff": "diff --git a/tools/dataset/parse_macaquepose_dataset.py b/tools/dataset/parse_macaquepose_dataset.py\n--- a/tools/dataset/parse_macaquepose_dataset.py\n+++ b/tools/dataset/parse_macaquepose_dataset.py\n@@ -10,14 +10,22 @@\n np.random.seed(0)\n \n \n-def PolyArea(x, y):\n+def get_poly_area(x, y):\n     \"\"\"Calculate area of polygon given (x,y) coordinates (Shoelace formula)\n \n     :param x: np.ndarray(N, )\n     :param y: np.ndarray(N, )\n     :return: area\n     \"\"\"\n-    return 0.5 * np.abs(np.dot(x, np.roll(y, 1)) - np.dot(y, np.roll(x, 1)))\n+    return float(0.5 *\n+                 np.abs(np.dot(x, np.roll(y, 1)) - np.dot(y, np.roll(x, 1))))\n+\n+\n+def get_seg_area(segmentations):\n+    area = 0\n+    for segmentation in segmentations:\n+        area += get_poly_area(segmentation[:, 0], segmentation[:, 1])\n+    return area\n \n \n def save_coco_anno(data_annotation,\n@@ -63,9 +71,26 @@\n                     keypoints[ind, 1] = p['position'][1]\n                     keypoints[ind, 2] = 2\n \n-            segmentation = np.array(seg[0]['segment'])\n-            max_x, max_y = segmentation.max(0)\n-            min_x, min_y = segmentation.min(0)\n+            segmentations = []\n+\n+            max_x = -1\n+            max_y = -1\n+            min_x = 999999\n+            min_y = 999999\n+            for segm in seg:\n+                if len(segm['segment']) == 0:\n+                    continue\n+\n+                segmentation = np.array(segm['segment'])\n+                segmentations.append(segmentation)\n+\n+                _max_x, _max_y = segmentation.max(0)\n+                _min_x, _min_y = segmentation.min(0)\n+\n+                max_x = max(max_x, _max_x)\n+                max_y = max(max_y, _max_y)\n+                min_x = min(min_x, _min_x)\n+                min_y = min(min_y, _min_y)\n \n             anno = {}\n             anno['keypoints'] = keypoints.reshape(-1).tolist()\n@@ -79,10 +104,11 @@\n                 float(max_y - min_y + 1)\n             ]\n             anno['iscrowd'] = 0\n-            anno['area'] = float(\n-                PolyArea(segmentation[:, 0], segmentation[:, 1]))\n+            anno['area'] = get_seg_area(segmentations)\n             anno['category_id'] = 1\n-            anno['segmentation'] = segmentation.reshape([1, -1]).tolist()\n+            anno['segmentation'] = [\n+                seg.reshape(-1).tolist() for seg in segmentations\n+            ]\n \n             annotations.append(anno)\n             ann_id += 1\n@@ -133,7 +159,6 @@\n \n \n dataset_dir = '/data/macaque/'\n-\n with open(os.path.join(dataset_dir, 'annotations.csv'), 'r') as fp:\n     data_annotation_all = list(csv.reader(fp, delimiter=','))[1:]\n", "issue": "False 'segmentation' labeled in 'macaque_train/test.json'\nIn general, the macaque dataset is missing parts of segmentation.\r\n\r\n\u7334\u5b50\u7684\u6570\u636e\u96c6\uff1a\u6bcf\u5f53\u8eab\u4f53\u4f4d\u7f6e\u662f\u5206\u5f00\u7684\u65f6\u5019\uff0c\u2018'segmentation\u2019 \u7684\u6807\u6ce8\u90fd\u6709\u95ee\u9898\u3002\u6211check\u4e86\u539f\u59cbcsv\u6807\u6ce8\u6570\u636e\uff0c\u662f\u6b63\u786e\u7684\uff1b\u662f\u4f60\u4eec\u5236\u4f5c\u7684\u201cmacaque_train/test.json\u201d\u51fa\u73b0\u4e86\u504f\u5dee\u3002\r\n\r\n![image](https://user-images.githubusercontent.com/17546446/135393754-c2539040-10d6-4e24-a3ca-b6bf721287ed.png)\r\n\n", "before_files": [{"content": "# Copyright (c) OpenMMLab. All rights reserved.\nimport csv\nimport json\nimport os\nimport time\n\nimport cv2\nimport numpy as np\n\nnp.random.seed(0)\n\n\ndef PolyArea(x, y):\n    \"\"\"Calculate area of polygon given (x,y) coordinates (Shoelace formula)\n\n    :param x: np.ndarray(N, )\n    :param y: np.ndarray(N, )\n    :return: area\n    \"\"\"\n    return 0.5 * np.abs(np.dot(x, np.roll(y, 1)) - np.dot(y, np.roll(x, 1)))\n\n\ndef save_coco_anno(data_annotation,\n                   img_root,\n                   save_path,\n                   start_img_id=0,\n                   start_ann_id=0,\n                   kpt_num=17):\n    \"\"\"Save annotations in coco-format.\n\n    :param data_annotation: list of data annotation.\n    :param img_root: the root dir to load images.\n    :param save_path: the path to save transformed annotation file.\n    :param start_img_id: the starting point to count the image id.\n    :param start_ann_id: the starting point to count the annotation id.\n    :param kpt_num: the number of keypoint.\n    \"\"\"\n    images = []\n    annotations = []\n\n    img_id = start_img_id\n    ann_id = start_ann_id\n\n    for i in range(0, len(data_annotation)):\n        data_anno = data_annotation[i]\n        image_name = data_anno[0]\n\n        img = cv2.imread(os.path.join(img_root, image_name))\n\n        kp_string = data_anno[1]\n        kps = json.loads(kp_string)\n\n        seg_string = data_anno[2]\n        segs = json.loads(seg_string)\n\n        for kp, seg in zip(kps, segs):\n            keypoints = np.zeros([kpt_num, 3])\n            for ind, p in enumerate(kp):\n                if p['position'] is None:\n                    continue\n                else:\n                    keypoints[ind, 0] = p['position'][0]\n                    keypoints[ind, 1] = p['position'][1]\n                    keypoints[ind, 2] = 2\n\n            segmentation = np.array(seg[0]['segment'])\n            max_x, max_y = segmentation.max(0)\n            min_x, min_y = segmentation.min(0)\n\n            anno = {}\n            anno['keypoints'] = keypoints.reshape(-1).tolist()\n            anno['image_id'] = img_id\n            anno['id'] = ann_id\n            anno['num_keypoints'] = int(sum(keypoints[:, 2] > 0))\n            anno['bbox'] = [\n                float(min_x),\n                float(min_y),\n                float(max_x - min_x + 1),\n                float(max_y - min_y + 1)\n            ]\n            anno['iscrowd'] = 0\n            anno['area'] = float(\n                PolyArea(segmentation[:, 0], segmentation[:, 1]))\n            anno['category_id'] = 1\n            anno['segmentation'] = segmentation.reshape([1, -1]).tolist()\n\n            annotations.append(anno)\n            ann_id += 1\n\n        image = {}\n        image['id'] = img_id\n        image['file_name'] = image_name\n        image['height'] = img.shape[0]\n        image['width'] = img.shape[1]\n\n        images.append(image)\n        img_id += 1\n\n    cocotype = {}\n\n    cocotype['info'] = {}\n    cocotype['info']['description'] = 'MacaquePose Generated by MMPose Team'\n    cocotype['info']['version'] = '1.0'\n    cocotype['info']['year'] = time.strftime('%Y', time.localtime())\n    cocotype['info']['date_created'] = time.strftime('%Y/%m/%d',\n                                                     time.localtime())\n\n    cocotype['images'] = images\n    cocotype['annotations'] = annotations\n    cocotype['categories'] = [{\n        'supercategory':\n        'animal',\n        'id':\n        1,\n        'name':\n        'macaque',\n        'keypoints': [\n            'nose', 'left_eye', 'right_eye', 'left_ear', 'right_ear',\n            'left_shoulder', 'right_shoulder', 'left_elbow', 'right_elbow',\n            'left_wrist', 'right_wrist', 'left_hip', 'right_hip', 'left_knee',\n            'right_knee', 'left_ankle', 'right_ankle'\n        ],\n        'skeleton': [[16, 14], [14, 12], [17, 15], [15, 13], [12, 13], [6, 12],\n                     [7, 13], [6, 7], [6, 8], [7, 9], [8, 10], [9, 11], [2, 3],\n                     [1, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7]]\n    }]\n\n    os.makedirs(os.path.dirname(save_path), exist_ok=True)\n    json.dump(cocotype, open(save_path, 'w'), indent=4)\n    print('number of images:', img_id)\n    print('number of annotations:', ann_id)\n    print(f'done {save_path}')\n\n\ndataset_dir = '/data/macaque/'\n\nwith open(os.path.join(dataset_dir, 'annotations.csv'), 'r') as fp:\n    data_annotation_all = list(csv.reader(fp, delimiter=','))[1:]\n\nnp.random.shuffle(data_annotation_all)\n\ndata_annotation_train = data_annotation_all[0:12500]\ndata_annotation_val = data_annotation_all[12500:]\n\nimg_root = os.path.join(dataset_dir, 'images')\nsave_coco_anno(\n    data_annotation_train,\n    img_root,\n    os.path.join(dataset_dir, 'annotations', 'macaque_train.json'),\n    kpt_num=17)\nsave_coco_anno(\n    data_annotation_val,\n    img_root,\n    os.path.join(dataset_dir, 'annotations', 'macaque_test.json'),\n    start_img_id=12500,\n    start_ann_id=15672,\n    kpt_num=17)\n", "path": "tools/dataset/parse_macaquepose_dataset.py"}], "after_files": [{"content": "# Copyright (c) OpenMMLab. All rights reserved.\nimport csv\nimport json\nimport os\nimport time\n\nimport cv2\nimport numpy as np\n\nnp.random.seed(0)\n\n\ndef get_poly_area(x, y):\n    \"\"\"Calculate area of polygon given (x,y) coordinates (Shoelace formula)\n\n    :param x: np.ndarray(N, )\n    :param y: np.ndarray(N, )\n    :return: area\n    \"\"\"\n    return float(0.5 *\n                 np.abs(np.dot(x, np.roll(y, 1)) - np.dot(y, np.roll(x, 1))))\n\n\ndef get_seg_area(segmentations):\n    area = 0\n    for segmentation in segmentations:\n        area += get_poly_area(segmentation[:, 0], segmentation[:, 1])\n    return area\n\n\ndef save_coco_anno(data_annotation,\n                   img_root,\n                   save_path,\n                   start_img_id=0,\n                   start_ann_id=0,\n                   kpt_num=17):\n    \"\"\"Save annotations in coco-format.\n\n    :param data_annotation: list of data annotation.\n    :param img_root: the root dir to load images.\n    :param save_path: the path to save transformed annotation file.\n    :param start_img_id: the starting point to count the image id.\n    :param start_ann_id: the starting point to count the annotation id.\n    :param kpt_num: the number of keypoint.\n    \"\"\"\n    images = []\n    annotations = []\n\n    img_id = start_img_id\n    ann_id = start_ann_id\n\n    for i in range(0, len(data_annotation)):\n        data_anno = data_annotation[i]\n        image_name = data_anno[0]\n\n        img = cv2.imread(os.path.join(img_root, image_name))\n\n        kp_string = data_anno[1]\n        kps = json.loads(kp_string)\n\n        seg_string = data_anno[2]\n        segs = json.loads(seg_string)\n\n        for kp, seg in zip(kps, segs):\n            keypoints = np.zeros([kpt_num, 3])\n            for ind, p in enumerate(kp):\n                if p['position'] is None:\n                    continue\n                else:\n                    keypoints[ind, 0] = p['position'][0]\n                    keypoints[ind, 1] = p['position'][1]\n                    keypoints[ind, 2] = 2\n\n            segmentations = []\n\n            max_x = -1\n            max_y = -1\n            min_x = 999999\n            min_y = 999999\n            for segm in seg:\n                if len(segm['segment']) == 0:\n                    continue\n\n                segmentation = np.array(segm['segment'])\n                segmentations.append(segmentation)\n\n                _max_x, _max_y = segmentation.max(0)\n                _min_x, _min_y = segmentation.min(0)\n\n                max_x = max(max_x, _max_x)\n                max_y = max(max_y, _max_y)\n                min_x = min(min_x, _min_x)\n                min_y = min(min_y, _min_y)\n\n            anno = {}\n            anno['keypoints'] = keypoints.reshape(-1).tolist()\n            anno['image_id'] = img_id\n            anno['id'] = ann_id\n            anno['num_keypoints'] = int(sum(keypoints[:, 2] > 0))\n            anno['bbox'] = [\n                float(min_x),\n                float(min_y),\n                float(max_x - min_x + 1),\n                float(max_y - min_y + 1)\n            ]\n            anno['iscrowd'] = 0\n            anno['area'] = get_seg_area(segmentations)\n            anno['category_id'] = 1\n            anno['segmentation'] = [\n                seg.reshape(-1).tolist() for seg in segmentations\n            ]\n\n            annotations.append(anno)\n            ann_id += 1\n\n        image = {}\n        image['id'] = img_id\n        image['file_name'] = image_name\n        image['height'] = img.shape[0]\n        image['width'] = img.shape[1]\n\n        images.append(image)\n        img_id += 1\n\n    cocotype = {}\n\n    cocotype['info'] = {}\n    cocotype['info']['description'] = 'MacaquePose Generated by MMPose Team'\n    cocotype['info']['version'] = '1.0'\n    cocotype['info']['year'] = time.strftime('%Y', time.localtime())\n    cocotype['info']['date_created'] = time.strftime('%Y/%m/%d',\n                                                     time.localtime())\n\n    cocotype['images'] = images\n    cocotype['annotations'] = annotations\n    cocotype['categories'] = [{\n        'supercategory':\n        'animal',\n        'id':\n        1,\n        'name':\n        'macaque',\n        'keypoints': [\n            'nose', 'left_eye', 'right_eye', 'left_ear', 'right_ear',\n            'left_shoulder', 'right_shoulder', 'left_elbow', 'right_elbow',\n            'left_wrist', 'right_wrist', 'left_hip', 'right_hip', 'left_knee',\n            'right_knee', 'left_ankle', 'right_ankle'\n        ],\n        'skeleton': [[16, 14], [14, 12], [17, 15], [15, 13], [12, 13], [6, 12],\n                     [7, 13], [6, 7], [6, 8], [7, 9], [8, 10], [9, 11], [2, 3],\n                     [1, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7]]\n    }]\n\n    os.makedirs(os.path.dirname(save_path), exist_ok=True)\n    json.dump(cocotype, open(save_path, 'w'), indent=4)\n    print('number of images:', img_id)\n    print('number of annotations:', ann_id)\n    print(f'done {save_path}')\n\n\ndataset_dir = '/data/macaque/'\nwith open(os.path.join(dataset_dir, 'annotations.csv'), 'r') as fp:\n    data_annotation_all = list(csv.reader(fp, delimiter=','))[1:]\n\nnp.random.shuffle(data_annotation_all)\n\ndata_annotation_train = data_annotation_all[0:12500]\ndata_annotation_val = data_annotation_all[12500:]\n\nimg_root = os.path.join(dataset_dir, 'images')\nsave_coco_anno(\n    data_annotation_train,\n    img_root,\n    os.path.join(dataset_dir, 'annotations', 'macaque_train.json'),\n    kpt_num=17)\nsave_coco_anno(\n    data_annotation_val,\n    img_root,\n    os.path.join(dataset_dir, 'annotations', 'macaque_test.json'),\n    start_img_id=12500,\n    start_ann_id=15672,\n    kpt_num=17)\n", "path": "tools/dataset/parse_macaquepose_dataset.py"}]}