File size: 873 Bytes
46cfe25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import utils
import pickle
import os
import argparse


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--root_dir", type=str, default="dataset/44k", help="path to root dir"
    )
    parser.add_argument('-c', '--config', type=str, default="./configs/config.json",
                    help='JSON file for configuration')
    parser.add_argument(
        "--output_dir", type=str, default="logs/44k", help="path to output dir"
    )

    args = parser.parse_args()

    hps = utils.get_hparams_from_file(args.config)
    spk_dic = hps.spk
    result = {}
    
    for k,v in spk_dic.items():
        print(f"now, index {k} feature...")
        index = utils.train_index(k,args.root_dir)
        result[v] = index

    with open(os.path.join(args.output_dir,"feature_and_index.pkl"),"wb") as f:
        pickle.dump(result,f)