Skip to content
Snippets Groups Projects
Commit 7413d906 authored by Marie Generali's avatar Marie Generali :worried:
Browse files

optimisation of the code

parent 865cf4a8
No related branches found
No related tags found
No related merge requests found
......@@ -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: resize image
:param image_max_width: Resize 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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment