-
Notifications
You must be signed in to change notification settings - Fork 129
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
Import for ADE20K dataset #400
Conversation
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.
Could you check if the imported dataset can be converted into some other format? Pascal VOC or other.
|
||
if Ade20k2020Path.MASK_IMAGE_PATTERN.search(item_id): |
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.
Probably, only the basename should be checked. Also, consider using re.fullmatch
to match the whole name.
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.
Okay, I will change the item_id to the basename, but I don't think that we should use re.,fullmatch
here, because we don't know full name for instance mask (that should be skipped). We only recognize it after parsing the annotation file.
I checked converting with VOC, COCO and KITTI formats. Conversion to COCO failed, but I think it's no related with this PR, the problem occurs here: datumaro/datumaro/plugins/coco_format/converter.py Lines 232 to 234 in 935fb0e
|
MASK_PATTERN = re.compile(r'''\w+_seg\.\w+ | ||
| \w+_parts_\d+\.\w+ | ||
| instance_\w+\.\w+ | ||
''', re.VERBOSE) |
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.
Isn't \w+
too restrictive? It won't accept digits and special characters like - and _.
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.
Okay, I'll add -
and spaces, regarding digits and underscores In the docs says that \w
accepts them.
Yes, looks like a bug in COCO. Can you fix it? |
Yes, I'll fix it in new PR. |
MASK_PATTERN = re.compile(r'''[\w|\s|-]+_seg\.\w+ | ||
| [\w|\s|-]+_parts_\d+\.\w+ | ||
''', re.VERBOSE) |
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.
MASK_PATTERN = re.compile(r'''[\w|\s|-]+_seg\.\w+ | |
| [\w|\s|-]+_parts_\d+\.\w+ | |
''', re.VERBOSE) | |
MASK_PATTERN = re.compile(r''' | |
.+_seg | |
| .+_parts_\d+ | |
''', re.VERBOSE) |
MASK_PATTERN = re.compile(r'''[\w|\s|-]+_seg\.\w+ | ||
| [\w|\s|-]+_parts_\d+\.\w+ | ||
| instance_[\w|\s|-]+\.\w+ |
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.
MASK_PATTERN = re.compile(r'''[\w|\s|-]+_seg\.\w+ | |
| [\w|\s|-]+_parts_\d+\.\w+ | |
| instance_[\w|\s|-]+\.\w+ | |
MASK_PATTERN = re.compile(r'''.+_seg | |
| .+_parts_\d+ | |
| instance_.+ |
for image_path in sorted(images): | ||
item_id = osp.splitext(osp.relpath(image_path, path))[0] | ||
|
||
if Ade20k2020Path.MASK_PATTERN.fullmatch(osp.basename(image_path)): |
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 Ade20k2020Path.MASK_PATTERN.fullmatch(osp.basename(image_path)): | |
if Ade20k2020Path.MASK_PATTERN.fullmatch(osp.basename(image_id)): |
for image_path in sorted(images): | ||
item_id = osp.splitext(osp.relpath(image_path, path))[0] | ||
|
||
if Ade20k2017Path.MASK_PATTERN.fullmatch(osp.basename(image_path)): |
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 Ade20k2017Path.MASK_PATTERN.fullmatch(osp.basename(image_path)): | |
if Ade20k2017Path.MASK_PATTERN.fullmatch(osp.basename(image_id)): |
Summary
Resolved #399.
How to test
Checklist
develop
branchLicense
Feel free to contact the maintainers if that's a concern.