title: How to split the images and annotations into train, test and validation sets for an object detection task?
body: <p>I know that similar threads exists, but I have not been able to find the appropriate answer.</p>
  <p>I have seen solutions for the cases where the images are stored based on certain classes, but this is not what I am looking for. I would like to know how to properly split the image dataset into train, test and validation sets, where each image has a corresponding annotation (labeling) file.</p>
  <p>The images and their respective annotations(pascal voc/yolo darkent formats) exist both in the same and different directories, depending on the convenience of splitting.</p>
  <p>Thanks in advance.</p>
  <p>Edit:</p>
  <p>I think this might be the fastest solution: This later can be applied for obtaining the validation as well.</p>
  <pre><code>train_size = int(0.8 * len(full_dataset))
  test_size = len(full_dataset) - train_size
  train_dataset, test_dataset = torch.utils.data.random_split(full_dataset, [train_size, test_size])
  </code></pre>
  <p>or let's say:</p>
  <pre><code>train, val, test = torch.utils.data.random_split(dataset, [1000, 100, 100]) 
  </code></pre>
  <p>given there are 1200 total images.</p>