Datasets:

Languages:
English
License:
kimsan0622 commited on
Commit
6b0a878
1 Parent(s): 2015ff6

Update coco.py

Browse files
Files changed (1) hide show
  1. coco.py +244 -9
coco.py CHANGED
@@ -157,6 +157,118 @@ CAT = [
157
  "hair brush",
158
  ]
159
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  SUPER_CAT = [
161
  "none",
162
  "person",
@@ -173,6 +285,24 @@ SUPER_CAT = [
173
  "indoor",
174
  ]
175
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
  CAT2SUPER_CAT = [
177
  "none",
178
  "person",
@@ -266,13 +396,118 @@ CAT2SUPER_CAT = [
266
  "indoor",
267
  "indoor",
268
  "indoor",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
269
  ]
270
 
271
 
272
-
273
-
274
-
275
-
276
  class AnnotationType(object):
277
  """Enum of the annotation format types.
278
  Splits are annotated with different formats.
@@ -313,8 +548,8 @@ PANOPTIC_FEATURE = datasets.Features(
313
  "bbox": datasets.Sequence(
314
  feature=datasets.Value("float32")
315
  ),
316
- "label": datasets.ClassLabel(names=CAT),
317
- "super_cat_label": datasets.ClassLabel(names=SUPER_CAT),
318
  "is_crowd": datasets.Value("bool"),
319
  })),
320
  "panoptic_image": datasets.Image(),
@@ -605,10 +840,10 @@ class Coco(datasets.GeneratorBasedBuilder):
605
  # pylint: disable=cell-var-from-loop
606
  # build_bbox is only used within the loop so it is ok to use image_info
607
  return [
608
- y,
609
  x,
610
- (y + height),
611
  (x + width),
 
612
  ]
613
  # pylint: enable=cell-var-from-loop
614
 
@@ -622,7 +857,7 @@ class Coco(datasets.GeneratorBasedBuilder):
622
  'area': instance['area'],
623
  'bbox': build_bbox(*instance['bbox']),
624
  'label': instance['category_id'],
625
- 'super_cat_label': SUPER_CAT.index(CAT2SUPER_CAT[instance['category_id']]),
626
  'is_crowd': bool(instance['iscrowd']),
627
  }
628
  for instance in instances
 
157
  "hair brush",
158
  ]
159
 
160
+ CAT_PANOPTIC = CAT + [
161
+ "banner",
162
+ "blanket",
163
+ "none1",
164
+ "bridge",
165
+ "none2",
166
+ "none3",
167
+ "none4",
168
+ "none5",
169
+ "cardboard",
170
+ "none6",
171
+ "none7",
172
+ "none8",
173
+ "none9",
174
+ "none10",
175
+ "none11",
176
+ "counter",
177
+ "none12",
178
+ "curtain",
179
+ "none13",
180
+ "none14",
181
+ "door-stuff",
182
+ "none15",
183
+ "none16",
184
+ "none17",
185
+ "none18",
186
+ "none19",
187
+ "floor-wood",
188
+ "flower",
189
+ "none20",
190
+ "none21",
191
+ "fruit",
192
+ "none22",
193
+ "none23",
194
+ "gravel",
195
+ "none24",
196
+ "none25",
197
+ "house",
198
+ "none26",
199
+ "light",
200
+ "none27",
201
+ "none28",
202
+ "mirror-stuff",
203
+ "none29",
204
+ "none30",
205
+ "none31",
206
+ "none32",
207
+ "net",
208
+ "none33",
209
+ "none34",
210
+ "pillow",
211
+ "none35",
212
+ "none36",
213
+ "platform",
214
+ "playingfield",
215
+ "none37",
216
+ "railroad",
217
+ "river",
218
+ "road",
219
+ "none38",
220
+ "roof",
221
+ "none39",
222
+ "none40",
223
+ "sand",
224
+ "sea",
225
+ "shelf",
226
+ "none41",
227
+ "none42",
228
+ "snow",
229
+ "none43",
230
+ "stairs",
231
+ "none44",
232
+ "none45",
233
+ "none46",
234
+ "none47",
235
+ "tent",
236
+ "none48",
237
+ "towel",
238
+ "none49",
239
+ "none50",
240
+ "wall-brick",
241
+ "none51",
242
+ "none52",
243
+ "none53",
244
+ "wall-stone",
245
+ "wall-tile",
246
+ "wall-wood",
247
+ "water-other",
248
+ "none54",
249
+ "window-blind",
250
+ "window-other",
251
+ "none55",
252
+ "none56",
253
+ "tree-merged",
254
+ "fence-merged",
255
+ "ceiling-merged",
256
+ "sky-other-merged",
257
+ "cabinet-merged",
258
+ "table-merged",
259
+ "floor-other-merged",
260
+ "pavement-merged",
261
+ "mountain-merged",
262
+ "grass-merged",
263
+ "dirt-merged",
264
+ "paper-merged",
265
+ "food-other-merged",
266
+ "building-other-merged",
267
+ "rock-merged",
268
+ "wall-other-merged",
269
+ "rug-merged",
270
+ ]
271
+
272
  SUPER_CAT = [
273
  "none",
274
  "person",
 
285
  "indoor",
286
  ]
287
 
288
+ SUPER_CAT_PANOPTIC = SUPER_CAT + [
289
+ "textile",
290
+ "building",
291
+ "raw-material",
292
+ "furniture-stuff",
293
+ "floor",
294
+ "plant",
295
+ "food-stuff",
296
+ "ground",
297
+ "structural",
298
+ "water",
299
+ "wall",
300
+ "window",
301
+ "ceiling",
302
+ "sky",
303
+ "solid",
304
+ ]
305
+
306
  CAT2SUPER_CAT = [
307
  "none",
308
  "person",
 
396
  "indoor",
397
  "indoor",
398
  "indoor",
399
+ "textile",
400
+ "textile",
401
+ "none",
402
+ "building",
403
+ "none",
404
+ "none",
405
+ "none",
406
+ "none",
407
+ "raw-material",
408
+ "none",
409
+ "none",
410
+ "none",
411
+ "none",
412
+ "none",
413
+ "none",
414
+ "furniture-stuff",
415
+ "none",
416
+ "textile",
417
+ "none",
418
+ "none",
419
+ "furniture-stuff",
420
+ "none",
421
+ "none",
422
+ "none",
423
+ "none",
424
+ "none",
425
+ "floor",
426
+ "plant",
427
+ "none",
428
+ "none",
429
+ "food-stuff",
430
+ "none",
431
+ "none",
432
+ "ground",
433
+ "none",
434
+ "none",
435
+ "building",
436
+ "none",
437
+ "furniture-stuff",
438
+ "none",
439
+ "none",
440
+ "furniture-stuff",
441
+ "none",
442
+ "none",
443
+ "none",
444
+ "none",
445
+ "structural",
446
+ "none",
447
+ "none",
448
+ "textile",
449
+ "none",
450
+ "none",
451
+ "ground",
452
+ "ground",
453
+ "none",
454
+ "ground",
455
+ "water",
456
+ "ground",
457
+ "none",
458
+ "building",
459
+ "none",
460
+ "none",
461
+ "ground",
462
+ "water",
463
+ "furniture-stuff",
464
+ "none",
465
+ "none",
466
+ "ground",
467
+ "none",
468
+ "furniture-stuff",
469
+ "none",
470
+ "none",
471
+ "none",
472
+ "none",
473
+ "building",
474
+ "none",
475
+ "textile",
476
+ "none",
477
+ "none",
478
+ "wall",
479
+ "none",
480
+ "none",
481
+ "none",
482
+ "wall",
483
+ "wall",
484
+ "wall",
485
+ "water",
486
+ "none",
487
+ "window",
488
+ "window",
489
+ "none",
490
+ "none",
491
+ "plant",
492
+ "structural",
493
+ "ceiling",
494
+ "sky",
495
+ "furniture-stuff",
496
+ "furniture-stuff",
497
+ "floor",
498
+ "ground",
499
+ "solid",
500
+ "plant",
501
+ "ground",
502
+ "raw-material",
503
+ "food-stuff",
504
+ "building",
505
+ "solid",
506
+ "wall",
507
+ "textile",
508
  ]
509
 
510
 
 
 
 
 
511
  class AnnotationType(object):
512
  """Enum of the annotation format types.
513
  Splits are annotated with different formats.
 
548
  "bbox": datasets.Sequence(
549
  feature=datasets.Value("float32")
550
  ),
551
+ "label": datasets.ClassLabel(names=CAT_PANOPTIC),
552
+ "super_cat_label": datasets.ClassLabel(names=SUPER_CAT_PANOPTIC),
553
  "is_crowd": datasets.Value("bool"),
554
  })),
555
  "panoptic_image": datasets.Image(),
 
840
  # pylint: disable=cell-var-from-loop
841
  # build_bbox is only used within the loop so it is ok to use image_info
842
  return [
 
843
  x,
844
+ y,
845
  (x + width),
846
+ (y + height),
847
  ]
848
  # pylint: enable=cell-var-from-loop
849
 
 
857
  'area': instance['area'],
858
  'bbox': build_bbox(*instance['bbox']),
859
  'label': instance['category_id'],
860
+ 'super_cat_label': SUPER_CAT_PANOPTIC.index(CAT2SUPER_CAT[instance['category_id']]),
861
  'is_crowd': bool(instance['iscrowd']),
862
  }
863
  for instance in instances