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