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

extract_data.py 1.0 KB

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
19
20
21
22
23
24
25
26
27
28
29
30
31
32
  1. import os
  2. import sys
  3. import subprocess
  4. import numpy as np
  5. import glob
  6. import json
  7. import pandas as pd
  8. '''
  9. This script creates a folder "Extracted_data" inside which it extracts all the wav files in the directories date-wise
  10. '''
  11. coswara_data_dir = os.path.abspath('.') # Local Path of iiscleap/Coswara-Data Repo
  12. extracted_data_dir = os.path.join(coswara_data_dir, 'Extracted_data')
  13. if not os.path.exists(coswara_data_dir):
  14. raise("Check the Coswara dataset directory!")
  15. if not os.path.exists(extracted_data_dir):
  16. os.makedirs(extracted_data_dir) # Creates the Extracted_data folder if it doesn't exist
  17. dirs_extracted = set(map(os.path.basename,glob.glob('{}/202*'.format(extracted_data_dir))))
  18. dirs_all = set(map(os.path.basename,glob.glob('{}/202*'.format(coswara_data_dir))))
  19. dirs_to_extract = list(set(dirs_all) - dirs_extracted)
  20. for d in dirs_to_extract:
  21. p = subprocess.Popen('cat {}/{}/*.tar.gz.* |tar -xvz -C {}/'.format(coswara_data_dir, d, extracted_data_dir), shell=True)
  22. p.wait()
  23. print("Extraction process complete!")
Tip!

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

Comments

Loading...