Skip to content

Commit 063b845

Browse files
authored
fix coco category id mismatch bug
1 parent ac3f68c commit 063b845

1 file changed

Lines changed: 1 addition & 11 deletions

File tree

efficientdet/dataset.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ def load_classes(self):
2626
categories.sort(key=lambda x: x['id'])
2727

2828
self.classes = {}
29-
self.coco_labels = {}
30-
self.coco_labels_inverse = {}
3129
for c in categories:
32-
self.coco_labels[len(self.classes)] = c['id']
33-
self.coco_labels_inverse[c['id']] = len(self.classes)
3430
self.classes[c['name']] = len(self.classes)
3531

3632
# also load the reverse (label -> name)
@@ -77,7 +73,7 @@ def load_annotations(self, image_index):
7773

7874
annotation = np.zeros((1, 5))
7975
annotation[0, :4] = a['bbox']
80-
annotation[0, 4] = self.coco_label_to_label(a['category_id'])
76+
annotation[0, 4] = a['category_id']
8177
annotations = np.append(annotations, annotation, axis=0)
8278

8379
# transform from [x, y, w, h] to [x1, y1, x2, y2]
@@ -86,12 +82,6 @@ def load_annotations(self, image_index):
8682

8783
return annotations
8884

89-
def coco_label_to_label(self, coco_label):
90-
return self.coco_labels_inverse[coco_label]
91-
92-
def label_to_coco_label(self, label):
93-
return self.coco_labels[label]
94-
9585

9686
def collater(data):
9787
imgs = [s['img'] for s in data]

0 commit comments

Comments
 (0)