Commit 07963737 authored by Milos CERNAK's avatar Milos CERNAK

Correction on iVector train data format

parent 6e8a6081
Pipeline #10695 passed with stages
in 6 minutes and 43 seconds
......@@ -73,12 +73,9 @@ def ivector_train(feats, fubm, ivector_extractor, num_gselect=20,
# ToDo: implement Bob's function for that
with tempfile.NamedTemporaryFile(delete=False, suffix='.ark') as arkfile:
with open(arkfile.name, 'wb') as f:
if feats.ndim == 3:
for i, utt in enumerate(feats):
uttid = 'utt' + str(i)
io.write_mat(f, utt, key=uttid.encode('utf-8'))
else:
io.write_mat(f, feats, key=b'utt0')
for i, utt in enumerate(feats):
uttid = 'utt' + str(i)
io.write_mat(f, utt, key=uttid.encode('utf-8'))
# Initialize the i-vector extractor using the FGMM input
cmd1 = [binary1] # fgmm-global-to-gmm
......
......@@ -33,7 +33,9 @@ def test_ivector_train():
fubm = bob.kaldi.ubm_full_train(array, dubm, temp_fubm_file,
num_gselect=2, num_iters=2)
# Train small ivector extractor
ivector = bob.kaldi.ivector_train(array, fubm, temp_ivec_file,
feats=[[]]
feats[0]=array
ivector = bob.kaldi.ivector_train(feats, fubm, temp_ivec_file,
num_gselect=2, ivector_dim=20, num_iters=2)
assert ivector.find('IvectorExtractor')
......@@ -59,7 +61,9 @@ def test_ivector_extract():
fubm = bob.kaldi.ubm_full_train(array, dubm, temp_fubm_file,
num_gselect=2, num_iters=2)
# Train small ivector extractor
ivector = bob.kaldi.ivector_train(array, fubm, temp_ivec_file,
feats=[[]]
feats[0]=array
ivector = bob.kaldi.ivector_train(feats, fubm, temp_ivec_file,
num_gselect=2, ivector_dim=20, num_iters=2)
# Extract ivector
ivector_array = bob.kaldi.ivector_extract(array, fubm, ivector,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment