Skip to content

Commit

Permalink
Merge pull request #26 from yajiemiao/master
Browse files Browse the repository at this point in the history
incorporate changes made by Guoli Ye to CE utilities
  • Loading branch information
yajiemiao committed Jan 7, 2016
2 parents 95a2c61 + 1e7f9dd commit 68f2bc2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/net/ce-loss.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down Expand Up @@ -75,7 +76,11 @@ void CE::Eval(const CuMatrixBase<BaseFloat> &net_out, const std::vector<int32> &
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;
Expand Down Expand Up @@ -148,7 +153,11 @@ void CE::EvalParallel(const CuMatrixBase<BaseFloat> &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;
Expand Down
4 changes: 4 additions & 0 deletions src/netbin/train-ce-parallel.cc
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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<BaseFloat>(feat_mat_host), &net_out);
ce.EvalParallel(net_out, target_host, &obj_diff, frame_mask_host, cur_sequence_num);
Expand Down

1 comment on commit 68f2bc2

@JianweiSun007
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you tell me where is the cost function of CTC and how to caculate its cost independently? thanks your help!

Please sign in to comment.