RozDavid / LanguageGroundedSemseg

Implementation for ECCV 2022 paper Language-Grounded Indoor 3D Semantic Segmentation in the Wild
98 stars 14 forks source link

Mapping CLASS_IDS to CLASS_NAME #25

Closed alexsax closed 9 months ago

alexsax commented 11 months ago

Hi @RozDavid and thanks for both the useful work and the continued support :)

I'm wondering what is the correct mapping of CLASS_IDS to CLASS_NAMES in scannet_constants.py. This affects the correct subset of classes for each split 20/100/200, etc.

First off, what should CLASS_IDS contain? VALID_CLASS_IDS_20 contains an entry '12', which seems like it's an NYU category rather than one of the raw IDs inscannetv2-labels.combined.tsv, however CLASS_IDs for other sized subsets include IDs > 40, so can't be from NYU.

I'm assuming that the mapping should be something like dict(zip(CLASS_IDS, CLASS_NAMES)), but of course this doesn't work since the order of CLASS_NAMES varies between the different subsets. For example, VALID_CLASS_IDS_20 this maps 3 -> cabinet, while for VALID_CLASS_IDS_LONG this maps 7 -> cabinet.

Could you advise on how to create such a mapping for each subset? (e.g. with an example of how to use map_to_orig_labels)

Thanks :)

RozDavid commented 11 months ago

Hey @alexsax,

First of all, thanks for reaching out with your question and also thanks for your appreciation. So this is a really good question tbh, I should have detailed it much better - but as this project was focusing only on the 200 scenario I forgot about mentioning the details in the standard benchmark case.

So when you check the scannetv2-labels.combined.tsv file there are two rows we use, one is the id which is a raw, unfiltered category id and the nyu40id whihc is an aggregated version mapping to the NYU40 categories.

For the standard ScanNet benchmark the categories are a 20 category subset of these NYU40 labels and keeping their IDs. These numbers are associated with the VALID_CLASS_IDS_20 and ordered accordingly as class labels at CLASS_LABELS_20.

For every other label ids and class names including both VALID_CLASSIDS[200/LONG] we use the raw category ids and their raw_category names. This mapping is happening in the preprocessing script, here. So for this case the id to label mapping could be either done by iterating over the zipped VALID_CLASSIDS and CLASSLABELS, or alternatively loading the label mapping table and looking up the raw category name for every corresponding category id.

Let me know if you have any more questions, and I hope I could help.

Cheers, David

P.s. The map_to_orig_labels function is not used currently for this project, just a legacy util function, where we ran a couple experiments for a hierarchical semantic representation.

alexsax commented 9 months ago

Thank you @RozDavid! This helps -- sorry for the late reply and I think we can close the issue