From fc268542a3df935294f7319f785b08dcaeab86c9 Mon Sep 17 00:00:00 2001 From: Francois Savard <46498565+fsavard-eai@users.noreply.github.com> Date: Tue, 29 Oct 2019 13:24:48 +0000 Subject: [PATCH] Fixing issue #1530 by starting ann_id to 1 in convert_to_coco_api --- references/detection/coco_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/references/detection/coco_utils.py b/references/detection/coco_utils.py index efbbdd3f4ea..26701a2cbee 100644 --- a/references/detection/coco_utils.py +++ b/references/detection/coco_utils.py @@ -145,7 +145,8 @@ def _has_valid_annotation(anno): def convert_to_coco_api(ds): coco_ds = COCO() - ann_id = 0 + # annotation IDs need to start at 1, not 0, see torchvision issue #1530 + ann_id = 1 dataset = {'images': [], 'categories': [], 'annotations': []} categories = set() for img_idx in range(len(ds)):