Fix mask resampling in some cases
Former-commit-id: 8f317cb13c17ef25a86b25a0c24390e04cd4db82
This commit is contained in:
parent
229dd44fca
commit
a445c4bdc4
|
@ -30,7 +30,7 @@ class BasicDataset(Dataset):
|
||||||
w, h = pil_img.size
|
w, h = pil_img.size
|
||||||
newW, newH = int(scale * w), int(scale * h)
|
newW, newH = int(scale * w), int(scale * h)
|
||||||
assert newW > 0 and newH > 0, 'Scale is too small, resized images would have no pixel'
|
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)
|
img_ndarray = np.asarray(pil_img)
|
||||||
|
|
||||||
if img_ndarray.ndim == 2 and not is_mask:
|
if img_ndarray.ndim == 2 and not is_mask:
|
||||||
|
|
Loading…
Reference in a new issue