import torch
import torchvision.transforms.functional as F
from PIL import Image
import numpy as np
import cv2

img = cv2.imread('1.jpg')
print(img.shape) # 483x850x3

img1 = Image.open('1.jpg').convert('RGB')
               # left, top, right, bottom
img1 = F.pad(img1, (0, 0, 1, 1))
img1 = np.array(img1)
print(img1.shape) # 481x851x3
# Question1: Is this image padded for RGB channels respectively?

size = 128 # patch size
stride = 128 # patch stride

img2 = torch.from_numpy(img1)
patches = img2.unfold(0, size, stride).unfold(1, size, stride)
print(patches.shape) # torch.Size([3, 6, 3, 128, 128])
# Question2: what does [3, 6, 3] mean?



Thank you in advance!!!