Updates `imgToAnns` variable to `snake_case` (#19402)

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
pull/19418/head
Burhan 2 weeks ago committed by GitHub
parent 58936e9661
commit 77eac7898a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      ultralytics/data/converter.py

@ -274,13 +274,13 @@ def convert_coco(
# Create image dict
images = {f"{x['id']:d}": x for x in data["images"]}
# Create image-annotations dict
imgToAnns = defaultdict(list)
annotations = defaultdict(list)
for ann in data["annotations"]:
imgToAnns[ann["image_id"]].append(ann)
annotations[ann["image_id"]].append(ann)
image_txt = []
# Write labels file
for img_id, anns in TQDM(imgToAnns.items(), desc=f"Annotations {json_file}"):
for img_id, anns in TQDM(annotations.items(), desc=f"Annotations {json_file}"):
img = images[f"{img_id:d}"]
h, w = img["height"], img["width"]
f = str(Path(img["coco_url"]).relative_to("http://images.cocodataset.org")) if lvis else img["file_name"]

Loading…
Cancel
Save