-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds support for official COCO annotation format in source processing #258
Conversation
Oh, yeah, I totally abused the meaning of --annotations-dir, sorry about that. bigmler source --annotations-dir=train/_annotations.coco.json --annotations-language=COCO --train train/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to add a test for that. Tests for VOC and YOLO are in
bigmler/tests/test_42_composites.py
and the test data is in data/images
@@ -568,3 +571,72 @@ def voc_to_cocojson(voc_dir, args, session_file): | |||
|
|||
return [relative_path(args.images_dir, filename) for filename in \ | |||
filenames] | |||
|
|||
def mscoco_to_cocojson(mscoco_file, args, session_file): | |||
"""Translates annotations from a VOC format, where each image is associated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the comment talks about VOC format and should be MS COCO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the annotations file is a single JSON
data = json.load(handle) | ||
|
||
# Extract the file_name and id into a dict | ||
images = dict([ [el['id'], { "file": el['file_name'], "boxes": [] }]\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
usually lint complains about variable names having less than three letters, but we have allowed that previously, so your choice.
That's not correct. The --annotations-dir refers to the directory. |
options: |
Added with checks, tests and examples in version 5.9.0 |
I mean, I fully accept that this is probably not merge worthy, but it works, so let me know what needs to be fixed and/or improved :)