diff --git a/MANIFEST.in b/MANIFEST.in index 116c9ac00c715448a9e75f2067881287117806a4..66b9880014098ec276593791d0ebddf7b47e400c 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,3 @@ -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 bob/kaldi/test/data *.wav *.txt *.npy *.ivector *.ie diff --git a/README.rst b/README.rst index 99fafcd20d8cf3335aebf853a0a346ec49a354c9..2572f073b6a99d60d264fbc92ff32632de743d0d 100644 --- a/README.rst +++ b/README.rst @@ -28,14 +28,11 @@ Bob_. Installation ------------ -Follow our `installation`_ instructions. Then, using the Python interpreter -provided by the distribution, build this package with:: - - $ git clone BOB.KALDI_REPOSITORY - $ cd bob.kaldi - $ source activate BOB_ENV - $ buildout +To install the package, install firt bob, and then install the bob.kaldi package: + $ conda install bob kaldi + $ pip install bob.kaldi + To be able to work properly, some dependent packages are required to be installed. Please make sure that you have read the `Dependencies <https://github.com/idiap/bob/wiki/Dependencies>`_ for your operating system. @@ -65,4 +62,4 @@ development `mailing list`_. .. _bob: https://www.idiap.ch/software/bob .. _kaldi: http://kaldi-asr.org/ .. _mailing list: https://www.idiap.ch/software/bob/discuss -.. _installation: https://www.idiap.ch/software/bob/install \ No newline at end of file +.. _installation: https://www.idiap.ch/software/bob/install diff --git a/bob/kaldi/mfcc.py b/bob/kaldi/mfcc.py index 5911bfeb93efe6dd4802c6dab8b321e4ae30ce4d..befac8ddf59100479d6588edcc0c51af38a318aa 100644 --- a/bob/kaldi/mfcc.py +++ b/bob/kaldi/mfcc.py @@ -11,7 +11,7 @@ from . import io from subprocess import PIPE, Popen # import subprocess -from os.path import exists +from os.path import isfile import tempfile import logging @@ -148,7 +148,7 @@ def mfcc_from_path(filename, channel=0, preemphasis_coefficient=0.97, raw_energy ] # import ipdb; ipdb.set_trace() - assert exists(filename) + assert isfile(filename) with open(os.devnull, "w") as fnull: pipe1 = Popen (cmd1, stdin=PIPE, stdout=PIPE, stderr=fnull) diff --git a/doc/index.rst b/doc/index.rst index 5aaeb3892e322f0ef789834fff57e6d5bb2013aa..b11f1a4494a1e2db5c0b4d43189168dc3710bdc4 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -12,7 +12,8 @@ import pkg_resources import bob.kaldi import bob.io.audio - + import tempfile + import os .. _bob.kaldi: @@ -84,19 +85,20 @@ are supported, speakers can be enrolled and scored: .. doctest:: - >>> sample = pkg_resources.resource_filename('bob.kaldi', 'test/data/sample16k.wav') - >>> mfcc = bob.kaldi.mfcc_from_path(sample) >>> # Train small diagonall GMM - >>> projector_file = 'Projector' - >>> dubm = bob.kaldi.ubm_train(mfcc, projector_file, num_gauss = 2, num_gselect = 2, num_iters = 2) + >>> projector = tempfile.TemporaryFile() + >>> dubm = bob.kaldi.ubm_train(feat, projector.name, num_gauss=2, num_gselect=2, num_iters=2) >>> # 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 - >>> spk_model = bob.kaldi.ubm_enroll(mfcc, dubm) + >>> spk_model = bob.kaldi.ubm_enroll(feat, dubm) >>> # GMM scoring - >>> score = bob.kaldi.gmm_score(mfcc, spk_model, dubm) + >>> score = bob.kaldi.gmm_score(feat, spk_model, dubm) >>> print ('%.3f' % score) 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: @@ -104,13 +106,13 @@ Following guide describes how to run whole speaker recognition experiments: .. 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: .. 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: