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
90f7e4db
Commit
90f7e4db
authored
1 year ago
by
Marie Generali
Browse files
Options
Downloads
Patches
Plain Diff
do not return temperature
parent
7413d906
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dan/decoder.py
+1
-3
1 addition, 3 deletions
dan/decoder.py
dan/predict/prediction.py
+1
-2
1 addition, 2 deletions
dan/predict/prediction.py
dan/utils.py
+12
-0
12 additions, 0 deletions
dan/utils.py
with
14 additions
and
5 deletions
dan/decoder.py
+
1
−
3
View file @
90f7e4db
...
...
@@ -454,9 +454,7 @@ class GlobalHTADecoder(Module):
-
1
,
1
,
features_size
[
2
],
features_size
[
3
]
)
temperature
=
self
.
temperature
return
output
,
preds
,
hidden_predict
,
cache
,
weights
,
temperature
return
output
,
preds
,
hidden_predict
,
cache
,
weights
def
generate_enc_mask
(
self
,
batch_reduced_size
,
total_size
,
device
):
"""
...
...
This diff is collapsed.
Click to expand it.
dan/predict/prediction.py
+
1
−
2
View file @
90f7e4db
...
...
@@ -2,7 +2,6 @@
import
os
import
pickle
from
itertools
import
pairwise
from
pathlib
import
Path
import
cv2
...
...
@@ -21,7 +20,7 @@ from dan.predict.attention import (
plot_attention
,
split_text_and_confidences
,
)
from
dan.utils
import
read_image
from
dan.utils
import
pairwise
,
read_image
class
DAN
:
...
...
This diff is collapsed.
Click to expand it.
dan/utils.py
+
12
−
0
View file @
90f7e4db
# -*- coding: utf-8 -*-
from
itertools
import
tee
import
cv2
import
numpy
as
np
import
torch
...
...
@@ -206,3 +208,13 @@ def round_floats(float_list, decimals=2):
Round list of floats with fixed decimals
"""
return
[
np
.
around
(
num
,
decimals
)
for
num
in
float_list
]
def
pairwise
(
iterable
):
"""
Not necessary when using 3.10. See https://docs.python.org/3/library/itertools.html#itertools.pairwise.
"""
# pairwise('ABCDEFG') --> AB BC CD DE EF FG
a
,
b
=
tee
(
iterable
)
next
(
b
,
None
)
return
zip
(
a
,
b
)
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