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

Add in-place functions to coords-based augmentables #532

Merged
merged 2 commits into from Jan 2, 2020
Merged

Conversation

aleju
Copy link
Owner

@aleju aleju commented Dec 21, 2019

This patch adds in-place versions of existing functions to coordinate-based augmentable classes,
i.e. keypoints, BBs, LineStrings and Polygons (both single instances and *OnImage containers).
The in-place functions should improve performance during augmentation by re-instantiating objects less often.

The should decrease a bit the performance problems mentioned in #426, though probably not by too much.

@aleju aleju force-pushed the inplace_funcs branch 3 times, most recently from 5145c67 to 91a0c56 Compare December 21, 2019 16:16
@codecov-io
Copy link

codecov-io commented Dec 21, 2019

Codecov Report

Merging #532 into master will increase coverage by 0.04%.
The diff coverage is 99.6%.

@@            Coverage Diff             @@
##           master     #532      +/-   ##
==========================================
+ Coverage   96.34%   96.38%   +0.04%     
==========================================
  Files          37       37              
  Lines       13366    13494     +128     
==========================================
+ Hits        12877    13006     +129     
+ Misses        489      488       -1

This patch adds in-place versions of existing
functions to coordinate-based augmentable classes,
i.e. keypoints, BBs, LineStrings and Polygons (both
single instances and *OnImage containers).
The in-place functions should improve performance
during augmentation by re-instantiating objects
less often.

Changes:
+ Add augmentables.utils.project_coords_()
+ Add setter for KeypointsOnImage.items
+ Add setter for BoundingBoxesOnImage.items
+ Add setter for LineStringsOnImage.items
+ Add setter for PolygonsOnImage.items
+ Add Keypoint.project_()
+ Add Keypoint.shift_()
+ Add KeypointsOnImage.on_()
+ Add KeypointsOnImage.remove_out_of_image_fraction_()
+ Add KeypointsOnImage.clip_out_of_image_fraction_()
+ Add KeypointsOnImage.shift_()
+ Add BoundingBox.project_()
+ Add BoundingBox.extend_()
+ Add BoundingBox.clip_out_of_image_()
+ Add BoundingBox.shift_()
+ Add BoundingBoxesOnImage.on_()
+ Add BoundingBoxesOnImage.clip_out_of_image_()
+ Add BoundingBoxesOnImage.remove_out_of_image_()
+ Add BoundingBoxesOnImage.remove_out_of_image_fraction_()
+ Add BoundingBoxesOnImage.shift_()
+ Add LineString.project_()
+ Add LineString.shift_()
+ Add LineStringsOnImage.on_()
+ Add LineStringsOnImage.remove_out_of_image_()
+ Add LineStringsOnImage.remove_out_of_image_fraction_()
+ Add LineStringsOnImage.clip_out_of_image_()
+ Add LineStringsOnImage.shift_()
+ Add Polygon.project_()
+ Add Polygon.shift_()
+ Add PolygonsOnImage.remove_out_of_image_()
+ Add PolygonsOnImage.remove_out_of_image_fraction_()
+ Add PolygonsOnImage.clip_out_of_image_()
+ Add PolygonsOnImage.shift_()
+ Add PolygonsOnImage.on_()
+ Add Polygon.subdivide_()
+ Add PolygonsOnImage.subdivide_()
+ Switch CBAOI augmentation to in-place calls
+ Switch BoundingBoxesOnImage.copy() to custom copy op
+ Switch KeypointsOnImage.copy() to custom copy op
+ Add bounding_boxes and shape args to BBSOI.copy()
+ Add bounding_boxes and shape args to BBSOI.deepcopy()
+ Add polygons and shape args to PSOI.copy()
+ Add polygons and shape args to PSOI.deepcopy()
@aleju aleju merged commit 1340df3 into master Jan 2, 2020
@aleju aleju deleted the inplace_funcs branch January 2, 2020 17:05
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.

None yet

2 participants