Skip to content

Commit

Permalink
Fix Affine deprecation warning (aleju#685)
Browse files Browse the repository at this point in the history
This patch fixes a deprecation warning in
`Affine` that would be caused when providing
boolean images and `order != 0`.
  • Loading branch information
aleju authored Jun 1, 2020
1 parent 6c73eaa commit 0101108
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Fixed a deprecation warning in `Affine` that would
be caused when providing boolean images and
`order != 0`. #685
6 changes: 6 additions & 0 deletions imgaug/augmenters/geometric.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,12 @@ def _warp_affine_arr_skimage(arr, matrix, cval, mode, order, output_shape):

input_dtype = arr.dtype

# tf.warp() produces a deprecation warning for bool images with
# order!=0. We either need to convert them to float or use NN
# interpolation.
if input_dtype == iadt._BOOL_DTYPE and order != 0:
arr = arr.astype(np.float32)

image_warped = tf.warp(
arr,
np.linalg.inv(matrix),
Expand Down

0 comments on commit 0101108

Please sign in to comment.