Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
DAN
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Container Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Automatic Text Recognition
DAN
Merge requests
!274
Add Language Model Decoder
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Add Language Model Decoder
lm-decoder
into
main
Overview
37
Commits
34
Pipelines
0
Changes
3
All threads resolved!
Hide all comments
Merged
Solene Tarride
requested to merge
lm-decoder
into
main
1 year ago
Overview
37
Commits
34
Pipelines
0
Changes
3
All threads resolved!
Hide all comments
Expand
Closes
#142 (closed)
Taking over from
!222 (closed)
0
0
Merge request reports
Viewing commit
f7563b0c
Prev
Next
Show latest version
3 files
+
69
−
91
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
f7563b0c
Document prediction command
· f7563b0c
Solene Tarride
authored
1 year ago
dan/ocr/decoder.py
+
7
−
3
Options
@@ -571,10 +571,14 @@ class CTCLanguageDecoder:
).
strip
()
for
hypothesis
in
hypotheses
]
# Normalize confidence score
# Normalize confidence score
f"{np.around(np.mean(char_confidences[current : next_token]), 2)}
out
[
"
confidence
"
]
=
[
np
.
exp
(
hypothesis
[
0
].
score
/
((
self
.
language_model_weight
+
1
)
*
length
.
item
())
np
.
around
(
np
.
exp
(
hypothesis
[
0
].
score
/
((
self
.
language_model_weight
+
1
)
*
length
.
item
())
),
2
,
)
for
hypothesis
,
length
in
zip
(
hypotheses
,
batch_sizes
)
]
Loading