When I display some samples photos from the dataset I use, the previews of images are displayed in low resolution (they look like very low-resolution photos). How I can I display the images without losing their resolutions?
Here are my transformations
which are used to move the data to the tensor and apply some transformations using PyTorch
functions:
data_transforms = transforms.Compose([
transforms.Resize((50, 50)),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225])
])
Then I load the data through DataLoader
:
train_loader = DataLoader(face_train_dataset,
batch_size=train_batch_size, shuffle=False,
num_workers=4)
Finally, I display some previews for the sample photos which are retrieved using the DataLoader
object:
example_data = example_data.cpu()
example_targets = example_targets.cpu()
for i in range(6):
plt.subplot(2, 3, i + 1)
plt.tight_layout()
plt.imshow(example_data[i][0], cmap='gray', interpolation='none')
plt.title('{}'.format(folders[example_targets[i]]))
plt.show()
p.s. Images are in tiff
format.