From a05e753d11d9c36983ec4e58c421dbcf86d1dcd4 Mon Sep 17 00:00:00 2001
From: Xian Shi <40013335+R1ckShi@users.noreply.github.com>
Date: 星期二, 17 十月 2023 16:47:27 +0800
Subject: [PATCH] Merge branch 'main' into dev_onnx
---
funasr/runtime/onnxruntime/src/fsmn-vad.cpp | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/funasr/runtime/onnxruntime/src/fsmn-vad.cpp b/funasr/runtime/onnxruntime/src/fsmn-vad.cpp
index 50a9a03..db633b0 100644
--- a/funasr/runtime/onnxruntime/src/fsmn-vad.cpp
+++ b/funasr/runtime/onnxruntime/src/fsmn-vad.cpp
@@ -54,11 +54,11 @@
void FsmnVad::ReadModel(const char* vad_model) {
try {
vad_session_ = std::make_shared<Ort::Session>(
- env_, vad_model, session_options_);
+ env_, ORTCHAR(vad_model), session_options_);
LOG(INFO) << "Successfully load model from " << vad_model;
} catch (std::exception const &e) {
LOG(ERROR) << "Error when load vad onnx model: " << e.what();
- exit(0);
+ exit(-1);
}
GetInputOutputInfo(vad_session_, &vad_in_names_, &vad_out_names_);
}
@@ -197,7 +197,7 @@
ifstream cmvn_stream(filename);
if (!cmvn_stream.is_open()) {
LOG(ERROR) << "Failed to open file: " << filename;
- exit(0);
+ exit(-1);
}
string line;
@@ -230,7 +230,7 @@
}
}catch(std::exception const &e) {
LOG(ERROR) << "Error when load vad cmvn : " << e.what();
- exit(0);
+ exit(-1);
}
}
@@ -279,12 +279,15 @@
FsmnVad::Infer(std::vector<float> &waves, bool input_finished) {
std::vector<std::vector<float>> vad_feats;
std::vector<std::vector<float>> vad_probs;
+ std::vector<std::vector<int>> vad_segments;
FbankKaldi(vad_sample_rate_, vad_feats, waves);
+ if(vad_feats.size() == 0){
+ return vad_segments;
+ }
LfrCmvn(vad_feats);
Forward(vad_feats, &vad_probs, &in_cache_, input_finished);
E2EVadModel vad_scorer = E2EVadModel();
- std::vector<std::vector<int>> vad_segments;
vad_segments = vad_scorer(vad_probs, waves, true, false, vad_silence_duration_, vad_max_len_,
vad_speech_noise_thres_, vad_sample_rate_);
return vad_segments;
--
Gitblit v1.9.1