Created
September 13, 2023 14:00
-
-
Save Tob-iee/2a31b6e6d0ab243ac55e2b8359dc37f1 to your computer and use it in GitHub Desktop.
Built, write and read annotations in COCO format using the COCO library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def coco_format_loader(train_dataset_version, label_names, coco_annotations_path): | |
coco_annotation = train_dataset_version.build_coco_file_locally( | |
enforced_ordered_categories=label_names | |
) | |
annotations_dict = coco_annotation.dict() | |
with open(coco_annotations_path, "w") as f: | |
f.write(json.dumps(annotations_dict)) | |
annotations_coco = COCO(coco_annotations_path) | |
return annotations_coco |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment