To debug my code I need to get name of images in my batch with its labels and prediction. As images in batch are in form of tensor, So I can not acess image name.
In my dataloader below part of code is used-
def getitem(self, i):
data, label = self.data[i], self.label[i] #here data is actual file name of image
image = self.transform(Image.open(data).convert(‘RGB’)) # here its converted into tensor
return image, label #return image tensor and labels
Below part of code I am using to load data in batch-
for i, batch in tqdm(enumerate(self.test_loader, 1)):
data, _ = [_.cuda() for _ in batch] #data loaded in form of tensor
logits = self.model(data)
loss = F.cross_entropy(logits, label)
So what needs to be changed so that I can see the data not only in form of tensor but also as name of data(file name)?