File size: 615 Bytes
4feaec5
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from lhotse.features.io import KaldiWriter
import numpy as np

for part in ["train_clean_460", "dev_clean", "test_clean"]:
    with open(f"./exp/xvector_nnet_1a/xvectors_{part}/spk_xvector.txt", "r") as f:
        with KaldiWriter(f"./exp/xvector_nnet_1a/xvectors_{part}/") as writer:
            features = [line.strip().split() for line in f]
            for feature in features:
                key = feature[0]
                feats = feature[2:-1]
                feats = [float(f) for f in feats]
                assert len(feats) == 512
                writer.write(key, np.array([feats], dtype=np.float32))