-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Support of context images for 2D tasks #3122
Conversation
Sure. I created the corresponding task. |
utils/dataset_manifest/utils.py
Outdated
related_images = {} | ||
latest_dirname = '' | ||
related_images_exist = False | ||
|
||
for image_path in sorted(image_paths): | ||
rel_image_path = os.path.relpath(image_path, root_path) | ||
dirname = os.path.dirname(image_path) | ||
related_images_dirname = os.path.join(dirname, 'related_images') | ||
related_images[rel_image_path] = [] | ||
|
||
if latest_dirname == dirname and not related_images_exist: | ||
continue | ||
elif latest_dirname != dirname: | ||
# Update some data applicable for a subset of paths (within the current dirname) | ||
latest_dirname = dirname | ||
related_images_exist = os.path.isdir(related_images_dirname) | ||
|
||
if related_images_exist: | ||
related_images_dirname = os.path.join( | ||
related_images_dirname, '_'.join(os.path.basename(image_path).rsplit('.', 1)) | ||
) | ||
|
||
if os.path.isdir(related_images_dirname): | ||
related_images[rel_image_path] = _prepare_context_list(_list_and_join(related_images_dirname), root_path) | ||
return related_images |
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.
This is updated implementation for 2D. We do not find context images for images where parent directory does not include "related_images". Something like this (and some other optimizations) work for 3D case.
for image_path in image_paths: | ||
# .bin files are expected to be converted to .pcd before this code | ||
if os.path.splitext(image_path)[1].lower() == '.pcd': |
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.
@bsekachev , from my perspective it is better to have an explicit flag. But let's live with the solution.
@bsekachev , please check if images are in a subdirectory inside an archive, the PR works. |
@bsekachev , if |
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.
LGTM
Motivation and context
Resolved #3049
Expected structure is like this (example):
You can upload this structure using an archive or from an attached shared storage.
Working gif:
Need documentation. @TOsmanov, could you please take a look after the PR will be merged?
Need tests. @dvkruchinin , could you please take a look after the PR will be merged?
How has this been tested?
Manual testing
Checklist
develop
branchcvat-core, cvat-data and cvat-ui)
License
Feel free to contact the maintainers if that's a concern.