open-mmlab / labelbee-client

Out-of-the-box Annotation Toolbox
Apache License 2.0
382 stars 51 forks source link

Bug: While importing the annotation class ID is wrong #30

Closed waqarsqureshi closed 2 years ago

waqarsqureshi commented 2 years ago

When we use import to mask. The mask image is saved with the wrong IDs it starts from 1,2,3,4, irrespective the value set by the person in the properties

0 is set to no attribute by default.

Kerwin-L commented 2 years ago

Sorry do you mean the trainIDs? xxx-color-list.json is a mapping of attributes to color and grayscale value, in which the trainIDs is the grayscale value. Grayscale value starts from 1, and the value 0 means the background

waqarsqureshi commented 2 years ago

Another issue is the TrainIDs are saved as color images i.e. and not as a 8bit unsign Int image.

waqarsqureshi commented 2 years ago

There is an option of Attribute, where you can select the key and value of your choice. I selected road=0 and background as 1. However it still used its own value i.e. 0 to background and then so on.

waqarsqureshi commented 2 years ago

image I attended to use labels as above. However, in the jason while it is as below: [ { "attribute": "2", "color": "rgb(128,0,0)", "colorList": [ 128, 0, 0, 255 ], "trainIds": 1 }, { "attribute": "0", "color": "rgb(0,128,0)", "colorList": [ 0, 128, 0, 255 ], "trainIds": 2 }, { "attribute": "3", "color": "rgb(128,128,0)", "colorList": [ 128, 128, 0, 255 ], "trainIds": 3 }, { "attribute": "1", "color": "rgb(0,0,128)", "colorList": [ 0, 0, 128, 255 ], "trainIds": 4 } ] It did not follow either of the sequence given in the attribute but rather made its own TrainIds.

Kerwin-L commented 2 years ago

Another issue is the TrainIDs are saved as color images i.e. and not as a 8bit unsign Int image.

Yes, js can't export 8bit unsign Int image, so I provided the python script to solve this problem

image
Kerwin-L commented 2 years ago

image I attended to use labels as above. However, in the jason while it is as below: [ { "attribute": "2", "color": "rgb(128,0,0)", "colorList": [ 128, 0, 0, 255 ], "trainIds": 1 }, { "attribute": "0", "color": "rgb(0,128,0)", "colorList": [ 0, 128, 0, 255 ], "trainIds": 2 }, { "attribute": "3", "color": "rgb(128,128,0)", "colorList": [ 128, 128, 0, 255 ], "trainIds": 3 }, { "attribute": "1", "color": "rgb(0,0,128)", "colorList": [ 0, 0, 128, 255 ], "trainIds": 4 } ] It did not follow either of the sequence given in the attribute but rather made its own TrainIds.

The sequence of the json follows the sequence of results. This approach does make the configuration random, i will update it later, thanks for comments.

You can now determine the current tranid by the attribute. For example, You now want road, whose value you configured as 0, to get through the configuration file [ { "attribute": "0", "color": "rgb(0,128,0)", "colorList": [ 0, 128, 0, 255 ], "trainIds": 2 } ], its trainIDs (grayscale) is 2.

waqarsqureshi commented 2 years ago

Thanks. I figured it out by opening the image in MATLAB. I think I can just pass them through a python script to changes I desired. As I have other data and want to keep class Ids the same in all the sets. Otherwise, I would create a mess. I will appreciate it if you can update the code. Thank you for clarification.