fuliucansheng
commited on
Commit
·
f6da417
1
Parent(s):
2b5cf97
minicoco dataset
Browse files- minicoco.py +138 -138
minicoco.py
CHANGED
@@ -21,124 +21,124 @@ _URLS = {
|
|
21 |
# fmt: off
|
22 |
CLASS_INFOS = [
|
23 |
# name id train
|
24 |
-
('person', 1, 0),
|
25 |
-
('bicycle', 2, 1),
|
26 |
-
('car', 3, 2),
|
27 |
-
('motorcycle', 4, 3),
|
28 |
-
('airplane', 5, 4),
|
29 |
-
('bus', 6, 5),
|
30 |
-
('train', 7, 6),
|
31 |
-
('truck', 8, 7),
|
32 |
-
('boat', 9, 8),
|
33 |
-
('traffic light', 10, 9),
|
34 |
-
('fire hydrant', 11, 10),
|
35 |
-
('stop sign', 13, 11),
|
36 |
-
('parking meter', 14, 12),
|
37 |
-
('bench', 15, 13),
|
38 |
-
('bird', 16, 14),
|
39 |
-
('cat', 17, 15),
|
40 |
-
('dog', 18, 16),
|
41 |
-
('horse', 19, 17),
|
42 |
-
('sheep', 20, 18),
|
43 |
-
('cow', 21, 19),
|
44 |
-
('elephant', 22, 20),
|
45 |
-
('bear', 23, 21),
|
46 |
-
('zebra', 24, 22),
|
47 |
-
('giraffe', 25, 23),
|
48 |
-
('backpack', 27, 24),
|
49 |
-
('umbrella', 28, 25),
|
50 |
-
('handbag', 31, 26),
|
51 |
-
('tie', 32, 27),
|
52 |
-
('suitcase', 33, 28),
|
53 |
-
('frisbee', 34, 29),
|
54 |
-
('skis', 35, 30),
|
55 |
-
('snowboard', 36, 31),
|
56 |
-
('sports ball', 37, 32),
|
57 |
-
('kite', 38, 33),
|
58 |
-
('baseball bat', 39, 34),
|
59 |
-
('baseball glove', 40, 35),
|
60 |
-
('skateboard', 41, 36),
|
61 |
-
('surfboard', 42, 37),
|
62 |
-
('tennis racket', 43, 38),
|
63 |
-
('bottle', 44, 39),
|
64 |
-
('wine glass', 46, 40),
|
65 |
-
('cup', 47, 41),
|
66 |
-
('fork', 48, 42),
|
67 |
-
('knife', 49, 43),
|
68 |
-
('spoon', 50, 44),
|
69 |
-
('bowl', 51, 45),
|
70 |
-
('banana', 52, 46),
|
71 |
-
('apple', 53, 47),
|
72 |
-
('sandwich', 54, 48),
|
73 |
-
('orange', 55, 49),
|
74 |
-
('broccoli', 56, 50),
|
75 |
-
('carrot', 57, 51),
|
76 |
-
('hot dog', 58, 52),
|
77 |
-
('pizza', 59, 53),
|
78 |
('donut', 60, 54),
|
79 |
-
('cake', 61, 55),
|
80 |
-
('chair', 62, 56),
|
81 |
-
('couch', 63, 57),
|
82 |
-
('potted plant', 64, 58),
|
83 |
-
('bed', 65, 59),
|
84 |
-
('dining table', 67, 60),
|
85 |
-
('toilet', 70, 61),
|
86 |
-
('tv', 72, 62),
|
87 |
-
('laptop', 73, 63),
|
88 |
-
('mouse', 74, 64),
|
89 |
-
('remote', 75, 65),
|
90 |
-
('keyboard', 76, 66),
|
91 |
-
('cell phone', 77, 67),
|
92 |
-
('microwave', 78, 68),
|
93 |
-
('oven', 79, 69),
|
94 |
-
('toaster', 80, 70),
|
95 |
-
('sink', 81, 71),
|
96 |
-
('refrigerator', 82, 72),
|
97 |
-
('book', 84, 73),
|
98 |
-
('clock', 85, 74),
|
99 |
-
('vase', 86, 75),
|
100 |
-
('scissors', 87, 76),
|
101 |
-
('teddy bear', 88, 77),
|
102 |
-
('hair drier', 89, 78),
|
103 |
('toothbrush', 90, 79)
|
104 |
]
|
105 |
|
106 |
KEYPOINTS_INFOS=[
|
107 |
# name id train
|
108 |
-
# ('nose', 1, 0),
|
109 |
-
# ('left_eye', 2, 1),
|
110 |
-
# ('right_eye', 3, 2),
|
111 |
-
# ('left_ear', 4, 3),
|
112 |
-
# ('right_ear', 5, 4),
|
113 |
-
# ('left_shoulder', 6, 5),
|
114 |
-
# ('right_shoulder', 7, 6),
|
115 |
-
# ('left_elbow', 8, 7),
|
116 |
-
# ('right_elbow', 9, 8),
|
117 |
-
# ('left_wrist', 10, 9),
|
118 |
-
# ('right_wrist', 11, 10),
|
119 |
-
# ('left_hip', 12, 11),
|
120 |
-
# ('right_hip', 13, 12),
|
121 |
-
# ('left_knee', 14, 13),
|
122 |
-
# ('right_knee', 15, 14),
|
123 |
-
# ('left_ankle', 16, 15),
|
124 |
# ('right_ankle', 17, 16)
|
125 |
('none', 1, 0),
|
126 |
-
('nose', 2, 1),
|
127 |
-
('left_eye', 3, 2),
|
128 |
-
('right_eye', 4, 3),
|
129 |
-
('left_ear', 5, 4),
|
130 |
-
('right_ear', 6, 5),
|
131 |
-
('left_shoulder', 7, 6),
|
132 |
-
('right_shoulder', 8, 7),
|
133 |
-
('left_elbow', 9, 8),
|
134 |
-
('right_elbow', 10, 9),
|
135 |
-
('left_wrist', 11, 10),
|
136 |
-
('right_wrist', 12, 11),
|
137 |
-
('left_hip', 13, 12),
|
138 |
-
('right_hip', 14, 13),
|
139 |
-
('left_knee', 15, 14),
|
140 |
-
('right_knee', 16, 15),
|
141 |
-
('left_ankle', 17, 16),
|
142 |
('right_ankle', 18, 17)
|
143 |
]
|
144 |
|
@@ -195,7 +195,7 @@ captions_features = datasets.Features(
|
|
195 |
}
|
196 |
)
|
197 |
|
198 |
-
keypoint_features = datasets.Features(
|
199 |
# 这里可能有点问题,因为模型的keypoint的标注的类别没别没有增加进来,
|
200 |
# 有点复杂,后面再finetune,现在基本信息已经正确
|
201 |
{
|
@@ -244,7 +244,7 @@ def get_captions_annotation(captions_path):
|
|
244 |
"width":image["width"],
|
245 |
"image_id":image['id']
|
246 |
})
|
247 |
-
|
248 |
return anno_infos, images_infos
|
249 |
|
250 |
|
@@ -256,18 +256,18 @@ def get_instances_annotation(instances_path):
|
|
256 |
images_infos = list()
|
257 |
|
258 |
for instance_info in anno_instances['annotations']:
|
259 |
-
# instance_info = {'segmentation': [[510.66, 423.01, 511.72, 420.03, 510.45, 416.0, 510.34, 413.02,
|
260 |
-
# 510.77, 410.26, 510.77, 407.5, 510.34, 405.16, 511.51, 402.83, 511.41, 400.49, 510.24, 398.16,
|
261 |
-
# 509.39, 397.31, 504.61, 399.22, 502.17, 399.64, 500.89, 401.66, 500.47, 402.08, 499.09, 401.87,
|
262 |
-
# 495.79, 401.98, 490.59, 401.77, 488.79, 401.77, 485.39, 398.58, 483.9, 397.31, 481.56, 396.35,
|
263 |
-
# 478.48, 395.93, 476.68, 396.03, 475.4, 396.77, 473.92, 398.79, 473.28, 399.96, 473.49, 401.87,
|
264 |
-
# 474.56, 403.47, 473.07, 405.59, 473.39, 407.71, 476.68, 409.41, 479.23, 409.73, 481.56, 410.69,
|
265 |
-
# 480.4, 411.85, 481.35, 414.93, 479.86, 418.65, 477.32, 420.03, 476.04, 422.58, 479.02, 422.58,
|
266 |
-
# 480.29, 423.01, 483.79, 419.93, 486.66, 416.21, 490.06, 415.57, 492.18, 416.85, 491.65, 420.24,
|
267 |
-
# 492.82, 422.9, 493.56, 424.39, 496.43, 424.6, 498.02, 423.01, 498.13, 421.31, 497.07, 420.03,
|
268 |
-
# 497.07, 415.15, 496.33, 414.51, 501.1, 411.96, 502.06, 411.32, 503.02, 415.04, 503.33, 418.12,
|
269 |
-
# 501.1, 420.24, 498.98, 421.63, 500.47, 424.39, 505.03, 423.32, 506.2, 421.31, 507.69, 419.5,
|
270 |
-
# 506.31, 423.32, 510.03, 423.01, 510.45, 423.01]], 'area': 702.1057499999998, 'iscrowd': 0,
|
271 |
# 'image_id': 289343, 'bbox': [473.07, 395.93, 38.65, 28.67], 'category_id': 18, 'id': 1768}
|
272 |
bbox = instance_info['bbox']
|
273 |
image_id = instance_info['image_id']
|
@@ -291,12 +291,12 @@ def get_instances_annotation(instances_path):
|
|
291 |
"classes":CATEGORY_ID2CLASS_NAMES[instance_info['category_id']]
|
292 |
}
|
293 |
]
|
294 |
-
|
295 |
|
296 |
for image in anno_instances['images']:
|
297 |
-
# image={'license': 4, 'file_name': '000000397133.jpg',
|
298 |
-
# 'coco_url': 'http://images.cocodataset.org/val2017/000000397133.jpg',
|
299 |
-
# 'height': 427, 'width': 640, 'date_captured': '2013-11-14 17:02:52',
|
300 |
# 'flickr_url': 'http://farm7.staticflickr.com/6116/6255196340_da26cf2c9e_z.jpg', 'id': 397133}
|
301 |
images_infos.append({
|
302 |
"image_name":image['file_name'],
|
@@ -304,7 +304,7 @@ def get_instances_annotation(instances_path):
|
|
304 |
"width":image["width"],
|
305 |
"image_id":image['id']
|
306 |
})
|
307 |
-
|
308 |
return anno_infos, images_infos
|
309 |
|
310 |
|
@@ -338,7 +338,7 @@ def get_keypoints_annotation(keypoints_path):
|
|
338 |
"num_keypoints":keypoint_info['num_keypoints'],
|
339 |
}
|
340 |
]
|
341 |
-
|
342 |
|
343 |
for image in anno_keypoints['images']:
|
344 |
# image={'license': 4, 'file_name': '000000397133.jpg', 'coco_url': 'http://images.cocodataset.org/val2017/000000397133.jpg', 'height': 427, 'width': 640, 'date_captured': '2013-11-14 17:02:52', 'flickr_url': 'http://farm7.staticflickr.com/6116/6255196340_da26cf2c9e_z.jpg', 'id': 397133}
|
@@ -348,7 +348,7 @@ def get_keypoints_annotation(keypoints_path):
|
|
348 |
"width":image["width"],
|
349 |
"image_id":image['id']
|
350 |
})
|
351 |
-
|
352 |
return anno_infos, images_infos
|
353 |
|
354 |
|
@@ -370,7 +370,7 @@ class MINICOCOConfig(datasets.BuilderConfig):
|
|
370 |
self.task_name = task_name
|
371 |
|
372 |
|
373 |
-
class
|
374 |
|
375 |
BUILDER_CONFIGS = [
|
376 |
MINICOCOConfig(
|
@@ -472,7 +472,7 @@ class PASCALDataset(datasets.GeneratorBasedBuilder):
|
|
472 |
"width": image["width"],
|
473 |
"objects":[
|
474 |
{
|
475 |
-
"bboxes": object_info["bbox"],
|
476 |
"classes": object_info["classes"]
|
477 |
}
|
478 |
for object_info in anno_infos[image['image_id']]
|
@@ -495,7 +495,7 @@ class PASCALDataset(datasets.GeneratorBasedBuilder):
|
|
495 |
"width": image["width"],
|
496 |
"objects":[
|
497 |
{
|
498 |
-
"bboxes": object_info["bbox"],
|
499 |
"classes": object_info["classes"],
|
500 |
'segmentation':object_info['segmentation'],
|
501 |
'iscrowd':object_info['iscrowd']
|
@@ -503,7 +503,7 @@ class PASCALDataset(datasets.GeneratorBasedBuilder):
|
|
503 |
for object_info in anno_infos[image['image_id']]
|
504 |
]
|
505 |
}
|
506 |
-
yield id_, example
|
507 |
|
508 |
elif task_name=="keypoint":
|
509 |
keypoints_path = os.path.join(filepath, "annotations", "person_keypoints_" + split + "2017.json")
|
@@ -519,8 +519,8 @@ class PASCALDataset(datasets.GeneratorBasedBuilder):
|
|
519 |
"height": image["height"],
|
520 |
"width": image["width"],
|
521 |
"objects":[
|
522 |
-
{
|
523 |
-
"bboxes": object_info["bbox"],
|
524 |
"classes": object_info["classes"],
|
525 |
'keypoints':object_info['keypoints'],
|
526 |
"num_keypoints":object_info["num_keypoints"]
|
@@ -528,4 +528,4 @@ class PASCALDataset(datasets.GeneratorBasedBuilder):
|
|
528 |
for object_info in anno_infos[image['image_id']]
|
529 |
]
|
530 |
}
|
531 |
-
yield id_, example
|
|
|
21 |
# fmt: off
|
22 |
CLASS_INFOS = [
|
23 |
# name id train
|
24 |
+
('person', 1, 0),
|
25 |
+
('bicycle', 2, 1),
|
26 |
+
('car', 3, 2),
|
27 |
+
('motorcycle', 4, 3),
|
28 |
+
('airplane', 5, 4),
|
29 |
+
('bus', 6, 5),
|
30 |
+
('train', 7, 6),
|
31 |
+
('truck', 8, 7),
|
32 |
+
('boat', 9, 8),
|
33 |
+
('traffic light', 10, 9),
|
34 |
+
('fire hydrant', 11, 10),
|
35 |
+
('stop sign', 13, 11),
|
36 |
+
('parking meter', 14, 12),
|
37 |
+
('bench', 15, 13),
|
38 |
+
('bird', 16, 14),
|
39 |
+
('cat', 17, 15),
|
40 |
+
('dog', 18, 16),
|
41 |
+
('horse', 19, 17),
|
42 |
+
('sheep', 20, 18),
|
43 |
+
('cow', 21, 19),
|
44 |
+
('elephant', 22, 20),
|
45 |
+
('bear', 23, 21),
|
46 |
+
('zebra', 24, 22),
|
47 |
+
('giraffe', 25, 23),
|
48 |
+
('backpack', 27, 24),
|
49 |
+
('umbrella', 28, 25),
|
50 |
+
('handbag', 31, 26),
|
51 |
+
('tie', 32, 27),
|
52 |
+
('suitcase', 33, 28),
|
53 |
+
('frisbee', 34, 29),
|
54 |
+
('skis', 35, 30),
|
55 |
+
('snowboard', 36, 31),
|
56 |
+
('sports ball', 37, 32),
|
57 |
+
('kite', 38, 33),
|
58 |
+
('baseball bat', 39, 34),
|
59 |
+
('baseball glove', 40, 35),
|
60 |
+
('skateboard', 41, 36),
|
61 |
+
('surfboard', 42, 37),
|
62 |
+
('tennis racket', 43, 38),
|
63 |
+
('bottle', 44, 39),
|
64 |
+
('wine glass', 46, 40),
|
65 |
+
('cup', 47, 41),
|
66 |
+
('fork', 48, 42),
|
67 |
+
('knife', 49, 43),
|
68 |
+
('spoon', 50, 44),
|
69 |
+
('bowl', 51, 45),
|
70 |
+
('banana', 52, 46),
|
71 |
+
('apple', 53, 47),
|
72 |
+
('sandwich', 54, 48),
|
73 |
+
('orange', 55, 49),
|
74 |
+
('broccoli', 56, 50),
|
75 |
+
('carrot', 57, 51),
|
76 |
+
('hot dog', 58, 52),
|
77 |
+
('pizza', 59, 53),
|
78 |
('donut', 60, 54),
|
79 |
+
('cake', 61, 55),
|
80 |
+
('chair', 62, 56),
|
81 |
+
('couch', 63, 57),
|
82 |
+
('potted plant', 64, 58),
|
83 |
+
('bed', 65, 59),
|
84 |
+
('dining table', 67, 60),
|
85 |
+
('toilet', 70, 61),
|
86 |
+
('tv', 72, 62),
|
87 |
+
('laptop', 73, 63),
|
88 |
+
('mouse', 74, 64),
|
89 |
+
('remote', 75, 65),
|
90 |
+
('keyboard', 76, 66),
|
91 |
+
('cell phone', 77, 67),
|
92 |
+
('microwave', 78, 68),
|
93 |
+
('oven', 79, 69),
|
94 |
+
('toaster', 80, 70),
|
95 |
+
('sink', 81, 71),
|
96 |
+
('refrigerator', 82, 72),
|
97 |
+
('book', 84, 73),
|
98 |
+
('clock', 85, 74),
|
99 |
+
('vase', 86, 75),
|
100 |
+
('scissors', 87, 76),
|
101 |
+
('teddy bear', 88, 77),
|
102 |
+
('hair drier', 89, 78),
|
103 |
('toothbrush', 90, 79)
|
104 |
]
|
105 |
|
106 |
KEYPOINTS_INFOS=[
|
107 |
# name id train
|
108 |
+
# ('nose', 1, 0),
|
109 |
+
# ('left_eye', 2, 1),
|
110 |
+
# ('right_eye', 3, 2),
|
111 |
+
# ('left_ear', 4, 3),
|
112 |
+
# ('right_ear', 5, 4),
|
113 |
+
# ('left_shoulder', 6, 5),
|
114 |
+
# ('right_shoulder', 7, 6),
|
115 |
+
# ('left_elbow', 8, 7),
|
116 |
+
# ('right_elbow', 9, 8),
|
117 |
+
# ('left_wrist', 10, 9),
|
118 |
+
# ('right_wrist', 11, 10),
|
119 |
+
# ('left_hip', 12, 11),
|
120 |
+
# ('right_hip', 13, 12),
|
121 |
+
# ('left_knee', 14, 13),
|
122 |
+
# ('right_knee', 15, 14),
|
123 |
+
# ('left_ankle', 16, 15),
|
124 |
# ('right_ankle', 17, 16)
|
125 |
('none', 1, 0),
|
126 |
+
('nose', 2, 1),
|
127 |
+
('left_eye', 3, 2),
|
128 |
+
('right_eye', 4, 3),
|
129 |
+
('left_ear', 5, 4),
|
130 |
+
('right_ear', 6, 5),
|
131 |
+
('left_shoulder', 7, 6),
|
132 |
+
('right_shoulder', 8, 7),
|
133 |
+
('left_elbow', 9, 8),
|
134 |
+
('right_elbow', 10, 9),
|
135 |
+
('left_wrist', 11, 10),
|
136 |
+
('right_wrist', 12, 11),
|
137 |
+
('left_hip', 13, 12),
|
138 |
+
('right_hip', 14, 13),
|
139 |
+
('left_knee', 15, 14),
|
140 |
+
('right_knee', 16, 15),
|
141 |
+
('left_ankle', 17, 16),
|
142 |
('right_ankle', 18, 17)
|
143 |
]
|
144 |
|
|
|
195 |
}
|
196 |
)
|
197 |
|
198 |
+
keypoint_features = datasets.Features(
|
199 |
# 这里可能有点问题,因为模型的keypoint的标注的类别没别没有增加进来,
|
200 |
# 有点复杂,后面再finetune,现在基本信息已经正确
|
201 |
{
|
|
|
244 |
"width":image["width"],
|
245 |
"image_id":image['id']
|
246 |
})
|
247 |
+
|
248 |
return anno_infos, images_infos
|
249 |
|
250 |
|
|
|
256 |
images_infos = list()
|
257 |
|
258 |
for instance_info in anno_instances['annotations']:
|
259 |
+
# instance_info = {'segmentation': [[510.66, 423.01, 511.72, 420.03, 510.45, 416.0, 510.34, 413.02,
|
260 |
+
# 510.77, 410.26, 510.77, 407.5, 510.34, 405.16, 511.51, 402.83, 511.41, 400.49, 510.24, 398.16,
|
261 |
+
# 509.39, 397.31, 504.61, 399.22, 502.17, 399.64, 500.89, 401.66, 500.47, 402.08, 499.09, 401.87,
|
262 |
+
# 495.79, 401.98, 490.59, 401.77, 488.79, 401.77, 485.39, 398.58, 483.9, 397.31, 481.56, 396.35,
|
263 |
+
# 478.48, 395.93, 476.68, 396.03, 475.4, 396.77, 473.92, 398.79, 473.28, 399.96, 473.49, 401.87,
|
264 |
+
# 474.56, 403.47, 473.07, 405.59, 473.39, 407.71, 476.68, 409.41, 479.23, 409.73, 481.56, 410.69,
|
265 |
+
# 480.4, 411.85, 481.35, 414.93, 479.86, 418.65, 477.32, 420.03, 476.04, 422.58, 479.02, 422.58,
|
266 |
+
# 480.29, 423.01, 483.79, 419.93, 486.66, 416.21, 490.06, 415.57, 492.18, 416.85, 491.65, 420.24,
|
267 |
+
# 492.82, 422.9, 493.56, 424.39, 496.43, 424.6, 498.02, 423.01, 498.13, 421.31, 497.07, 420.03,
|
268 |
+
# 497.07, 415.15, 496.33, 414.51, 501.1, 411.96, 502.06, 411.32, 503.02, 415.04, 503.33, 418.12,
|
269 |
+
# 501.1, 420.24, 498.98, 421.63, 500.47, 424.39, 505.03, 423.32, 506.2, 421.31, 507.69, 419.5,
|
270 |
+
# 506.31, 423.32, 510.03, 423.01, 510.45, 423.01]], 'area': 702.1057499999998, 'iscrowd': 0,
|
271 |
# 'image_id': 289343, 'bbox': [473.07, 395.93, 38.65, 28.67], 'category_id': 18, 'id': 1768}
|
272 |
bbox = instance_info['bbox']
|
273 |
image_id = instance_info['image_id']
|
|
|
291 |
"classes":CATEGORY_ID2CLASS_NAMES[instance_info['category_id']]
|
292 |
}
|
293 |
]
|
294 |
+
|
295 |
|
296 |
for image in anno_instances['images']:
|
297 |
+
# image={'license': 4, 'file_name': '000000397133.jpg',
|
298 |
+
# 'coco_url': 'http://images.cocodataset.org/val2017/000000397133.jpg',
|
299 |
+
# 'height': 427, 'width': 640, 'date_captured': '2013-11-14 17:02:52',
|
300 |
# 'flickr_url': 'http://farm7.staticflickr.com/6116/6255196340_da26cf2c9e_z.jpg', 'id': 397133}
|
301 |
images_infos.append({
|
302 |
"image_name":image['file_name'],
|
|
|
304 |
"width":image["width"],
|
305 |
"image_id":image['id']
|
306 |
})
|
307 |
+
|
308 |
return anno_infos, images_infos
|
309 |
|
310 |
|
|
|
338 |
"num_keypoints":keypoint_info['num_keypoints'],
|
339 |
}
|
340 |
]
|
341 |
+
|
342 |
|
343 |
for image in anno_keypoints['images']:
|
344 |
# image={'license': 4, 'file_name': '000000397133.jpg', 'coco_url': 'http://images.cocodataset.org/val2017/000000397133.jpg', 'height': 427, 'width': 640, 'date_captured': '2013-11-14 17:02:52', 'flickr_url': 'http://farm7.staticflickr.com/6116/6255196340_da26cf2c9e_z.jpg', 'id': 397133}
|
|
|
348 |
"width":image["width"],
|
349 |
"image_id":image['id']
|
350 |
})
|
351 |
+
|
352 |
return anno_infos, images_infos
|
353 |
|
354 |
|
|
|
370 |
self.task_name = task_name
|
371 |
|
372 |
|
373 |
+
class MiniCOCODataset(datasets.GeneratorBasedBuilder):
|
374 |
|
375 |
BUILDER_CONFIGS = [
|
376 |
MINICOCOConfig(
|
|
|
472 |
"width": image["width"],
|
473 |
"objects":[
|
474 |
{
|
475 |
+
"bboxes": object_info["bbox"],
|
476 |
"classes": object_info["classes"]
|
477 |
}
|
478 |
for object_info in anno_infos[image['image_id']]
|
|
|
495 |
"width": image["width"],
|
496 |
"objects":[
|
497 |
{
|
498 |
+
"bboxes": object_info["bbox"],
|
499 |
"classes": object_info["classes"],
|
500 |
'segmentation':object_info['segmentation'],
|
501 |
'iscrowd':object_info['iscrowd']
|
|
|
503 |
for object_info in anno_infos[image['image_id']]
|
504 |
]
|
505 |
}
|
506 |
+
yield id_, example
|
507 |
|
508 |
elif task_name=="keypoint":
|
509 |
keypoints_path = os.path.join(filepath, "annotations", "person_keypoints_" + split + "2017.json")
|
|
|
519 |
"height": image["height"],
|
520 |
"width": image["width"],
|
521 |
"objects":[
|
522 |
+
{
|
523 |
+
"bboxes": object_info["bbox"],
|
524 |
"classes": object_info["classes"],
|
525 |
'keypoints':object_info['keypoints'],
|
526 |
"num_keypoints":object_info["num_keypoints"]
|
|
|
528 |
for object_info in anno_infos[image['image_id']]
|
529 |
]
|
530 |
}
|
531 |
+
yield id_, example
|