-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathexample_hmm.py
39 lines (32 loc) · 1.09 KB
/
example_hmm.py
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
33
34
35
36
37
38
39
import pyVSR
from pyVSR import tcdtimit
from os import path
def main():
dataset_dir = '/run/media/john_tukey/download/datasets/adapt/tcdtimit/'
train, test = tcdtimit.files.request_files(
dataset_dir=dataset_dir,
protocol='speaker_dependent',
remove_sa=True)
featdir = './run/features/dct/'
pyVSR.run(
train_files=tcdtimit_feature_dict(train, featdir),
test_files=tcdtimit_feature_dict(test, featdir),
hmm_states=3,
mixtures=(2, 3, 5, 7, 9, 11, 14, 17, 20),
language_model=False,
config_dir='./pyVSR/tcdtimit/htkconfigs/',
report_results=('train', 'test'),
experiment_name='dct_volunteers',
num_threads=4,
)
def tcdtimit_feature_dict(files, feat_dir):
feature_dict = dict()
for file in files:
htk_file = path.join(
feat_dir,
path.splitext(file.split('tcdtimit/')[-1])[0] + '.htk')
sentence_id = path.splitext(file.split('tcdtimit/')[-1])[0]
feature_dict[sentence_id] = htk_file
return feature_dict
if __name__ == '__main__':
main()