hi ,is there a way to get the class and the original name of the tranfrom image,when using the model(x) code
to forward torch.utils.data.DataLoader as an input
normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225])
val_loader = torch.utils.data.DataLoader(
datasets.ImageFolder(valdir, transforms.Compose([
transforms.Scale(256),
transforms.CenterCrop(224),
transforms.ToTensor(),
normalize,
])),
batch_size=1, shuffle=False,
num_workers=4, pin_memory=True)
a torch.utils.data.DataLoader is created here
and i want to get the input result:
for i, (input, target) in enumerate(val_loader):
target_var = torch.autograd.Variable(target)
target = target.cuda(async=True)
x = torch.autograd.Variable(input, volatile=True)
target_var = torch.autograd.Variable(target, volatile=True)
#want to print the input varialbe’s imagename and classes here,how?
f2=model(x)
i want to print the input varialbe’s imagename and classes before code model(x)
many thanks!