我在 train 文件夹中有 21,522 个项目,总计 609.7 MB
train
-1(3600 png)
-2(3600 png)
.
.
-6
train_trans = transforms.Compose([
vision.transforms.Resize(target_size),
vision.transforms.RandomHorizontalFlip(),
vision.transforms.RandomRotation(20),
#CIFAR10Policy(),
vision.transforms.ToTensor(),
vision.transforms.Normalize(
[0.485, 0.456, 0.406],
[0.229, 0.224, 0.225])
])
valid_trans = transforms.Compose([
vision.transforms.Resize(target_size),
vision.transforms.RandomResizedCrop(target_size, scale=(0.8,1.0)),
vision.transforms.RandomHorizontalFlip(),
vision.transforms.ToTensor(),
vision.transforms.Normalize(
[0.485, 0.456, 0.406],
[0.229, 0.224, 0.225])
])
test_trans = transforms.Compose([
vision.transforms.Resize((size,size)),
vision.transforms.RandomResizedCrop(target_size, scale=(0.8,1.0)),
vision.transforms.ToTensor(),
vision.transforms.Normalize(
[0.485, 0.456, 0.406],
[0.229, 0.224, 0.225])
])
但是当我加载数据集时
train_dataset = torchvision.datasets.ImageFolder(root= path + 'train/',transform=trans)
不知何故
打印(len(train_dataset)) = 4109
不知何故,它不会加载整个图像文件