Skip to content

Commit 8f904cb

Browse files
committed
minor fix and tested
1 parent fb94d36 commit 8f904cb

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tools/pascal_voc_xml2json.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,18 +164,22 @@ def parseXmlFiles(xml_path, file_list):
164164

165165

166166
if __name__ == '__main__':
167+
"""
168+
Change the image_sets_path, anno_path and xml_path as per your
169+
absolute path for this script to work.
170+
"""
171+
172+
global coco
173+
167174
image_sets_path = 'ImageSets/Main'
168175
anno_path = 'annotations'
169176
xml_path = 'Annotations'
170177

171-
if os.path.exists(anno_path):
172-
os.makedirs(anno_path)
173-
174178
for f in os.listdir(image_sets_path):
175179
if not f.endswith('.txt'):
176180
continue
177181

178-
global coco = dict()
182+
coco = dict()
179183
coco['images'] = []
180184
coco['type'] = 'instances'
181185
coco['annotations'] = []

0 commit comments

Comments
 (0)