Fix mask resampling in some cases

Former-commit-id: 8f317cb13c17ef25a86b25a0c24390e04cd4db82
This commit is contained in:
milesial 2021-11-03 09:39:21 +01:00 committed by GitHub
parent 229dd44fca
commit a445c4bdc4

View file

@ -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: