Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

petersen-poul
Copy link
Member

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 :)

@petersen-poul petersen-poul self-assigned this May 30, 2024
@petersen-poul petersen-poul requested a review from mmerce May 30, 2024 02:09
@petersen-poul
Copy link
Member Author

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/

Copy link
Member

@mmerce mmerce left a 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
Copy link
Member

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

Copy link
Member

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": [] }]\
Copy link
Member

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.

@mmerce
Copy link
Member

mmerce commented May 31, 2024

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/

That's not correct. The --annotations-dir refers to the directory.

@mmerce
Copy link
Member

mmerce commented May 31, 2024

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/

options:
-h, --help show this help message and exit
--HOG Whether to use Histogram of Gradients as image
analysis features. Captures profiles.
--add-sources ADD_SOURCES
A comma-separated list of source identifiers to add to
the composite.
--annotations-dir ANNOTATIONS_DIR
Directory for individual annotation files.
--annotations-file ANNOTATIONS_FILE
File that contains the annotations to images.

@mmerce
Copy link
Member

mmerce commented Jun 13, 2024

Added with checks, tests and examples in version 5.9.0

@mmerce mmerce closed this Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants