How can I change my padding here , since I want non overlapping pixels.
def extract_patches(img, kernel_size=128, stride=15):
x = F.pad(img,(img.size(2) % kernel_size // 2, img.size(2) % kernel_size // 2, img.size(1) % kernel_size // 2, img.size(1) % kernel_size // 2))
print(x.shape)
ret = x.unfold(1, kernel_size, stride).unfold(2, kernel_size, stride).reshape(-1,128,128)
print(ret.shape)
return ret
But when I try to visualize
plt.imshow(patch[10],cmap=‘gray’)
plt.show()
The left most and top borders are not correcttly padded