Commit bc06cf95 authored by Karel Vesely's avatar Karel Vesely
Browse files

trunk,nnet : bugfix #12 Small bugs in rbm-train-cd1-frmshuff, nnet-train-frmshuff

- removing --drop-frames from rbm-train-cd1-frmshuff,
- fixing code, so no utterance is used twice



git-svn-id: https://svn.code.sf.net/p/kaldi/code/trunk@4327 5e6a8d80-dfce-4ca6-a32a-6e07a63d50c8
parent 5ec2925c
......@@ -143,6 +143,7 @@ int main(int argc, char *argv[]) {
#endif
// fill the randomizer
for ( ; !feature_reader.Done(); feature_reader.Next()) {
if (feature_randomizer.IsFull()) break; // suspend, keep utt for next loop
std::string utt = feature_reader.Key();
KALDI_VLOG(3) << "Reading " << utt;
// check that we have targets
......@@ -199,8 +200,6 @@ int main(int argc, char *argv[]) {
targets_randomizer.AddData(targets);
weights_randomizer.AddData(weights);
num_done++;
// end when randomizer full
if (feature_randomizer.IsFull()) break;
// report the speed
if (num_done % 5000 == 0) {
......
......@@ -69,9 +69,6 @@ int main(int argc, char *argv[]) {
kaldi::int32 max_frames = 6000; // Allow segments maximum of 30 seconds by default
po.Register("max-frames",&max_frames, "Maximum number of frames a segment can have to be processed");
BaseFloat drop_data = 0.0;
po.Register("drop-data", &drop_data, "Threshold for random dropping of the data (0 no-drop, 1 drop-all)");
std::string use_gpu="yes";
po.Register("use-gpu", &use_gpu, "yes|no|optional, only has effect if compiled with CUDA");
......@@ -151,6 +148,7 @@ int main(int argc, char *argv[]) {
#endif
// fill the randomizer
for ( ; !feature_reader.Done(); feature_reader.Next()) {
if (feature_randomizer.IsFull()) break; // suspend, keep utt for next loop
std::string utt = feature_reader.Key();
KALDI_VLOG(3) << utt;
// get feature matrix
......@@ -167,25 +165,9 @@ int main(int argc, char *argv[]) {
feats.CopyFromMat(mat);
// apply optional feature transform
rbm_transf.Feedforward(feats, &feats_transf);
// subsample training data to get faster epochs on large datasets
if(drop_data > 0.0) {
Matrix<BaseFloat> mat2(feats_transf.NumRows(), feats_transf.NumCols(),
kUndefined);
feats_transf.CopyToMat(&mat2);
for(int32 r=mat2.NumRows()-1; r >= 0; r--) {
if(RandUniform() < drop_data) {
mat2.RemoveRow(r);
}
}
if(mat2.NumRows() == 0) continue;
feats_transf.Resize(mat2.NumRows(),mat2.NumCols());
feats_transf.CopyFromMat(mat2);
}
// add to randomizer
feature_randomizer.AddData(feats_transf);
num_done++;
// end when randomizer full
if (feature_randomizer.IsFull()) break;
// report the speed
if (num_done % 5000 == 0) {
......
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