revert pascal evaluation format

This commit is contained in:
Xingyi Zhou 2019-04-26 10:53:05 -05:00
parent a412990c06
commit 3a1e9c668c
1 changed files with 3 additions and 3 deletions

View File

@ -46,7 +46,7 @@ class PascalVOC(data.Dataset):
print('==> initializing pascal {} data.'.format(_ann_name[split])) print('==> initializing pascal {} data.'.format(_ann_name[split]))
self.coco = coco.COCO(self.annot_path) self.coco = coco.COCO(self.annot_path)
self.images = self.coco.getImgIds() self.images = sorted(self.coco.getImgIds())
self.num_samples = len(self.images) self.num_samples = len(self.images)
print('Loaded {} {} samples'.format(split, self.num_samples)) print('Loaded {} {} samples'.format(split, self.num_samples))
@ -61,9 +61,9 @@ class PascalVOC(data.Dataset):
img_id = self.images[i] img_id = self.images[i]
for j in range(1, self.num_classes + 1): for j in range(1, self.num_classes + 1):
if isinstance(all_bboxes[img_id][j], np.ndarray): if isinstance(all_bboxes[img_id][j], np.ndarray):
detections[j][img_id] = all_bboxes[img_id][j].tolist() detections[j][i] = all_bboxes[img_id][j].tolist()
else: else:
detections[j][img_id] = all_bboxes[img_id][j] detections[j][i] = all_bboxes[img_id][j]
return detections return detections
def __len__(self): def __len__(self):