Skip to content

Instantly share code, notes, and snippets.

@techzizou
Last active February 28, 2021 00:14
Show Gist options
  • Save techzizou/9017e6dd21f01cc1716bd2997ac8707a to your computer and use it in GitHub Desktop.
Save techzizou/9017e6dd21f01cc1716bd2997ac8707a to your computer and use it in GitHub Desktop.
#creating two dir for training and testing
!mkdir test_labels train_labels
# lists the files inside 'annotations' in a random order (not really random, by their hash value instead)
# Moves the first 274/1370 labels (20% of the labels) to the testing dir: `test_labels`
!ls annotations/* | sort -R | head -274 | xargs -I{} mv {} test_labels/
# Moves the rest of the labels ( 1096 labels ) to the training dir: `train_labels`
!ls annotations/* | xargs -I{} mv {} train_labels/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment