Пример #1
0
database_cfg = dict(database_cfg.items('database'))

#read the features config file
feat_cfg = configparser.ConfigParser()
feat_cfg.read(feat_cfg_file)
feat_cfg = dict(feat_cfg.items('features'))

#compute the features of the training set for training
print '------- computing training features ----------'
prepare_data.prepare_data(datadir=database_cfg['train_data'],
                          featdir=os.path.join(database_cfg['train_dir'],
                                               feat_cfg['name']),
                          conf=feat_cfg)

print '------- computing cmvn stats ----------'
prepare_data.compute_cmvn(featdir=database_cfg['train_dir'] + '/' +
                          feat_cfg['name'])

#get the feature dim
reader = ark.ArkReader(
    os.path.join(database_cfg['train_dir'], feat_cfg['name'], 'feats.scp'))
_, features, _ = reader.read_next_utt()
input_dim = features.shape[1]

with open(os.path.join(database_cfg['train_dir'], feat_cfg['name'], 'dim'),
          'w') as fid:
    fid.write(str(input_dim))

#compute the features of the dev set
if 'dev_data' in database_cfg:

    print '------- computing developement features ----------'
Пример #2
0
database_cfg = dict(database_cfg.items('directories'))

#read the features config file
feat_cfg = configparser.ConfigParser()
feat_cfg.read(feat_cfg_file)
feat_cfg = dict(feat_cfg.items('features'))

#compute the features of the training set for training
print '------- computing training features ----------'
prepare_data.prepare_data(datadir=database_cfg['train_data'],
                          featdir=database_cfg['train_features'] + '/' +
                          feat_cfg['name'],
                          conf=feat_cfg)

print '------- computing cmvn stats ----------'
prepare_data.compute_cmvn(featdir=database_cfg['train_features'] + '/' +
                          feat_cfg['name'])

#compute the features of the dev set
if 'dev_data' in database_cfg:

    print '------- computing developement features ----------'
    prepare_data.prepare_data(datadir=database_cfg['dev_data'],
                              featdir=database_cfg['dev_features'] + '/' +
                              feat_cfg['name'],
                              conf=feat_cfg)

    print '------- computing cmvn stats ----------'
    prepare_data.compute_cmvn(featdir=database_cfg['dev_features'] + '/' +
                              feat_cfg['name'])

#compute the features of the test set for testing