Skip to content

Commit

Permalink
add blank_sacle in ctc_endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
jiajidong committed Feb 28, 2024
1 parent 3e3cee5 commit 7585cad
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion runtime/core/decoder/ctc_endpoint.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ bool CtcEndpoint::IsEndpoint(
float blank_prob = expf(logp_t[config_.blank]);

num_frames_decoded_++;
if (blank_prob > config_.blank_threshold) {
if (blank_prob > config_.blank_threshold * config_.blank_scale) {
num_frames_trailing_blank_++;
} else {
num_frames_trailing_blank_ = 0;
Expand Down
1 change: 1 addition & 0 deletions runtime/core/decoder/ctc_endpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ struct CtcEndpointRule {
struct CtcEndpointConfig {
/// We consider blank as silence for purposes of endpointing.
int blank = 0; // blank id
float blank_scale = 1.0; // blank scale
float blank_threshold = 0.8; // blank threshold to be silence
/// We support three rules. We terminate decoding if ANY of these rules
/// evaluates to "true". If you want to add more rules, do it by changing this
Expand Down
1 change: 1 addition & 0 deletions runtime/core/decoder/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ std::shared_ptr<DecodeOptions> InitDecodeOptionsFromFlags() {
decode_config->ctc_prefix_search_opts.second_beam_size = FLAGS_nbest;
decode_config->ctc_prefix_search_opts.blank = FLAGS_blank_id;
decode_config->ctc_endpoint_config.blank = FLAGS_blank_id;
decode_config->ctc_endpoint_config.blank_scale = FLAGS_blank_scale;
return decode_config;
}

Expand Down

0 comments on commit 7585cad

Please sign in to comment.