pull/2524/head
Hui Zhang 2 years ago
parent 4dbff16f70
commit aaf39863e0

@ -74,7 +74,7 @@ void CTCPrefixBeamSearch::AdvanceDecode(
std::vector<kaldi::BaseFloat> frame_prob; std::vector<kaldi::BaseFloat> frame_prob;
bool flag = decodable->FrameLikelihood(num_frame_decoded_, &frame_prob); bool flag = decodable->FrameLikelihood(num_frame_decoded_, &frame_prob);
if (flag == false) { if (flag == false) {
LOG(INFO) << "decoder advance decode exit." << frame_prob.size(); VLOG(1) << "decoder advance decode exit." << frame_prob.size();
break; break;
} }

@ -49,11 +49,13 @@ int main(int argc, char* argv[]) {
kaldi::Timer timer; kaldi::Timer timer;
for (; !wav_reader.Done(); wav_reader.Next()) { for (; !wav_reader.Done(); wav_reader.Next()) {
kaldi::Timer local_timer;
std::string utt = wav_reader.Key(); std::string utt = wav_reader.Key();
const kaldi::WaveData& wave_data = wav_reader.Value(); const kaldi::WaveData& wave_data = wav_reader.Value();
LOG(INFO) << "utt: " << utt; LOG(INFO) << "utt: " << utt;
LOG(INFO) << "wav dur: " << wave_data.Duration() << " sec."; LOG(INFO) << "wav dur: " << wave_data.Duration() << " sec.";
tot_wav_duration += wave_data.Duration(); double dur = wave_data.Duration();
tot_wav_duration += dur;
int32 this_channel = 0; int32 this_channel = 0;
kaldi::SubVector<kaldi::BaseFloat> waveform(wave_data.Data(), kaldi::SubVector<kaldi::BaseFloat> waveform(wave_data.Data(),
@ -63,6 +65,7 @@ int main(int argc, char* argv[]) {
int sample_offset = 0; int sample_offset = 0;
int cnt = 0; int cnt = 0;
while (sample_offset < tot_samples) { while (sample_offset < tot_samples) {
int cur_chunk_size = int cur_chunk_size =
std::min(chunk_sample_size, tot_samples - sample_offset); std::min(chunk_sample_size, tot_samples - sample_offset);
@ -78,8 +81,10 @@ int main(int argc, char* argv[]) {
recognizer.SetFinished(); recognizer.SetFinished();
} }
recognizer.Decode(); recognizer.Decode();
LOG(INFO) << "Pratial result: " << cnt << " " if (recognizer.DecodedSomething()) {
<< recognizer.GetPartialResult(); LOG(INFO) << "Pratial result: " << cnt << " "
<< recognizer.GetPartialResult();
}
// no overlap // no overlap
sample_offset += cur_chunk_size; sample_offset += cur_chunk_size;
@ -101,7 +106,9 @@ int main(int argc, char* argv[]) {
continue; continue;
} }
LOG(INFO) << " the result of " << utt << " is " << result; LOG(INFO) << utt << " " << result;
LOG(INFO) << " RTF: " << dur / local_timer.Elapsed() << " dur: " << dur
<< " cost: " << local_timer.Elapsed();
result_writer.Write(utt, result); result_writer.Write(utt, result);
@ -111,7 +118,7 @@ int main(int argc, char* argv[]) {
double elapsed = timer.Elapsed(); double elapsed = timer.Elapsed();
LOG(INFO) << "Done " << num_done << " out of " << (num_err + num_done); LOG(INFO) << "Done " << num_done << " out of " << (num_err + num_done);
LOG(INFO) << "cost:" << elapsed << " sec"; LOG(INFO) << "total cost:" << elapsed << " sec";
LOG(INFO) << "total wav duration is: " << tot_wav_duration << " sec"; LOG(INFO) << "total wav duration is: " << tot_wav_duration << " sec";
LOG(INFO) << "the RTF is: " << elapsed / tot_wav_duration; LOG(INFO) << "RTF is: " << elapsed / tot_wav_duration;
} }

Loading…
Cancel
Save