Closed chiiyeh closed 4 months ago
I think is_final
means we reach the end of the audio, and is_endpoint
means we need to break the audio at this point, when is_endpoint
is true, we can continue decoding, but when is_final
is true, the decoding is done. @csukuangfj might have more to say.
I think is_endpoint
here is more like vad.
Ah, actually i realize is more of needing the json return final
to be True
when endpoint is detected to match what is stated here:
https://k2-fsa.github.io/sherpa/python/streaming_asr/endpointing.html#endpointing
Where the message['final']=True
when endpoint is detected.
Right now it appears that it is just taking the is_final
value. So when endpoint is detected the message['final']
returns a False
instead.
https://github.com/k2-fsa/sherpa/blob/3d4a3321a8acfa276e6179a4c9aa81f12607996f/sherpa/cpp_api/online-recognizer.cc#L52
I'm facing the same issue
currently I set the last prediction of each segment as the final, not sure if this is equivalent to the expected case or not.
@chiiyeh https://github.com/k2-fsa/sherpa-onnx/pull/342
Please have a look at the above pull-request.
We will fix the implementation in k2-fsa/sherpa
when use use_endpoint=True , just change in online-recognizer.cc
if (is_endpoint || is_final) {
decoder_->FinalizeResult(s, &r);
}
to
if (is_endpoint || is_final) {
is_final = true;
decoder_->FinalizeResult(s, &r);
}
Any news for this issue?
When endpoint is detected the segment breaks as expected but the
is_final
remains asFalse
. Took a look at the code, seems like theis_final
variable does not get updated toTrue
whenis_endpoint
isTrue
. Not sure if this is the intended behavior.https://github.com/k2-fsa/sherpa/blob/3d4a3321a8acfa276e6179a4c9aa81f12607996f/sherpa/cpp_api/online-recognizer.cc#L426-L432