-
Notifications
You must be signed in to change notification settings - Fork 49
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] Support CocoPanoptic Metric #106
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: RangiLyu <lyuchqi@gmail.com>
thing_classes = self.dataset_meta['thing_classes'] | ||
elif self.dataset_meta and 'THING_CLASSES' in self.dataset_meta: | ||
thing_classes = self.dataset_meta['THING_CLASSES'] | ||
warnings.warn( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will raise a warning whenever you call it.
@property | ||
def thing_classes(self) -> tuple: | ||
"""Get thing classes from self.dataset_meta.""" | ||
if self.dataset_meta and 'thing_classes' in self.dataset_meta: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add comments we will Deprecate in v1.0.0
if self.dataset_meta and 'thing_classes' in self.dataset_meta: | ||
thing_classes = self.dataset_meta['thing_classes'] | ||
elif self.dataset_meta and 'THING_CLASSES' in self.dataset_meta: | ||
thing_classes = self.dataset_meta['THING_CLASSES'] | ||
warnings.warn( | ||
'DeprecationWarning: The `THING_CLASSES` in `dataset_meta` ' | ||
'is deprecated, use `thing_classes` instead!') | ||
else: | ||
raise RuntimeError('Could not find `thing_classes` in ' | ||
f'dataset_meta: {self.dataset_meta}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if self.dataset_meta and 'thing_classes' in self.dataset_meta: | |
thing_classes = self.dataset_meta['thing_classes'] | |
elif self.dataset_meta and 'THING_CLASSES' in self.dataset_meta: | |
thing_classes = self.dataset_meta['THING_CLASSES'] | |
warnings.warn( | |
'DeprecationWarning: The `THING_CLASSES` in `dataset_meta` ' | |
'is deprecated, use `thing_classes` instead!') | |
else: | |
raise RuntimeError('Could not find `thing_classes` in ' | |
f'dataset_meta: {self.dataset_meta}') | |
if hasattr(self, '_thing_classes'): | |
return self._thing_classes | |
else: | |
if self.dataset_meta and 'thing_classes' in self.dataset_meta: | |
thing_classes = self.dataset_meta['thing_classes'] | |
elif self.dataset_meta and 'THING_CLASSES' in self.dataset_meta: | |
thing_classes = self.dataset_meta['THING_CLASSES'] | |
warnings.warn( | |
'DeprecationWarning: The `THING_CLASSES` in `dataset_meta` ' | |
'is deprecated, use `thing_classes` instead!') | |
else: | |
raise RuntimeError('Could not find `thing_classes` in ' | |
f'dataset_meta: {self.dataset_meta}') | |
self._thing_classes = thing_classes | |
return thing_classes | |
Related PR: open-mmlab/mmdetection#9863
Thanks to the previous work of @Even-ok, I optimized it on the basis of #69
TODO:
Before:
After: