Skip to content

Commit 13b35ff

Browse files
fsavard-eaifmassa
authored andcommitted
Fixing issue #1530 by starting ann_id to 1 in convert_to_coco_api (#1531)
1 parent 7d509c5 commit 13b35ff

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

references/detection/coco_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ def _has_valid_annotation(anno):
145145

146146
def convert_to_coco_api(ds):
147147
coco_ds = COCO()
148-
ann_id = 0
148+
# annotation IDs need to start at 1, not 0, see torchvision issue #1530
149+
ann_id = 1
149150
dataset = {'images': [], 'categories': [], 'annotations': []}
150151
categories = set()
151152
for img_idx in range(len(ds)):

0 commit comments

Comments
 (0)