| | |
| | | public: |
| | | FsmnVad(); |
| | | void Test(); |
| | | void InitVad(const std::string &vad_model, const std::string &vad_cmvn, int vad_sample_rate, int vad_silence_duration, int vad_max_len, |
| | | float vad_speech_noise_thres); |
| | | void InitVad(const std::string &vad_model, const std::string &vad_cmvn, const std::string &vad_config); |
| | | |
| | | std::vector<std::vector<int>> Infer(const std::vector<float> &waves); |
| | | void Reset(); |
| | | |
| | | private: |
| | | |
| | | void ReadModel(const std::string &vad_model); |
| | | void ReadModel(const char* vad_model); |
| | | void LoadConfigFromYaml(const char* filename); |
| | | |
| | | static void GetInputOutputInfo( |
| | | const std::shared_ptr<Ort::Session> &session, |
| | |
| | | void FbankKaldi(float sample_rate, std::vector<std::vector<float>> &vad_feats, |
| | | const std::vector<float> &waves); |
| | | |
| | | std::vector<std::vector<float>> &LfrCmvn(std::vector<std::vector<float>> &vad_feats, int lfr_m, int lfr_n); |
| | | std::vector<std::vector<float>> &LfrCmvn(std::vector<std::vector<float>> &vad_feats); |
| | | |
| | | void Forward( |
| | | const std::vector<std::vector<float>> &chunk_feats, |
| | |
| | | knf::FbankOptions fbank_opts; |
| | | std::vector<float> means_list; |
| | | std::vector<float> vars_list; |
| | | int vad_sample_rate_ = 16000; |
| | | int vad_silence_duration_ = 800; |
| | | int vad_max_len_ = 15000; |
| | | double vad_speech_noise_thres_ = 0.9; |
| | | |
| | | int vad_sample_rate_ = MODEL_SAMPLE_RATE; |
| | | int vad_silence_duration_ = VAD_SILENCE_DURATION; |
| | | int vad_max_len_ = VAD_MAX_LEN; |
| | | double vad_speech_noise_thres_ = VAD_SPEECH_NOISE_THRES; |
| | | int lfr_m = VAD_LFR_M; |
| | | int lfr_n = VAD_LFR_N; |
| | | }; |
| | | |
| | | |