Why use padding for ValDataset?
rulixiang opened this issue · comments
Lixiang Ru commented
Hey, I found the ValDataset used padding for both image and label.
#image, label = pad_inf(image, label)
def pad_inf(image, label=None):
h, w = image.size()[-2:]
stride = settings.STRIDE
pad_h = (stride + 1 - h % stride) % stride
pad_w = (stride + 1 - w % stride) % stride
if pad_h > 0 or pad_w > 0:
image = F.pad(image, (0, pad_w, 0, pad_h), mode='constant', value=0.)
if label is not None:
label = F.pad(label, (0, pad_w, 0, pad_h), mode='constant',
value=settings.IGNORE_LABEL)
return image, label
Can you show the reasons for doing so?