Skip to content
Snippets Groups Projects
Commit 56b7157a authored by Milos CERNAK's avatar Milos CERNAK
Browse files

Addressing review comments

parent eaab3caa
Branches
Tags
1 merge request!1Add documentation
Pipeline #
include README.rst buildout.cfg develop.cfg version.txt include LICENSE README.rst buildout.cfg develop.cfg version.txt
recursive-include doc conf.py *.rst recursive-include doc conf.py *.rst
recursive-include bob/kaldi/test/data *.wav *.txt *.npy *.ivector *.ie recursive-include bob/kaldi/test/data *.wav *.txt *.npy *.ivector *.ie
...@@ -28,13 +28,10 @@ Bob_. ...@@ -28,13 +28,10 @@ Bob_.
Installation Installation
------------ ------------
Follow our `installation`_ instructions. Then, using the Python interpreter To install the package, install firt bob, and then install the bob.kaldi package:
provided by the distribution, build this package with::
$ git clone BOB.KALDI_REPOSITORY $ conda install bob kaldi
$ cd bob.kaldi $ pip install bob.kaldi
$ source activate BOB_ENV
$ buildout
To be able to work properly, some dependent packages are required to be installed. To be able to work properly, some dependent packages are required to be installed.
Please make sure that you have read the `Dependencies Please make sure that you have read the `Dependencies
......
...@@ -11,7 +11,7 @@ from . import io ...@@ -11,7 +11,7 @@ from . import io
from subprocess import PIPE, Popen from subprocess import PIPE, Popen
# import subprocess # import subprocess
from os.path import exists from os.path import isfile
import tempfile import tempfile
import logging import logging
...@@ -148,7 +148,7 @@ def mfcc_from_path(filename, channel=0, preemphasis_coefficient=0.97, raw_energy ...@@ -148,7 +148,7 @@ def mfcc_from_path(filename, channel=0, preemphasis_coefficient=0.97, raw_energy
] ]
# import ipdb; ipdb.set_trace() # import ipdb; ipdb.set_trace()
assert exists(filename) assert isfile(filename)
with open(os.devnull, "w") as fnull: with open(os.devnull, "w") as fnull:
pipe1 = Popen (cmd1, stdin=PIPE, stdout=PIPE, stderr=fnull) pipe1 = Popen (cmd1, stdin=PIPE, stdout=PIPE, stderr=fnull)
......
...@@ -12,7 +12,8 @@ ...@@ -12,7 +12,8 @@
import pkg_resources import pkg_resources
import bob.kaldi import bob.kaldi
import bob.io.audio import bob.io.audio
import tempfile
import os
.. _bob.kaldi: .. _bob.kaldi:
...@@ -84,19 +85,20 @@ are supported, speakers can be enrolled and scored: ...@@ -84,19 +85,20 @@ are supported, speakers can be enrolled and scored:
.. doctest:: .. doctest::
>>> sample = pkg_resources.resource_filename('bob.kaldi', 'test/data/sample16k.wav')
>>> mfcc = bob.kaldi.mfcc_from_path(sample)
>>> # Train small diagonall GMM >>> # Train small diagonall GMM
>>> projector_file = 'Projector' >>> projector = tempfile.TemporaryFile()
>>> dubm = bob.kaldi.ubm_train(mfcc, projector_file, num_gauss = 2, num_gselect = 2, num_iters = 2) >>> dubm = bob.kaldi.ubm_train(feat, projector.name, num_gauss=2, num_gselect=2, num_iters=2)
>>> # Train small full GMM >>> # Train small full GMM
>>> ubm = bob.kaldi.ubm_full_train(mfcc, projector_file, num_gselect = 2, num_iters = 2) >>> ubm = bob.kaldi.ubm_full_train(feat, projector.name, num_gselect=2, num_iters=2)
>>> # Enrollement - MAP adaptation of the UBM-GMM >>> # Enrollement - MAP adaptation of the UBM-GMM
>>> spk_model = bob.kaldi.ubm_enroll(mfcc, dubm) >>> spk_model = bob.kaldi.ubm_enroll(feat, dubm)
>>> # GMM scoring >>> # GMM scoring
>>> score = bob.kaldi.gmm_score(mfcc, spk_model, dubm) >>> score = bob.kaldi.gmm_score(feat, spk_model, dubm)
>>> print ('%.3f' % score) >>> print ('%.3f' % score)
0.282 0.282
>>> os.unlink(projector.name)
>>> os.unlink(projector.name + '.dubm')
>>> os.unlink(projector.name + '.fubm')
Following guide describes how to run whole speaker recognition experiments: Following guide describes how to run whole speaker recognition experiments:
...@@ -104,13 +106,13 @@ Following guide describes how to run whole speaker recognition experiments: ...@@ -104,13 +106,13 @@ Following guide describes how to run whole speaker recognition experiments:
.. code-block:: sh .. code-block:: sh
./bin/verify.py -d 'mobio-audio-male' -p 'energy-2gauss' -e 'mfcc-kaldi' -a 'gmm-kaldi' -s exp-gmm-kaldi --groups {dev,eval} -R '/your/work/directory/' -T '/your/temp/directory' -vv verify.py -d 'mobio-audio-male' -p 'energy-2gauss' -e 'mfcc-kaldi' -a 'gmm-kaldi' -s exp-gmm-kaldi --groups {dev,eval} -R '/your/work/directory/' -T '/your/temp/directory' -vv
2. To run the ivector+plda speaker recognition experiment, run: 2. To run the ivector+plda speaker recognition experiment, run:
.. code-block:: sh .. code-block:: sh
./bin/verify.py -d 'mobio-audio-male' -p 'energy-2gauss' -e 'mfcc-kaldi' -a 'ivector-plda-kaldi' -s exp-ivector-plda-kaldi --groups {dev,eval} -R '/your/work/directory/' -T '/your/temp/directory' -vv verify.py -d 'mobio-audio-male' -p 'energy-2gauss' -e 'mfcc-kaldi' -a 'ivector-plda-kaldi' -s exp-ivector-plda-kaldi --groups {dev,eval} -R '/your/work/directory/' -T '/your/temp/directory' -vv
3. Results: 3. Results:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment