Repository navigation
v0.0.6
utter 0.0.6 adds TitaNet-small as a speaker model. It embeds each word's span on a thread of the recognizer's own, and the recognizer's thread costs about what it costs with no speaker model. Every partial and final now rates how well the acoustic model hears the audio and describes the sound outside words. It also adds normalized float input, and a stream's heap stays flat however long the stream runs. Without a speaker model and with the new rating keys taken out, integer input gives byte-for-byte the output of 0.0.5.
Added
TitaNet-small speaker evidence, recorded as TD-15 and TD-16. scripts/titanet_convert.py converts the published TitaNet-small ONNX into a model directory. SpeakerModel::open and utter_spk_model_new open it as they open an x-vector directory, and set_spk_model and utter_recognizer_set_spk_model set it on a recognizer. A word's entry then carries spk, spk_frames, spk_start and spk_end, as with the x-vector. Partials and finals carry no top-level evidence. The model needs audio at 16 kHz or faster.
By default the recognizer embeds on a thread of its own, spawned when the model is set. At each decoder advance it queues the best path's words, the open word over its span so far. A span's evidence is published on the results read after the first accept that brings 40 ms more audio. If the thread has not finished by then, that accept waits for it. So the result that first carries a word's evidence is the same on every machine. Fed faster than real time, as a batch host feeds, the accepts wait more often.
set_spk_threads(false), utter_recognizer_set_spk_threads in C, runs no thread. The recognizer embeds a word once its span has closed, in slices budgeted by work, never by time, on accept calls that do not advance the decoder, so evidence never moves a result to a later block. A host whose blocks are a decoder chunk (about 0.5 s) or longer advances the decoder on every accept and gets no evidence this way. A span's evidence has the same bytes in both modes; only the result that first carries it differs.
On the speaker-cost streams (400 clips, 40 streams, 571 s of audio in 40 ms blocks) fed in real time, five repetitions, the recognizer on one hardware thread of a core and the TitaNet thread on the other:
| 99th percentile block | slowest block | real-time factor | |
|---|---|---|---|
| 0.0.6 TitaNet-small, the recognizer's thread | 3.027 ms | 5.05 ms | 0.01306 |
| 0.0.5, no speaker model | 3.011 ms | 5.37 ms | 0.01296 |
| 0.0.6, no speaker model | 3.017 ms | 4.90 ms | 0.01307 |
No accept waited. The TitaNet thread's own real-time factor is 0.0054.
Single-threaded, fed as fast as it decodes on one core, against 0.0.5 with the x-vector:
| 0.0.5 x-vector | 0.0.6 TitaNet-small | |
|---|---|---|
| 99th percentile block | 2.911 ms | 2.604 ms |
| slowest block | 5.95 ms | 4.45 ms |
| real-time factor | 0.01713 | 0.01335 |
Single-threaded TitaNet-small comes out ahead in every configuration measured: three readings, three readings with ten alternatives, and floor margin 8. With the speaker keys taken out, the transcripts match those with no speaker model exactly.
How long after a word ends its evidence arrives, and how many final words carry it:
| mode | median | 90th percentile | 99th percentile | final words with evidence |
|---|---|---|---|---|
| multi-threaded | 200 ms | 380 ms | 500 ms | 90.7% |
| single-threaded | 420 ms | 530 ms | 610 ms | 89.7% |
On the speaker page (205 speakers, 1980 probe words), one word through TitaNet-small, multi-threaded, clears a gate at 1% false accept 81.2% of the time, against 41.6% for the x-vector in the same recognizer:
| word length | TitaNet-small | x-vector |
|---|---|---|
| under 400 ms | 62.5% | 30.5% |
| 400 to 600 ms | 84.5% | 42.3% |
| 600 ms and over | 89.4% | 49.9% |
Among two enrolled speakers, one word names its speaker 93.8% of the time against the x-vector's 96.2%, because 5.8% of words carry no TitaNet evidence against 2.0%, and a word without evidence names no one. Single-threaded, the figures are 80.7% and 93.3%.
The x-vector stays as the speaker model for audio below 16 kHz, which TitaNet-small does not take.
Any span can be embedded directly with SpeakerModel's embed, utter_spk_model_embed and utter_spk_model_dim, with either model layout.
The acoustic model's certainty and the sound outside words, recorded as TD-17. Every partial and final carries these keys, with no setting to turn them on:
- certainty_words and certainty_outside: 1 minus the normalised entropy of the acoustic network's output, 0 to 1, averaged over the frames decoded since the previous result. The path splits the frames into those in words and those outside them. words_frames and outside_frames count them. The rating depends on the network and the audio alone, not the grammar or the path.
- band_db, band_sd_db, rise_start_sample, rise_ms and rise_db: the sound over the frames in no named word. That is each of the front end's mel bands in dB over the band's own floor, each band's standard deviation, and the loudest rise with its start, length and level over the broadband floor. A steady noise, a low hum and a click come out apart; the runtime names none of them.
Every word entry carries certainty over its own span, and the [sil] and [speech] entries of partial_result carry the sound over theirs. On the stock small models the certainty sits well under 0.1, and only differences within one model mean anything. Results grow about fourfold on the benchmark streams. With the keys taken out, every result is 0.0.5's byte for byte. On TD-17's streams they cost up to 0.9% in real-time factor against 0.0.5 and 0.015 ms at the 99th percentile block, and the slowest block is faster in every configuration. On the Speech Commands page's steady state, three runs a side, the median block is 3.2% slower and the 99th percentile 2.5% slower, 0.068 ms; the real-time factor moves within the spread between runs. The sound-rating benchmark page measures what they tell apart on public audio.
Normalized float input, recorded as TD-13. Recognizer::accept_f32 takes samples at full scale -1.0 and 1.0. A block with a sample that is not finite or not within that range is refused whole and leaves the recognizer as it was. A 16-bit sample s given as s / 32768.0 gives exactly what accept gives for s, and the two calls may be interleaved. The history stays at two bytes a sample until the first sample that is not a 16-bit value.
A small-models gate page compares German, French, Spanish and Russian small models against the stock wheel on Common Voice's single words. Every model passes every bar.
Fixed
A stream's heap no longer grows with its length. In 0.0.5 it grew by about 400 KiB a second, reaching 246 MiB at 20 minutes. Now it stays near 17.9 MiB, or 23.2 MiB with the x-vector. A speaker model set mid-stream starts at the current utterance, with its mean normalisation starting afresh there.
The benchmark preflight opens each engine in its own process. The published pages had charged the engine opened second about 20 ms that was not its own.
The Speech Commands harness sends grammars as unescaped JSON, so the stock wheel keeps non-ASCII words.