Initial commit: FunASR Speech Recognition Toolkit
Update API Documentation / build-api-docs (push) Has been cancelled
Update API Documentation / build-api-docs (push) Has been cancelled
Add complete FunASR codebase including models, runtime, and documentation.
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AliFsmnVadSharp.Model
|
||||
{
|
||||
internal class CmvnEntity
|
||||
{
|
||||
private List<float> _means = new List<float>();
|
||||
private List<float> _vars = new List<float>();
|
||||
|
||||
public List<float> Means { get => _means; set => _means = value; }
|
||||
public List<float> Vars { get => _vars; set => _vars = value; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AliFsmnVadSharp.Model
|
||||
{
|
||||
internal class E2EVadFrameProbEntity
|
||||
{
|
||||
private double _noise_prob = 0.0F;
|
||||
private double _speech_prob = 0.0F;
|
||||
private double _score = 0.0F;
|
||||
private int _frame_id = 0;
|
||||
private int _frm_state = 0;
|
||||
|
||||
public double noise_prob { get => _noise_prob; set => _noise_prob = value; }
|
||||
public double speech_prob { get => _speech_prob; set => _speech_prob = value; }
|
||||
public double score { get => _score; set => _score = value; }
|
||||
public int frame_id { get => _frame_id; set => _frame_id = value; }
|
||||
public int frm_state { get => _frm_state; set => _frm_state = value; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
// AliFsmnVadSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
// AliFsmnVadSharp.Model.E2EVadSpeechBufWithDoaEntity
|
||||
internal class E2EVadSpeechBufWithDoaEntity
|
||||
{
|
||||
private int _start_ms = 0;
|
||||
|
||||
private int _end_ms = 0;
|
||||
|
||||
private byte[]? _buffer;
|
||||
|
||||
private bool _contain_seg_start_point = false;
|
||||
|
||||
private bool _contain_seg_end_point = false;
|
||||
|
||||
private int _doa = 0;
|
||||
|
||||
public int start_ms
|
||||
{
|
||||
get
|
||||
{
|
||||
return _start_ms;
|
||||
}
|
||||
set
|
||||
{
|
||||
_start_ms = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int end_ms
|
||||
{
|
||||
get
|
||||
{
|
||||
return _end_ms;
|
||||
}
|
||||
set
|
||||
{
|
||||
_end_ms = value;
|
||||
}
|
||||
}
|
||||
|
||||
public byte[]? buffer
|
||||
{
|
||||
get
|
||||
{
|
||||
return _buffer;
|
||||
}
|
||||
set
|
||||
{
|
||||
_buffer = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool contain_seg_start_point
|
||||
{
|
||||
get
|
||||
{
|
||||
return _contain_seg_start_point;
|
||||
}
|
||||
set
|
||||
{
|
||||
_contain_seg_start_point = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool contain_seg_end_point
|
||||
{
|
||||
get
|
||||
{
|
||||
return _contain_seg_end_point;
|
||||
}
|
||||
set
|
||||
{
|
||||
_contain_seg_end_point = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int doa
|
||||
{
|
||||
get
|
||||
{
|
||||
return _doa;
|
||||
}
|
||||
set
|
||||
{
|
||||
_doa = value;
|
||||
}
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
_start_ms = 0;
|
||||
_end_ms = 0;
|
||||
_buffer = new byte[0];
|
||||
_contain_seg_start_point = false;
|
||||
_contain_seg_end_point = false;
|
||||
_doa = 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AliFsmnVadSharp.Model
|
||||
{
|
||||
public class EncoderConfEntity
|
||||
{
|
||||
private int _input_dim=400;
|
||||
private int _input_affineDim = 140;
|
||||
private int _fsmn_layers = 4;
|
||||
private int _linear_dim = 250;
|
||||
private int _proj_dim = 128;
|
||||
private int _lorder = 20;
|
||||
private int _rorder = 0;
|
||||
private int _lstride = 1;
|
||||
private int _rstride = 0;
|
||||
private int _output_dffine_dim = 140;
|
||||
private int _output_dim = 248;
|
||||
|
||||
public int input_dim { get => _input_dim; set => _input_dim = value; }
|
||||
public int input_affine_dim { get => _input_affineDim; set => _input_affineDim = value; }
|
||||
public int fsmn_layers { get => _fsmn_layers; set => _fsmn_layers = value; }
|
||||
public int linear_dim { get => _linear_dim; set => _linear_dim = value; }
|
||||
public int proj_dim { get => _proj_dim; set => _proj_dim = value; }
|
||||
public int lorder { get => _lorder; set => _lorder = value; }
|
||||
public int rorder { get => _rorder; set => _rorder = value; }
|
||||
public int lstride { get => _lstride; set => _lstride = value; }
|
||||
public int rstride { get => _rstride; set => _rstride = value; }
|
||||
public int output_affine_dim { get => _output_dffine_dim; set => _output_dffine_dim = value; }
|
||||
public int output_dim { get => _output_dim; set => _output_dim = value; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AliFsmnVadSharp.Model
|
||||
{
|
||||
public class FrontendConfEntity
|
||||
{
|
||||
private int _fs = 16000;
|
||||
private string _window = "hamming";
|
||||
private int _n_mels = 80;
|
||||
private int _frame_length = 25;
|
||||
private int _frame_shift = 10;
|
||||
private float _dither = 0.0F;
|
||||
private int _lfr_m = 5;
|
||||
private int _lfr_n = 1;
|
||||
|
||||
public int fs { get => _fs; set => _fs = value; }
|
||||
public string window { get => _window; set => _window = value; }
|
||||
public int n_mels { get => _n_mels; set => _n_mels = value; }
|
||||
public int frame_length { get => _frame_length; set => _frame_length = value; }
|
||||
public int frame_shift { get => _frame_shift; set => _frame_shift = value; }
|
||||
public float dither { get => _dither; set => _dither = value; }
|
||||
public int lfr_m { get => _lfr_m; set => _lfr_m = value; }
|
||||
public int lfr_n { get => _lfr_n; set => _lfr_n = value; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AliFsmnVadSharp.Model
|
||||
{
|
||||
public class SegmentEntity
|
||||
{
|
||||
private List<int[]> _segment=new List<int[]>();
|
||||
private List<float[]> _waveform=new List<float[]>();
|
||||
|
||||
public List<int[]> Segment { get => _segment; set => _segment = value; }
|
||||
public List<float[]> Waveform { get => _waveform; set => _waveform = value; }
|
||||
//public SegmentEntity()
|
||||
//{
|
||||
// int[] t=new int[0];
|
||||
// _segment.Add(t);
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AliFsmnVadSharp.Model
|
||||
{
|
||||
internal class VadInputEntity
|
||||
{
|
||||
private float[]? _speech;
|
||||
private int _speechLength;
|
||||
private List<float[]> _inCaches = new List<float[]>();
|
||||
private float[]? _waveform;
|
||||
private E2EVadModel _vad_scorer;
|
||||
|
||||
public float[]? Speech { get => _speech; set => _speech = value; }
|
||||
public int SpeechLength { get => _speechLength; set => _speechLength = value; }
|
||||
public List<float[]> InCaches { get => _inCaches; set => _inCaches = value; }
|
||||
public float[] Waveform { get => _waveform; set => _waveform = value; }
|
||||
internal E2EVadModel VadScorer { get => _vad_scorer; set => _vad_scorer = value; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AliFsmnVadSharp.Model
|
||||
{
|
||||
internal class VadOutputEntity
|
||||
{
|
||||
private float[,,]? _scores;
|
||||
private List<float[]> _outCaches=new List<float[]>();
|
||||
private float[]? _waveform;
|
||||
|
||||
public float[,,]? Scores { get => _scores; set => _scores = value; }
|
||||
public List<float[]> OutCaches { get => _outCaches; set => _outCaches = value; }
|
||||
public float[] Waveform { get => _waveform; set => _waveform = value; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AliFsmnVadSharp.Model
|
||||
{
|
||||
public class VadPostConfEntity
|
||||
{
|
||||
private int _sample_rate= 16000;
|
||||
private int _detect_mode = 1 ;
|
||||
private int _snr_mode = 0;
|
||||
private int _max_end_silence_time = 800;
|
||||
private int _max_start_silence_time = 3000;
|
||||
private bool _do_start_point_detection = true;
|
||||
private bool _do_end_point_detection = true;
|
||||
private int _window_size_ms = 200;
|
||||
private int _sil_to_speech_time_thres = 150;
|
||||
private int _speech_to_sil_time_thres = 150;
|
||||
private float _speech_2_noise_ratio = 1.0F;
|
||||
private int _do_extend = 1;
|
||||
private int _lookback_time_start_point = 200;
|
||||
private int _lookahead_time_end_point = 100;
|
||||
private int _max_single_segment_time = 60000;
|
||||
private int _nn_eval_block_size = 8;
|
||||
private int _dcd_block_size = 4;
|
||||
private float _snr_thres = -100.0F;
|
||||
private int _noise_frame_num_used_for_snr = 100;
|
||||
private float _decibel_thres = -100.0F;
|
||||
private float _speech_noise_thres = 0.6F;
|
||||
private float _fe_prior_thres = 0.0001F;
|
||||
private int _silence_pdf_num = 1;
|
||||
private int[] _sil_pdf_ids = new int[] {0};
|
||||
private float _speech_noise_thresh_low = -0.1F;
|
||||
private float _speech_noise_thresh_high = 0.3F;
|
||||
private bool _output_frame_probs = false;
|
||||
private int _frame_in_ms = 10;
|
||||
private int _frame_length_ms = 25;
|
||||
|
||||
public int sample_rate { get => _sample_rate; set => _sample_rate = value; }
|
||||
public int detect_mode { get => _detect_mode; set => _detect_mode = value; }
|
||||
public int snr_mode { get => _snr_mode; set => _snr_mode = value; }
|
||||
public int max_end_silence_time { get => _max_end_silence_time; set => _max_end_silence_time = value; }
|
||||
public int max_start_silence_time { get => _max_start_silence_time; set => _max_start_silence_time = value; }
|
||||
public bool do_start_point_detection { get => _do_start_point_detection; set => _do_start_point_detection = value; }
|
||||
public bool do_end_point_detection { get => _do_end_point_detection; set => _do_end_point_detection = value; }
|
||||
public int window_size_ms { get => _window_size_ms; set => _window_size_ms = value; }
|
||||
public int sil_to_speech_time_thres { get => _sil_to_speech_time_thres; set => _sil_to_speech_time_thres = value; }
|
||||
public int speech_to_sil_time_thres { get => _speech_to_sil_time_thres; set => _speech_to_sil_time_thres = value; }
|
||||
public float speech_2_noise_ratio { get => _speech_2_noise_ratio; set => _speech_2_noise_ratio = value; }
|
||||
public int do_extend { get => _do_extend; set => _do_extend = value; }
|
||||
public int lookback_time_start_point { get => _lookback_time_start_point; set => _lookback_time_start_point = value; }
|
||||
public int lookahead_time_end_point { get => _lookahead_time_end_point; set => _lookahead_time_end_point = value; }
|
||||
public int max_single_segment_time { get => _max_single_segment_time; set => _max_single_segment_time = value; }
|
||||
public int nn_eval_block_size { get => _nn_eval_block_size; set => _nn_eval_block_size = value; }
|
||||
public int dcd_block_size { get => _dcd_block_size; set => _dcd_block_size = value; }
|
||||
public float snr_thres { get => _snr_thres; set => _snr_thres = value; }
|
||||
public int noise_frame_num_used_for_snr { get => _noise_frame_num_used_for_snr; set => _noise_frame_num_used_for_snr = value; }
|
||||
public float decibel_thres { get => _decibel_thres; set => _decibel_thres = value; }
|
||||
public float speech_noise_thres { get => _speech_noise_thres; set => _speech_noise_thres = value; }
|
||||
public float fe_prior_thres { get => _fe_prior_thres; set => _fe_prior_thres = value; }
|
||||
public int silence_pdf_num { get => _silence_pdf_num; set => _silence_pdf_num = value; }
|
||||
public int[] sil_pdf_ids { get => _sil_pdf_ids; set => _sil_pdf_ids = value; }
|
||||
public float speech_noise_thresh_low { get => _speech_noise_thresh_low; set => _speech_noise_thresh_low = value; }
|
||||
public float speech_noise_thresh_high { get => _speech_noise_thresh_high; set => _speech_noise_thresh_high = value; }
|
||||
public bool output_frame_probs { get => _output_frame_probs; set => _output_frame_probs = value; }
|
||||
public int frame_in_ms { get => _frame_in_ms; set => _frame_in_ms = value; }
|
||||
public int frame_length_ms { get => _frame_length_ms; set => _frame_length_ms = value; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AliFsmnVadSharp.Model
|
||||
{
|
||||
internal class VadYamlEntity
|
||||
{
|
||||
private int _input_size;
|
||||
private string _frontend = "wav_frontend";
|
||||
private FrontendConfEntity _frontend_conf=new FrontendConfEntity();
|
||||
private string _model = "e2evad";
|
||||
private string _encoder = "fsmn";
|
||||
private EncoderConfEntity _encoder_conf=new EncoderConfEntity();
|
||||
private VadPostConfEntity _vad_post_conf=new VadPostConfEntity();
|
||||
|
||||
public int input_size { get => _input_size; set => _input_size = value; }
|
||||
public string frontend { get => _frontend; set => _frontend = value; }
|
||||
public string model { get => _model; set => _model = value; }
|
||||
public string encoder { get => _encoder; set => _encoder = value; }
|
||||
public FrontendConfEntity frontend_conf { get => _frontend_conf; set => _frontend_conf = value; }
|
||||
public EncoderConfEntity encoder_conf { get => _encoder_conf; set => _encoder_conf = value; }
|
||||
public VadPostConfEntity model_conf { get => _vad_post_conf; set => _vad_post_conf = value; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user