From 1e7f9dda715ad727112a1207f915dcee1af266aa Mon Sep 17 00:00:00 2001 From: yajiemiao Date: Thu, 7 Jan 2016 12:36:11 -0500 Subject: [PATCH] incorporate changes made by Guoli Ye to CE utilities --- src/net/ce-loss.cc | 13 +++++++++++-- src/netbin/train-ce-parallel.cc | 4 ++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/net/ce-loss.cc b/src/net/ce-loss.cc index f8e08c5d..881758cf 100644 --- a/src/net/ce-loss.cc +++ b/src/net/ce-loss.cc @@ -2,6 +2,7 @@ // Copyright 2011 Brno University of Technology (author: Karel Vesely) // 2015 Yajie Miao +// 2015 Guoli Ye // See ../../COPYING for clarification regarding multiple authors // @@ -75,7 +76,11 @@ void CE::Eval(const CuMatrixBase &net_out, const std::vector & if (sequences_progress_ > report_step_) { KALDI_LOG << "After " << sequences_num_ << " sequences (" << frames_/(100.0 * 3600) << "Hr): " << "CE-Obj = " << obj_progress_/sequences_progress_ - << " FrameAcc = " << 100.0*(correct_progress_/frames_progress_) << "%"; + << "Frame-level CE-Obj = " << obj_progress_/frames_progress_ + << " FrameAcc = " << 100.0*(double(correct_progress_)/frames_progress_) << "%" + << " obj_progress_= " << obj_progress_ + << " sequences_progress_= " << sequences_progress_ + << " frames_progress_= " << frames_progress_ ; // reset sequences_progress_ = 0; frames_progress_ = 0; @@ -148,7 +153,11 @@ void CE::EvalParallel(const CuMatrixBase &net_out, if (sequences_progress_ > report_step_) { KALDI_LOG << "After " << sequences_num_ << " sequences (" << frames_/(100.0 * 3600) << "Hr): " << "CE-Obj = " << obj_progress_/sequences_progress_ - << " FrameAcc = " << 100.0*(correct_progress_/frames_progress_) << "%"; + << "Frame-level CE-Obj = " << obj_progress_/frames_progress_ + << " FrameAcc = " << 100.0*(double(correct_progress_)/frames_progress_) << "%" + << " obj_progress_= " << obj_progress_ + << " sequences_progress_= " << sequences_progress_ + << " frames_progress_= " << frames_progress_ ; // reset sequences_progress_ = 0; frames_progress_ = 0; diff --git a/src/netbin/train-ce-parallel.cc b/src/netbin/train-ce-parallel.cc index 8ddb6a9b..f40f02b4 100644 --- a/src/netbin/train-ce-parallel.cc +++ b/src/netbin/train-ce-parallel.cc @@ -1,6 +1,7 @@ // netbin/train-ce-parallel.cc // Copyright 2015 Yajie Miao +// Guoli Ye // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -149,6 +150,9 @@ int main(int argc, char *argv[]) { } } + // guoye: add here, I think I fix the bugs. Set the original lengths of utterances before padding + net.SetSeqLengths(frame_num_utt); + // Propagation and CTC training net.Propagate(CuMatrix(feat_mat_host), &net_out); ce.EvalParallel(net_out, target_host, &obj_diff, frame_mask_host, cur_sequence_num);