title: How do I load custom image based datasets into Pytorch for use with a CNN?
body: <p>I have searched for hours on the internet to find a good solution to my issue. Here is some relevant background information to help you answer my question.</p>
  
  <p>This is my first ever deep learning project and I have no idea what I am doing. I know the theory but not the practical elements.</p>
  
  <p>The data that I am using can be found on kaggle at this link:
  (<a href="https://www.kaggle.com/alxmamaev/flowers-recognition" rel="noreferrer">https://www.kaggle.com/alxmamaev/flowers-recognition</a>)</p>
  
  <p>I am aiming to classify flowers based on the images provided in the dataset using a CNN.</p>
  
  <p>Here is some sample code I have tried to use to load data in so far, this is my best attempt but as I mentioned I am clueless and Pytorch docs didn't offer much help that I could understand at my level.
  (<a href="https://pastebin.com/fNLVW1UW" rel="noreferrer">https://pastebin.com/fNLVW1UW</a>)</p>
  
  <pre><code>    # Loads the images for use with the CNN.
  def load_images(image_size=32, batch_size=64, root="../images"):
      transform = transforms.Compose([
          transforms.Resize(32),
          transforms.ToTensor(),
          transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))])
  
      train_set = datasets.ImageFolder(root=root, train=True, transform=transform)
      train_loader = torch.utils.data.DataLoader(train_set, batch_size=batch_size, shuffle=True, num_workers=2)
  
      return train_loader
  
  
  # Defining variables for use with the CNN.
  classes = ('daisy', 'dandelion', 'rose', 'sunflower', 'tulip')
  train_loader_data = load_images()
  
  # Training samples.
  n_training_samples = 3394
  train_sampler = SubsetRandomSampler(np.arange(n_training_samples, dtype=np.int64))
  
  # Validation samples.
  n_val_samples = 424
  val_sampler = SubsetRandomSampler(np.arange(n_training_samples, n_training_samples + n_val_samples, dtype=np.int64))
  
  # Test samples.
  n_test_samples = 424
  test_sampler = SubsetRandomSampler(np.arange(n_test_samples, dtype=np.int64))
  </code></pre>
  
  <p>Here are my direct questions that I require answers too:</p>
  
  <ul>
  <li><p>How do I fix my code to load in the dataset in an 80/10/10 split for training/test/validation?</p></li>
  <li><p>How do i create the required labels/classes for these images which are already divided by folders in /images ?</p></li>
  </ul>