abreheret / PixelAnnotationTool

Annotate quickly images.
GNU Lesser General Public License v3.0
1.41k stars 307 forks source link

Logic behind mask id #70

Closed Zartris closed 3 years ago

Zartris commented 3 years ago

So I wanted to make a script that converts my already trained model to give the input for the PixelAnnotationTool (So generate x_mask.png, x_color_mask.png). This will enable me to just correct the labels instead of creating them from scratch.

But these mask id's inside x_mask.png seem a little random to me. They are consistent between images and I think it has something to do with the config file, but I would love to reproduce this logic inside my script.

My script is as follows:

  1. Inference the images
  2. convert the model classes to a config file (matching colors with class).
  3. ??? (without the logic to convert colors or class-name into id, we are stuck here)

Thanks

Zartris commented 3 years ago

I need to learn reading the config file... It says freaking ID!

BestVanRome commented 3 years ago

Hi @Zartris, I'm stuck at the same point. Can you explain it with more detail: What is the difference between the "id" and the "color" mask, I still don't get it? And which config-file do you mean?

Zartris commented 3 years ago

Either you have to make your own config file or retrieve the id's from the existing. Go under (tool > save config file) and find a place to save the default config file. Mine looks something like:

{
    "labels": {
        "bicycle": {
            "categorie": "vehicle",
            "color": [
                119,
                11,
                32
            ],
            "id": 33,
            "id_categorie": 7,
            "name": "bicycle"
        },
        "bridge": {
            "categorie": "construction",
            "color": [
                150,
                100,
                100
            ],
            "id": 15,
            "id_categorie": 2,
            "name": "bridge"
        },
....
}

Here you can see the ID's are specified for each class.