From a445c4bdc4db4035678bba5697f8398d77ac7d52 Mon Sep 17 00:00:00 2001 From: milesial Date: Wed, 3 Nov 2021 09:39:21 +0100 Subject: [PATCH] Fix mask resampling in some cases Former-commit-id: 8f317cb13c17ef25a86b25a0c24390e04cd4db82 --- utils/data_loading.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/data_loading.py b/utils/data_loading.py index e2e1dd7..2d6e4e6 100644 --- a/utils/data_loading.py +++ b/utils/data_loading.py @@ -30,7 +30,7 @@ class BasicDataset(Dataset): w, h = pil_img.size newW, newH = int(scale * w), int(scale * h) assert newW > 0 and newH > 0, 'Scale is too small, resized images would have no pixel' - pil_img = pil_img.resize((newW, newH)) + pil_img = pil_img.resize((newW, newH), resample=Image.NEAREST if is_mask else Image.BICUBIC) img_ndarray = np.asarray(pil_img) if img_ndarray.ndim == 2 and not is_mask: