From f0ea666e1575c9e0c8db0d6d8d269d198f35aa54 Mon Sep 17 00:00:00 2001 From: Felix Dittrich Date: Tue, 26 Sep 2023 10:03:44 +0200 Subject: [PATCH] fix antialising (#1324) --- 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]