import os
import torch
from PIL import Image
from torchvision import transforms
vde_path='./P01_s1_00_0_color'
img_path=os.listdir(vde_path)
# print(img_path)
imgs=list()
for i in img_path:
img=Image.open(os.path.join(vde_path,i))
transform=transforms.Compose([transforms.Resize([128, 128]), transforms.ToTensor()])
img=transform(img)
print(img.shape)
imgs.append(img)
imgs=torch.stack(imgs, dim=0)
print(imgs.shape)
torch.Size([3, 128, 128])
torch.Size([3, 128, 128])
torch.Size([3, 128, 128])
torch.Size([3, 128, 128])
torch.Size([3, 128, 128])
torch.Size([3, 128, 128])
torch.Size([3, 128, 128])
torch.Size([3, 128, 128])
torch.Size([3, 128, 128])
torch.Size([3, 128, 128])
torch.Size([3, 128, 128])
torch.Size([12, 3, 128, 128])



