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
Commits
a949bca4
Commit
a949bca4
authored
2 years ago
by
Yoann Schneider
Committed by
Tristan Faine
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
approved suggestion
parent
c928cbbd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!75
Added function to aggregate attention maps
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dan/predict/attention.py
+1
-2
1 addition, 2 deletions
dan/predict/attention.py
with
1 addition
and
2 deletions
dan/predict/attention.py
+
1
−
2
View file @
a949bca4
...
...
@@ -44,8 +44,7 @@ def compute_coverage(text: str, max_value: float, offset: int, attentions):
# blank vector to accumulate weights for the current text
coverage_vector
=
np
.
zeros
((
height
,
width
))
for
i
in
range
(
len
(
text
)):
local_weight
=
attentions
[
i
+
offset
]
local_weight
=
cv2
.
resize
(
local_weight
,
(
width
,
height
))
local_weight
=
cv2
.
resize
(
attentions
[
i
+
offset
],
(
width
,
height
))
coverage_vector
=
np
.
clip
(
coverage_vector
+
local_weight
,
0
,
1
)
# Normalize coverage vector
...
...
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