Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
felixT2K committed Oct 13, 2023
1 parent ec71bd1 commit 82fcbdb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion doctr/models/preprocessor/tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ def __call__(self, x: Union[tf.Tensor, np.ndarray, List[Union[tf.Tensor, np.ndar
x = tf.image.convert_image_dtype(x, dtype=tf.float32)
# Resizing
if (x.shape[1], x.shape[2]) != self.resize.output_size:
x = tf.image.resize(x, self.resize.output_size, method=self.resize.method, antialias=True)
x = tf.image.resize(
x, self.resize.output_size, method=self.resize.method, antialias=self.resize.antialias
)

batches = [x]

Expand Down
3 changes: 2 additions & 1 deletion doctr/transforms/modules/tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def __init__(
self.method = method
self.preserve_aspect_ratio = preserve_aspect_ratio
self.symmetric_pad = symmetric_pad
self.antialias = True

if isinstance(self.output_size, int):
self.wanted_size = (self.output_size, self.output_size)
Expand All @@ -104,7 +105,7 @@ def __call__(
) -> Union[tf.Tensor, Tuple[tf.Tensor, np.ndarray]]:
input_dtype = img.dtype

img = tf.image.resize(img, self.wanted_size, self.method, self.preserve_aspect_ratio, antialias=True)
img = tf.image.resize(img, self.wanted_size, self.method, self.preserve_aspect_ratio, self.antialias)
# It will produce an un-padded resized image, with a side shorter than wanted if we preserve aspect ratio
raw_shape = img.shape[:2]
if self.preserve_aspect_ratio:
Expand Down

0 comments on commit 82fcbdb

Please sign in to comment.