title: Loading and correctly displaying an image dataset using pytorch Dataloader
body: <p>I'm trying to load a custom dataset for training a neural network, but before I load them in, I would like to verify that they've been loaded correctly. So far it looks like they are not being loaded correctly, but I can't figure out what gives the images the format that they get.</p>
  
  <p>This is the code that I'm loading the images with, and then displaying them.</p>
  
  <pre><code>f, axarr = plt.subplots(2,2, figsize=(20,20))
  
  def load_dataset():
      data_path = 'processedData/HE/train/'
      train_dataset = torchvision.datasets.ImageFolder(
          root=data_path,
          transform=torchvision.transforms.ToTensor()
      )
      train_loader = DataLoader(
          train_dataset, batch_size=64
      )
      return train_loader
  x_train = load_dataset()
  
  datathing = next(iter(x_train))
  
  for i, ax in enumerate(axarr.flat):
      ax.imshow(datathing[0][i].view(128,128,3))
      ax.axis('off')
  plt.show()
  </code></pre>
  
  <p>When running this with the images, the output <a href="https://i.stack.imgur.com/INF0S.png" rel="nofollow noreferrer">looks like this.</a></p>
  
  <p>It is suppose to look something <a href="https://i.stack.imgur.com/ZTAQ4.png" rel="nofollow noreferrer">like these images</a></p>
  
  <p>I have been trying with different image datasets, but all the sets return the same format, so my question is:</p>
  
  <ul>
  <li>How to load images and then displaying them in their real format using pytorch's dataloader?</li>
  </ul>