[fbbdf8]: / scripts / dataset-generation-pool.py

Download this file

22 lines (15 with data), 476 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
import multiprocessing as mp
import os.path as osp
import subprocess
from glob import glob
from tqdm import tqdm
input_dir = "../mit-bih/*.atr"
ecg_data = sorted([osp.splitext(i)[0] for i in glob(input_dir)])
pbar = tqdm(total=len(ecg_data))
def run(file):
params = ["python3", "dataset-generation.py", "--file", file]
subprocess.check_call(params)
pbar.update(1)
if __name__ == "__main__":
p = mp.Pool(processes=mp.cpu_count())
p.map(run, ecg_data)