ryouchinsa / Rectlabel-support

RectLabel is an offline image annotation tool for object detection and segmentation.
https://rectlabel.com
515 stars 73 forks source link

COCO JSON- import custom attributes #231

Closed alelordelo closed 1 year ago

alelordelo commented 1 year ago

Hi Ryo,

How can I import custom attributes from COCO JSON?

"image_id": 11342, "category_id": 20, "area": 3000 * 4000, "bbox": [0, 0, 3000, 4000],
"iscrowd": 0, "color": "black" # new attribute

I have a very large dataset, and manually updating attributes on RectLabel is not viable.

Is there a way to do it?

I thought of running a python script to update the rectLabel XML files (from my COCO JSON), but the created attributes fields on RectLabel are not there
alelordelo commented 1 year ago

Still cannot import any custom attributes from COCO JSON... Maybe with LabelMe JSON is possible?

ryouchinsa commented 1 year ago

You can create a color attribute and combine with object names. https://rectlabel.com/settings#attributes

スクリーンショット 2023-06-28 19 20 40

スクリーンショット 2023-06-28 19 20 45

This is an example of the COCO JSON file. Please import from App menu -> Import settings file.

{
    "annotations": [
    {
        "area": 696080,
        "attributes":
        {
            "color": ["black"]
        },
        "bbox": [612, 2296, 904, 770],
        "category_id": 1,
        "id": 1,
        "image_id": 1,
        "iscrowd": 0,
        "segmentation": []
    },
    {
        "area": 259632,
        "bbox": [742, 276, 601, 432],
        "category_id": 2,
        "id": 2,
        "image_id": 1,
        "iscrowd": 0,
        "segmentation": []
    },
    {
        "area": 40092,
        "bbox": [1131, 560, 156, 257],
        "category_id": 3,
        "id": 3,
        "image_id": 1,
        "iscrowd": 0,
        "segmentation": []
    },
    {
        "area": 1913805,
        "attributes":
        {
            "color": ["black"]
        },
        "bbox": [518, 748, 1065, 1797],
        "category_id": 4,
        "id": 4,
        "image_id": 1,
        "iscrowd": 0,
        "segmentation": []
    }],
    "attributes": [
    {
        "items": ["black", "blue", "brown", "burgundy", "gold", "gray", "green", "neutrals", "orange", "pink", "purple", "red", "silver", "white", "yellow"],
        "name": "color",
        "prefix": "",
        "type": "Multiple select"
    }],
    "categories": [
    {
        "attributes": ["color"],
        "id": 1,
        "name": "bottom"
    },
    {
        "id": 2,
        "name": "hair"
    },
    {
        "id": 3,
        "name": "face"
    },
    {
        "attributes": ["color"],
        "id": 4,
        "name": "jacket"
    },
    {
        "id": 5,
        "name": "background"
    }],
    "images": [
    {
        "file_name": "6.jpg",
        "height": 3072,
        "id": 1,
        "width": 2048
    }]
}
alelordelo commented 1 year ago

Thanks Ryo!

Multiple select works now.

But Text input is not working…

Is the structure bellow correct?

{ "name": "camera orientation", "type": "Multiple select", "items": ["back view", "frontal view", "left view", "right view"] }, { "name": "photo style", "type": "Multiple select", "items": ["photograph", "portrait"] }, { "name": "gender", "type": "Multiple select", "items": ["woman", "men"] }, { "name": "shot prompt", "type": "Text input", "input": "default" # new initial value }

On 28 Jun 2023, at 12:27, Ryo Kawamura @.***> wrote:

You can create a color attribute and combine with object names. https://rectlabel.com/settings#attributes

This is an example of the COCO JSON file. Please import from App menu -> Import settings file.

{ "annotations": [ { "area": 696080, "attributes": { "color": ["black"] }, "bbox": [612, 2296, 904, 770], "category_id": 1, "id": 1, "image_id": 1, "iscrowd": 0, "segmentation": [] }, { "area": 259632, "bbox": [742, 276, 601, 432], "category_id": 2, "id": 2, "image_id": 1, "iscrowd": 0, "segmentation": [] }, { "area": 40092, "bbox": [1131, 560, 156, 257], "category_id": 3, "id": 3, "image_id": 1, "iscrowd": 0, "segmentation": [] }, { "area": 1913805, "attributes": { "color": ["black"] }, "bbox": [518, 748, 1065, 1797], "category_id": 4, "id": 4, "image_id": 1, "iscrowd": 0, "segmentation": [] }], "attributes": [ { "items": ["black", "blue", "brown", "burgundy", "gold", "gray", "green", "neutrals", "orange", "pink", "purple", "red", "silver", "white", "yellow"], "name": "color", "prefix": "", "type": "Multiple select" }], "categories": [ { "attributes": ["color"], "id": 1, "name": "bottom" }, { "id": 2, "name": "hair" }, { "id": 3, "name": "face" }, { "attributes": ["color"], "id": 4, "name": "jacket" }, { "id": 5, "name": "background" }], "images": [ { "file_name": "6.jpg", "height": 3072, "id": 1, "width": 2048 }] } — Reply to this email directly, view it on GitHub https://github.com/ryouchinsa/Rectlabel-support/issues/231#issuecomment-1611157194, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEHDNTZ333YXEQXSP72EHSDXNQBJJANCNFSM6AAAAAAZV5AMEY. You are receiving this because you authored the thread.

ryouchinsa commented 1 year ago

Thanks for your feedback. For the text input, at this moment, there is not the default text setting. The default text is empty. Please let us know your opinion.

The attribute types are "Single select", "Multiple select", and "Text input". https://rectlabel.com/settings#attributes

We think for the gender, you can use the "Single select".

{
    "annotations": [
    {
        "area": 696080,
        "attributes":
        {
            "color": ["black"],
            "shot prompt": "default"
        },
        "bbox": [612, 2296, 904, 770],
        "category_id": 1,
        "id": 1,
        "image_id": 1,
        "iscrowd": 0,
        "segmentation": []
    },
    {
        "area": 259632,
        "bbox": [742, 276, 601, 432],
        "category_id": 2,
        "id": 2,
        "image_id": 1,
        "iscrowd": 0,
        "segmentation": []
    },
    {
        "area": 40092,
        "bbox": [1131, 560, 156, 257],
        "category_id": 3,
        "id": 3,
        "image_id": 1,
        "iscrowd": 0,
        "segmentation": []
    },
    {
        "area": 1913805,
        "attributes":
        {
            "color": ["black"]
        },
        "bbox": [518, 748, 1065, 1797],
        "category_id": 4,
        "id": 4,
        "image_id": 1,
        "iscrowd": 0,
        "segmentation": []
    }],
    "attributes": [
    {
        "items": ["black", "blue", "brown", "burgundy", "gold", "gray", "green", "neutrals", "orange", "pink", "purple", "red", "silver", "white", "yellow"],
        "name": "color",
        "prefix": "",
        "type": "Multiple select"
    },
    {
        "items": ["item1", "item2"],
        "name": "shot prompt",
        "prefix": "",
        "type": "Text input"
    }],
    "categories": [
    {
        "attributes": ["color", "shot prompt"],
        "id": 1,
        "name": "bottom"
    },
    {
        "id": 2,
        "name": "hair"
    },
    {
        "id": 3,
        "name": "face"
    },
    {
        "attributes": ["color", "shot prompt"],
        "id": 4,
        "name": "jacket"
    },
    {
        "id": 5,
        "name": "background"
    }],
    "images": [
    {
        "file_name": "6.jpg",
        "height": 3072,
        "id": 1,
        "width": 2048
    }]
}
ryouchinsa commented 1 year ago

Currently If you need our support to fix this problem, please let us know.