v7labs / darwin-py

Library and commandline tool for managing datasets on darwin.v7labs.com
MIT License
115 stars 42 forks source link

Coco import missing "extra" info in annotations #726

Open drapado opened 11 months ago

drapado commented 11 months ago

While exporting to COCO the "extra" entry of each annotation is built (https://github.com/v7labs/darwin-py/blob/f29c58aad1694c2ee39aaaa3761140cd137f9a30/darwin/exporter/formats/coco.py#L308). It contains "instance_id" for instance where the objects have a tracking ID.

However, the COCO importer completely ignores this "extra" category in the annotations.

drapado commented 11 months ago

Changing the importer coco.py at line 138 like this:

    if len(segmentation) == 0 and len(annotation["bbox"]) == 4:
        x, y, w, h = map(int, annotation["bbox"])
        track_id = int(annotation["extra"]["instance_id"])
        # print(dt.make_instance_id(track_id), track_id)
        return dt.make_bounding_box(category["name"], x, y, w, h, subs=[dt.make_instance_id(track_id)])

doesn't solve the issue, any ideas why?

drapado commented 11 months ago

I made it work, just created a PR: https://github.com/v7labs/darwin-py/pull/729