Skip to content

Instantly share code, notes, and snippets.

@Akash-Rawat
Last active July 9, 2021 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Akash-Rawat/4ba8db73db21a21270a69832f553450d to your computer and use it in GitHub Desktop.
Save Akash-Rawat/4ba8db73db21a21270a69832f553450d to your computer and use it in GitHub Desktop.
def prep_test_data(med, train_dir, test_dir):
pop = os.listdir(train_dir+'/'+med)
test_data=random.sample(pop, 2000)
print(test_data)
for f in test_data:
shutil.copy(train_dir+'/'+med+'/'+f, test_dir+'/'+med+'/')
for medi in os.listdir(train_dir):
prep_test_data(medi, train_dir, test_dir)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment