""" 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"]}')