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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
54 changes: 54 additions & 0 deletions changelogs/master/added/20191221_inplace_cba_methods.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Added in-place Methods for Coordinate-based Augmentables #532

* Added `Keypoint.project_()`.
* Added `Keypoint.shift_()`.
* Added `KeypointsOnImage.on_()`.
* Added setter for `KeypontsOnImage.items`.
* Added setter for `BoundingBoxesOnImage.items`.
* Added setter for `LineStringsOnImage.items`.
* Added setter for `PolygonsOnImage.items`.
* Added `KeypointsOnImage.remove_out_of_image_fraction_()`.
* Added `KeypointsOnImage.clip_out_of_image_fraction_()`.
* Added `KeypointsOnImage.shift_()`.
* Added `BoundingBox.project_()`.
* Added `BoundingBox.extend_()`.
* Added `BoundingBox.clip_out_of_image_()`.
* Added `BoundingBox.shift_()`.
* Added `BoundingBoxesOnImage.on_()`.
* Added `BoundingBoxesOnImage.clip_out_of_image_()`.
* Added `BoundingBoxesOnImage.remove_out_of_image_()`.
* Added `BoundingBoxesOnImage.remove_out_of_image_fraction_()`.
* Added `BoundingBoxesOnImage.shift_()`.
* Added `imgaug.augmentables.utils.project_coords_()`.
* Added `LineString.project_()`.
* Added `LineString.shift_()`.
* Added `LineStringsOnImage.on_()`.
* Added `LineStringsOnImage.remove_out_of_image_()`.
* Added `LineStringsOnImage.remove_out_of_image_fraction_()`.
* Added `LineStringsOnImage.clip_out_of_image_()`.
* Added `LineStringsOnImage.shift_()`.
* Added `Polygon.project_()`.
* Added `Polygon.shift_()`.
* Added `Polygon.on_()`.
* Added `Polygon.subdivide_()`.
* Added `PolygonsOnImage.remove_out_of_image_()`.
* Added `PolygonsOnImage.remove_out_of_image_fraction_()`.
* Added `PolygonsOnImage.clip_out_of_image_()`.
* Added `PolygonsOnImage.shift_()`.
* Added `PolygonsOnImage.subdivide_()`.
* Switched `BoundingBoxesOnImage.copy()` to a custom copy operation (away
from module `copy` module).
* Added parameters `bounding_boxes` and `shape` to
BoundingBoxesOnImage.copy()`.
* Added parameters `bounding_boxes` and `shape` to
BoundingBoxesOnImage.deepcopy()`.
* Switched `KeypointsOnImage.copy()` to a custom copy operation (away
from module `copy` module).
* Switched `PolygonsOnImage.copy()` to a custom copy operation (away
from module `copy` module).
* Added parameters `polygons` and `shape` to
PolygonsOnImage.copy()`.
* Added parameters `polygons` and `shape` to
PolygonsOnImage.deepcopy()`.
* Switched augmenters to use in-place functions for keypoints,
bounding boxes, line strings and polygons.
8 changes: 6 additions & 2 deletions checks/check_jigsaw.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@

def main():
image = ia.quokka_square((200, 200))
kpsoi = ia.quokka_keypoints((200, 200), extract="square")
aug = iaa.Jigsaw(10, 10)

images_aug = aug(images=[image] * 16)
ia.imshow(ia.draw_grid(images_aug))
images_aug, kpsois_aug = aug(images=[image] * 16,
keypoints=[kpsoi] * 16)
images_show = [kpsoi_aug.draw_on_image(image_aug)
for image_aug, kpsoi_aug in zip(images_aug, kpsois_aug)]
ia.imshow(ia.draw_grid(images_show))

gen_time = timeit.timeit(
"iaa.generate_jigsaw_destinations(10, 10, 2, rng)",
Expand Down