我们定义了一些DataSet
带有一些随机transform
s 的东西,每次加载某些特定图像时都会重新应用它们。是否也可以使用图像提取应用于图像的转换?(我也想将应用于图像的转换应用于其他图像。)
import torchvision
import torchvision.transforms as transforms
import torch.utils.data
path = "/path/to/image/folders/" #should contain at least one folder with some images
transform = transforms.Compose([
transforms.RandomHorizontalFlip(p=0.5),
transforms.RandomRotation(degrees=[0, 360]),
transforms.ToTensor()
])
dataset = torchvision.datasets.ImageFolder(root=path, transform=transform)
dataloader = torch.utils.data.DataLoader(dataset=dataset, shuffle=True)
for input, target in dataloader:
pass #get transform that was applied to input?