Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gst-kaldi-nnet2-online
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
homeostasis
gst-kaldi-nnet2-online
Commits
882a0402
Commit
882a0402
authored
10 years ago
by
Benoit Favre
Browse files
Options
Downloads
Patches
Plain Diff
disable lattice generation, change partial hyp interval
parent
ff37cb00
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/gstkaldinnet2onlinedecoder.cc
+25
-2
25 additions, 2 deletions
src/gstkaldinnet2onlinedecoder.cc
with
25 additions
and
2 deletions
src/gstkaldinnet2onlinedecoder.cc
+
25
−
2
View file @
882a0402
...
...
@@ -615,6 +615,15 @@ static void gst_kaldinnet2onlinedecoder_final_result(
int64
*
tot_num_frames
,
double
*
tot_like
,
guint
*
num_words
)
{
if
(
clat
.
NumStates
()
==
0
)
{
KALDI_WARN
<<
"Empty lattice."
;
// ADDED
int
hyp_length
=
0
;
GstBuffer
*
buffer
=
gst_buffer_new_and_alloc
(
hyp_length
+
1
);
gst_buffer_fill
(
buffer
,
0
,
""
,
hyp_length
);
gst_buffer_memset
(
buffer
,
hyp_length
,
'\n'
,
1
);
gst_pad_push
(
filter
->
srcpad
,
buffer
);
/* Emit a signal for applications. */
g_signal_emit
(
filter
,
gst_kaldinnet2onlinedecoder_signals
[
FINAL_RESULT_SIGNAL
],
0
,
""
);
return
;
}
CompactLattice
best_path_clat
;
...
...
@@ -764,7 +773,7 @@ static void gst_kaldinnet2onlinedecoder_loop(
GST_DEBUG_OBJECT
(
filter
,
"Starting decoding loop.."
);
#ifndef THREADED_DECODER // used for partial result, unavailable with threading
BaseFloat
traceback_period_secs
=
1.0
;
BaseFloat
traceback_period_secs
=
0.2
;
#endif
int32
chunk_length
=
int32
(
filter
->
sample_rate
*
filter
->
chunk_length_in_secs
);
...
...
@@ -810,24 +819,32 @@ static void gst_kaldinnet2onlinedecoder_loop(
#endif
}
#ifndef THREADED_DECODER // the threaded decoder just starts when it gets data
//fprintf(stderr, "START advance_decoding ()\n");
decoder
.
AdvanceDecoding
();
//fprintf(stderr, " END advance_decoding ()\n");
#endif
if
(
!
more_data
)
{
fprintf
(
stderr
,
"BREAK !more_data
\n
"
);
break
;
}
//fprintf(stderr, "do_endpointing = %d\n", filter->do_endpointing);
filter
->
do_endpointing
=
true
;
if
(
filter
->
do_endpointing
&&
decoder
.
EndpointDetected
(
*
(
filter
->
endpoint_config
)))
{
#ifdef THREADED_DECODER // must stop it (the non-threaded is already idle)
decoder
.
TerminateDecoding
();
#endif
GST_DEBUG_OBJECT
(
filter
,
"Endpoint detected!"
);
fprintf
(
stderr
,
"BREAK end_point
\n
"
);
break
;
}
num_seconds_decoded
+=
filter
->
chunk_length_in_secs
;
#ifndef THREADED_DECODER // I think it's only relevant to the single-thread version
if
(
num_seconds_decoded
-
last_traceback
>
traceback_period_secs
)
{
Lattice
lat
;
//fprintf(stderr, "START get_best_path ()\n");
decoder
.
GetBestPath
(
false
,
&
lat
);
//fprintf(stderr, " END get_best_path ()\n");
gst_kaldinnet2onlinedecoder_partial_result
(
filter
,
lat
);
last_traceback
+=
traceback_period_secs
;
}
...
...
@@ -838,13 +855,17 @@ static void gst_kaldinnet2onlinedecoder_loop(
decoder
.
Wait
();
#endif
GST_DEBUG_OBJECT
(
filter
,
"Getting lattice.."
);
//fprintf(stderr, "START finalize_decoding ()\n");
decoder
.
FinalizeDecoding
();
//fprintf(stderr, " END finalize_decoding ()\n");
CompactLattice
clat
;
bool
end_of_utterance
=
true
;
#ifdef THREADED_DECODER
decoder
.
GetLattice
(
end_of_utterance
,
&
clat
,
NULL
);
#else
decoder
.
GetLattice
(
end_of_utterance
,
&
clat
);
//fprintf(stderr, "START get_lattice ()\n");
//decoder.GetLattice(end_of_utterance, &clat);
//fprintf(stderr, " END get_lattice ()\n");
#endif
GST_DEBUG_OBJECT
(
filter
,
"Lattice done"
);
if
((
filter
->
lm_fst
!=
NULL
)
&&
(
filter
->
big_lm_const_arpa
!=
NULL
))
{
...
...
@@ -859,8 +880,10 @@ static void gst_kaldinnet2onlinedecoder_loop(
int64
num_frames
=
0
;
guint
num_words
=
0
;
//fprintf(stderr, "START final_result ()\n");
gst_kaldinnet2onlinedecoder_final_result
(
filter
,
clat
,
&
num_frames
,
&
tot_like
,
&
num_words
);
//fprintf(stderr, " END final_result ()\n");
if
(
num_words
>
0
)
{
// Only update adaptation state if the utterance was not empty
#ifdef THREADED_DECODER
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment