Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Instance Train ID Images #184

Open
collinmccarthy opened this issue Apr 22, 2024 · 1 comment
Open

[BUG]: Instance Train ID Images #184

collinmccarthy opened this issue Apr 22, 2024 · 1 comment

Comments

@collinmccarthy
Copy link

collinmccarthy commented Apr 22, 2024

I'll keep this brief. Based on the semantics of json2labelImg.py, the json2instanceImg.py has a typo which will lead to labeling "caravan" and "trailer" as instance classes instead of void, when using "trainIds" encoding, for some images.

In https://github.com/mcordts/cityscapesScripts/blob/master/cityscapesscripts/preparation/json2instanceImg.py#L141-L143:

if labelTuple.hasInstances and not isGroup and id != 255:
    id = id * 1000 + nbInstances[label]
    nbInstances[label] += 1

should be as follows, were we use labelTuple.trainId instead of id when comparing to 255.

if labelTuple.hasInstances and not isGroup and labelTuple.trainId != 255:
    id = id * 1000 + nbInstances[label]
    nbInstances[label] += 1

If someone doesn't want to fix the code, one "solution" would be to just not use train IDs, but use original label IDs which don't have this issue, and then use the mapping in cityscapesscripts when loading in the data. Also I'm not entirely sure this matters if one is ignoring these classes when loading in the data. But depending on how the data is used, it could lead to issues.

@collinmccarthy
Copy link
Author

collinmccarthy commented Apr 23, 2024

I spent some more time on this and determined this script to generate trainId images is not pixel-level accurate either, as described in #136. I instead wrote my own script to input the _instanceIds.png images and directly create _instanceTrainIds.png images using numpy and the label mappings in helpers/label.py.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant