Spaces:
Running on Zero
Running on Zero
File size: 575 Bytes
47f2ebf | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | """
Optional helper.
Your COCO exporter should already contain the same categories in train and val.
This script prints the category IDs/names so you can compare them with classes.txt.
Usage:
python training/convert_coco_categories.py data/train/annotations.json
"""
import json
import sys
if len(sys.argv) != 2:
raise SystemExit("Usage: python training/convert_coco_categories.py annotations.json")
data = json.load(open(sys.argv[1], "r", encoding="utf-8"))
for cat in sorted(data["categories"], key=lambda x: x["id"]):
print(f'{cat["id"]}: {cat["name"]}')
|