-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Accounting for class_id in cityscapes dataset #1064
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
Comments
For now, I'd recommend adding a Before merging something like the PR you mentioned, we need to have a more structured way of addressing this. |
also cc @TheCodez , as you have sent the original PRs |
I would also recommend using a transform even when having some helper methods available. |
Seconding @TheCodez approach. I've been doing something similar-ish (but keeping the ID logic within the transform) - also using dual transforms logic. class ConvertCityscapesIds(object):
"""Converts Cityscape masks - adds an ignore index"""
def __init__(self, ignore_index):
self.ignore_index = ignore_index
self.id_to_trainid = {-1: ignore_index, 0: ignore_index, 1: ignore_index, 2: ignore_index, 3: ignore_index,
4: ignore_index, 5: ignore_index, 6: ignore_index, 7: 0, 8: 1, 9: ignore_index,
10: ignore_index, 11: 2, 12: 3, 13: 4, 14: ignore_index, 15: ignore_index, 16: ignore_index,
17: 5, 18: ignore_index, 19: 6, 20: 7, 21: 8, 22: 9, 23: 10, 24: 11, 25: 12, 26: 13, 27: 14,
28: 15, 29: ignore_index, 30: ignore_index, 31: 16, 32: 17, 33: 18}
def __call__(self, image, target):
target_copy = target.clone()
for k, v in self.id_to_trainid.items():
target_copy[target == k] = v
return image, target_copy |
Yes, the way @RJT1990 is how I do it myself as well. @prabhuteja12 by structured way, I meant a similar comment as in #1067 (comment) |
Uh oh!
There was an error while loading. Please reload this page.
Hi,
In the dataset class for
Cityscapes
, the classes with their meta-data is mentioned as a namedtuple. However, this information is not used anywhere. Especially for semantic segmenation, the train_id should be used to convert the pixel value (of the label image) to the training label.Is this planned to be added anytime soon?
Edit: There seems to have been a commit that does something like this and that hasn't been merged.
39a7a2f
The text was updated successfully, but these errors were encountered: