2
## ====================================================================
4
## Copyright (c) 1996-2000 Carnegie Mellon University. All rights
7
## Redistribution and use in source and binary forms, with or without
8
## modification, are permitted provided that the following conditions
11
## 1. Redistributions of source code must retain the above copyright
12
## notice, this list of conditions and the following disclaimer.
14
## 2. Redistributions in binary form must reproduce the above copyright
15
## notice, this list of conditions and the following disclaimer in
16
## the documentation and/or other materials provided with the
19
## 3. The names "Sphinx" and "Carnegie Mellon" must not be used to
20
## endorse or promote products derived from this software without
21
## prior written permission. To obtain permission, contact
24
## 4. Redistributions of any form whatsoever must retain the following
26
## "This product includes software developed by Carnegie
27
## Mellon University (http://www.speech.cs.cmu.edu/)."
29
## THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
30
## ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
31
## THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
32
## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
33
## NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36
## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37
## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38
## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39
## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41
## ====================================================================
43
## Author: Ricky Houghton
48
use File::Spec::Functions;
49
use lib catdir(dirname($0), updir(), 'lib');
50
use SphinxTrain::Config;
51
use SphinxTrain::Util;
53
#***************************************************************************
54
# Script to find the VQ codebooks for the training set.
55
# The codewords in the codebook will be used later as the means of
56
# clusters for the Discrete HMMs.
57
#***************************************************************************
62
my ($hmmdir,$outhmm,$segdmpdir,$dumpfile,$logfile);
64
$| = 1; # Turn on autoflushing
66
my $mllt_file = catfile($ST::CFG_MODEL_DIR, "${ST::CFG_EXPTNAME}.mllt");
67
my $model_type = 'ci';
70
$hmmdir = "$ST::CFG_BASE_DIR/model_parameters";
73
$outhmm = "$hmmdir/${ST::CFG_EXPTNAME}.${model_type}_${ST::CFG_DIRLABEL}_flatinitial";
76
$segdmpdir = "$ST::CFG_BWACCUM_DIR/${ST::CFG_EXPTNAME}_buff_1";
77
mkdir ($segdmpdir,0777);
79
$dumpfile = "$segdmpdir/${ST::CFG_EXPTNAME}.dmp";
81
my $logdir = "$ST::CFG_LOG_DIR/05.vector_quantize";
83
$logfile = "$logdir/${ST::CFG_EXPTNAME}.kmeans.log";
88
if (defined($ST::CFG_SVSPEC)){
89
@feat_args = (-svspec =>$ST::CFG_SVSPEC);
94
-ldadim => $ST::CFG_LDA_DIMENSION);
97
exit RunTool('kmeans_init', $logfile, 0,
102
-ndensity => $ST::CFG_INITIAL_NUM_DENSITIES,
103
-meanfn => "$outhmm/means",
104
-varfn => "$outhmm/variances",
105
-fullvar => $ST::CFG_FULLVAR,
107
-segdmpdirs => $segdmpdir,
108
-segdmpfn => $dumpfile,
109
-ceplen => $ST::CFG_VECTOR_LENGTH,
110
-feat => $ST::CFG_FEATURE,
112
-agc => $ST::CFG_AGC,
113
-cmn => $ST::CFG_CMN,
114
-varnorm => $ST::CFG_VARNORM);