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

[Feature] Custom classes for Det3DDataset #3046

Open
mbspng opened this issue Oct 17, 2024 · 1 comment
Open

[Feature] Custom classes for Det3DDataset #3046

mbspng opened this issue Oct 17, 2024 · 1 comment

Comments

@mbspng
Copy link

mbspng commented Oct 17, 2024

What is the feature?

Look at the code here:

# we allow to train on subset of self.METAINFO['classes']

It says

        if metainfo is not None and 'classes' in metainfo:
            # we allow to train on subset of self.METAINFO['classes']
            # map unselected labels to -1
            self.label_mapping = {
                i: -1
                for i in range(len(self.METAINFO['classes']))
            }
            self.label_mapping[-1] = -1
            for label_idx, name in enumerate(metainfo['classes']):
                ori_label = self.METAINFO['classes'].index(name)
                self.label_mapping[ori_label] = label_idx

That is pretty ridiculous. It took me forever to realize this hard-coded nonsense was preventing my dataset from working, due to labels specific to my use-case. Why is this hard-coded? I am not finding any way to use a dataset with labels other than the original. Of course, I could map my labels to the labels of the original dataset. That would be silly though and, even worse, if I have more classes than the original dataset I am out of luck again!

How is anybody supposed to use this for their own use-case? It is useless if it hard-coded for the original dataset!

Any other context?

No response

@mbspng
Copy link
Author

mbspng commented Oct 17, 2024

Solution: You have to copy-paste the derived dataset (e.g. SUNRGBDDataset from mmdet3d.datasets.sunrgbd_datasets), give it a new name and make sure to use the @DATASETS.register_module() decorator and modify the set of classes in the copy-pasted version. Then you have to edit your training config to override the old dataset class with your new dataset class.

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