ryouchinsa / Rectlabel-support

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

Import JSON with bonding box and segmentation masks #224

Closed alelordelo closed 12 months ago

alelordelo commented 1 year ago

Hi, amazing app, super intuitive and polished! : )

I have a dataset with JSON files with classes, bonding boxes and segmentation masks (one png file for each mask).

It it possible to import to RectLabel? Can I import the masks as pixels? Converting to geometry seems not to seamless...

thanks!

ryouchinsa commented 1 year ago

Thanks for writing the issue.

Which JSON format are you using? We will update RectLabel to import the JSON file and png mask images.

ryouchinsa commented 1 year ago

Improved so that you can drag & drop grayscale mask images to the labels table. The new version 2023.05.29 was released.

dragDropToLabelsTable

ryouchinsa commented 1 year ago

Improved so that you can drag & drop the COCO RLE JSON file of the SA-1B dataset to the labels table to import mask annotations. The new version 2023.05.31 was released.

Segment Anything 1 Billion (SA-1B) is a dataset designed for training general-purpose object segmentation models from open world images. https://github.com/facebookresearch/segment-anything

dragDropRLEJSONFilesXML

alelordelo commented 1 year ago

@ryouchinsa , great just tested now!

Is it possible to add annotations (like a longer text description) to masks? I only see an option to add a label....

alelordelo commented 1 year ago

Also.., when you import the JSON, doesn't it import the labels?

ryouchinsa commented 1 year ago

In general, a COCO JSON file includes all images and the annotations. So that Export menu -> Import COCO JSON file is used to import.

For dragging & dropping the COCO JSON file to the labels table, currently the COCO RLE JSON format is corresponded. This format does not include label names, just include the mask images. https://github.com/facebookresearch/segment-anything

{
    "image":
    {
        "image_id": 1,
        "width": 1500,
        "height": 2060,
        "file_name": "sa_1.jpg"
    },
    "annotations": [
    {
        "bbox": [866.0, 946.0, 132.0, 199.0],
        "area": 14773,
        "segmentation":
        {
            "size": [2060, 1500],
            "counts": "TS_f15SP27K3N2iTNHWf1:bYN0Yf12cYN1\\f11mWN7SNKni11PVNS2OmMPj15aUN\\2;aMSj1m3`UNVL_j1m4N1O1O1O10000O10O10O100000000O10000O100O1O100O101O000000000O10O101N1N2N2O1O100O100\\KhUNT3Wj1jLnUNS3Tj1kLoUNR3Rj1mLTVNW3ci1hL`VNW3_i1hLdVNV3\\i1iLfVNV3Zi1jLgVNU3Yi1jLiVNV3Vi1jLlVNT3Ti1kLnVNT3Ri1lLoVNS3Qi1lLQWNS3oh1mLRWNR3nh1nLSWNQ3mh1nLVWNP3jh1PMWWNo2ih1QMXWNl2jh1TMWWNg2mh1XMUWNV1gNlN_j1NkVNS1jNkN]j12jVNQ1lNiN\\j16jVNm0mNjN[j19iVNk0nNjNZj1;iVNh0QOkNVj1=jVNe0TOjNTj1a0jVN3EXObi1e0YYNVOjf1j0\\4001O00001O00001O00001O10O01O001O1O1O1O1O2N1O1O1O1O1O1O100O101N10000O00100O1O1O100O1O1O0000lNRRNGQn17S1O2N1O101M4Mom^o0"
        },
        "predicted_iou": 0.9523417353630066,
        "point_coords": [
            [940.9375, 1034.5625]
        ],
        "crop_box": [622.0, 902.0, 567.0, 707.0],
        "id": 523353737,
        "stability_score": 0.9742233753204346
    },
    ...
}
ryouchinsa commented 1 year ago

To add a long description, you can use a text attribute.

スクリーンショット 2023-06-27 16 56 33

スクリーンショット 2023-06-27 16 56 39

スクリーンショット 2023-06-27 16 58 26

スクリーンショット 2023-06-27 16 59 21

We need some ideas to brush up the design when you type the long text and how to show the long text on the labels table.

alelordelo commented 1 year ago

In general, a COCO JSON file includes all images and the annotations. So that Export menu -> Import COCO JSON file is used to import.

For dragging & dropping the COCO JSON file to the labels table, currently the COCO RLE JSON format is corresponded. This format does not include label names, just include the mask images. https://github.com/facebookresearch/segment-anything

{
    "image":
    {
        "image_id": 1,
        "width": 1500,
        "height": 2060,
        "file_name": "sa_1.jpg"
    },
    "annotations": [
    {
        "bbox": [866.0, 946.0, 132.0, 199.0],
        "area": 14773,
        "segmentation":
        {
            "size": [2060, 1500],
            "counts": "TS_f15SP27K3N2iTNHWf1:bYN0Yf12cYN1\\f11mWN7SNKni11PVNS2OmMPj15aUN\\2;aMSj1m3`UNVL_j1m4N1O1O1O10000O10O10O100000000O10000O100O1O100O101O000000000O10O101N1N2N2O1O100O100\\KhUNT3Wj1jLnUNS3Tj1kLoUNR3Rj1mLTVNW3ci1hL`VNW3_i1hLdVNV3\\i1iLfVNV3Zi1jLgVNU3Yi1jLiVNV3Vi1jLlVNT3Ti1kLnVNT3Ri1lLoVNS3Qi1lLQWNS3oh1mLRWNR3nh1nLSWNQ3mh1nLVWNP3jh1PMWWNo2ih1QMXWNl2jh1TMWWNg2mh1XMUWNV1gNlN_j1NkVNS1jNkN]j12jVNQ1lNiN\\j16jVNm0mNjN[j19iVNk0nNjNZj1;iVNh0QOkNVj1=jVNe0TOjNTj1a0jVN3EXObi1e0YYNVOjf1j0\\4001O00001O00001O00001O10O01O001O1O1O1O1O2N1O1O1O1O1O1O100O101N10000O00100O1O1O100O1O1O0000lNRRNGQn17S1O2N1O101M4Mom^o0"
        },
        "predicted_iou": 0.9523417353630066,
        "point_coords": [
            [940.9375, 1034.5625]
        ],
        "crop_box": [622.0, 902.0, 567.0, 707.0],
        "id": 523353737,
        "stability_score": 0.9742233753204346
    },
    ...
}

Thanks, so batch import is only available for COCO RLE, not COCO? I prefer to have separate files instead of a merged one. But guess the only way then is to merge everything?

ryouchinsa commented 1 year ago

We will improve the "Import COCO RLE JSON files" to import the usual COCO JSON files. Each JSON file name should be the same as image file name. image.jpg -> image.json, etc.

ryouchinsa commented 1 year ago

The new version 2023.07.05 was released. Please let us know your opinion.

ryouchinsa commented 12 months ago

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