Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

train-test-split.py 628 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
  1. import os
  2. from shutil import copyfile
  3. # As per README:
  4. # All files of iteration 0-4 move to testing-spectrograms
  5. # All files of iteration 5-49 move to training-spectrograms
  6. def separate(source):
  7. for filename in os.listdir(source):
  8. first_split = filename.rsplit("_", 1)[1]
  9. second_split = first_split.rsplit(".", 1)[0]
  10. if int(second_split) <= 4:
  11. copyfile(source + "/" + filename, "../testing-spectrograms" + "/" + filename)
  12. else:
  13. copyfile(source + "/" + filename, "../training-spectrograms" + "/" + filename)
  14. if __name__ == '__main__':
  15. separate("../spectrograms")
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...