From 43516d8c6232585935eba0851c655a12cc29f790 Mon Sep 17 00:00:00 2001 From: felix Date: Tue, 19 Sep 2023 14:57:42 +0200 Subject: [PATCH] fix antialising --- doctr/models/preprocessor/pytorch.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doctr/models/preprocessor/pytorch.py b/doctr/models/preprocessor/pytorch.py index 98819bade1..2f9586173e 100644 --- a/doctr/models/preprocessor/pytorch.py +++ b/doctr/models/preprocessor/pytorch.py @@ -101,7 +101,9 @@ def __call__(self, x: Union[torch.Tensor, np.ndarray, List[Union[torch.Tensor, n raise TypeError("unsupported data type for torch.Tensor") # Resizing if x.shape[-2] != self.resize.size[0] or x.shape[-1] != self.resize.size[1]: - x = F.resize(x, self.resize.size, interpolation=self.resize.interpolation) + x = F.resize( + x, self.resize.size, interpolation=self.resize.interpolation, antialias=self.resize.antialias + ) # Data type if x.dtype == torch.uint8: # type: ignore[union-attr] x = x.to(dtype=torch.float32).div(255).clip(0, 1) # type: ignore[union-attr]