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
7413d906
Commit
7413d906
authored
1 year ago
by
Marie Generali
Browse files
Options
Downloads
Patches
Plain Diff
optimisation of the code
parent
865cf4a8
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
dan/predict/prediction.py
+4
-4
4 additions, 4 deletions
dan/predict/prediction.py
with
4 additions
and
4 deletions
dan/predict/prediction.py
+
4
−
4
View file @
7413d906
...
...
@@ -27,16 +27,17 @@ from dan.utils import read_image
class
DAN
:
"""
The DAN class is used to apply a DAN model.
The class initializes useful parameters: the device.
The class initializes useful parameters: the device
and the temperature scalara parameter
.
"""
def
__init__
(
self
,
device
):
def
__init__
(
self
,
device
,
temperature
):
"""
Constructor of the DAN class.
:param device: The device to use.
"""
super
(
DAN
,
self
).
__init__
()
self
.
device
=
device
self
.
temperature
=
temperature
def
load
(
self
,
model_path
,
params_path
,
charset_path
,
mode
=
"
eval
"
):
"""
...
...
@@ -177,7 +178,6 @@ class DAN:
hidden_predict
=
hidden_predict
,
cache
=
cache
,
num_pred
=
1
,
temperature
=
1
,
)
pred
=
pred
/
temperature
...
...
@@ -287,7 +287,7 @@ def run(
:param attention_map_scale: Scaling factor for the attention map.
:param word_separators: List of word separators.
:param line_separators: List of line separators.
:param image_max_width:
r
esize image
:param image_max_width:
R
esize image
:param predict_objects: Whether to extract objects.
:param threshold_method: Thresholding method. Should be in [
"
otsu
"
,
"
simple
"
].
:param threshold_value: Thresholding value to use for the
"
simple
"
thresholding method.
...
...
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