Skip to content

Instantly share code, notes, and snippets.

@techzizou

techzizou/divide_labels.py Secret

Last active Feb 28, 2021
Embed
What would you like to do?
#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