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

Support of context images for 2D tasks #3122

Merged
merged 52 commits into from
May 19, 2021
Merged

Support of context images for 2D tasks #3122

merged 52 commits into from
May 19, 2021

Conversation

bsekachev
Copy link
Member

@bsekachev bsekachev commented Apr 22, 2021

Motivation and context

Resolved #3049

  • Added meta to manifest (updated version, set to 1.1)
  • Added support of context images for images annotation tasks
  • Redesigned context image for 3D a bit (UI part)

Expected structure is like this (example):

  • root_directory
    • image_1_to_be_annotated.jpg
    • image_2_to_be_annotated.jpg
    • related_images/
      • image_1_to_be_annotated_jpg/
        • context_image_for_image_1.jpg
      • image_2_to_be_annotated_jpg/
        • context_image_for_image_2.jpg
    • subdirectory_example/
      • image_3_to_be_annotated.jpg
      • related_images/
        • image_3_to_be_annotated_jpg/
          • context_image_for_image_3.jpg

You can upload this structure using an archive or from an attached shared storage.

Working gif:

Peek 2021-04-22 18-54 (1)

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

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.
  • I have updated the license header for each file (see an example below)
# Copyright (C) 2021 Intel Corporation
#
# SPDX-License-Identifier: MIT

@dvkruchinin
Copy link
Contributor

Need tests. @dvkruchinin , could you please take a look after the PR will be merged?

Sure. I created the corresponding task.

@coveralls
Copy link

coveralls commented Apr 22, 2021

Coverage Status

Coverage increased (+0.2%) to 74.259% when pulling e3ac571 on bs/context_image_2d into 2a9a1e9 on develop.

@bsekachev bsekachev changed the title [WIP] Support of context images for 2D tasks Support of context images for 2D tasks Apr 23, 2021
@bsekachev bsekachev changed the title Support of context images for 2D tasks [WIP] Support of context images for 2D tasks May 14, 2021
@bsekachev bsekachev changed the title [WIP] Support of context images for 2D tasks Support of context images for 2D tasks May 14, 2021
Comment on lines 55 to 80
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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nmanovic

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':
Copy link
Contributor

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.

nmanovic
nmanovic previously approved these changes May 18, 2021
@nmanovic
Copy link
Contributor

@bsekachev , please check if images are in a subdirectory inside an archive, the PR works.

@nmanovic
Copy link
Contributor

@bsekachev , if related_images in the / directory, the filter works incorrectly as well. You will have extra images in the task.

Copy link
Contributor

@nmanovic nmanovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Context images as a hint for an image/frame
7 participants