未验证 提交 32a75cd5 编写于 作者: H Hui Zhang 提交者: GitHub

Merge pull request #1751 from SmileGoat/add_websocketlib

[speechx] fix linear-spectrogram-wo-db-norm-ol read feature issue
...@@ -66,6 +66,11 @@ int main(int argc, char* argv[]) { ...@@ -66,6 +66,11 @@ int main(int argc, char* argv[]) {
new ppspeech::CMVN(FLAGS_cmvn_file, std::move(linear_spectrogram))); new ppspeech::CMVN(FLAGS_cmvn_file, std::move(linear_spectrogram)));
ppspeech::FeatureCacheOptions feat_cache_opts; ppspeech::FeatureCacheOptions feat_cache_opts;
// the feature cache output feature chunk by chunk.
// frame_chunk_size : num frame of a chunk.
// frame_chunk_stride: chunk sliding window stride.
feat_cache_opts.frame_chunk_stride = 1;
feat_cache_opts.frame_chunk_size = 1;
ppspeech::FeatureCache feature_cache(feat_cache_opts, std::move(cmvn)); ppspeech::FeatureCache feature_cache(feat_cache_opts, std::move(cmvn));
LOG(INFO) << "feat dim: " << feature_cache.Dim(); LOG(INFO) << "feat dim: " << feature_cache.Dim();
...@@ -105,12 +110,13 @@ int main(int argc, char* argv[]) { ...@@ -105,12 +110,13 @@ int main(int argc, char* argv[]) {
if (cur_chunk_size < chunk_sample_size) { if (cur_chunk_size < chunk_sample_size) {
feature_cache.SetFinished(); feature_cache.SetFinished();
} }
feature_cache.Read(&features); bool flag = true;
if (features.Dim() == 0) break; do {
flag = feature_cache.Read(&features);
feats.push_back(features); feats.push_back(features);
sample_offset += cur_chunk_size;
feature_rows += features.Dim() / feature_cache.Dim(); feature_rows += features.Dim() / feature_cache.Dim();
} while(flag == true && features.Dim() != 0);
sample_offset += cur_chunk_size;
} }
int cur_idx = 0; int cur_idx = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册