glog to stderr

pull/1631/head
Hui Zhang 3 years ago
parent aa0cb236e2
commit f17347f454

@ -11,11 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import os
import librosa
import numpy as np import numpy as np
from config import DEFAULT_TABLE
from logs import LOGGER from logs import LOGGER
from paddlespeech.cli import VectorExecutor from paddlespeech.cli import VectorExecutor

@ -3,3 +3,5 @@ cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
add_subdirectory(feat) add_subdirectory(feat)
add_subdirectory(nnet) add_subdirectory(nnet)
add_subdirectory(decoder) add_subdirectory(decoder)
add_subdirectory(glog)

@ -1,8 +1,9 @@
# Examples # Examples
* decoder - online decoder to work as offline * glog - glog usage
* feat - mfcc, linear * feat - mfcc, linear
* nnet - ds2 nn * nnet - ds2 nn
* decoder - online decoder to work as offline
## How to run ## How to run

@ -63,6 +63,7 @@ int main(int argc, char* argv[]) {
int32 chunk_size = 35; int32 chunk_size = 35;
decoder.InitDecoder(); decoder.InitDecoder();
LOG(INFO) << "chunk size: " << chunk_size;
for (; !feature_reader.Done(); feature_reader.Next()) { for (; !feature_reader.Done(); feature_reader.Next()) {
string utt = feature_reader.Key(); string utt = feature_reader.Key();

@ -25,6 +25,9 @@ model_dir=../paddle_asr_model
feat_wspecifier=./feats.ark feat_wspecifier=./feats.ark
cmvn=./cmvn.ark cmvn=./cmvn.ark
export GLOG_logtostderr=1
# 3. run feat # 3. run feat
linear_spectrogram_main \ linear_spectrogram_main \
--wav_rspecifier=scp:$model_dir/wav.scp \ --wav_rspecifier=scp:$model_dir/wav.scp \
@ -37,4 +40,4 @@ offline_decoder_main \
--model_path=$model_dir/avg_1.jit.pdmodel \ --model_path=$model_dir/avg_1.jit.pdmodel \
--param_path=$model_dir/avg_1.jit.pdparams \ --param_path=$model_dir/avg_1.jit.pdparams \
--dict_file=$model_dir/vocab.txt \ --dict_file=$model_dir/vocab.txt \
--lm_path=$model_dir/avg_1.jit.klm --lm_path=$model_dir/avg_1.jit.klm

@ -25,6 +25,8 @@
#include "kaldi/util/kaldi-io.h" #include "kaldi/util/kaldi-io.h"
#include "kaldi/util/table-types.h" #include "kaldi/util/table-types.h"
#include <glog/logging.h>
DEFINE_string(wav_rspecifier, "", "test wav scp path"); DEFINE_string(wav_rspecifier, "", "test wav scp path");
DEFINE_string(feature_wspecifier, "", "output feats wspecifier"); DEFINE_string(feature_wspecifier, "", "output feats wspecifier");
DEFINE_string(cmvn_write_path, "./cmvn.ark", "write cmvn"); DEFINE_string(cmvn_write_path, "./cmvn.ark", "write cmvn");
@ -172,6 +174,9 @@ int main(int argc, char* argv[]) {
ppspeech::LinearSpectrogramOptions opt; ppspeech::LinearSpectrogramOptions opt;
opt.frame_opts.frame_length_ms = 20; opt.frame_opts.frame_length_ms = 20;
opt.frame_opts.frame_shift_ms = 10; opt.frame_opts.frame_shift_ms = 10;
LOG(INFO) << "frame length (ms):" << opt.frame_opts.frame_length_ms;
LOG(INFO) << "frame shift (ms):" << opt.frame_opts.frame_shift_ms;
ppspeech::DecibelNormalizerOptions db_norm_opt; ppspeech::DecibelNormalizerOptions db_norm_opt;
std::unique_ptr<ppspeech::FeatureExtractorInterface> base_feature_extractor( std::unique_ptr<ppspeech::FeatureExtractorInterface> base_feature_extractor(
new ppspeech::DecibelNormalizer(db_norm_opt, std::move(data_source))); new ppspeech::DecibelNormalizer(db_norm_opt, std::move(data_source)));
@ -190,6 +195,11 @@ int main(int argc, char* argv[]) {
int sample_rate = 16000; int sample_rate = 16000;
int chunk_sample_size = streaming_chunk * sample_rate; int chunk_sample_size = streaming_chunk * sample_rate;
LOG(INFO) << "sr:" << sample_rate;
LOG(INFO) << "chunk size (s):" << streaming_chunk;
LOG(INFO) << "chunk size (sample):" << chunk_sample_size;
for (; !wav_reader.Done(); wav_reader.Next()) { for (; !wav_reader.Done(); wav_reader.Next()) {
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();

@ -25,6 +25,7 @@ feat_wspecifier=./feats.ark
cmvn=./cmvn.ark cmvn=./cmvn.ark
# 3. run feat # 3. run feat
export GLOG_logtostderr=1
linear_spectrogram_main \ linear_spectrogram_main \
--wav_rspecifier=scp:$model_dir/wav.scp \ --wav_rspecifier=scp:$model_dir/wav.scp \
--feature_wspecifier=ark,t:$feat_wspecifier \ --feature_wspecifier=ark,t:$feat_wspecifier \

Loading…
Cancel
Save