From 2d20ab988bc4c3d0a9d91a4d91db41349710dd68 Mon Sep 17 00:00:00 2001 From: Pritesh Gohil Date: Sat, 26 Sep 2020 20:51:27 +0200 Subject: [PATCH] Bug fix: category start index to 1. ref #9 --- voc2coco.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/voc2coco.py b/voc2coco.py index d04670d..3857aa0 100644 --- a/voc2coco.py +++ b/voc2coco.py @@ -48,10 +48,10 @@ def get_filename_as_int(filename): def get_categories(xml_files): """Generate category name to id mapping from a list of xml files. - + Arguments: xml_files {list} -- A list of xml file paths. - + Returns: dict -- category name to id mapping. """ @@ -63,7 +63,7 @@ def get_categories(xml_files): classes_names.append(member[0].text) classes_names = list(set(classes_names)) classes_names.sort() - return {name: i for i, name in enumerate(classes_names)} + return {name: i+1 for i, name in enumerate(classes_names)} def convert(xml_files, json_file):