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

Lazy Masks / Detections2D #979

Merged
merged 20 commits into from
Apr 21, 2022
Merged

Lazy Masks / Detections2D #979

merged 20 commits into from
Apr 21, 2022

Conversation

ekolve
Copy link

@ekolve ekolve commented Feb 8, 2022

Currently, when using instance segmentation (ai2thor.controller.Controller(renderInstanceSegmentation=True)) instance masks, class masks and 2D detections are generated for every object in the image. This process is quite costly and end-users don't often use every single bounding-box or mask that is generated. This PR introduces lazily generated masks and 2D detections. In the absolute best case, users will get a 4x speed improvement (this means that no masks or 2D detections are generated, but the instance segmentation frame is sent from Unity to Python). In the worst case (we generate all the bounding boxes and masks) users should see a 2x improvement over the current implementation. This speed improvement is largely due to the elimination of the use of np.unique and np.tile in favor of a zero-copy based approach. The relevant properties on Event are: instance_masks, class_masks, instance_detections_2D, and class_detections_2D. All these properties now point to a class that implements the Mapping interface, but the behavior should be identical to the current scheme (i.e. if a key doesn't exist in the lazy-map a KeyError will get thrown). My plan is to merge this in post-ECCV.

@ekolve ekolve requested review from AlvaroHG and mattdeitke February 8, 2022 23:45
@lgtm-com
Copy link

lgtm-com bot commented Feb 9, 2022

This pull request introduces 1 alert when merging 4da7e68 into 1d35fba - view on LGTM.com

new alerts:

  • 1 for `__eq__` not overridden when adding attributes

@lgtm-com
Copy link

lgtm-com bot commented Apr 5, 2022

This pull request introduces 1 alert when merging c68795e into f9fb7fa - view on LGTM.com

new alerts:

  • 1 for Syntax error

@lgtm-com
Copy link

lgtm-com bot commented Apr 5, 2022

This pull request introduces 1 alert when merging 84d4f16 into f9fb7fa - view on LGTM.com

new alerts:

  • 1 for `__eq__` not overridden when adding attributes

@lgtm-com
Copy link

lgtm-com bot commented Apr 12, 2022

This pull request introduces 1 alert when merging 1dacd77 into ea60106 - view on LGTM.com

new alerts:

  • 1 for `__eq__` not overridden when adding attributes

@lgtm-com
Copy link

lgtm-com bot commented Apr 13, 2022

This pull request introduces 1 alert when merging f518057 into dc0f9ec - view on LGTM.com

new alerts:

  • 1 for `__eq__` not overridden when adding attributes

@lgtm-com
Copy link

lgtm-com bot commented Apr 14, 2022

This pull request introduces 1 alert when merging 27ac088 into dc0f9ec - view on LGTM.com

new alerts:

  • 1 for `__eq__` not overridden when adding attributes

Copy link
Contributor

@Lucaweihs Lucaweihs left a comment

Choose a reason for hiding this comment

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

Looks nice! A couple of minor comments here and there, it would be great to have a bit of documentation about the inputs/outputs for some of the more important, user facing, functions.

@lgtm-com
Copy link

lgtm-com bot commented Apr 21, 2022

This pull request introduces 2 alerts when merging a262b25 into 86e58cb - view on LGTM.com

new alerts:

  • 1 for `__eq__` not overridden when adding attributes
  • 1 for Unused import

Copy link
Contributor

@Lucaweihs Lucaweihs left a comment

Choose a reason for hiding this comment

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

LGTM, having the type hints is very nice :)!

@ekolve ekolve merged commit 49e4343 into main Apr 21, 2022
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

Successfully merging this pull request may close these issues.

2 participants