NaturalIntelligence / imglab

To speedup and simplify image labeling/ annotation process with multiple supported formats.
https://solothought.com/imglab/
MIT License
977 stars 596 forks source link

COCO bbox format #126

Closed alecGraves closed 5 years ago

alecGraves commented 5 years ago

Describe the bug The bbox category in an annotation for the COCO JSON data format is slightly different than official COCO Documentation. The documentation states that the bbox string should map to an array as follows:

"bbox" : [x,y,width,height]

while the current implementation maps the bbox sting the following json object:

"bbox": {
                "cx": cx,
                "w": w,
                "cy": cy,
                "h": h,
                "y": y,
                "height": height,
                "x": x,
                "width": width
           },

To Reproduce Steps to reproduce the behavior:

  1. Open imglab in browser
  2. Add a folder of images
  3. Select rectangle from left side of screen
  4. Draw a rectangle on the open image
  5. press ctrl + e to open save options
  6. select COCO JSON
  7. select save
  8. Open the saved .json file

Additional context

This is an example output:

{
    "images": [
        {
            "file_name": "wallpaper.jpg",
            "height": 1080,
            "width": 1920,
            "id": 1
        }
    ],
    "type": "instances",
    "annotations": [
        {
            "segmentation": [
                [
                    1128.3333333333333,
                    434.99999999999994,
                    1615.0276692708333,
                    434.99999999999994,
                    1615.0276692708333,
                    911.6944376627603,
                    1128.3333333333333,
                    911.6944376627603
                ]
            ],
            "area": 232004.48278337717,
            "iscrowd": 0,
            "image_id": 1,
            "bbox": {
                "x": 1128.3333333333333,
                "y": 434.99999999999994,
                "cx": 1371.6805013020833,
                "cy": 673.3472188313801,
                "w": 486.69433593749994,
                "h": 476.6944376627604,
                "width": 486.69433593749994,
                "height": 476.6944376627604
            },
            "category_id": 1,
            "id": 1,
            "ignore": 0
        }
    ],
    "categories": [
        {
            "supercategory": "none",
            "id": 1,
            "name": "uncategorized"
        }
    ]
}

Notice bbox is not in the same format as on the COCO Documentation.

amitguptagwl commented 5 years ago

@alecGraves Thanks to reporting this bug. Will you mind to fix it?

alecGraves commented 5 years ago

Ok, I will try to fix it.

amitguptagwl commented 5 years ago

Thanks. Let me know if you need any support.

On Sat 27 Oct, 2018, 12:21 PM Alec Graves <notifications@github.com wrote:

Ok, I will try to fix it.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/NaturalIntelligence/imglab/issues/126#issuecomment-433596646, or mute the thread https://github.com/notifications/unsubscribe-auth/AHVgKNXqOJu8kVsVerodIUOH6lzKcNN4ks5upAJ0gaJpZM4X9Oja .