import torch from torchvision import datasets, transforms from torch.utils.data import DataLoader,TensorDataset transform = transforms.Compose([ transforms.Resize((512, 512)), transforms.ToTensor(), ]) # 加载训练集和测试集 train_set = datasets.ImageFolder(root='data/cat_vs_dog/train', transform=transform) test_set = datasets.ImageFolder(root='data/cat_vs_dog/test', transform=transform) train_data = train_set.imgs print("train_data:", train_data)