| | |
| | | virtual void LoadConfigFromYaml(const char* filename)=0; |
| | | virtual void FbankKaldi(float sample_rate, std::vector<std::vector<float>> &vad_feats, |
| | | const std::vector<float> &waves)=0; |
| | | virtual std::vector<std::vector<float>> &LfrCmvn(std::vector<std::vector<float>> &vad_feats)=0; |
| | | virtual void LfrCmvn(std::vector<std::vector<float>> &vad_feats)=0; |
| | | virtual void Forward( |
| | | const std::vector<std::vector<float>> &chunk_feats, |
| | | std::vector<std::vector<float>> *out_prob)=0; |
| | |
| | | virtual void InitCache()=0; |
| | | }; |
| | | |
| | | VadModel *CreateVadModel(std::map<std::string, std::string>& model_path, int thread_num); |
| | | VadModel *CreateVadModel(std::map<std::string, std::string>& model_path, int thread_num, int mode); |
| | | } // namespace funasr |
| | | #endif |
| | |
| | | } |
| | | } |
| | | |
| | | std::vector<std::vector<float>> &FsmnVad::LfrCmvn(std::vector<std::vector<float>> &vad_feats) { |
| | | void FsmnVad::LfrCmvn(std::vector<std::vector<float>> &vad_feats) { |
| | | |
| | | std::vector<std::vector<float>> out_feats; |
| | | int T = vad_feats.size(); |
| | |
| | | } |
| | | } |
| | | vad_feats = out_feats; |
| | | return vad_feats; |
| | | } |
| | | |
| | | std::vector<std::vector<int>> |
| | |
| | | std::vector<std::vector<float>> vad_feats; |
| | | std::vector<std::vector<float>> vad_probs; |
| | | FbankKaldi(vad_sample_rate_, vad_feats, waves); |
| | | vad_feats = LfrCmvn(vad_feats); |
| | | LfrCmvn(vad_feats); |
| | | Forward(vad_feats, &vad_probs); |
| | | |
| | | E2EVadModel vad_scorer = E2EVadModel(); |
| | |
| | | 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); |
| | | void LfrCmvn(std::vector<std::vector<float>> &vad_feats); |
| | | |
| | | void Forward( |
| | | const std::vector<std::vector<float>> &chunk_feats, |
| | |
| | | #include "precomp.h" |
| | | |
| | | namespace funasr { |
| | | VadModel *CreateVadModel(std::map<std::string, std::string>& model_path, int thread_num) |
| | | VadModel *CreateVadModel(std::map<std::string, std::string>& model_path, int thread_num, int mode) |
| | | { |
| | | VadModel *mm; |
| | | mm = new FsmnVad(); |
| | | if(mode == FSMN_VAD_OFFLINE){ |
| | | mm = new FsmnVad(); |
| | | }else{ |
| | | LOG(ERROR)<<"Online fsmn vad not imp!"; |
| | | } |
| | | |
| | | string vad_model_path; |
| | | string vad_cmvn_path; |