Closed XiaohangZhan closed 4 years ago
No, but sounds useful if we had.
I made a converter for Labelme to COCO. https://github.com/cm107/annotation_utils/blob/master/build/lib/annotation_utils/converter/labelme_coco_converter.py
You could do something similar for converting COCO to Labelme as well. You would have to make assumptions though. For example, all Labelme point annotations are keypoints, all rectangles are bounding boxes, and all polygons are segmentation. You would also have to assume that all point labels are contained in either a rectangle or polygon.
Labelme Parser: https://github.com/cm107/annotation_utils/blob/master/build/lib/annotation_utils/labelme/annotation/labelme_annotation.py COCO Parser: https://github.com/cm107/annotation_utils/blob/master/build/lib/annotation_utils/coco/annotation/coco_annotation.py
Edit 2020/12/9:
pip install https://github.com/cm107/annotation_utils/archive/development.zip
Here is an example:
from annotation_utils.coco.structs import COCO_Dataset
dataset = COCO_Dataset.load_from_path('annotations/instances_val2017.json', img_dir='val2017', strict=False)
labelme_handler = dataset.to_labelme()
labelme_handler.save_to_dir(json_save_dir='labelme_json', src_img_dir='val2017', overwrite=True)
I want to load LVIS annotation file (in the same format as coco) to labelme and modify the instance segmentations. It should be the inverse process of examples/instance_segmentation/labelme2coco.py.
Is there such a script?