ESPnetASR<T>
Models & Types · AiDotNet.SpeechRecognition.Robust
ESPnet ASR (Watanabe et al. 2018): the toolkit’s hybrid CTC/attention recognizer, here its LibriSpeech Conformer.
Inheritance: NeuralNetworkBase<T> → AudioNeuralNetworkBase<T> → ESPnetASR<T>
Implements: ISpeechRecognizer<T>
For Beginners
ESPnet ASR turns 16 kHz audio into an 80-band log-mel spectrogram, shortens it 4x with two convolutions, and encodes it with Conformer blocks, each mixing self-attention (long-range context) with a convolution (local patterns). A linear layer gives every frame a probability for each token; collapsing repeats and blanks gives the transcript.
How It Works
ESPnet trains an encoder with a CTC layer and a Transformer decoder jointly (hybrid CTC/attention, Watanabe et al. 2017). The defaults are its LibriSpeech recipe (train_asr_conformer10_hop_length160): a 12-block Conformer, width 512, 8 heads, 2048 feed-forward units, a 31-wide depthwise kernel, a 6-layer decoder with 2048 feed-forward units, CTC weight 0.3, label smoothing 0.1 and a 5000-token BPE vocabulary. Transcription decodes the attention decoder greedily. SpecAugment masks the features in training (section 3.1). Training minimizes the joint CTC/attention loss (Watanabe et al. 2017); transcription decodes the attention decoder greedily. The paper’s blocks use relative
positional encoding; these use rotary position encoding, the relative scheme
ConformerBlockLayer provides.
Example
var architecture = new NeuralNetworkArchitecture<float>(
inputType: InputType.OneDimensional,
taskType: NeuralNetworkTaskType.SpeechRecognition,
inputSize: 16000, outputSize: 34);
var model = new ESPnetASR<float>(architecture);
var text = model.Transcribe(waveform).Text;
Constructors
| Constructor | Summary |
|---|---|
ESPnetASR(NeuralNetworkArchitecture<T> architecture, ESPnetASROptions options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer) |
|
ESPnetASR(NeuralNetworkArchitecture<T> architecture, string modelPath, ESPnetASROptions options) |
Properties
| Property | Summary |
|---|---|
IReadOnlyList<string> SupportedLanguages { get; } |
|
bool SupportsStreaming { get; } |
|
bool SupportsWordTimestamps { get; } |
Methods
| Method | Summary |
|---|---|
IReadOnlyDictionary<string, T> DetectLanguageProbabilities(Tensor<T> audio) |
|
IStreamingTranscriptionSession<T> StartStreamingSession(string language) |
|
ModelMetadata<T> GetModelMetadata() |
|
Task<TranscriptionResult<T>> TranscribeAsync(Tensor<T> audio, string language, bool? includeTimestamps, CancellationToken cancellationToken) |
|
Tensor<T> ForwardForTraining(Tensor<T> input) |
|
TranscriptionResult<T> Transcribe(Tensor<T> audio, string language, bool? includeTimestamps) |
Transcribes audio: the encoder and the attention decoder with greedy decoding. |
string DetectLanguage(Tensor<T> audio) |